File: .lake/packages/lean4/src/lean/lake/Lake/DSL/Package.lean

full_name: Lake.DSL.packageDeclName
code: /-- The name given to the definition created by the `package` syntax. -/
def packageDeclName 
goal: Lake.Name

full_name: Lake.DSL.packageDecl
code: /--
Defines the configuration of a Lake package.  Has many forms:

```lean
package «pkg-name»
package «pkg-name» { /- config opts -/ }
package «pkg-name» where /- config opts -/
```

There can only be one `package` declaration per Lake configuration file.
The defined package configuration will be available for reference as `_package`.
-/
scoped elab (name := packageDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"package " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| «package»)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``PackageConfig sig doc? attrs packageDeclName
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Package___elabRules_Lake_DSL_packageDecl_1»
code: /--
Defines the configuration of a Lake package.  Has many forms:

```lean
package «pkg-name»
package «pkg-name» { /- config opts -/ }
package «pkg-name» where /- config opts -/
```

There can only be one `package` declaration per Lake configuration file.
The defined package configuration will be available for reference as `_package`.
-/
scoped elab (name := packageDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"package " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| «package»)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``PackageConfig sig doc? attrs packageDeclName
goal: Lean.Elab.Command.CommandElab

full_name: Lake.DSL.PackageDecl
code: abbrev PackageDecl 
goal: Type

full_name: Lake.DSL.instCoePackageDeclCommand
code: instance : Coe PackageDecl Command 
goal: Coe Lake.DSL.PackageDecl Lean.Command

full_name: Lake.DSL.postUpdateDecl
code: /--
Declare a post-`lake update` hook for the package.
Runs the monadic action is after a successful `lake update` execution
in this package or one of its downstream dependents.

**Example**

This feature enables Mathlib to synchronize the Lean toolchain and run
`cache get` after a `lake update`:

```
lean_exe cache
post_update pkg do
  let wsToolchainFile := (← getRootPackage).dir / "lean-toolchain"
  let mathlibToolchain ← IO.FS.readFile <| pkg.dir / "lean-toolchain"
  IO.FS.writeFile wsToolchainFile mathlibToolchain
  let exeFile ← runBuild cache.fetch
  let exitCode ← env exeFile.toString #["get"]
  if exitCode ≠ 0 then
    error s!"{pkg.name}: failed to fetch cache"
```
-/
scoped syntax (name := postUpdateDecl)
optional(docComment) optional(Term.attributes)
"post_update " (ppSpace simpleBinder)? (declValSimple <|> declValDo) : command
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Package___macroRules_Lake_DSL_postUpdateDecl_1»
code: macro_rules
| `($[$doc?]? $[$attrs?]? post_update%$kw $[$pkg?]? do $seq $[$wds?:whereDecls]?) =>
  `($[$doc?]? $[$attrs?]? post_update%$kw $[$pkg?]? := do $seq $[$wds?:whereDecls]?)
| `($[$doc?]? $[$attrs?]? post_update%$kw $[$pkg?]? := $defn $[$wds?:whereDecls]?) => withRef kw do
  let pkg ← expandOptSimpleBinder pkg?
  let pkgName := mkIdentFrom pkg `_package.name
  let attr ← `(Term.attrInstance| «post_update»)
  let attrs := #[attr] ++ expandAttrs attrs?
  `($[$doc?]? @[$attrs,*] def postUpdateHook : PostUpdateHookDecl :=
    {pkg := $pkgName, fn := fun $pkg => $defn} $[$wds?:whereDecls]?)
goal: Lean.Macro