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

full_name: Lake.DSL.buildDeclSig
code: syntax buildDeclSig :=
  identOrStr (ppSpace simpleBinder)? Term.typeSpec declValSimple
goal: Lean.ParserDescr

full_name: Lake.DSL.mkModuleFacetDecl
code: abbrev mkModuleFacetDecl
  (α) (facet : Name)
  [FamilyDef ModuleData facet (BuildJob α)]
  (f : Module → FetchM (BuildJob α))
: ModuleFacetDecl 
goal: Lake.ModuleFacetDecl

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___macroRules_Lake_DSL_moduleFacetDecl_1»
code: macro (name := moduleFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"module_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx $[$mod?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| module_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_modFacet")
    let mod ← expandOptSimpleBinder mod?
    `(module_data $id : BuildJob $ty
      $[$doc?:docComment]? @[$attrs,*] abbrev $declId :=
        Lake.DSL.mkModuleFacetDecl $ty $facet (fun $mod => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed module facet declaration"
goal: Lean.Macro

full_name: Lake.DSL.moduleFacetDecl
code: macro (name := moduleFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"module_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx $[$mod?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| module_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_modFacet")
    let mod ← expandOptSimpleBinder mod?
    `(module_data $id : BuildJob $ty
      $[$doc?:docComment]? @[$attrs,*] abbrev $declId :=
        Lake.DSL.mkModuleFacetDecl $ty $facet (fun $mod => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed module facet declaration"
goal: Lean.ParserDescr

full_name: Lake.DSL.mkPackageFacetDecl
code: abbrev mkPackageFacetDecl
  (α) (facet : Name)
  [FamilyDef PackageData facet (BuildJob α)]
  (f : Package → FetchM (BuildJob α))
: PackageFacetDecl 
goal: Lake.PackageFacetDecl

full_name: Lake.DSL.packageFacetDecl
code: macro (name := packageFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"package_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx $[$pkg?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| package_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_pkgFacet")
    let pkg ← expandOptSimpleBinder pkg?
    `(package_data $id : BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $declId :=
        Lake.DSL.mkPackageFacetDecl $ty $facet (fun $pkg => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed package facet declaration"
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___macroRules_Lake_DSL_packageFacetDecl_1»
code: macro (name := packageFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"package_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx $[$pkg?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| package_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_pkgFacet")
    let pkg ← expandOptSimpleBinder pkg?
    `(package_data $id : BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $declId :=
        Lake.DSL.mkPackageFacetDecl $ty $facet (fun $pkg => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed package facet declaration"
goal: Lean.Macro

full_name: Lake.DSL.mkLibraryFacetDecl
code: abbrev mkLibraryFacetDecl
  (α) (facet : Name)
  [FamilyDef LibraryData facet (BuildJob α)]
  (f : LeanLib → FetchM (BuildJob α))
: LibraryFacetDecl 
goal: Lake.LibraryFacetDecl

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___macroRules_Lake_DSL_libraryFacetDecl_1»
code: macro (name := libraryFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"library_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx  $[$lib?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| library_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_libFacet")
    let lib ← expandOptSimpleBinder lib?
    `(library_data $id : BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $declId : LibraryFacetDecl :=
        Lake.DSL.mkLibraryFacetDecl $ty $facet (fun $lib => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed library facet declaration"
goal: Lean.Macro

full_name: Lake.DSL.libraryFacetDecl
code: macro (name := libraryFacetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"library_facet " sig:buildDeclSig : command => withRef kw do
  match sig with
  | `(buildDeclSig| $nameStx  $[$lib?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| library_facet)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let facet := Name.quoteFrom id id.getId
    let declId := mkIdentFrom id <| id.getId.modifyBase (.str · "_libFacet")
    let lib ← expandOptSimpleBinder lib?
    `(library_data $id : BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $declId : LibraryFacetDecl :=
        Lake.DSL.mkLibraryFacetDecl $ty $facet (fun $lib => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed library facet declaration"
goal: Lean.ParserDescr

full_name: Lake.DSL.mkTargetDecl
code: abbrev mkTargetDecl
  (α) (pkgName target : Name)
  [FamilyDef CustomData (pkgName, target) (BuildJob α)]
  (f : NPackage pkgName → FetchM (BuildJob α))
: TargetDecl 
goal: Lake.TargetDecl

full_name: Lake.DSL.targetDecl
code: macro (name := targetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"target " sig:buildDeclSig : command => do
  match sig with
  | `(buildDeclSig| $id:ident $[$pkg?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| target)
    let attrs := #[attr] ++ expandAttrs attrs?
    let name := Name.quoteFrom id id.getId
    let pkgName := mkIdentFrom id `_package.name
    let pkg ← expandOptSimpleBinder pkg?
    `(family_def $id : CustomData ($pkgName, $name) := BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $id :=
        Lake.DSL.mkTargetDecl $ty $pkgName $name (fun $pkg => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed target declaration"
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___macroRules_Lake_DSL_targetDecl_1»
code: macro (name := targetDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"target " sig:buildDeclSig : command => do
  match sig with
  | `(buildDeclSig| $id:ident $[$pkg?]? : $ty := $defn $[$wds?:whereDecls]?) =>
    let attr ← withRef kw `(Term.attrInstance| target)
    let attrs := #[attr] ++ expandAttrs attrs?
    let name := Name.quoteFrom id id.getId
    let pkgName := mkIdentFrom id `_package.name
    let pkg ← expandOptSimpleBinder pkg?
    `(family_def $id : CustomData ($pkgName, $name) := BuildJob $ty
      $[$doc?]? @[$attrs,*] abbrev $id :=
        Lake.DSL.mkTargetDecl $ty $pkgName $name (fun $pkg => $defn)
      $[$wds?:whereDecls]?)
  | stx => Macro.throwErrorAt stx "ill-formed target declaration"
goal: Lean.Macro

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___elabRules_Lake_DSL_leanLibDecl_1»
code: /--
Define a new Lean library target for the package.
Can optionally be provided with a configuration of type `LeanLibConfig`.
Has many forms:

```lean
lean_lib «target-name»
lean_lib «target-name» { /- config opts -/ }
lean_lib «target-name» where /- config opts -/
```
-/
scoped elab (name := leanLibDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"lean_lib " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| lean_lib)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``LeanLibConfig sig doc? attrs
goal: Lean.Elab.Command.CommandElab

full_name: Lake.DSL.leanLibDecl
code: /--
Define a new Lean library target for the package.
Can optionally be provided with a configuration of type `LeanLibConfig`.
Has many forms:

```lean
lean_lib «target-name»
lean_lib «target-name» { /- config opts -/ }
lean_lib «target-name» where /- config opts -/
```
-/
scoped elab (name := leanLibDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"lean_lib " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| lean_lib)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``LeanLibConfig sig doc? attrs
goal: Lean.ParserDescr

full_name: Lake.DSL.LeanLibDecl
code: @[inherit_doc leanLibDecl] abbrev LeanLibDecl 
goal: Type

full_name: Lake.DSL.instCoeLeanLibDeclCommand
code: instance : Coe LeanLibDecl Command 
goal: Coe Lake.DSL.LeanLibDecl Lean.Command

full_name: Lake.DSL.leanExeDecl
code: /--
Define a new Lean binary executable target for the package.
Can optionally be provided with a configuration of type `LeanExeConfig`.
Has many forms:

```lean
lean_exe «target-name»
lean_exe «target-name» { /- config opts -/ }
lean_exe «target-name» where /- config opts -/
```
-/
scoped elab (name := leanExeDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"lean_exe " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| lean_exe)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``LeanExeConfig sig doc? attrs
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___elabRules_Lake_DSL_leanExeDecl_1»
code: /--
Define a new Lean binary executable target for the package.
Can optionally be provided with a configuration of type `LeanExeConfig`.
Has many forms:

```lean
lean_exe «target-name»
lean_exe «target-name» { /- config opts -/ }
lean_exe «target-name» where /- config opts -/
```
-/
scoped elab (name := leanExeDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"lean_exe " sig:structDeclSig : command => withRef kw do
  let attr ← `(Term.attrInstance| lean_exe)
  let attrs := #[attr] ++ expandAttrs attrs?
  elabConfigDecl ``LeanExeConfig sig doc? attrs
goal: Lean.Elab.Command.CommandElab

full_name: Lake.DSL.LeanExeDecl
code: @[inherit_doc leanExeDecl] abbrev LeanExeDecl 
goal: Type

full_name: Lake.DSL.instCoeLeanExeDeclCommand
code: instance : Coe LeanExeDecl Command 
goal: Coe Lake.DSL.LeanExeDecl Lean.Command

full_name: Lake.DSL.externLibDeclSpec
code: syntax externLibDeclSpec :=
  identOrStr (ppSpace simpleBinder)? declValSimple
goal: Lean.ParserDescr

full_name: Lake.DSL.externLibDecl
code: macro (name := externLibDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"extern_lib " spec:externLibDeclSpec : command => withRef kw do
  match spec with
  | `(externLibDeclSpec| $nameStx $[$pkg?]? := $defn $[$wds?:whereDecls]?) =>
    let attr ← `(Term.attrInstance| extern_lib)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let pkgName := mkIdentFrom id `_package.name
    let targetId := mkIdentFrom id <| id.getId.modifyBase (· ++ `static)
    let name := Name.quoteFrom id id.getId
    `(target $targetId:ident $[$pkg?]? : FilePath := $defn $[$wds?:whereDecls]?
      $[$doc?:docComment]? @[$attrs,*] def $id : ExternLibDecl := {
        pkg := $pkgName
        name := $name
        config := {getJob := ofFamily}
      })
  | stx => Macro.throwErrorAt stx "ill-formed external library declaration"
goal: Lean.ParserDescr

full_name: Lake.DSL.«_aux_.lake_packages_lean4_src_lean_lake_Lake_DSL_Targets___macroRules_Lake_DSL_externLibDecl_1»
code: macro (name := externLibDecl)
doc?:optional(docComment) attrs?:optional(Term.attributes)
kw:"extern_lib " spec:externLibDeclSpec : command => withRef kw do
  match spec with
  | `(externLibDeclSpec| $nameStx $[$pkg?]? := $defn $[$wds?:whereDecls]?) =>
    let attr ← `(Term.attrInstance| extern_lib)
    let attrs := #[attr] ++ expandAttrs attrs?
    let id := expandIdentOrStrAsIdent nameStx
    let pkgName := mkIdentFrom id `_package.name
    let targetId := mkIdentFrom id <| id.getId.modifyBase (· ++ `static)
    let name := Name.quoteFrom id id.getId
    `(target $targetId:ident $[$pkg?]? : FilePath := $defn $[$wds?:whereDecls]?
      $[$doc?:docComment]? @[$attrs,*] def $id : ExternLibDecl := {
        pkg := $pkgName
        name := $name
        config := {getJob := ofFamily}
      })
  | stx => Macro.throwErrorAt stx "ill-formed external library declaration"
goal: Lean.Macro