Lean ่ฏญ่จ€ๅ‚่€ƒ

24.1.ย Lake๐Ÿ”—

Lake ๆ˜ฏๆ ‡ๅ‡† Lean ๆž„ๅปบๅทฅๅ…ทใ€‚ ๅฎƒ่ดŸ่ดฃ๏ผš

  • ้…็ฝฎๆž„ๅปบๅนถๆž„ๅปบ Lean ไปฃ็ 

  • ่Žทๅ–ๅ’Œๆž„ๅปบๅค–้ƒจไพ่ต–้กน

  • ไธŽ Reservoir ้›†ๆˆ๏ผŒLean ่ฝฏไปถๅŒ…ๆœๅŠกๅ™จ

  • ่ฟ่กŒๆต‹่ฏ•ใ€linter ๅ’Œๅ…ถไป–ๅผ€ๅ‘ๅทฅไฝœๆต็จ‹

Lake ๆ˜ฏๅฏๆ‰ฉๅฑ•็š„ใ€‚ ๅฎƒๆไพ›ไบ†ไธฐๅฏŒ็š„ API๏ผŒๅฏ็”จไบŽๅฎšไน‰ๆœชๅœจ Lean ไธญ็ผ–ๅ†™็š„่ฝฏไปถๅทฅไปถ็š„ๅขž้‡ๆž„ๅปบไปปๅŠกใ€่‡ชๅŠจๆ‰ง่กŒ็ฎก็†ไปปๅŠกไปฅๅŠไธŽๅค–้ƒจๅทฅไฝœๆต็จ‹้›†ๆˆใ€‚ ๅฏนไบŽไธ้œ€่ฆ่ฟ™ไบ›ๅŠŸ่ƒฝ็š„ๆž„ๅปบ้…็ฝฎ๏ผŒLake ๆไพ›ไบ†ไธ€็งๅฃฐๆ˜Žๆ€ง้…็ฝฎ่ฏญ่จ€๏ผŒๅฏไปฅ็”จ TOML ๆˆ– Lean ๆ–‡ไปถ็ผ–ๅ†™ใ€‚

ๆœฌ่Š‚ไป‹็ป Lake ็š„ ๅ‘ฝไปค่กŒ็•Œ้ขใ€้…็ฝฎๆ–‡ไปถๅ’Œ ๅ†…้ƒจ APIใ€‚ ่ฟ™ไธ‰ไธชๅ…ฑไบซไธ€็ป„ๆฆ‚ๅฟตๅ’Œๆœฏ่ฏญใ€‚

24.1.1.ย ๆฆ‚ๅฟตๅ’Œๆœฏ่ฏญ๐Ÿ”—

packageๆ˜ฏLeanไปฃ็ ๅˆ†ๅ‘็š„ๅŸบๆœฌๅ•ไฝใ€‚ ๅ•ไธชๅŒ…ๅฏ่ƒฝๅŒ…ๅซๅคšไธชๅบ“ๆˆ–ๅฏๆ‰ง่กŒ็จ‹ๅบใ€‚ ๅŒ…็”ฑไธ€ไธช็›ฎๅฝ•็ป„ๆˆ๏ผŒๅ…ถไธญๅŒ…ๅซ ๅŒ…้…็ฝฎ ๆ–‡ไปถๅ’Œๆบไปฃ็ ใ€‚ ่ฝฏไปถๅŒ…ๅฏ่ƒฝ require ๅ…ถไป–่ฝฏไปถๅŒ…๏ผŒๅœจ่ฟ™็งๆƒ…ๅ†ตไธ‹๏ผŒ่ฟ™ไบ›่ฝฏไปถๅŒ…็š„ไปฃ็ ๏ผˆๆ›ดๅ…ทไฝ“ๅœฐ่ฏด๏ผŒๅฎƒไปฌ็š„ ็›ฎๆ ‡๏ผ‰ๅฏ็”จใ€‚ ๅŒ…็š„ direct dependency ๆ˜ฏๅฎƒ้œ€่ฆ็š„ไพ่ต–้กน๏ผŒtransitive dependency ๆ˜ฏๅŒ…็š„็›ดๆŽฅไพ่ต–้กนๅŠๅ…ถไผ ้€’ไพ่ต–้กนใ€‚ ๅŒ…ๅฏไปฅไปŽ Reservoirใ€Lean ๅŒ…ๅญ˜ๅ‚จๅบ“ๆˆ–ไปŽๆ‰‹ๅŠจๆŒ‡ๅฎš็š„ไฝ็ฝฎ่Žทๅ–ใ€‚ Git dependency ็”ฑ Git ๅญ˜ๅ‚จๅบ“ URL ไปฅๅŠไฟฎ่ฎข๏ผˆๅˆ†ๆ”ฏใ€ๆ ‡็ญพๆˆ–ๅ“ˆๅธŒ๏ผ‰ๆŒ‡ๅฎš๏ผŒๅนถไธ”ๅฟ…้กปๅœจๆž„ๅปบไน‹ๅ‰ๅœจๆœฌๅœฐๅ…‹้š†๏ผŒ่€Œๆœฌๅœฐ path dependency ็”ฑ็›ธๅฏนไบŽๅŒ…็›ฎๅฝ•็š„่ทฏๅพ„ๆŒ‡ๅฎšใ€‚

workspace ๆ˜ฏ็ฃ็›˜ไธŠ็š„ไธ€ไธช็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซ package ๆบไปฃ็ ็š„ๅทฅไฝœๅ‰ฏๆœฌไปฅๅŠๆ‰€ๆœ‰ๆœชๆŒ‡ๅฎšไธบๆœฌๅœฐ่ทฏๅพ„็š„ transitive dependency ็š„ๆบไปฃ็ ใ€‚ ไธบๅ…ถๅˆ›ๅปบๅทฅไฝœๅŒบ็š„ๅŒ…ๆ˜ฏ root packageใ€‚ ่ฏฅๅทฅไฝœๅŒบ่ฟ˜ๅŒ…ๅซ่ฏฅๅŒ…็š„ไปปไฝ•ๆž„ๅปบ็š„ ๅทฅไปถ๏ผŒไปŽ่€Œๅฏ็”จ ๅขž้‡ๆž„ๅปบใ€‚ ไธ้œ€่ฆๅญ˜ๅœจไพ่ต–ๅ…ณ็ณปๅ’Œๅทฅไปถๅณๅฏๅฐ†็›ฎๅฝ•่ง†ไธบๅทฅไฝœ็ฉบ้—ด๏ผ›ๅฆ‚ๆžœ lake update ๅ’Œ lake build ็ญ‰ๅ‘ฝไปคไธขๅคฑ๏ผŒๅˆ™ไผš็”Ÿๆˆๅฎƒไปฌใ€‚ Lake ้€šๅธธ็”จไบŽๅทฅไฝœๅŒบใ€‚ๅˆ›ๅปบๅทฅไฝœๅŒบ็š„ lake init ๅ’Œ lake new ๆ˜ฏไพ‹ๅค–ใ€‚ ๅทฅไฝœ็ฉบ้—ด้€šๅธธๅ…ทๆœ‰ไปฅไธ‹ๅธƒๅฑ€๏ผš

  • lean-toolchain๏ผšๅทฅๅ…ท้“พๆ–‡ไปถใ€‚

  • lakefile.toml ๆˆ– lakefile.lean๏ผšๆ นๅŒ…็š„ ๅŒ…้…็ฝฎ ๆ–‡ไปถใ€‚

  • lake-manifest.json๏ผšๆ นๅŒ…็š„ ๆธ…ๅ•ใ€‚

  • .lake/๏ผš็”ฑLake็ฎก็†็š„ไธญ้—ด็Šถๆ€๏ผŒไพ‹ๅฆ‚ๆž„ๅปบ็š„artifactsๅ’Œไพ่ต–ๆบไปฃ็ ใ€‚

    • .lake/lakefile.olean๏ผšๆ นๅŒ…็š„้…็ฝฎ๏ผŒๅทฒ็ผ“ๅญ˜ใ€‚

    • .lake/packages/๏ผšๅทฅไฝœๅŒบ็š„ package ็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซๆ นๅŒ…็š„ๆ‰€ๆœ‰้žๆœฌๅœฐไผ ้€’ไพ่ต–้กน็š„ๅ‰ฏๆœฌ๏ผŒๅ…ถๆž„ๅปบ็š„ๅทฅไปถไฝไบŽๅ…ถ่‡ชๅทฑ็š„ .lake ็›ฎๅฝ•ไธญใ€‚

    • .lake/build/๏ผšbuild ็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซๆ นๅŒ…็š„ๆž„ๅปบๅทฅไปถ๏ผš

      • .lake/build/bin๏ผšๅŒ…็š„ binary ็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซๆž„ๅปบ็š„ๅฏๆ‰ง่กŒๆ–‡ไปถใ€‚

      • .lake/build/lib๏ผšๅŒ…็š„ๅบ“็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซๆž„ๅปบ็š„ๅบ“ๅ’Œ .olean ๆ–‡ไปถใ€‚

      • .lake/build/ir๏ผšๅŒ…็š„ไธญ้—ด็ป“ๆžœ็›ฎๅฝ•๏ผŒๅ…ถไธญๅŒ…ๅซ็”Ÿๆˆ็š„ไธญ้—ดๅทฅไปถ๏ผŒไธป่ฆๆ˜ฏ C ไปฃ็ ใ€‚

Workspace lean-toolchain Root package Package configuration file (lakefile.lean) Libraries Executables Manifest (lake-manifest.json) Lake Directory (.lake) Packages Dependency 1 Package configuration file Libraries Executables Artifacts Dependency 2 Package configuration file Libraries Executables Artifacts โ‹ฏ Artifacts Built libraries Built executables
Workspace Layout

package ้…็ฝฎ ๆ–‡ไปถๆŒ‡ๅฎšๅŒ…็š„ไพ่ต–้กนใ€่ฎพ็ฝฎๅ’Œ็›ฎๆ ‡ใ€‚ ๅŒ…ๅฏไปฅๆŒ‡ๅฎš้€‚็”จไบŽๅ…ถๅŒ…ๅซ็š„ๆ‰€ๆœ‰็›ฎๆ ‡็š„้…็ฝฎ้€‰้กนใ€‚ ๅฎƒไปฌๅฏไปฅๅ†™ๆˆไธค็งๆ ผๅผ๏ผš

  • TOML ๆ ผๅผ (lakefile.toml) ็”จไบŽๅฎŒๅ…จๅฃฐๆ˜Žๆ€งๅŒ…้…็ฝฎใ€‚

  • Lean ๆ ผๅผ (lakefile.lean) ๅฆๅค–ๆ”ฏๆŒไฝฟ็”จ Lean ไปฃ็ ไปฅๅฃฐๆ˜Žๆ€ง้€‰้กนไธๆ”ฏๆŒ็š„ๆ–นๅผ้…็ฝฎๅŒ…ใ€‚

manifest ่ทŸ่ธชๅŒ…ไธญไฝฟ็”จ็š„ๅ…ถไป–ๅŒ…็š„็‰นๅฎš็‰ˆๆœฌใ€‚ ๆธ…ๅ•ๅ’Œ ็จ‹ๅบๅŒ…้…็ฝฎ ๆ–‡ไปถไธ€่ตทไธบ็จ‹ๅบๅŒ…ๆŒ‡ๅฎšไธ€็ป„ๅ”ฏไธ€็š„ไผ ้€’ไพ่ต–้กนใ€‚ ๅœจๆž„ๅปบไน‹ๅ‰๏ผŒLake ไผšๅฐ†ๆฏไธชไพ่ต–้กน็š„ๆœฌๅœฐๅ‰ฏๆœฌไธŽๆธ…ๅ•ไธญๆŒ‡ๅฎš็š„็‰ˆๆœฌๅŒๆญฅใ€‚ ๅฆ‚ๆžœๆฒกๆœ‰ๅฏ็”จ็š„ๆธ…ๅ•๏ผŒLake ไผš่Žทๅ–ๆฏไธชไพ่ต–้กน็š„ๆœ€ๆ–ฐๅŒน้…็‰ˆๆœฌๅนถๅˆ›ๅปบไธ€ไธชๆธ…ๅ•ใ€‚ ๅฆ‚ๆžœๆธ…ๅ•ไธญๅˆ—ๅ‡บ็š„ๅŒ…ๅ็งฐไธŽๅŒ…ไฝฟ็”จ็š„ๅ็งฐไธๅŒน้…๏ผŒๅˆ™ไผšๅ‡บ็Žฐ้”™่ฏฏ๏ผ›ๅœจๆž„ๅปบไน‹ๅ‰ๅฟ…้กปไฝฟ็”จ lake update ๆ›ดๆ–ฐๆธ…ๅ•ใ€‚ ๆธ…ๅ•ๅบ”่ขซ่ง†ไธบๅŒ…ไปฃ็ ็š„ไธ€้ƒจๅˆ†๏ผŒๅนถไธ”้€šๅธธๅบ”ๆฃ€ๆŸฅๅˆฐๆบไปฃ็ ็ฎก็†ไธญใ€‚

target่กจ็คบ็”จๆˆทๅฏไปฅ่ฏทๆฑ‚็š„่พ“ๅ‡บใ€‚ ๆŒไน…ๆž„ๅปบ่พ“ๅ‡บ๏ผˆไพ‹ๅฆ‚็›ฎๆ ‡ไปฃ็ ใ€ๅฏๆ‰ง่กŒไบŒ่ฟ›ๅˆถๆ–‡ไปถๆˆ– .olean ๆ–‡ไปถ๏ผ‰็งฐไธบ artifactใ€‚ ๅœจ็”Ÿๆˆๅทฅไปถ็š„่ฟ‡็จ‹ไธญ๏ผŒLakeๅฏ่ƒฝ้œ€่ฆ็”Ÿๆˆๆ›ดๅคšๅทฅไปถ๏ผ›ไพ‹ๅฆ‚๏ผŒๅฐ† Lean ็จ‹ๅบ็ผ–่ฏ‘ไธบๅฏๆ‰ง่กŒๆ–‡ไปถ้œ€่ฆๅฐ†ๅ…ถๅŠๅ…ถไพ่ต–้กน็ผ–่ฏ‘ไธบ็›ฎๆ ‡ๆ–‡ไปถ๏ผŒ่ฟ™ไบ›็›ฎๆ ‡ๆ–‡ไปถๆœฌ่บซๆ˜ฏไปŽ C ๆบๆ–‡ไปถ็”Ÿๆˆ็š„๏ผŒ่€Œ C ๆบๆ–‡ไปถๆ˜ฏ้€š่ฟ‡่ฏฆ็ป†่ฏดๆ˜Ž Lean ๆบๆ–‡ไปถๅนถ็”Ÿๆˆ .olean ๆ–‡ไปถ ไบง็”Ÿ็š„ใ€‚ ่ฏฅ้“พไธญ็š„ๆฏไธช้“พๆŽฅ้ƒฝๆ˜ฏไธ€ไธช็›ฎๆ ‡๏ผŒLake ๅฎ‰ๆŽ’ๆฏไธช้“พๆŽฅไพๆฌกๆž„ๅปบใ€‚ ้“พ็š„ๅผ€ๅคดๆ˜ฏ ๅˆๅง‹็›ฎๆ ‡๏ผš

  • Packages ๆ˜ฏไฝœไธบไธ€ไธชๅ•ๅ…ƒๅˆ†ๅ‘็š„ Lean ไปฃ็ ๅ•ๅ…ƒใ€‚

  • Libraries ๆ˜ฏ Lean ๆจกๅ— ็š„้›†ๅˆ๏ผŒๅœจไธ€ไธชๆˆ–ๅคšไธช module root ไธ‹ๅˆ†ๅฑ‚็ป„็ป‡ใ€‚

  • Executables ็”ฑๅฎšไน‰ main ็š„ๅ•ไธชๆจกๅ—็ป„ๆˆใ€‚

  • ๅค–้ƒจๅบ“ ๆ˜ฏ้ž Lean ้™ๆ€ ๅบ“๏ผŒๅฎƒไปฌๅฐ†้“พๆŽฅๅˆฐๅŒ…ๅŠๅ…ถไพ่ต–้กน็š„ไบŒ่ฟ›ๅˆถๆ–‡ไปถ๏ผŒๅŒ…ๆ‹ฌๅฎƒไปฌ็š„ๅ…ฑไบซๅบ“ๅ’Œๅฏๆ‰ง่กŒๆ–‡ไปถใ€‚

  • ่‡ชๅฎšไน‰็›ฎๆ ‡ๅŒ…ๅซ่ฟ่กŒๆž„ๅปบ็š„ไปปๆ„ไปฃ็ ๏ผŒไฝฟ็”จ Lake ็š„ๅ†…้ƒจ API ็ผ–ๅ†™ใ€‚

้™คไบ† Lean ไปฃ็ ไน‹ๅค–๏ผŒๅŒ…ใ€ๅบ“ๅ’Œๅฏๆ‰ง่กŒๆ–‡ไปถ่ฟ˜ๅŒ…ๅซๅฝฑๅ“ๅŽ็ปญๆž„ๅปบๆญฅ้ชค็š„้…็ฝฎ่ฎพ็ฝฎใ€‚ ๅŒ…ๅฏไปฅๆŒ‡ๅฎšไธ€็ป„ default ็›ฎๆ ‡ใ€‚ ้ป˜่ฎค็›ฎๆ ‡ๆ˜ฏๅŒ…ไธญ็š„ๅˆๅง‹็›ฎๆ ‡๏ผŒ่ฟ™ไบ›็›ฎๆ ‡ๅฐ†ๅœจๆŒ‡ๅฎšไบ†ๅŒ…ไฝ†ๆœชๆŒ‡ๅฎš็‰นๅฎš็›ฎๆ ‡็š„ไธŠไธ‹ๆ–‡ไธญๆž„ๅปบใ€‚

log ๅŒ…ๅซๆž„ๅปบๆœŸ้—ด็”Ÿๆˆ็š„ไฟกๆฏใ€‚ ๆ—ฅๅฟ—่ขซไฟๅญ˜๏ผŒไปฅไพฟๅฏไปฅๅœจ ๅขž้‡ๆž„ๅปบๆœŸ้—ด้‡ๆ’ญใ€‚ ๆ—ฅๅฟ—ไธญ็š„ๆถˆๆฏๆœ‰ๅ››ไธช็บงๅˆซ๏ผŒๆŒ‰ไธฅ้‡ๆ€งๆŽ’ๅบ๏ผš

  1. ่ทŸ่ธชๆถˆๆฏ ๅŒ…ๅซ้€šๅธธ็‰นๅฎšไบŽ่ฟ่กŒๆž„ๅปบ็š„่ฎก็ฎ—ๆœบ็š„ๅ†…้ƒจๆž„ๅปบ่ฏฆ็ป†ไฟกๆฏ๏ผŒๅŒ…ๆ‹ฌ Lean ็š„็‰นๅฎš่ฐƒ็”จไปฅๅŠไผ ้€’ๅˆฐ shell ็š„ๅ…ถไป–ๅทฅๅ…ทใ€‚

  2. ไฟกๆฏๆ€งๆถˆๆฏๅŒ…ๅซไธ€่ˆฌไฟกๆฏ่พ“ๅ‡บ๏ผŒ้ข„่ฎกไธไผšๆŒ‡็คบไปฃ็ ้—ฎ้ข˜๏ผŒไพ‹ๅฆ‚ Lean.Parser.Command.eval : command`#eval e` evaluates the expression `e` by compiling and evaluating it. * The command attempts to use `ToExpr`, `Repr`, or `ToString` instances to print the result. * If `e` is a monadic value of type `m ty`, then the command tries to adapt the monad `m` to one of the monads that `#eval` supports, which include `IO`, `CoreM`, `MetaM`, `TermElabM`, and `CommandElabM`. Users can define `MonadEval` instances to extend the list of supported monads. The `#eval` command gracefully degrades in capability depending on what is imported. Importing the `Lean.Elab.Command` module provides full capabilities. Due to unsoundness, `#eval` refuses to evaluate expressions that depend on `sorry`, even indirectly, since the presence of `sorry` can lead to runtime instability and crashes. This check can be overridden with the `#eval! e` command. Options: * If `eval.pp` is true (default: true) then tries to use `ToExpr` instances to make use of the usual pretty printer. Otherwise, only tries using `Repr` and `ToString` instances. * If `eval.type` is true (default: false) then pretty prints the type of the evaluated value. * If `eval.derive.repr` is true (default: true) then attempts to auto-derive a `Repr` instance when there is no other way to print the result. See also: `#reduce e` for evaluation by term reduction. #eval ๅ‘ฝไปค็š„็ป“ๆžœใ€‚

  3. ่ญฆๅ‘Š่กจ็คบๆฝœๅœจ็š„้—ฎ้ข˜๏ผŒไพ‹ๅฆ‚ๆœชไฝฟ็”จ็š„ๅ˜้‡็ป‘ๅฎšใ€‚

  4. ้”™่ฏฏ่งฃ้‡Šไธบไป€ไนˆ่งฃๆžๅ’Œ็ฒพๅŒ–ๆ— ๆณ•ๅฎŒๆˆใ€‚

้ป˜่ฎคๆƒ…ๅ†ตไธ‹๏ผŒ่ทŸ่ธชๆถˆๆฏๆ˜ฏ้š่—็š„๏ผŒ่€Œๅ…ถไป–ๆถˆๆฏๆ˜ฏๆ˜พ็คบ็š„ใ€‚ ๅฏไปฅไฝฟ็”จ --log-level ้€‰้กนใ€--verbose ๆ ‡ๅฟ—ๆˆ– --quiet ๆ ‡ๅฟ—ๆฅ่ฐƒๆ•ด้˜ˆๅ€ผใ€‚

24.1.1.1.ย ๅŒ…่ฆ†็›–๐Ÿ”—

็จ‹ๅบๅŒ…้…็ฝฎ ๅ’Œ ๆธ…ๅ• ไธ€่ตทๆ่ฟฐไบ† Lake ๆœŸๆœ›่Žทๅ–ไพ่ต–้กน็š„็กฎๅˆ‡ๆ–นๅผใ€‚ ้€šๅธธ๏ผŒ่ฟ™ๆถ‰ๅŠ้€š่ฟ‡็ฝ‘็ปœๅˆถไฝœ่ฟœ็จ‹ Git ๅญ˜ๅ‚จๅบ“็š„ๆœฌๅœฐๅ‰ฏๆœฌใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่ฎฟ้—ฎ่ฟœ็จ‹ๅญ˜ๅ‚จๅบ“๏ผŒLake ๅฐ†็ปˆๆญขๅนถๅ‡บ็Žฐ้”™่ฏฏใ€‚ ็”ฑไบŽไพ่ต–ๅ…ณ็ณป็š„ๆฅๆบๆ˜ฏๅฏ้ข„ๆต‹็š„๏ผŒๅ› ๆญคๆž„ๅปบๅฏไปฅ่ทจ็ณป็ปŸ้‡็Žฐ๏ผ›ๅœจๆ‰€ๆœ‰ๆœบๅ™จไธŠไปฅ็›ธๅŒ็š„ๆ–นๅผไปŽ็›ธๅŒ็š„ๆบๆฃ€็ดขๅŒ…ใ€‚

ๅฐฝ็ฎกๅฆ‚ๆญค๏ผŒๅœจๆŸไบ›ๆƒ…ๅ†ตไธ‹๏ผŒๆ— ๆณ•ๅƒๅŽŸๅง‹ๅผ€ๅ‘ไบบๅ‘˜้‚ฃๆ ท่Žทๅ–ๅŒ…ไพ่ต–้กนใ€‚ ไพ‹ๅฆ‚๏ผŒไธ€ไบ›ๅ…ฌๅธ่ฆๆฑ‚ๅœจไฝฟ็”จไน‹ๅ‰ๅฏนๆ‰€ๆœ‰ไพ่ต–้กน่ฟ›่กŒๅฎกๆ ธ๏ผŒๅนถไธ”ๅนถ้žๆฏไธชไบบๅœจๅทฅไฝœๆ—ถๅง‹็ปˆๅฏไปฅ่ฎฟ้—ฎไบ’่”็ฝ‘ใ€‚ ๅœจ่ฟ™ไบ›ๆƒ…ๅ†ตไธ‹๏ผŒๆœ‰ๅฟ…่ฆ้€š่ฟ‡ๅ…ถไป–ๆ–นๅผ่Žทๅ–ๅŒ…ใ€‚

Lake ็š„ package overrides ๅ…่ฎธๅฐ†ๅŒ…ไพ่ต–้กนไปŽไธ€ไธชๆบ้‡ๅฎšๅ‘ๅˆฐๅฆไธ€ไธชๆบ๏ผŒ่€Œๆ— ้œ€ไฟฎๆ”นไปปไฝ• ๅŒ…้…็ฝฎ ๆˆ– ๆธ…ๅ•ใ€‚ ๅฎƒไปฌไธๅ…่ฎธๅ‘ ๅทฅไฝœๅŒบ ๆทปๅŠ ๆˆ–ๅˆ ้™คๅŒ…ใ€‚ ๅทฅไฝœๅŒบไธญ็š„ๆ‰€ๆœ‰ไผ ้€’ไพ่ต–้กน้ƒฝ้ตๅพช้‡ๅฎšๅ‘ใ€‚ ๅŒ…่ฆ†็›–ๆ–‡ไปถๆ˜ฏไธ€ไธช JSON ๆ–‡ไปถ๏ผŒๅ…ถไธญๅŒ…ๅซๅŒ…ๆก็›ฎ็š„ๅค‡็”จๅˆ—่กจใ€‚ ่ฟ™ไบ›ๆก็›ฎๅฐ†ไผ˜ๅ…ˆไบŽๅŒ…็š„ manifest ไธญ็š„ๆก็›ฎใ€‚ ่ฏฅๆ–‡ไปถๅฏไปฅ้€š่ฟ‡ --packages ้€‰้กนๆˆ–ๅฐ†ๅ…ถๆ”พ็ฝฎๅœจ Lake ๅทฅไฝœๅŒบไธญ็š„ๅ›บๅฎš่ทฏๅพ„ไธญๆไพ›็ป™ Lake๏ผš.lake/package-overrides.jsonใ€‚

ๅŒ…ไธญๅŒ…ๆก็›ฎ็š„่ฏญๆณ•ไผš่ฆ†็›–้•œๅƒ manifest ็š„ๆ–‡ไปถใ€‚ ๅ› ๆญค๏ผŒๅฏไปฅๅฐ†ๆธ…ๅ•ไธญ็š„ๆก็›ฎๅคๅˆถๅˆฐๅŒ…่ฆ†็›–ๆ–‡ไปถไธญ๏ผˆๅไน‹ไบฆ็„ถ๏ผ‰ใ€‚ ็กฎๅฎšๅŒ…ๆก็›ฎๅฟ…่ฆ่ฏญๆณ•็š„ไธ€็งๆ–นๆณ•ๆ˜ฏๅฐ†ไธดๆ—ถไพ่ต–้กนๆทปๅŠ ๅˆฐไธŽๆ‰€้œ€้…็ฝฎๅŒน้…็š„ ๅŒ…้…็ฝฎ๏ผŒ่ฟ่กŒ lake update ไปฅ็”Ÿๆˆๅ…ทๆœ‰่ฏฅไพ่ต–้กน็š„ๆธ…ๅ•๏ผŒ็„ถๅŽๅฐ†ๆก็›ฎไปŽๆธ…ๅ•ๅคๅˆถๅˆฐๅŒ…่ฆ†็›–ๆ–‡ไปถไธญใ€‚

Making Remote Dependencies Local

่€ƒ่™‘ไธ€ไธช็”จไพ‹๏ผŒๅ…ถไธญ็จ‹ๅบๆ˜ฏๅœจๆ— ๆณ•่ฎฟ้—ฎ็ฝ‘็ปœ็š„ๅ—้™็Žฏๅขƒไธญๅผ€ๅ‘็š„๏ผˆไพ‹ๅฆ‚๏ผŒๅ‡บไบŽๅฎ‰ๅ…จๅŽŸๅ› ๏ผ‰ใ€‚ ่ฏฅๅ›ข้˜ŸๅธŒๆœ›็ผ–่ฏ‘ไธ€ไธช็”จ Lean ็ผ–ๅ†™็š„ๅฐๅทฅๅ…ท๏ผŒ่ฏฅๅทฅๅ…ทไพ่ต–ไบŽ @leanprover/Cli ๅบ“ๆฅๆไพ›็ฎ€ๅ•็š„ๅ‘ฝไปค่กŒ็•Œ้ขใ€‚ ่ฏฅๅทฅๅ…ท็š„ manifest ็œ‹่ตทๆฅๅƒ่ฟ™ๆ ท๏ผš

{
  "version": "1.2.0",
  "packagesDir": ".lake/packages",
  "packages": [{
    "url": "https://github.com/leanprover/lean4-cli",
    "type": "git",
    "subDir": null,
    "scope": "leanprover",
    "rev": "0000000000000000000000000000000000000000",
    "name": "Cli",
    "manifestFile": "lake-manifest.json",
    "inputRev": null,
    "inherited": false,
    "configFile": "lakefile.toml"
  }],
  "name": "myTool",
  "lakeDir": ".lake",
  "fixedToolchain": false
}

ๆž„ๅปบๆญคๅทฅๅ…ทๆ—ถ๏ผŒๆญคๆธ…ๅ•ๅฐ†ๆŒ‡็คบ Lake ไปŽๆŒ‡ๅฎš็š„ GitHub URL ไธ‹่ฝฝ Cli ๅŒ…ใ€‚ ไฝ†ๆ˜ฏ๏ผŒๅ—้™็Žฏๅขƒๆฒกๆœ‰็ฝ‘็ปœ่ฎฟ้—ฎๆƒ้™๏ผŒๅ› ๆญค้™ค้ž Lake ไฝฟ็”จๆœฌๅœฐๅ‰ฏๆœฌ๏ผŒๅฆๅˆ™ๆž„ๅปบๅฐ†ไผšๅคฑ่ดฅใ€‚ ่ฟ™ๅฏไปฅ้€š่ฟ‡ไปฅไธ‹ package overrides ๆ–‡ไปถๆฅๅฎŒๆˆ๏ผš

{
  "version": "1.2.0",
  "packages": [{
    "type": "path",
    "dir": "/etc/lean-packages/Cli",
    "name": "Cli",
    "manifestFile": "lake-manifest.json",
    "inherited": false,
    "configFile": "lakefile.toml"
  }]
}

่ฟ™ๆ ท๏ผŒLake ๅฐ†ๆ”นไธบ่งฃๆž Cli ๅฏนไฝไบŽ่ทฏๅพ„ /etc/lean-packages/Cli ็š„ๆœฌๅœฐๅŒ…็š„ไพ่ต–ๅ…ณ็ณปใ€‚

24.1.1.2.ย ๆž„ๅปบ๐Ÿ”—

็”Ÿๆˆๆ‰€้œ€็š„ ๅทฅไปถ๏ผŒไพ‹ๅฆ‚ .olean ๆ–‡ไปถ ๆˆ–ๅฏๆ‰ง่กŒไบŒ่ฟ›ๅˆถๆ–‡ไปถ๏ผŒ็งฐไธบ buildใ€‚ ๆž„ๅปบ็”ฑ lake build ๅ‘ฝไปคๆˆ–้œ€่ฆๅญ˜ๅœจๅทฅไปถ็š„ๅ…ถไป–ๅ‘ฝไปค๏ผˆไพ‹ๅฆ‚ lake exe๏ผ‰่งฆๅ‘ใ€‚ ๆž„ๅปบ็”ฑไปฅไธ‹ๆญฅ้ชค็ป„ๆˆ๏ผš

้…็ฝฎๅŒ…

ๅฆ‚ๆžœ ็จ‹ๅบๅŒ…้…็ฝฎ ๆ–‡ไปถๆฏ”็ผ“ๅญ˜็š„้…็ฝฎๆ–‡ไปถ lakefile.olean ๆ–ฐ๏ผŒๅˆ™้‡ๆ–ฐ่ฏฆ็ป†่ฏดๆ˜Ž็จ‹ๅบๅŒ…้…็ฝฎใ€‚ ๅฝ“็ผ“ๅญ˜ๆ–‡ไปถไธขๅคฑๆˆ–ๆไพ› --reconfigure ๆˆ– -R ๆ ‡ๅฟ—ๆ—ถ๏ผŒไนŸไผšๅ‘็”Ÿ่ฟ™็งๆƒ…ๅ†ตใ€‚ ไฝฟ็”จ -K ๆ›ดๆ”น้€‰้กนไธไผš่งฆๅ‘้…็ฝฎๆ–‡ไปถ็š„้‡ๆ–ฐ็ฒพๅŒ–๏ผ›ๅœจ่ฟ™ไบ›ๆƒ…ๅ†ตไธ‹ -R ๆ˜ฏๅฟ…่ฆ็š„ใ€‚

่ฎก็ฎ—ไพ่ต–ๅ…ณ็ณป

็กฎๅฎšไบง็”Ÿๆ‰€้œ€่พ“ๅ‡บๆ‰€้œ€็š„ๅทฅไปถ้›†๏ผŒไปฅๅŠไบง็”Ÿๅฎƒไปฌ็š„ ็›ฎๆ ‡ ๅ’Œ ๆ–น้ขใ€‚ ่ฟ™ไธช่ฟ‡็จ‹ๆ˜ฏ้€’ๅฝ’็š„๏ผŒ็ป“ๆžœๆ˜ฏไพ่ต–ๅ…ณ็ณปๅ›พใ€‚ ๆญคๅ›พไธญ็š„ไพ่ต–ๅ…ณ็ณปไธŽไธบๅŒ…ๅฃฐๆ˜Ž็š„ไพ่ต–ๅ…ณ็ณปไธๅŒ๏ผšๅŒ…ไพ่ต–ไบŽๅ…ถไป–ๅŒ…๏ผŒ่€Œๆž„ๅปบ็›ฎๆ ‡ไพ่ต–ไบŽๅ…ถไป–ๆž„ๅปบ็›ฎๆ ‡๏ผŒ่ฟ™ไบ›ๆž„ๅปบ็›ฎๆ ‡ๅฏ่ƒฝไฝไบŽๅŒไธ€ๅŒ…ไธญ๏ผŒไนŸๅฏ่ƒฝไฝไบŽไธๅŒ็š„ๅŒ…ไธญใ€‚ ็ป™ๅฎš็›ฎๆ ‡็š„ไธ€ไธชๆ–น้ขๅฏ่ƒฝๅ–ๅ†ณไบŽๅŒไธ€็›ฎๆ ‡็š„ๅ…ถไป–ๆ–น้ขใ€‚ Lake ่‡ชๅŠจๅˆ†ๆž Lean ๆจกๅ—็š„ๅฏผๅ…ฅไปฅๅ‘็Žฐๅ…ถไพ่ต–ๅ…ณ็ณป๏ผŒๅนถไธ” extraDepTargets ๅญ—ๆฎตๅฏ็”จไบŽๅ‘็›ฎๆ ‡ๆทปๅŠ ๅ…ถไป–ไพ่ต–ๅ…ณ็ณปใ€‚

้‡ๆ”พ็—•่ฟน

Lake ไฝฟ็”จไฟๅญ˜็š„ trace ๆ–‡ไปถ ๆฅ็กฎๅฎš้œ€่ฆๆž„ๅปบๅ“ชไบ›ๅทฅไปถ๏ผŒ่€Œไธๆ˜ฏไปŽๅคดๅผ€ๅง‹้‡ๅปบไพ่ต–ๅ…ณ็ณปๅ›พไธญ็š„ๆ‰€ๆœ‰ๅ†…ๅฎนใ€‚ ๅœจๆž„ๅปบๆœŸ้—ด๏ผŒLake ่ฎฐๅฝ•็”จไบŽ็”Ÿๆˆๆฏไธชๅทฅไปถ็š„ๆบๆ–‡ไปถๆˆ–ๅ…ถไป–ๅทฅไปถ๏ผŒไฟๅญ˜ๆฏไธช่พ“ๅ…ฅ็š„ๅ“ˆๅธŒๅ€ผ๏ผ›่ฟ™ไบ› traces ไฟๅญ˜ๅœจ ๆž„ๅปบ็›ฎๅฝ•ไธญใ€‚ๆ›ดๅ…ทไฝ“ๅœฐ่ฏด๏ผŒๆฏไธชๅทฅไปถ็š„่ทŸ่ธชๆ–‡ไปถๅŒ…ๅซๅ…ถ่พ“ๅ…ฅๅ“ˆๅธŒ็š„ Merkle ๆ ‘ๅ“ˆๅธŒๆททๅˆใ€‚ ๅฆ‚ๆžœ่พ“ๅ…ฅๅ…จ้ƒจๆœชไฟฎๆ”น๏ผŒๅˆ™ไธไผš้‡ๅปบ็›ธๅบ”็š„ๅทฅไปถใ€‚ ่ทŸ่ธชๆ–‡ไปถ่ฟ˜่ฎฐๅฝ•ๆฏไธชๆž„ๅปบไปปๅŠก็š„ log๏ผ›่ฟ™ไบ›่พ“ๅ‡บไผš่ขซ้‡ๆ’ญ๏ผŒๅฐฑๅฅฝๅƒๅทฅไปถๆ˜ฏ้‡ๆ–ฐๆž„ๅปบ็š„ไธ€ๆ ทใ€‚ ๅฐฝๅฏ่ƒฝ้‡็”จไปฅๅ‰็š„ๆž„ๅปบไบงๅ“็งฐไธบ ๅขž้‡ๆž„ๅปบใ€‚

ๅปบ็ญ‘ๆ–‡็‰ฉ

ๅฝ“ไพ่ต–ๅ…ณ็ณปๅ›พไธญๆ‰€ๆœ‰ๆœชไฟฎๆ”น็š„ไพ่ต–ๅ…ณ็ณป้ƒฝๅทฒไปŽๅ…ถ่ทŸ่ธชๆ–‡ไปถ้‡ๆ’ญๅŽ๏ผŒLake ็ปง็ปญๆž„ๅปบๆฏไธชๅทฅไปถใ€‚ ่ฟ™ๆถ‰ๅŠๅœจ่พ“ๅ…ฅๆ–‡ไปถไธŠ่ฟ่กŒ้€‚ๅฝ“็š„ๆž„ๅปบๅทฅๅ…ทๅนถไฟๅญ˜ๅทฅไปถๅŠๅ…ถ่ทŸ่ธชๆ–‡ไปถ๏ผŒๅฆ‚็›ธๅบ”ๆ–น้ขไธญๆŒ‡ๅฎš็š„้‚ฃๆ ทใ€‚

Lake ไฝฟ็”จไธค็งๅ•็‹ฌ็š„ๅ“ˆๅธŒ็ฎ—ๆณ•ใ€‚ ๆ–‡ๆœฌๆ–‡ไปถๅœจ่ง„่ŒƒๅŒ–ๆข่กŒ็ฌฆๅŽ่ฟ›่กŒๅ“ˆๅธŒๅค„็†๏ผŒไปฅไพฟไป…ๅ› ็‰นๅฎšไบŽๅนณๅฐ็š„ๆข่กŒ็ฌฆ็บฆๅฎš่€ŒไธๅŒ็š„ๆ–‡ไปถ่ฟ›่กŒ็›ธๅŒ็š„ๅ“ˆๅธŒๅค„็†ใ€‚ ๅ…ถไป–ๆ–‡ไปถๅœจๆฒกๆœ‰ไปปไฝ•ๆ ‡ๅ‡†ๅŒ–็š„ๆƒ…ๅ†ตไธ‹่ฟ›่กŒๅ“ˆๅธŒๅค„็†ใ€‚

Lean ไธŽ่ทŸ่ธชๆ–‡ไปถไธ€่ตท็ผ“ๅญ˜่พ“ๅ…ฅๅ“ˆๅธŒๅ€ผใ€‚ ๆฏๅฝ“ๆž„ๅปบไธ€ไธชๅทฅไปถๆ—ถ๏ผŒๅฎƒ็š„ๅ“ˆๅธŒๅ€ผ้ƒฝไผšไฟๅญ˜ๅœจไธ€ไธชๅ•็‹ฌ็š„ๆ–‡ไปถไธญ๏ผŒๅฏไปฅ้‡ๆ–ฐ่ฏปๅ–่ฏฅๆ–‡ไปถ๏ผŒ่€Œไธๆ˜ฏไปŽๅคดๅผ€ๅง‹่ฎก็ฎ—ๅ“ˆๅธŒๅ€ผใ€‚ ่ฟ™ๆ˜ฏไธ€ไธชๆ€ง่ƒฝไผ˜ๅŒ–ใ€‚ ๅฏไปฅไฝฟ็”จ --rehash ๅ‘ฝไปค่กŒ้€‰้กน็ฆ็”จๆญคๅŠŸ่ƒฝ๏ผŒไปŽ่€Œๅฏผ่‡ดไปŽๅ…ถ่พ“ๅ…ฅ้‡ๆ–ฐ่ฎก็ฎ—ๆ‰€ๆœ‰ๅ“ˆๅธŒๅ€ผใ€‚

ๅœจๆž„ๅปบ่ฟ‡็จ‹ไธญ๏ผŒๅฐ†ๅ‘ๅบ•ๅฑ‚ๆž„ๅปบๅทฅๅ…ทๆไพ›ไปฅไธ‹็›ฎๅฝ•๏ผš

  • source ็›ฎๅฝ•ๅŒ…ๅซๅฏๅฏผๅ…ฅ็š„ Lean ๆบไปฃ็ ใ€‚

  • library ็›ฎๅฝ•ๅŒ…ๅซ .olean ๆ–‡ไปถ ไปฅๅŠๅฏ็”จไบŽ้“พๆŽฅ็š„ๅ…ฑไบซๅบ“ๅ’Œ้™ๆ€ๅบ“๏ผ›ๅฎƒ้€šๅธธ็”ฑ ๆ นๅŒ… ็š„ๅบ“็›ฎๅฝ•๏ผˆๅœจ .lake/build/lib ไธญๆ‰พๅˆฐ๏ผ‰ใ€ๅทฅไฝœๅŒบไธญๅ…ถไป–ๅŒ…็š„ๅบ“็›ฎๅฝ•ใ€ๅฝ“ๅ‰ Lean ๅทฅๅ…ท้“พ็š„ๅบ“็›ฎๅฝ•ๅ’Œ็ณป็ปŸๅบ“็›ฎๅฝ•็ป„ๆˆใ€‚

  • Lake home ๆ˜ฏ Lake ็š„ๅฎ‰่ฃ…็›ฎๅฝ•๏ผŒๅŒ…ๆ‹ฌไบŒ่ฟ›ๅˆถๆ–‡ไปถใ€ๆบไปฃ็ ๅ’Œๅบ“ใ€‚ Lake ไธป็›ฎๅฝ•ไธญ็š„ๅบ“้œ€่ฆ่ฏฆ็ป†่ฏดๆ˜Ž Lake ้…็ฝฎๆ–‡ไปถ๏ผŒ่ฟ™ไบ›ๆ–‡ไปถๅฏไปฅ่ฎฟ้—ฎ Lean ็š„ๅ…จ้ƒจๅŠŸ่ƒฝใ€‚

24.1.1.3.ย ๅˆป้ข๐Ÿ”—

facet ๆ่ฟฐไบ†ๅฆไธ€ไธช็›ฎๆ ‡็š„็”Ÿๆˆใ€‚ ไปŽๆฆ‚ๅฟตไธŠ่ฎฒ๏ผŒไปปไฝ•็›ฎๆ ‡้ƒฝๅฏ่ƒฝๆœ‰ๅคšไธชๆ–น้ขใ€‚ ไฝ†ๆ˜ฏ๏ผŒๅฏๆ‰ง่กŒๆ–‡ไปถใ€ๅค–้ƒจๅบ“ๅ’Œ่‡ชๅฎšไน‰็›ฎๆ ‡ไป…ๆไพ›ไธ€ไธช้šๅผๆ–น้ขใ€‚ ๅŒ…ใ€ๅบ“ๅ’Œๆจกๅ—ๅ…ทๆœ‰ๅคšไธชๆ–น้ข๏ผŒๅœจ่ฐƒ็”จ lake build ๆ—ถๅฏไปฅ้€š่ฟ‡ๅ็งฐ่ฏทๆฑ‚ไปฅ้€‰ๆ‹ฉ็›ธๅบ”็š„็›ฎๆ ‡ใ€‚

ๅฝ“ๆœชๆ˜พๅผ่ฏทๆฑ‚ๆž„้ขไฝ†ๆŒ‡ๅฎšไบ†ๅˆๅง‹็›ฎๆ ‡ๆ—ถ๏ผŒlake build ไผš็”Ÿๆˆๅˆๅง‹็›ฎๆ ‡็š„ default facetใ€‚ ๆฏ็ง็ฑปๅž‹็š„ๅˆๅง‹็›ฎๆ ‡้ƒฝๆœ‰็›ธๅบ”็š„้ป˜่ฎคๆ–น้ข๏ผˆไพ‹ๅฆ‚๏ผŒไปŽๅฏๆ‰ง่กŒ็›ฎๆ ‡็”Ÿๆˆๅฏๆ‰ง่กŒไบŒ่ฟ›ๅˆถๆ–‡ไปถๆˆ–ๆž„ๅปบๅŒ…็š„ ้ป˜่ฎค็›ฎๆ ‡๏ผ‰๏ผ›ๅ…ถไป–ๆ–น้ขๅฏไปฅๅœจ ่ฝฏไปถๅŒ…้…็ฝฎ ไธญๆˆ–้€š่ฟ‡ Lake ็š„ ๅ‘ฝไปค่กŒๆŽฅๅฃ ๆ˜พๅผ่ฏทๆฑ‚ใ€‚ Lake ็š„ๅ†…้ƒจ API ๅฏ็”จไบŽ็ผ–ๅ†™่‡ชๅฎšไน‰ๆž„้ขใ€‚

ๅฏ็”จไบŽๅŒ…็š„ๆ–น้ขๆœ‰๏ผš

extraDep

ๅŒ…็š„้ขๅค–ไพ่ต–้กน็›ฎๆ ‡็š„้ป˜่ฎคๆ–น้ข๏ผŒๅœจ extraDepTargets ๅญ—ๆฎตไธญๆŒ‡ๅฎšใ€‚

deps

่ฏฅๅŒ…็š„ ็›ดๆŽฅไพ่ต–้กนใ€‚

transDeps

ๅŒ…็š„ ไผ ้€’ไพ่ต–้กน๏ผŒๆŒ‰ๆ‹“ๆ‰‘ๆŽ’ๅบใ€‚

optCache

ๅŒ…็š„ๅฏ้€‰็ผ“ๅญ˜ๆž„ๅปบๅญ˜ๆกฃ๏ผˆไพ‹ๅฆ‚๏ผŒๆฅ่‡ช Reservoir ๆˆ– GitHub๏ผ‰ใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–ๅญ˜ๆกฃ๏ผŒๅฐ† ไธไผš ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

cache

ๅŒ…็š„็ผ“ๅญ˜ๆž„ๅปบๅญ˜ๆกฃ๏ผˆไพ‹ๅฆ‚๏ผŒๆฅ่‡ช Reservoir ๆˆ– GitHub๏ผ‰ใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–ๅญ˜ๆกฃ๏ผŒๅฐ†ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

optBarrel

ๅŒ…็š„ๅฏ้€‰็ผ“ๅญ˜ๆž„ๅปบๅญ˜ๆกฃ๏ผˆไพ‹ๅฆ‚๏ผŒๆฅ่‡ช Reservoir ๆˆ– GitHub๏ผ‰ใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–ๅญ˜ๆกฃ๏ผŒๅฐ† ไธไผš ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

barrel

ๅŒ…็š„็ผ“ๅญ˜ๆž„ๅปบๅญ˜ๆกฃ๏ผˆไพ‹ๅฆ‚๏ผŒๆฅ่‡ช Reservoir ๆˆ– GitHub๏ผ‰ใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–ๅญ˜ๆกฃ๏ผŒๅฐ†ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

optRelease

GitHub ็‰ˆๆœฌไธญ่ฝฏไปถๅŒ…็š„ๅฏ้€‰ๆž„ๅปบๅญ˜ๆกฃใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–็‰ˆๆœฌ๏ผŒไธไผš ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

release

GitHub ็‰ˆๆœฌไธญ็š„็จ‹ๅบๅŒ…ๆž„ๅปบๅญ˜ๆกฃใ€‚ ๅฆ‚ๆžœๆ— ๆณ•่Žทๅ–ๅญ˜ๆกฃ๏ผŒๅฐ†ๅฏผ่‡ดๆ•ดไธชๆž„ๅปบๅคฑ่ดฅใ€‚

ๅ›พไนฆ้ฆ†ๅฏ็”จ็š„ๆ–น้ขๆœ‰๏ผš

leanArts

Lean ็ผ–่ฏ‘ๅ™จไธบๅบ“ๆˆ–ๅฏๆ‰ง่กŒๆ–‡ไปถ๏ผˆ*.oleanใ€*.ilean ๅ’Œ *.c ๆ–‡ไปถ๏ผ‰็”Ÿๆˆ็š„ๅทฅไปถใ€‚

static

C ็ผ–่ฏ‘ๅ™จไปŽ leanArts๏ผˆๅณ *.a ๆ–‡ไปถ๏ผ‰็”Ÿๆˆ็š„้™ๆ€ๅบ“ใ€‚

static.export

C ็ผ–่ฏ‘ๅ™จไปŽ leanArts๏ผˆๅณ *.a ๆ–‡ไปถ๏ผ‰็”Ÿๆˆ็š„้™ๆ€ๅบ“๏ผŒๅธฆๆœ‰ๅฏผๅ‡บ็š„็ฌฆๅทใ€‚

shared

C ็ผ–่ฏ‘ๅ™จไปŽ leanArts๏ผˆๅณ *.soใ€*.dll ๆˆ– *.dylib ๆ–‡ไปถ๏ผŒๅ…ทไฝ“ๅ–ๅ†ณไบŽๅนณๅฐ๏ผ‰็”Ÿๆˆ็š„ๅ…ฑไบซๅบ“ใ€‚

extraDep

Lean ๅบ“็š„ extraDepTargets ๅŠๅ…ถๅŒ…็š„ extraDepTargets ใ€‚

ๅฏๆ‰ง่กŒๆ–‡ไปถๅ…ทๆœ‰็”ฑๅฏๆ‰ง่กŒไบŒ่ฟ›ๅˆถๆ–‡ไปถ็ป„ๆˆ็š„ๅ•ไธช exe ๆ–น้ขใ€‚

ๆจกๅ—ๅฏ็”จ็š„ๆ–น้ขๆœ‰๏ผš

lean

ๆจกๅ—็š„ Lean ๆบๆ–‡ไปถใ€‚

leanArts๏ผˆ้ป˜่ฎค๏ผ‰

ๆจกๅ—็š„ Lean ๅทฅไปถ๏ผˆ*.oleanใ€*.ileanใ€*.c ๆ–‡ไปถ๏ผ‰ใ€‚

deps

ๆจกๅ—็š„ไพ่ต–้กน๏ผˆไพ‹ๅฆ‚ๅฏผๅ…ฅๆˆ–ๅ…ฑไบซๅบ“๏ผ‰ใ€‚

olean

ๆจกๅ—็š„ .olean ๆ–‡ไปถใ€‚

ilean

่ฏฅๆจกๅ—็š„ .ilean ๆ–‡ไปถ๏ผŒๅฎƒๆ˜ฏ Lean ่ฏญ่จ€ๆœๅŠกๅ™จไฝฟ็”จ็š„ๅ…ƒๆ•ฐๆฎใ€‚

header

ๆจกๅ—ๆบๆ–‡ไปถ็š„ๅทฒ่งฃๆžๆจกๅ—ๅคดใ€‚

input

ๆจกๅ—ๅค„็†ๅŽ็š„Leanๆบๆ–‡ไปถใ€‚ๅฐ†่ทŸ่ธชๆ–‡ไปถไธŽ่งฃๆžๅ…ถๆ ‡ๅคด็›ธ็ป“ๅˆใ€‚

imports

Lean ๆจกๅ—็š„็›ดๆŽฅๅฏผๅ…ฅ๏ผŒไฝ†ไธๆ˜ฏๅ…จๅฅ—ไผ ้€’ๅฏผๅ…ฅใ€‚

precompileImports

Lean ๆจกๅ—็š„ไผ ้€’ๅฏผๅ…ฅ๏ผŒ็ผ–่ฏ‘ไธบ็›ฎๆ ‡ไปฃ็ ใ€‚

transImports

Lean ๆจกๅ—็š„ไผ ้€’ๅฏผๅ…ฅ๏ผŒๅฆ‚ .olean ๆ–‡ไปถใ€‚

allImports

Lean ๆจกๅ—็š„็›ดๆŽฅๅฏผๅ…ฅๅ’Œไผ ้€’ๅฏผๅ…ฅใ€‚

setup

ๆจกๅ—็š„ๆ‰€ๆœ‰ไพ่ต–้กน๏ผšไผ ้€’ๆœฌๅœฐๅฏผๅ…ฅๅ’Œ่ฆไฝฟ็”จ --load-dynlib ๅŠ ่ฝฝ็š„ๅ…ฑไบซๅบ“ใ€‚ ่ฟ”ๅ›ž่ฆๅŠ ่ฝฝ็š„ๅ…ฑไบซๅบ“ๅˆ—่กจๅŠๅ…ถๆœ็ดข่ทฏๅพ„ใ€‚

ir

็”ฑ lean ็”Ÿๆˆ็š„ .ir ๆ–‡ไปถ๏ผˆๅฏ็”จ ๅฎž้ชŒๆจกๅ—็ณป็ปŸ๏ผ‰ใ€‚

c

Lean ็ผ–่ฏ‘ๅ™จ็”Ÿๆˆ็š„ C ๆ–‡ไปถใ€‚

bc

LLVM ไฝ็ ๆ–‡ไปถ๏ผŒ็”ฑ Lean ็ผ–่ฏ‘ๅ™จ็”Ÿๆˆใ€‚

c.o

ไปŽ C ๆ–‡ไปถ็”Ÿๆˆ็š„็ผ–่ฏ‘็›ฎๆ ‡ๆ–‡ไปถใ€‚ๅœจ Windows ไธŠ๏ผŒ่ฟ™็›ธๅฝ“ไบŽ .c.o.noexport๏ผŒ่€Œๅœจๅ…ถไป–ๅนณๅฐไธŠ็›ธๅฝ“ไบŽ .c.o.exportใ€‚

c.o.export

็ผ–่ฏ‘ๅŽ็š„็›ฎๆ ‡ๆ–‡ไปถ๏ผŒ็”ฑ C ๆ–‡ไปถ็”Ÿๆˆ๏ผŒๅนถๅฏผๅ‡บ Lean ็ฌฆๅทใ€‚

c.o.noexport

็ผ–่ฏ‘ๅŽ็š„็›ฎๆ ‡ๆ–‡ไปถ๏ผŒ็”ฑ C ๆ–‡ไปถ็”Ÿๆˆ๏ผŒๅนถๅฏผๅ‡บ Lean ็ฌฆๅทใ€‚

bc.o

็ผ–่ฏ‘ๅŽ็š„็›ฎๆ ‡ๆ–‡ไปถ๏ผŒ็”ฑ LLVM ไฝ็ ๆ–‡ไปถ็”Ÿๆˆใ€‚

o

้…็ฝฎๅŽ็ซฏ็š„็ผ–่ฏ‘็›ฎๆ ‡ๆ–‡ไปถใ€‚

dynlib

ๅ…ฑไบซๅบ“๏ผˆไพ‹ๅฆ‚๏ผŒๅฏนไบŽ Lean ้€‰้กน --load-dynlib๏ผ‰ใ€‚

ltar

ๆจกๅ—ๆž„ๅปบๅทฅไปถ็š„ๅŽ‹็ผฉๅญ˜ๆกฃ๏ผˆ้€š่ฟ‡ leantar ็”Ÿๆˆ๏ผ‰ใ€‚

24.1.1.4.ย ่„šๆœฌ๐Ÿ”—

Lake ๅŒ…้…็ฝฎๆ–‡ไปถๅฏ่ƒฝๅŒ…ๅซ Lake ่„šๆœฌ๏ผŒๅฎƒไปฌๆ˜ฏๅฏไปฅไปŽๅ‘ฝไปค่กŒๆ‰ง่กŒ็š„ๅตŒๅ…ฅๅผ็จ‹ๅบใ€‚ ่„šๆœฌๆ—จๅœจ็”จไบŽ Lake ็š„ๅ…ถไป–ๅŠŸ่ƒฝๅฐšๆœชๅพˆๅฅฝๅœฐๆปก่ถณ็š„็‰นๅฎšไบŽ้กน็›ฎ็š„ไปปๅŠกใ€‚ ๆ™ฎ้€šๅฏๆ‰ง่กŒ็จ‹ๅบๅœจ IO monad ไธญ่ฟ่กŒ๏ผŒ่€Œ่„šๆœฌๅœจ ScriptM ไธญ่ฟ่กŒ๏ผŒๅฎƒไฝฟ็”จๆœ‰ๅ…ณๅทฅไฝœ็ฉบ้—ด็š„ไฟกๆฏๆ‰ฉๅฑ•ไบ† IOใ€‚ ็”ฑไบŽๅฎƒไปฌๆ˜ฏ Lean ๅฎšไน‰๏ผŒๅ› ๆญค Lake ่„šๆœฌๅช่ƒฝไปฅ Lean ้…็ฝฎๆ ผๅผๅฎšไน‰ใ€‚

24.1.1.5.ย ๆต‹่ฏ•ๅ’Œ Lint ้ฉฑๅŠจ็จ‹ๅบ๐Ÿ”—

ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ่ฟ่กŒๅŒ…็š„ๆต‹่ฏ•ใ€‚ ๅฎƒๅฏไปฅๆ˜ฏๅฏๆ‰ง่กŒ็›ฎๆ ‡ใ€Lake ่„šๆœฌ ๆˆ–ๅบ“ใ€‚ Lake ๆœฌ่บซไธๆ˜ฏๆต‹่ฏ•ๆก†ๆžถ๏ผšlake test ๅ‘ฝไปคๅชๆ˜ฏๅฎšไฝ้…็ฝฎ็š„็›ฎๆ ‡๏ผŒๆž„ๅปบๅฎƒ๏ผŒ็„ถๅŽ๏ผˆๅฏนไบŽๅฏๆ‰ง่กŒๆ–‡ไปถๅ’Œ่„šๆœฌ๏ผ‰่ฟ่กŒๅฎƒใ€‚ ๅบ“้ฉฑๅŠจ็จ‹ๅบ็บฏ็ฒน็”ฑ็ฒพๅŒ–ๆ‰ง่กŒ๏ผŒๅ› ๆญคๅฎƒไปฌไธไผšไฝœไธบๅ•็‹ฌ็š„ๆญฅ้ชค่ฟ่กŒใ€‚ ๆ–ญ่จ€ใ€ๆต‹่ฏ•ๅ‘็Žฐๅ’ŒๆŠฅๅ‘Šๅ–ๅ†ณไบŽ็›ฎๆ ‡ๆœฌ่บซ๏ผŒๆ— ่ฎบๆ˜ฏ็ฌฌไธ‰ๆ–นๆต‹่ฏ•ๅบ“่ฟ˜ๆ˜ฏๆ‰‹ๅ†™ๆฃ€ๆŸฅใ€‚

ๅฏนไบŽๅฏๆ‰ง่กŒๆ–‡ไปถๅ’Œ่„šๆœฌ๏ผŒLake ๅฐ†้ž้›ถ้€€ๅ‡บไปฃ็ ่ง†ไธบๆต‹่ฏ•ๅคฑ่ดฅใ€‚ ๅฏนไบŽๅบ“๏ผŒไปปไฝ•็ฒพๅŒ–้”™่ฏฏ้ƒฝ็ฎ—ไฝœๆต‹่ฏ•ๅคฑ่ดฅ๏ผŒๅŒ…ๆ‹ฌ #guard ๆ ทๅผๅ‘ฝไปค็š„ๅคฑ่ดฅใ€‚

lint ้ฉฑๅŠจ็จ‹ๅบ ไธŽไน‹็ฑปไผผ๏ผŒไฝ†ๅฎƒ็”ฑ lake lint ่ฟ่กŒ๏ผŒๅนถๆฃ€ๆŸฅๅŒ…ๆ˜ฏๅฆๅญ˜ๅœจ้ฃŽๆ ผ้—ฎ้ข˜ๅ’Œๅ…ถไป–ๅนถ้ž้”™่ฏฏใ€ไฝ†่กจๆ˜Žๅฏ่ƒฝๅญ˜ๅœจ้—ฎ้ข˜็š„้—ฎ้ข˜ใ€‚ Lint ้ฉฑๅŠจ็จ‹ๅบๅช่ƒฝๆ˜ฏๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–่„šๆœฌ๏ผŒไธ่ƒฝๆ˜ฏๅบ“ใ€‚

24.1.1.5.1.ย ้…็ฝฎๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ๐Ÿ”—

ๅœจ lakefile.toml ไธญ๏ผŒๅฐ† testDriver ่ฎพ็ฝฎไธบๅŒไธ€้…็ฝฎไธญๅฎšไน‰็š„ๅฏๆ‰ง่กŒ็›ฎๆ ‡ใ€ๅบ“็›ฎๆ ‡ๆˆ–่„šๆœฌ็š„ๅ็งฐ๏ผš

Test Driver (lakefile.toml)
name = "my-package"
testDriver = "my-package-tests"

[[lean_exe]]
name = "my-package-tests"
root = "Tests"

ๅœจ lakefile.lean ไธญ๏ผŒๅฏไปฅๅœจ package ๅฃฐๆ˜ŽไธŠ่ฎพ็ฝฎ testDriver ๅญ—ๆฎต๏ผˆๅฆ‚ไธŠๆ‰€่ฟฐ๏ผ‰๏ผŒๆˆ–่€…ไฝฟ็”จ test_driver ๅฑžๆ€งๆ ‡่ฎฐ่„šๆœฌใ€ๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–ๅบ“ๅฃฐๆ˜Žใ€‚ ๅฑžๆ€งๅฝขๅผ้€šๅธธๅพˆๆ–นไพฟ๏ผŒๅ› ไธบๅฎƒๅฐ†ๆ ‡่ฎฐๆ”พ็ฝฎๅœจ็›ฎๆ ‡ๆ—่พนใ€‚

Test Driver (lakefile.lean)
import Lake open Lake DSL package ยซmy-packageยป where testDriver := "my-package-tests" lean_exe ยซmy-package-testsยป where root := `Tests

ๆฏไธชๅŒ…่ฃนๅช่ƒฝๆœ‰ไธ€ไปฝๅฃฐๆ˜Žๅธฆๆœ‰ test_driver ๆ ‡็ญพใ€‚ ๅœจๅŒไธ€ Lake ้…็ฝฎๆ–‡ไปถไธญๅŒๆ—ถไฝฟ็”จ test_driver ๅฑžๆ€งๅ’Œ้ž็ฉบ testDriver ๅญ—ๆฎตๆ˜ฏ้”™่ฏฏ็š„ใ€‚

ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบไนŸๅฏ่ƒฝๆ˜ฏไผ ้€’ๆ€ง ๅฟ…้œ€ ็š„ๅŒ…ไพ่ต–้กนไธญ็š„็›ฎๆ ‡ใ€‚ ่ฆไฝฟ็”จๅ…ถไป–ๅŒ…ไธญ็š„็›ฎๆ ‡๏ผŒ่ฏทไฝฟ็”จ <pkg>/<name> ไฝœไธบ testDriver ็š„ๅ€ผ๏ผŒๅ…ถไธญ <pkg> ๆ˜ฏๅœจๅ…ถไธญๆ‰พๅˆฐ็›ฎๆ ‡็š„ๅŒ…็š„ๅ็งฐใ€‚

24.1.1.5.2.ย ่ฟ่กŒๆต‹่ฏ•๐Ÿ”—

lake test ๅ‘ฝไปคไป…่ฟ่กŒไธบ root package ้…็ฝฎ็š„้ฉฑๅŠจ็จ‹ๅบใ€‚ ไธ่ฟ่กŒไพ่ต–้กน็š„ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบใ€‚

ๅฆ‚ๆžœๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบๆ˜ฏๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–่„šๆœฌ๏ผŒLake ้ฆ–ๅ…ˆไผ ้€’ๆฅ่‡ช testDriverArgs ็š„ๅ‚ๆ•ฐ๏ผŒ็„ถๅŽไผ ้€’ๅ‘ฝไปค่กŒไธŠ -- ไน‹ๅŽ็š„ไปปไฝ•ๅ†…ๅฎนใ€‚ ไพ‹ๅฆ‚๏ผŒ

lake test -- --filter Foo --verbose

ๅœจ้…็ฝฎๅฎŒ testDriverArgs ๅŽ๏ผŒๅฐ† --filter Foo --verbose ไผ ้€’็ป™้ฉฑๅŠจ็จ‹ๅบใ€‚ Lake ๅœจ่ฟ่กŒๅฏๆ‰ง่กŒ้ฉฑๅŠจ็จ‹ๅบไน‹ๅ‰ๆž„ๅปบๅฎƒไปฌใ€‚

ๅฆ‚ๆžœๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบๆ˜ฏๅบ“๏ผŒๅˆ™ไธๆŽฅๅ—ๅ‚ๆ•ฐใ€‚ ๅฆ‚ๆžœ testDriverArgs ้ž็ฉบๆˆ–่€… -- ๅŽ้ขๆœ‰ไปปไฝ•ๅ‚ๆ•ฐ๏ผŒๅˆ™ Lake ๆŠฅๅ‘Š้”™่ฏฏใ€‚ ่ฆ่ฟ่กŒๆต‹่ฏ•๏ผŒ่ฏฅๅบ“ๅชๆ˜ฏ ่ฏฆ็ป†ใ€‚

ๅฆ‚ๆžœไธบๆ นๅŒ…้…็ฝฎไบ†ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ๏ผŒlake check-test ๅฐ†ไปฅ้€€ๅ‡บไปฃ็  0 ็ปˆๆญข๏ผˆๅณๆˆๅŠŸ๏ผ‰ใ€‚ ๅฎƒไธไผšๆฃ€ๆŸฅๆŒ‡ๅฎš็š„็›ฎๆ ‡ๆ˜ฏๅฆ็กฎๅฎžๅญ˜ๅœจใ€‚

24.1.1.5.3.ย Lint ้ฉฑๅŠจ็จ‹ๅบ๐Ÿ”—

Lint ้ฉฑๅŠจ็จ‹ๅบ็š„้…็ฝฎๅ’Œ่ฟ่กŒไธŽ ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ็ฑปไผผใ€‚ Lake ้…็ฝฎๆ–‡ไปถๆŒ‡ๅฎšๅ……ๅฝ“ lint ้ฉฑๅŠจ็จ‹ๅบ็š„็›ฎๆ ‡๏ผŒlake lint ่ฟ่กŒๅฎƒใ€‚ ่ฏฅ็›ฎๆ ‡ๅฟ…้กปๆ˜ฏๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–่„šๆœฌ๏ผ›ไธŽๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบไธๅŒ๏ผŒlint ้ฉฑๅŠจ็จ‹ๅบๅฏ่ƒฝไธๆ˜ฏๅบ“ใ€‚

ๅœจ TOML ๆ ผๅผ็š„ Lake ้…็ฝฎๆ–‡ไปถไธญ๏ผŒๅŒ…็บงๅญ—ๆฎต lintDriver ๆŒ‡ๅฎš lint ้ฉฑๅŠจ็จ‹ๅบ็›ฎๆ ‡็š„ๅ็งฐใ€‚

Lint Driver (lakefile.toml)

่ฟ™ไธชๆœ€ๅฐ็š„ lakefile.toml ้…็ฝฎไบ†ไธ€ไธช lint ้ฉฑๅŠจ็จ‹ๅบ๏ผš

name = "my-package"
lintDriver = "my-package-lint"

[[lean_exe]]
name = "my-package-lint"
root = "Lint"

ๅœจ lakefile.lean ไธญ๏ผŒๅœจ package ๅฃฐๆ˜ŽไธŠ่ฎพ็ฝฎ lintDriver ๅญ—ๆฎต๏ผŒๆˆ–่€…ไฝฟ็”จ lint_driver ๅฑžๆ€งๆ ‡่ฎฐ่„šๆœฌๆˆ–ๅฏๆ‰ง่กŒๆ–‡ไปถๅฃฐๆ˜Žใ€‚ ๅฑžๆ€งๅฝขๅผ้€šๅธธๅพˆๆ–นไพฟ๏ผŒๅ› ไธบๅฎƒๅฐ†ๆ ‡่ฎฐๆ”พ็ฝฎๅœจ็›ฎๆ ‡ๆ—่พนใ€‚

Lint Driver (lakefile.lean)
import Lake open Lake DSL package ยซmy-packageยป where lintDriver := "my-package-lint" lean_exe ยซmy-package-lintยป where root := `Lint

ๆฏไธชๅŒ…่ฃนๅช่ƒฝๆœ‰ไธ€ไปฝๅฃฐๆ˜Žๅธฆๆœ‰ lint_driver ๆ ‡็ญพใ€‚ ๅœจๅŒไธ€ Lake ้…็ฝฎๆ–‡ไปถไธญๅŒๆ—ถไฝฟ็”จ lint_driver ๅฑžๆ€งๅ’Œ้ž็ฉบ lintDriver ๅญ—ๆฎตๆ˜ฏ้”™่ฏฏ็š„ใ€‚

ๅฏไปฅไฝฟ็”จ็”จไบŽๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ็š„็›ธๅŒ <pkg>/<name> ่ฏญๆณ•ๆฅๅผ•็”จไพ่ต–้กนๅŒ…ไธญ็š„ lint ้ฉฑๅŠจ็จ‹ๅบใ€‚

lake lint ่ฟ่กŒ้…็ฝฎ็š„้ฉฑๅŠจ็จ‹ๅบ๏ผŒ้ฆ–ๅ…ˆไผ ้€’ lintDriverArgs๏ผŒ็„ถๅŽๅœจๅ‘ฝไปค่กŒไธŠไผ ้€’ -- ไน‹ๅŽ็š„ไปปไฝ•ๅ†…ๅฎน๏ผš

lake lint -- --warnings-as-errors

Lake ่ฟ˜ๅ…ทๆœ‰ๅ•็‹ฌ็š„ builtin linter๏ผŒๅฎƒ็›ดๆŽฅๅœจ Lean ๆจกๅ—ไธŠ่ฟ่กŒ๏ผŒ็‹ฌ็ซ‹ไบŽไปปไฝ•้…็ฝฎ็š„้ฉฑๅŠจ็จ‹ๅบใ€‚ ๅ†…็ฝฎ linting ้€š่ฟ‡ --builtin-lint ๅ’Œ็›ธๅ…ณๆ ‡ๅฟ—๏ผˆ่ฏทๅ‚้˜… lake lint๏ผ‰ๆˆ–้€š่ฟ‡ๅœจๅฐ่ฃ…้…็ฝฎไธญๅฐ† builtinLint ่ฎพ็ฝฎไธบ true ๆฅๅฏ็”จใ€‚ ๅฝ“ๅ†…็ฝฎ linting ๅค„ไบŽๆดปๅŠจ็Šถๆ€ๆ—ถ๏ผŒ-- ไน‹ๅ‰็š„ไฝ็ฝฎ MODULE ๅ‚ๆ•ฐ้€‰ๆ‹ฉ่ฆ lint ็š„ๆจกๅ—๏ผŒๅนถไธ”ๅฎƒไปฌไธไผšไผ ้€’ๅˆฐ้…็ฝฎ็š„้ฉฑๅŠจ็จ‹ๅบใ€‚ ๅ› ๆญค๏ผŒlake lint Mathlib ่งฆๅ‘ Mathlib ไธŠ็š„ๅ†…็ฝฎ linting๏ผŒ่€Œ lake lint -- Mathlib ๅฐ† Mathlib ไผ ้€’็ป™้ฉฑๅŠจ็จ‹ๅบใ€‚ ่ฟ™ไธค็งๆœบๅˆถๆ˜ฏ็‹ฌ็ซ‹็š„๏ผŒๅนถไธ”ๅฏไปฅไธ€่ตท่ฟ่กŒ๏ผšๅฝ“ไธค่€…้ƒฝๅบ”็”จๆ—ถ๏ผŒLake ้ฆ–ๅ…ˆ่ฟ่กŒๅ†…็ฝฎ linter๏ผŒ็„ถๅŽ่ฟ่กŒ้ฉฑๅŠจ็จ‹ๅบใ€‚

ๅฆ‚ๆžœไธบๆ นๅŒ…้…็ฝฎไบ† lint ้ฉฑๅŠจ็จ‹ๅบๆˆ–่€…ๅœจๅ…ถ้…็ฝฎไธญๅฐ† builtinLint ่ฎพ็ฝฎไธบ true๏ผŒๅˆ™ lake check-lint ๅฐ†ไปฅไปฃ็  0 ้€€ๅ‡บ๏ผˆๅณๆˆๅŠŸ๏ผ‰ใ€‚

24.1.1.6.ย GitHub ๅ‘ๅธƒ็‰ˆๆœฌ๐Ÿ”—

Lake ๆ”ฏๆŒๅ‘ GitHub ็‰ˆๆœฌ็š„ๅŒ…ไธŠไผ ๅ’Œไธ‹่ฝฝๆž„ๅปบๅทฅไปถ๏ผˆๅณๅญ˜ๆกฃ็š„ๆž„ๅปบ็›ฎๅฝ•๏ผ‰ใ€‚ ่ฟ™ไฝฟๅพ—ๆœ€็ปˆ็”จๆˆท่ƒฝๅคŸไปŽไบ‘ไธญ่Žทๅ–้ข„ๆž„ๅปบ็š„ๅทฅไปถ๏ผŒ่€Œๆ— ้œ€่‡ชๅทฑไปŽๆบ้‡ๅปบๅŒ…ใ€‚ LAKE_NO_CACHE ็Žฏๅขƒๅ˜้‡ๅฏ็”จไบŽ็ฆ็”จๆญคๅŠŸ่ƒฝใ€‚

24.1.1.6.1.ย ๆญฃๅœจไธ‹่ฝฝ๐Ÿ”—

่ฆไธ‹่ฝฝๅทฅไปถ๏ผŒๅบ”้…็ฝฎๅŒ…้€‰้กน releaseRepo ๅ’Œ buildArchive ไปฅๆŒ‡ๅ‘ๆ‰˜็ฎก่ฏฅ็‰ˆๆœฌ็š„ GitHub ๅญ˜ๅ‚จๅบ“ไปฅๅŠๅ…ถไธญ็š„ๆญฃ็กฎๅทฅไปถๅ็งฐ๏ผˆๅฆ‚ๆžœ้ป˜่ฎคๅ€ผไธๅคŸ๏ผ‰ใ€‚ ็„ถๅŽ๏ผŒ่ฎพ็ฝฎ preferReleaseBuild := true ไปฅๅ‘Š่ฏ‰ Lake ๅฐ†ๅ…ถไฝœไธบ้ขๅค–็š„ๅŒ…ไพ่ต–้กน่ฟ›่กŒ่Žทๅ–ๅ’Œ่งฃๅŒ…ใ€‚

ๅฆ‚ๆžœ้œ€่ฆๅฎƒ็š„ๅŒ…ๆ˜ฏไพ่ต–้กน๏ผŒLake ๅฐ†ไป…่Žทๅ–ๅ‘ๅธƒ็‰ˆๆœฌไฝœไธบๅ…ถๆ ‡ๅ‡†ๆž„ๅปบ่ฟ‡็จ‹็š„ไธ€้ƒจๅˆ†๏ผˆๅ› ไธบๆ นๅŒ…้ข„่ฎกไผš่ขซไฟฎๆ”น๏ผŒๅ› ๆญค้€šๅธธไธŽๆญคๆ–นๆกˆไธๅ…ผๅฎน๏ผ‰ใ€‚ ไฝ†ๆ˜ฏ๏ผŒๅฆ‚ๆžœๅธŒๆœ›่Žทๅ–ๆ นๅŒ…็š„็‰ˆๆœฌ๏ผˆไพ‹ๅฆ‚๏ผŒๅœจๅ…‹้š†็‰ˆๆœฌๆบไน‹ๅŽไฝ†ๅœจ็ผ–่พ‘ไน‹ๅ‰๏ผ‰๏ผŒๅฏไปฅ้€š่ฟ‡ lake build :release ๆ‰‹ๅŠจๆ‰ง่กŒๆญคๆ“ไฝœใ€‚

Lake ๅœจๅ†…้ƒจไฝฟ็”จ curl ไธ‹่ฝฝ็‰ˆๆœฌ๏ผŒๅนถไฝฟ็”จ tar ๅฏนๅ…ถ่ฟ›่กŒ่งฃๅŽ‹๏ผŒๅ› ๆญคๆœ€็ปˆ็”จๆˆทๅฟ…้กปๅฎ‰่ฃ…่ฟ™ไธคไธชๅทฅๅ…ทๆ‰่ƒฝไฝฟ็”จๆญคๅŠŸ่ƒฝใ€‚ ๅฆ‚ๆžœ Lake ็”ฑไบŽไปปไฝ•ๅŽŸๅ› ๆ— ๆณ•่Žทๅ–็‰ˆๆœฌ๏ผŒๅฎƒๅฐ†็ปง็ปญไปŽๆบๆž„ๅปบใ€‚ ๆญคๆœบๅˆถๅœจๆŠ€ๆœฏไธŠๅนถไธ้™ไบŽ GitHub๏ผšไปปไฝ•ไฝฟ็”จ็›ธๅŒ URL ๆ–นๆกˆ็š„ Git ไธปๆœบ้ƒฝๅฏไปฅๅทฅไฝœใ€‚

24.1.1.6.2.ย ไธŠไผ ไธญ๐Ÿ”—

่ฆๅฐ†ๆž„ๅปบ็š„ๅŒ…ไฝœไธบๅทฅไปถไธŠไผ ๅˆฐ GitHub ็‰ˆๆœฌ๏ผŒLake ๆไพ›ไบ† lake upload ๅ‘ฝไปคไฝœไธบๆ–นไพฟ็š„็ฎ€ๅ†™ใ€‚ ๆญคๅ‘ฝไปคไฝฟ็”จ tar ๅฐ†็จ‹ๅบๅŒ…็š„ๆž„ๅปบ็›ฎๅฝ•ๆ‰“ๅŒ…ๅˆฐๅญ˜ๆกฃไธญ๏ผŒๅนถไฝฟ็”จ gh release upload ๅฐ†ๅ…ถ้™„ๅŠ ๅˆฐๆŒ‡ๅฎšๆ ‡่ฎฐ็š„้ข„ๅ…ˆๅญ˜ๅœจ็š„ GitHub ็‰ˆๆœฌใ€‚ ๅ› ๆญค๏ผŒไธบไบ†ไฝฟ็”จๅฎƒ๏ผŒๅŒ…ไธŠไผ ็จ‹ๅบ๏ผˆ่€Œไธๆ˜ฏไธ‹่ฝฝ็จ‹ๅบ๏ผ‰้œ€่ฆๅฎ‰่ฃ… ghใ€GitHub CLI ๅนถไฝไบŽ PATH ไธญใ€‚

24.1.1.7.ย ๅทฅไปถ็ผ“ๅญ˜๐Ÿ”—

่ฟ™ๆ˜ฏไธ€้กนไปๅœจๅผ€ๅ‘ไธญ็š„ๅฎž้ชŒๆ€งๅŠŸ่ƒฝใ€‚

Lake ๆ”ฏๆŒ ๆœฌๅœฐๅทฅไปถ็ผ“ๅญ˜๏ผŒ็”จไบŽๅญ˜ๅ‚จๅ„ไธชๆž„ๅปบไบงๅ“๏ผŒ่ทŸ่ธชไบง็”Ÿๅฎƒไปฌ็š„ๅฎŒๆ•ด่พ“ๅ…ฅ้›†ใ€‚ ๆฏไธช ๅทฅๅ…ท้“พ ้ƒฝๆœ‰่‡ชๅทฑ็š„็ผ“ๅญ˜๏ผŒๅ› ไธบไธญ้—ดๆž„ๅปบไบงๅ“ๅœจๅทฅๅ…ท้“พ็‰ˆๆœฌไน‹้—ดไธๅ…ผๅฎนใ€‚ ไฝ†ๆ˜ฏ๏ผŒๅทฅๅ…ท้“พ็š„็ผ“ๅญ˜ๅœจไฝฟ็”จๅฎƒ็š„ๆ‰€ๆœ‰ๆœฌๅœฐ ๅทฅไฝœ็ฉบ้—ด ไน‹้—ดๅ…ฑไบซ๏ผŒๅ› ๆญคไธ้œ€่ฆ้‡ๅปบๅ…ฌๅ…ฑไพ่ต–้กนใ€‚ ๅฆ‚ๆžœๅ…ทๆœ‰็›ธๅŒๅทฅๅ…ท้“พ็š„ไธคไธช็‹ฌ็ซ‹ๅทฅไฝœๅŒบไพ่ต–ไบŽๅŒไธ€ไธชๅŒ…๏ผŒ้‚ฃไนˆๅฎƒไปฌๅฏไปฅๅ…ฑไบซๅฝผๆญค็š„ๆž„ๅปบไบงๅ“ใ€‚

็”ฑไบŽ่ฟ™ๆ˜ฏไธ€้กนๅฎž้ชŒๆ€งๅŠŸ่ƒฝ๏ผŒๅ› ๆญค้ป˜่ฎคๆƒ…ๅ†ตไธ‹็ฆ็”จๆœฌๅœฐ็ผ“ๅญ˜ใ€‚ ไป…ๅฝ“ LAKE_ARTIFACT_CACHE ็Žฏๅขƒๅ˜้‡่ฎพ็ฝฎไธบ true ๆˆ– ้…็ฝฎๆ–‡ไปถ ไธญ็š„ enableArtifactCache ๅญ—ๆฎต่ฎพ็ฝฎไธบ true ๆ—ถๆ‰ๅฏ็”จใ€‚

24.1.1.7.1.ย ่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜๐Ÿ”—

ๅฏไปฅไปŽ่ฟœ็จ‹็ผ“ๅญ˜ๆœๅŠกๅ™จๆฃ€็ดขๆž„ๅปบไบงๅ“ๅนถๅฐ†ๅ…ถๆ”พๅ…ฅๆœฌๅœฐ็ผ“ๅญ˜ไธญใ€‚ ่ฟ™ไฝฟๅพ—ๅฎŒๅ…จ้ฟๅ…ๆœฌๅœฐๆž„ๅปบๆˆไธบๅฏ่ƒฝใ€‚ lake cache get ๅ‘ฝไปค็”จไบŽๅฐ†ๅทฅไปถไธ‹่ฝฝๅˆฐๆœฌๅœฐ็ผ“ๅญ˜ไธญใ€‚

ไธŽ GitHub ๅ‘่กŒ็‰ˆๆœฌ็›ธๆฏ”๏ผŒ่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜ๆ›ดๅŠ ็ป†็ฒ’ๅบฆใ€‚ ๅฎƒๅœจๅ„ไธชๆบๆ–‡ไปถใ€.olean ๆ–‡ไปถ ๅ’Œ็›ฎๆ ‡ไปฃ็ ็บงๅˆซ๏ผˆ่€Œไธๆ˜ฏๆ•ดไธชๅŒ…็บงๅˆซ๏ผ‰่ทŸ่ธชๆž„ๅปบไบงๅ“ใ€‚

24.1.1.7.2.ย ๆ˜ ๅฐ„๐Ÿ”—

ๅฝ“ไผ ้€’ -o ้€‰้กนๆ—ถ๏ผŒlake build ่ทŸ่ธช็”จไบŽ็”Ÿๆˆๆฏไธชๆž„ๅปบไบงๅ“็š„่พ“ๅ…ฅใ€‚ ่ฟ™ไบ›ไปฅ JSON ่กŒๆ ผๅผๅญ˜ๅ‚จๅˆฐ mappings file ไธญ๏ผŒๅ…ถไธญๆ–‡ไปถ็š„ๆฏไธ€่กŒๅฟ…้กปๆ˜ฏๆœ‰ๆ•ˆ็š„ JSON ๅฏน่ฑกใ€‚ ๆ˜ ๅฐ„ๆ–‡ไปถ่ทŸ่ธชๅ•ไธชๆž„ๅปบ๏ผŒๅนถๅŒ…ๆ‹ฌๅทฅไฝœๅŒบ็š„ ๆ นๅŒ… ็š„ๆ‰€ๆœ‰ไธญ้—ดๅ’Œๆœ€็ปˆๆž„ๅปบไบงๅ“๏ผŒไฝ†ไธๅŒ…ๆ‹ฌๅ…ถไพ่ต–้กนใ€‚ ่ฟ™ๅŒ…ๆ‹ฌๅทฒ็ปๆ˜ฏๆœ€ๆ–ฐไธ”ๆœช้‡ๆ–ฐ็”Ÿๆˆ็š„ๆž„ๅปบไบงๅ“ใ€‚ lake cache put ๅ‘ฝไปคๅฐ†ๆ˜ ๅฐ„ๆ–‡ไปถไธญ็š„ๆž„ๅปบไบงๅ“ไปŽๆœฌๅœฐ็ผ“ๅญ˜ไธŠไผ ๅˆฐ่ฟœ็จ‹็ผ“ๅญ˜ใ€‚

24.1.1.7.3.ย ้…็ฝฎ๐Ÿ”—

่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜ๆ˜ฏไฝฟ็”จไปฅไธ‹็Žฏๅขƒๅ˜้‡้…็ฝฎ็š„๏ผš

24.1.2.ย ๅ‘ฝไปค่กŒ็•Œ้ข๐Ÿ”—

Lake ็š„ๅ‘ฝไปค่กŒ็•Œ้ข็”ฑไธ€็ณปๅˆ—ๅญๅ‘ฝไปค็ป„ๆˆใ€‚ ๆ‰€ๆœ‰ๅญๅ‘ฝไปค้ƒฝๅ…ทๆœ‰้€š่ฟ‡ๆŸไบ›็Žฏๅขƒๅ˜้‡ๅ’Œๅ…จๅฑ€ๅ‘ฝไปค่กŒ้€‰้กน่ฟ›่กŒ้…็ฝฎ็š„่ƒฝๅŠ›ใ€‚ ๆฏไธชๅญๅ‘ฝไปค้ƒฝๅบ”่ฏฅ่ขซ็†่งฃไธบไธ€ไธช็‹ฌ็ซ‹็š„ๅฎž็”จ็จ‹ๅบ๏ผŒๅ…ทๆœ‰่‡ชๅทฑๆ‰€้œ€็š„ๅ‚ๆ•ฐ่ฏญๆณ•ๅ’Œๆ–‡ๆกฃใ€‚

Lake ็š„ๆŸไบ›ๅ‘ฝไปคๅง”ๆ‰˜็ป™ Lean ๅ‘่กŒ็‰ˆไธญๆœชๅŒ…ๅซ็š„ๅ…ถไป–ๅ‘ฝไปค่กŒๅฎž็”จ็จ‹ๅบใ€‚ ่ฟ™ไบ›ๅฎž็”จ็จ‹ๅบๅฟ…้กปๅœจ PATH ไธŠๅฏ็”จๆ‰่ƒฝไฝฟ็”จ็›ธๅบ”็š„ๅŠŸ่ƒฝ๏ผš

  • ้œ€่ฆ git ๆ‰่ƒฝ่ฎฟ้—ฎ Git ไพ่ต–้กนใ€‚

  • ๅˆ›ๅปบๆˆ–ๆๅ–ไบ‘ๆž„ๅปบๆกฃๆกˆ้œ€่ฆ tar๏ผŒๅนถไธ”้œ€่ฆ curl ๆฅ่Žทๅ–ๅฎƒไปฌใ€‚

  • ้œ€่ฆ gh ๆ‰่ƒฝๅฐ†ๆž„ๅปบๅทฅไปถไธŠไผ ๅˆฐ GitHub ็‰ˆๆœฌใ€‚

Lean ๅ‘่กŒ็‰ˆๅŒ…ๆ‹ฌ C ็ผ–่ฏ‘ๅ™จๅทฅๅ…ท้“พใ€‚

24.1.2.1.ย ็Žฏๅขƒๅ˜้‡๐Ÿ”—

ๅฝ“่ฐƒ็”จLean็ผ–่ฏ‘ๅ™จๆˆ–ๅ…ถไป–ๅทฅๅ…ทๆ—ถ๏ผŒLake่ฎพ็ฝฎๆˆ–ไฟฎๆ”นๅคšไธช็Žฏๅขƒๅ˜้‡ใ€‚ ่ฟ™ไบ›ๅ€ผๅ–ๅ†ณไบŽ็ณป็ปŸใ€‚ ๅœจไธๅธฆไปปไฝ•ๅ‚ๆ•ฐ็š„ๆƒ…ๅ†ตไธ‹่ฐƒ็”จ lake env ไผšๆ˜พ็คบ็Žฏๅขƒๅ˜้‡ๅŠๅ…ถๅ€ผใ€‚ ๅฆๅˆ™๏ผŒๅฐ†ๅœจ Lake ็š„็Žฏๅขƒไธญ่ฐƒ็”จๆ‰€ๆไพ›็š„ๅ‘ฝไปคใ€‚

่ฎพ็ฝฎไปฅไธ‹ๅ˜้‡๏ผŒ่ฆ†็›–ไปฅๅ‰็š„ๅ€ผ๏ผš

LAKE

ๆฃ€ๆต‹ๅˆฐ็š„ Lake ๅฏๆ‰ง่กŒๆ–‡ไปถ

LAKE_HOME

ๆฃ€ๆต‹ๅˆฐLake้ฆ–้กต

LEAN_SYSROOT

ๆฃ€ๆต‹ๅˆฐLean toolchain็›ฎๅฝ•

LEAN_AR

ๆฃ€ๆต‹ๅˆฐ Lean ar ไบŒ่ฟ›ๅˆถ

LEAN_CC

ๆฃ€ๆต‹ๅˆฐ็š„ C ็ผ–่ฏ‘ๅ™จ๏ผˆๅฆ‚ๆžœไธไฝฟ็”จๆ†็ป‘็š„็ผ–่ฏ‘ๅ™จ๏ผ‰

ไปฅไธ‹ๅ˜้‡ๅขžๅŠ ไบ†้™„ๅŠ ไฟกๆฏ๏ผš

LEAN_PATH

ๆทปๅŠ  Lake ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ Lean ๅบ“็›ฎๅฝ•ใ€‚

LEAN_SRC_PATH

ๆทปๅŠ ไบ† Lake ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ ๆบ็›ฎๅฝ•ใ€‚

PATH

ๆทปๅŠ  Leanใ€Lake ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ ไบŒ่ฟ›ๅˆถ็›ฎๅฝ•ใ€‚ ๅœจ Windows ไธŠ๏ผŒ่ฟ˜ๆทปๅŠ ไบ† Lean ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ ๅบ“็›ฎๅฝ•ใ€‚

DYLD_LIBRARY_PATH

ๅœจ macOS ไธŠ๏ผŒๆทปๅŠ  Lean ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ ๅบ“็›ฎๅฝ•ใ€‚

LD_LIBRARY_PATH

ๅœจ Windows ๅ’Œ macOS ไปฅๅค–็š„ๅนณๅฐไธŠ๏ผŒๆทปๅŠ  Lean ๅ’Œ ๅทฅไฝœ็ฉบ้—ด ็š„ ๅบ“็›ฎๅฝ•ใ€‚

Lakeๆœฌ่บซๅฏไปฅ้…็ฝฎไปฅไธ‹็Žฏๅขƒๅ˜้‡๏ผš

ELAN_HOME

Elan ๅฎ‰่ฃ…็š„ไฝ็ฝฎ๏ผŒ็”จไบŽ ่‡ชๅŠจๅทฅๅ…ท้“พๆ›ดๆ–ฐใ€‚

ELAN

elan ไบŒ่ฟ›ๅˆถๆ–‡ไปถ็š„ไฝ็ฝฎ๏ผŒ็”จไบŽ ่‡ชๅŠจๅทฅๅ…ท้“พๆ›ดๆ–ฐใ€‚ ๅฆ‚ๆžœๆœช่ฎพ็ฝฎ๏ผŒๅˆ™ elan ๅฟ…้กปๅญ˜ๅœจไบŽ PATH ไธŠใ€‚

LAKE_HOME

Lake ๅฎ‰่ฃ…็š„ไฝ็ฝฎใ€‚ ไป…ๅฝ“ Lake ๆ— ๆณ•ไปŽๅฝ“ๅ‰่ฟ่กŒ็š„ lake ๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ไฝ็ฝฎ็กฎๅฎšๅ…ถๅฎ‰่ฃ…่ทฏๅพ„ๆ—ถ๏ผŒๆ‰ไผšๅ‚่€ƒๆญค็Žฏๅขƒๅ˜้‡ใ€‚

LEAN_SYSROOT

Lean ๅฎ‰่ฃ…็š„ไฝ็ฝฎ๏ผŒ็”จไบŽๆŸฅๆ‰พ Lean ็ผ–่ฏ‘ๅ™จใ€ๆ ‡ๅ‡†ๅบ“ๅ’Œๅ…ถไป–ๆ†็ป‘ๅทฅๅ…ทใ€‚ Lake ้ฆ–ๅ…ˆๆฃ€ๆŸฅๅ…ถไบŒ่ฟ›ๅˆถๆ–‡ไปถๆ˜ฏๅฆไธŽ Lean ๅฎ‰่ฃ…ไฝไบŽๅŒไธ€ไฝ็ฝฎ๏ผŒๅฆ‚ๆžœๆ˜ฏ๏ผŒๅˆ™ไฝฟ็”จ่ฏฅๅฎ‰่ฃ…ใ€‚ ๅฆ‚ๆžœไธๆ˜ฏ๏ผŒๆˆ–่€…ๅฆ‚ๆžœ LAKE_OVERRIDE_LEAN ไธบ็œŸ๏ผŒๅˆ™ Lake ๆŸฅ้˜… LEAN_SYSROOTใ€‚ ๅฆ‚ๆžœๆœช่ฎพ็ฝฎ๏ผŒLake ๅฐ†ๆŸฅ้˜… LEAN ็Žฏๅขƒๅ˜้‡ๆฅๆŸฅๆ‰พ Lean ็ผ–่ฏ‘ๅ™จ๏ผŒๅนถๅฐ่ฏ•ๆŸฅๆ‰พไธŽ็ผ–่ฏ‘ๅ™จ็›ธๅ…ณ็š„ Lean ๅฎ‰่ฃ…ใ€‚ ๅฆ‚ๆžœ LEAN ่ฎพ็ฝฎไฝ†ไธบ็ฉบ๏ผŒๅˆ™ Lake ่ฎคไธบ Lean ๅทฒ็ฆ็”จใ€‚ ๅฆ‚ๆžœๆœช่ฎพ็ฝฎ LEAN_SYSROOT ๅ’Œ LEAN๏ผŒๅˆ™ไฝฟ็”จ PATH ไธŠ็ฌฌไธ€ๆฌกๅ‡บ็Žฐ็š„ lean ๆฅๆŸฅๆ‰พๅฎ‰่ฃ…ใ€‚

LEAN_CC ๅ’Œ LEAN_AR

ๅฆ‚ๆžœ่ฎพ็ฝฎไบ† LEAN_CC ๅ’Œ/ๆˆ– LEAN_AR๏ผŒๅˆ™ๅœจๆž„ๅปบๅบ“ๆ—ถ๏ผŒๅ…ถๅ€ผๅฐ†็”จไฝœ C ็ผ–่ฏ‘ๅ™จๆˆ– ar ๅ‘ฝไปคใ€‚ ๅฆ‚ๆžœๆฒกๆœ‰๏ผŒLake ๅฐ†ๅ›ž้€€ๅˆฐ Lean ๅฎ‰่ฃ…ไธญ็š„ๆ†็ป‘ๅทฅๅ…ทใ€‚ ๅฆ‚ๆžœๆœชๆ‰พๅˆฐๆ†็ป‘ๅทฅๅ…ท๏ผŒๅˆ™ไฝฟ็”จ CC ๆˆ– AR ็š„ๅ€ผ๏ผŒๅŽ่ทŸ PATH ไธŠ็š„ cc ๆˆ– arใ€‚

LAKE_NO_CACHE

ๅฆ‚ๆžœไธบ true๏ผŒๅˆ™ Lake ไธไฝฟ็”จ Reservoir ๆˆ– GitHub ็š„็ผ“ๅญ˜็‰ˆๆœฌใ€‚ ๅฏไปฅไฝฟ็”จ --try-cache ๅ‘ฝไปค่กŒ้€‰้กน่ฆ†็›–ๆญค็Žฏๅขƒๅ˜้‡ใ€‚

LAKE_ARTIFACT_CACHE

ๅฆ‚ๆžœไธบ true๏ผŒๅˆ™ Lake ไฝฟ็”จๅทฅไปถ็ผ“ๅญ˜ใ€‚ ่ฟ™ๆ˜ฏไธ€ไธชๅฎž้ชŒๆ€งๅŠŸ่ƒฝใ€‚

LAKE_CACHE_KEY

ๅฎšไน‰ ่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜ ็š„่บซไปฝ้ชŒ่ฏๅฏ†้’ฅใ€‚

LAKE_CACHE_ARTIFACT_ENDPOINT

็”จไบŽๅทฅไปถไธŠไผ ็š„ ่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜ ็š„ๅŸบๆœฌ URLใ€‚ ๅฆ‚ๆžœ่ฎพ็ฝฎ๏ผŒๅˆ™่ฟ˜ๅฟ…้กป่ฎพ็ฝฎ LAKE_CACHE_REVISION_ENDPOINTใ€‚ ๅฆ‚ๆžœไธค่€…ๅ‡ๆœช่ฎพ็ฝฎ๏ผŒLake ๅฐ†ไฝฟ็”จ Reservoir ไปฃๆ›ฟใ€‚

LAKE_CACHE_REVISION_ENDPOINT

่ฟœ็จ‹ๅทฅไปถ็ผ“ๅญ˜็š„ๅŸบๆœฌ URL๏ผŒ็”จไบŽไธŠไผ ๆฏไธชๅทฅไปถ็š„ ่พ“ๅ…ฅ/่พ“ๅ‡บๆ˜ ๅฐ„ใ€‚ ๅฆ‚ๆžœ่ฎพ็ฝฎ๏ผŒๅˆ™่ฟ˜ๅฟ…้กป่ฎพ็ฝฎ LAKE_CACHE_ARTIFACT_ENDPOINTใ€‚ ๅฆ‚ๆžœไธค่€…ๅ‡ๆœช่ฎพ็ฝฎ๏ผŒLake ๅฐ†ไฝฟ็”จ Reservoir ไปฃๆ›ฟใ€‚

ๅฝ“็Žฏๅขƒๅ˜้‡็š„ๅ€ผไธบ yใ€yesใ€tใ€trueใ€on ๆˆ– 1๏ผˆไธๅŒบๅˆ†ๅคงๅฐๅ†™๏ผ‰ๆ—ถ๏ผŒLake ่ฎคไธบ็Žฏๅขƒๅ˜้‡ไธบ trueใ€‚ ๅฝ“ๅ˜้‡็š„ๅ€ผไธบ nใ€noใ€fใ€falseใ€off ๆˆ– 0๏ผˆไธๅŒบๅˆ†ๅคงๅฐๅ†™๏ผ‰ๆ—ถ๏ผŒๅฎƒ่ฎคไธบๅ˜้‡ไธบ falseใ€‚ ๅฆ‚ๆžœๅ˜้‡ๆœช่ฎพ็ฝฎ๏ผŒๆˆ–ๅ…ถๅ€ผๆ—ขไธๆ˜ฏ true ไนŸไธๆ˜ฏ false๏ผŒๅˆ™ไฝฟ็”จ้ป˜่ฎคๅ€ผใ€‚

24.1.2.2.ย ้€‰้กน๐Ÿ”—

Lake ็š„ๅ‘ฝไปค่กŒ็•Œ้ขๆไพ›ไบ†่ฎธๅคšๅ…จๅฑ€้€‰้กนไปฅๅŠๆ‰ง่กŒ้‡่ฆไปปๅŠก็š„ๅญๅ‘ฝไปคใ€‚ ๅ•ๅญ—็ฌฆๆ ‡ๅฟ—ไธ่ƒฝ็ป„ๅˆ๏ผ› -HR ไธ็ญ‰ๅŒไบŽ -H -Rใ€‚

--version

Lake ่พ“ๅ‡บๅ…ถ็‰ˆๆœฌๅนถ้€€ๅ‡บ๏ผŒไธๆ‰ง่กŒไปปไฝ•ๅ…ถไป–ๆ“ไฝœใ€‚

--help ๆˆ– -h

Lake ่พ“ๅ‡บๅ…ถ็‰ˆๆœฌไปฅๅŠไฝฟ็”จไฟกๆฏๅนถ้€€ๅ‡บ่€Œไธๆ‰ง่กŒไปปไฝ•ๅ…ถไป–ๆ“ไฝœใ€‚ ๅญๅ‘ฝไปคๅฏไปฅไธŽ --help ไธ€่ตทไฝฟ็”จ๏ผŒๅœจ่ฟ™็งๆƒ…ๅ†ตไธ‹๏ผŒไผš่พ“ๅ‡บๅญๅ‘ฝไปค็š„ไฝฟ็”จไฟกๆฏใ€‚

--dir=DIR ๆˆ– -d=DIR

ไฝฟ็”จๆไพ›็š„็›ฎๅฝ•ไฝœไธบๅŒ…็š„ไฝ็ฝฎ๏ผŒ่€Œไธๆ˜ฏๅฝ“ๅ‰ๅทฅไฝœ็›ฎๅฝ•ใ€‚ ่ฟ™ๅนถไธๆ€ปๆ˜ฏ็ญ‰ๅŒไบŽ้ฆ–ๅ…ˆๆ›ดๆ”น็›ฎๅฝ•๏ผŒๅ› ไธบๅฐ†ไฝฟ็”จๅฝ“ๅ‰็›ฎๅฝ•็š„ ๅทฅๅ…ท้“พๆ–‡ไปถ ๆŒ‡็คบ็š„ lake ็‰ˆๆœฌ๏ผŒ่€Œไธๆ˜ฏ DIR ็š„็‰ˆๆœฌใ€‚

--file=FILE ๆˆ– -f=FILE

ไฝฟ็”จๆŒ‡ๅฎš็š„ ๅŒ…้…็ฝฎ ๆ–‡ไปถ่€Œไธๆ˜ฏ้ป˜่ฎคๆ–‡ไปถใ€‚

--old

ไป…้‡ๅปบไฟฎๆ”น่ฟ‡็š„ๆจกๅ—๏ผŒๅฟฝ็•ฅไผ ้€’ไพ่ต–ใ€‚ ๅฏผๅ…ฅไฟฎๆ”นๅŽ็š„ๆจกๅ—็š„ๆจกๅ—ๅฐ†ไธไผš่ขซ้‡ๅปบใ€‚ ไธบไบ†ๅฎž็Žฐ่ฟ™ไธ€็‚น๏ผŒไฝฟ็”จๆ–‡ไปถไฟฎๆ”นๆ—ถ้—ด่€Œไธๆ˜ฏๅ“ˆๅธŒๅ€ผๆฅ็กฎๅฎšๆจกๅ—ๆ˜ฏๅฆๅทฒๆ›ดๆ”นใ€‚

--rehash ๆˆ– -H

ๅฟฝ็•ฅ็ผ“ๅญ˜็š„ๆ–‡ไปถๅ“ˆๅธŒๅ€ผ๏ผŒ้‡ๆ–ฐ่ฎก็ฎ—ๅฎƒไปฌใ€‚ Lake ไฝฟ็”จไพ่ต–้กน็š„ๅ“ˆๅธŒๆฅ็กฎๅฎšๆ˜ฏๅฆ้‡ๅปบๅทฅไปถใ€‚ ๆฏๅฝ“ๆž„ๅปบๆจกๅ—ๆ—ถ๏ผŒ่ฟ™ไบ›ๅ“ˆๅธŒๅ€ผ้ƒฝไผš็ผ“ๅญ˜ๅœจ็ฃ็›˜ไธŠใ€‚ ไธบไบ†่Š‚็œๆž„ๅปบๆœŸ้—ด็š„ๆ—ถ้—ด๏ผŒ้™ค้žๆŒ‡ๅฎšไบ† --rehash๏ผŒๅฆๅˆ™ๅฐ†ไฝฟ็”จ่ฟ™ไบ›็ผ“ๅญ˜็š„ๅ“ˆๅธŒๅ€ผ่€Œไธๆ˜ฏ้‡ๆ–ฐ่ฎก็ฎ—ๆฏไธชๅ“ˆๅธŒๅ€ผใ€‚

--allow-empty

ๆŽฅๅ—ๅœจๆœช้…็ฝฎ ้ป˜่ฎค็›ฎๆ ‡ ๆ—ถไธไบง็”Ÿ่พ“ๅ‡บ็š„ๆž„ๅปบใ€‚

--update

ๅœจๅŠ ่ฝฝ ๅŒ…้…็ฝฎ ไน‹ๅŽไฝ†ๅœจๆ‰ง่กŒๅ…ถไป–ไปปๅŠก๏ผˆไพ‹ๅฆ‚ๆž„ๅปบ๏ผ‰ไน‹ๅ‰ๆ›ดๆ–ฐไพ่ต–้กนใ€‚ ่ฟ™็›ธๅฝ“ไบŽๅœจๆ‰€้€‰ๅ‘ฝไปคไน‹ๅ‰่ฟ่กŒ lake update๏ผŒไฝ†็”ฑไบŽไธๅฟ…ๅŠ ่ฝฝ้…็ฝฎไธคๆฌก๏ผŒๅ› ๆญคๅฏ่ƒฝไผšๆ›ดๅฟซใ€‚

--packages=FILE

ไฝฟ็”จๆŒ‡ๅฎš็š„ ๅŒ…่ฆ†็›– ๆ–‡ไปถใ€‚ ๅฏไปฅๅคšๆฌกๆŒ‡ๅฎšไปฅๆทปๅŠ ๆ›ดๅคš่ฆ†็›–๏ผˆไปฅๅŽ็š„่ฆ†็›–ไผ˜ๅ…ˆ๏ผ‰ใ€‚ ๅฎŒๆ•ด็š„ๅŒ…่ฆ†็›–้›†่ฟ˜ๅฐ†ๅŒ…ๆ‹ฌๆฅ่‡ช .lake/package-overrides.json ็š„ๅŒ…่ฆ†็›–๏ผˆๅฆ‚ๆžœๆœ‰๏ผ‰ใ€‚ ไฝ†ๆ˜ฏ๏ผŒๆญค้€‰้กนๆไพ›็š„้€‰้กนไผ˜ๅ…ˆใ€‚

--reconfigure ๆˆ– -R

้€šๅธธ๏ผŒ้ฆ–ๆฌก้…็ฝฎๅŒ…ๆ—ถ๏ผŒๅŒ…้…็ฝฎ ๆ–‡ไปถไธบ ่ฏฆ็ป†๏ผŒ็ป“ๆžœ็ผ“ๅญ˜ๅˆฐ .olean ๆ–‡ไปถ๏ผŒ็”จไบŽๅฐ†ๆฅ็š„่ฐƒ็”จ๏ผŒ็›ดๅˆฐๅŒ…้…็ฝฎไธบๆญข ๆไพ›ๆญคๆ ‡ๅฟ—ไผšๅฏผ่‡ด้‡ๆ–ฐ่ฏฆ็ป†่ฏดๆ˜Ž้…็ฝฎๆ–‡ไปถใ€‚

--keep-toolchain

้ป˜่ฎคๆƒ…ๅ†ตไธ‹๏ผŒLake ๅฐ่ฏ•ๆ›ดๆ–ฐๆœฌๅœฐ ๅทฅไฝœ็ฉบ้—ด ็š„ ๅทฅๅ…ท้“พๆ–‡ไปถใ€‚ ๆไพ›ๆญคๆ ‡ๅฟ—ไผš็ฆ็”จ ่‡ชๅŠจๅทฅๅ…ท้“พๆ›ดๆ–ฐใ€‚

--no-build

ๅฆ‚ๆžœๆž„ๅปบ็›ฎๆ ‡ไธๆ˜ฏๆœ€ๆ–ฐ็š„๏ผŒLake ไผš็ซ‹ๅณ้€€ๅ‡บ๏ผŒๅนถ่ฟ”ๅ›ž้ž้›ถ้€€ๅ‡บไปฃ็ ใ€‚

--no-cache

ไธ่ฆไฝฟ็”จๅฏ็”จ็š„ไบ‘ๆž„ๅปบ็ผ“ๅญ˜๏ผŒ่€Œๆ˜ฏๅœจๆœฌๅœฐๆž„ๅปบๆ‰€ๆœ‰ๅŒ…ใ€‚ ไธไธ‹่ฝฝๆž„ๅปบ็ผ“ๅญ˜ใ€‚

--try-cache

ๅฐ่ฏ•ไธ‹่ฝฝๆ”ฏๆŒ็š„ๅŒ…็š„ๆž„ๅปบ็ผ“ๅญ˜

24.1.2.3.ย ๆŽงๅˆถ่พ“ๅ‡บ๐Ÿ”—

่ฟ™ไบ›้€‰้กนๅ…่ฎธๆŽงๅˆถๆž„ๅปบๆ—ถ็”Ÿๆˆ็š„ logใ€‚ ้™คไบ†ๆ˜พ็คบๆˆ–้š่—ๆถˆๆฏไน‹ๅค–๏ผŒๅฝ“ๅ‘ๅ‡บ่ญฆๅ‘Š็”š่‡ณไฟกๆฏๆ—ถ๏ผŒๆž„ๅปบไนŸๅฏ่ƒฝๅคฑ่ดฅ๏ผ›่ฟ™ๅฏ็”จไบŽๅผบๅˆถๆ‰ง่กŒไธๅ…่ฎธๅœจๆž„ๅปบๆœŸ้—ด่พ“ๅ‡บ็š„ๆ ทๅผๆŒ‡ๅ—ใ€‚

--quietใ€-q

้š่—ไฟกๆฏๆ—ฅๅฟ—ๅ’Œ่ฟ›ๅบฆๆŒ‡็คบๅ™จใ€‚

--verboseใ€-v

ๆ˜พ็คบ่ทŸ่ธชๆ—ฅๅฟ—๏ผˆ้€šๅธธๆ˜ฏๅ‘ฝไปค่ฐƒ็”จ๏ผ‰ๅ’Œๆž„ๅปบ็š„ ็›ฎๆ ‡ใ€‚

--ansiใ€--no-ansi

ๅฏ็”จๆˆ–็ฆ็”จไฝฟ็”จ ANSI ่ฝฌไน‰็  ๅ‘ Lake ็š„่พ“ๅ‡บๆทปๅŠ ้ขœ่‰ฒๅ’ŒๅŠจ็”ปใ€‚

--log-level=LV

่ฎพ็ฝฎๆž„ๅปบๆˆๅŠŸๆ—ถๆ˜พ็คบ็š„ logs ็š„ๆœ€ไฝŽ็บงๅˆซใ€‚ LV ๅฏ่ƒฝๆ˜ฏ traceใ€infoใ€warning ๆˆ– error๏ผˆไธๅŒบๅˆ†ๅคงๅฐๅ†™๏ผ‰ใ€‚ ๅฝ“ๆž„ๅปบๅคฑ่ดฅๆ—ถ๏ผŒไผšๆ˜พ็คบๆ‰€ๆœ‰็บงๅˆซใ€‚ ้ป˜่ฎคๆ—ฅๅฟ—็บงๅˆซไธบ infoใ€‚

--fail-level=LV

่ฎพ็ฝฎ log ไธญ็š„ๆถˆๆฏๅฏผ่‡ดๆž„ๅปบ่ขซ่ง†ไธบๅคฑ่ดฅ็š„้˜ˆๅ€ผใ€‚ ๅฆ‚ๆžœๅ‘ๆ—ฅๅฟ—ๅ‘ๅ‡บ็š„ๆถˆๆฏ็š„็บงๅˆซๅคงไบŽๆˆ–็ญ‰ไบŽ้˜ˆๅ€ผ๏ผŒๅˆ™ๆž„ๅปบๅคฑ่ดฅใ€‚ LV ๅฏ่ƒฝๆ˜ฏ traceใ€infoใ€warning ๆˆ– error๏ผˆไธๅŒบๅˆ†ๅคงๅฐๅ†™๏ผ‰๏ผ›้ป˜่ฎคไธบerrorใ€‚

--iofail

ๅฆ‚ๆžœ่ฎฐๅฝ•ไปปไฝ• I/O ๆˆ–ๅ…ถไป–ไฟกๆฏ๏ผŒๅˆ™ไผšๅฏผ่‡ดๆž„ๅปบๅคฑ่ดฅใ€‚ ่ฟ™็›ธๅฝ“ไบŽ --fail-level=infoใ€‚

--wfail

ๅฆ‚ๆžœ่ฎฐๅฝ•ไปปไฝ•่ญฆๅ‘Š๏ผŒๅˆ™ไผšๅฏผ่‡ดๆž„ๅปบๅคฑ่ดฅใ€‚ ่ฟ™็›ธๅฝ“ไบŽ --fail-level=warningใ€‚

24.1.2.4.ย ่‡ชๅŠจๅทฅๅ…ท้“พๆ›ดๆ–ฐ๐Ÿ”—

lake update ๅ‘ฝไปคๆฃ€ๆŸฅไพ่ต–้กน็š„ๆ›ดๆ”น๏ผŒ่Žทๅ–ๅ…ถๆบๅนถ็›ธๅบ”ๅœฐๆ›ดๆ–ฐ manifestใ€‚ ้ป˜่ฎคๆƒ…ๅ†ตไธ‹๏ผŒๅฝ“ๆ–ฐ็‰ˆๆœฌ็š„ไพ่ต–้กนๆŒ‡ๅฎšๆ›ดๆ–ฐ็š„ๅทฅๅ…ท้“พๆ—ถ๏ผŒlake update ่ฟ˜ไผšๅฐ่ฏ•ๆ›ดๆ–ฐ ๆ นๅŒ… ็š„ ๅทฅๅ…ท้“พๆ–‡ไปถใ€‚ ๅฏไปฅไฝฟ็”จ --keep-toolchain ๆ ‡ๅฟ—็ฆ็”จๆญค่กŒไธบใ€‚

ๅฆ‚ๆžœๅคšไธชไพ่ต–้กนๆŒ‡ๅฎš่พƒๆ–ฐ็š„ๅทฅๅ…ท้“พ๏ผŒLake ๅฐ†้€‰ๆ‹ฉๆœ€ๆ–ฐ็š„ๅ…ผๅฎนๅทฅๅ…ท้“พ๏ผˆๅฆ‚ๆžœๅญ˜ๅœจ๏ผ‰ใ€‚ ไธบไบ†็กฎๅฎšๆœ€ๆ–ฐ็š„ๅ…ผๅฎนๅทฅๅ…ท้“พ๏ผŒLake ๅฐ†ๅŒ…็š„ lean-toolchain ๆ–‡ไปถไธญๅˆ—ๅ‡บ็š„ๅทฅๅ…ท้“พ่งฃๆžไธบๅ››็ฑป๏ผš

  • ็‰ˆๆœฌ๏ผŒๆŒ‰็‰ˆๆœฌๅท่ฟ›่กŒๆฏ”่พƒ๏ผˆไพ‹ๅฆ‚๏ผŒv4.4.0 < v4.8.0 ๅ’Œ v4.6.0-rc1 < v4.6.0๏ผ‰

  • ๆฏๆ™šๆž„ๅปบ๏ผŒๆŒ‰ๆ—ฅๆœŸ่ฟ›่กŒๆฏ”่พƒ๏ผˆไพ‹ๅฆ‚๏ผŒnightly-2024-01-10 < nightly-2024-10-01๏ผ‰

  • ๆ นๆฎๅฏน Lean ็ผ–่ฏ‘ๅ™จ็š„ๆ‹‰ๅ–่ฏทๆฑ‚่ฟ›่กŒๆž„ๅปบ๏ผŒ่ฟ™ๆ˜ฏๆ— ไธŽไผฆๆฏ”็š„

  • ๅ…ถไป–็‰ˆๆœฌ๏ผŒไนŸๆ˜ฏๆ— ๆณ•ๆฏ”ๆ‹Ÿ็š„

ๅคšไธช็ฑปๅˆซ็š„ๅทฅๅ…ท้“พ็‰ˆๆœฌๆ˜ฏๆ— ๆณ•ๆฏ”่พƒ็š„ใ€‚ ๅฆ‚ๆžœๆฒกๆœ‰ๆœ€ๆ–ฐ็š„ๅทฅๅ…ท้“พ๏ผŒLake ๅฐ†ๆ‰“ๅฐ่ญฆๅ‘Šๅนถ็ปง็ปญๆ›ดๆ–ฐ่€Œไธๆ›ดๆ”นๅทฅๅ…ท้“พใ€‚

ๅฆ‚ๆžœ Lake ็กฎๅฎžๆ‰พๅˆฐๆ–ฐๅทฅๅ…ท้“พ๏ผŒๅˆ™ไผš็›ธๅบ”ๆ›ดๆ–ฐ ๅทฅไฝœ็ฉบ้—ด ็š„ lean-toolchain ๆ–‡ไปถ๏ผŒๅนถไฝฟ็”จๆ–ฐๅทฅๅ…ท้“พ็š„ Lake ้‡ๆ–ฐๅฏโ€‹โ€‹ๅŠจ lake updateใ€‚ ๅฆ‚ๆžœๆฃ€ๆต‹ๅˆฐ Elan๏ผŒๅฎƒๅฐ†้€š่ฟ‡ elan run ็”Ÿๆˆๆ–ฐ็š„ Lake ่ฟ›็จ‹๏ผŒๅ…ถๅ‚ๆ•ฐไธŽๆœ€ๅˆ่ฟ่กŒ Lake ๆ—ถไฝฟ็”จ็š„ๅ‚ๆ•ฐ็›ธๅŒใ€‚ ๅฆ‚ๆžœElan็ผบๅคฑ๏ผŒไผšๆ็คบ็”จๆˆทๆ‰‹ๅŠจ้‡ๅฏLake๏ผŒๅนถ้€€ๅ‡บๅนถ่ฟ”ๅ›ž็‰นๆฎŠ้”™่ฏฏไปฃ็ ๏ผˆๅณ4๏ผ‰ใ€‚ Lake ไฝฟ็”จ็š„ Elan ๅฏๆ‰ง่กŒๆ–‡ไปถๅฏไปฅไฝฟ็”จ ELAN ็Žฏๅขƒๅ˜้‡่ฟ›่กŒ้…็ฝฎใ€‚

24.1.2.5.ย ๅˆ›ๅปบๅŒ…๐Ÿ”—

๐Ÿ”—Lake command
lake new name [template][.language]

่ฟ่กŒ lake new ไผšๅœจๆ–ฐ็›ฎๅฝ•ไธญๅˆ›ๅปบๅˆๅง‹ Lean ๅŒ…ใ€‚ ่ฏฅๅ‘ฝไปค็›ธๅฝ“ไบŽๅˆ›ๅปบไธ€ไธชๅไธบ name ็š„็›ฎๅฝ•๏ผŒ็„ถๅŽ่ฟ่กŒ lake init

๐Ÿ”—Lake command
lake init name [template][.language]

่ฟ่กŒ lake init ไผšๅœจๅฝ“ๅ‰็›ฎๅฝ•ไธญๅˆ›ๅปบๅˆๅง‹ Lean ๅŒ…ใ€‚ ่ฏฅๅŒ…็š„ๅ†…ๅฎนๅŸบไบŽๆจกๆฟ๏ผŒๅ…ถไธญ packageใ€ๅ…ถ targets ๅŠๅ…ถ module root ็š„ๅ็งฐๆบ่‡ชๅฝ“ๅ‰็›ฎๅฝ•็š„ๅ็งฐใ€‚

template ๅฏ่ƒฝๆ˜ฏ๏ผš

std๏ผˆ้ป˜่ฎค๏ผ‰

ๅˆ›ๅปบๅŒ…ๅซๅบ“ๅ’Œๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ๅŒ…ใ€‚

exe

ๅˆ›ๅปบไป…ๅŒ…ๅซๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ๅŒ…ใ€‚

lib

ๅˆ›ๅปบไป…ๅŒ…ๅซๅบ“็š„ๅŒ…ใ€‚

math

ๅˆ›ๅปบไธ€ไธชๅŒ…๏ผŒๅ…ถไธญๅŒ…ๅซไพ่ต–ไบŽ Mathlib ็š„ๅบ“ใ€‚

language ้€‰ๆ‹ฉ็”จไบŽ ๅŒ…้…็ฝฎ ๆ–‡ไปถ็š„ๆ–‡ไปถๆ ผๅผ๏ผŒๅฏไปฅๆ˜ฏ lean๏ผˆ้ป˜่ฎคๅ€ผ๏ผ‰ๆˆ– tomlใ€‚

24.1.2.6.ย ๆž„ๅปบๅ’Œ่ฟ่กŒ๐Ÿ”—

๐Ÿ”—Lake command
lake build [targets...] [-o mappings]

ๆž„ๅปบๆŒ‡ๅฎš็›ฎๆ ‡็š„ๆŒ‡ๅฎšไบ‹ๅฎžใ€‚

ๆฏไธช targets ็”ฑไปฅไธ‹ๅฝขๅผ็š„ๅญ—็ฌฆไธฒๆŒ‡ๅฎš๏ผš

[[@]package[/]][target|[+]module][:facet]

ๅฏ้€‰็š„ @ ๅ’Œ + ๆ ‡่ฎฐๅฏ็”จไบŽๆถˆ้™คๆ–‡ไปถ่ทฏๅพ„ไปฅๅŠๅฏๆ‰ง่กŒๆ–‡ไปถๅ’Œๅบ“ไธญ็š„ๅŒ…ๅ’Œๆจกๅ—็š„ๆญงไน‰๏ผŒ่ฟ™ไบ›ๆ–‡ไปถ้€š่ฟ‡ๅ็งฐๆŒ‡ๅฎšไธบ targetใ€‚ ๅฆ‚ๆžœๆœชๆไพ›๏ผŒpackage ้ป˜่ฎคไธบ ๅทฅไฝœ็ฉบ้—ด ็š„ ๆ นๅŒ…ใ€‚ ๅฆ‚ๆžœๅทฅไฝœๅŒบไธญ็š„ๅคšไธชๅŒ…ไธญๅญ˜ๅœจ็›ธๅŒ็š„็›ฎๆ ‡ๅ็งฐ๏ผŒๅˆ™้€‰ๆ‹ฉๅœจๅŒ…ไพ่ต–ๅ…ณ็ณปๅ›พ็š„ๆ‹“ๆ‰‘ๆŽ’ๅบไธญๆ‰พๅˆฐ็š„็›ฎๆ ‡ๅ็งฐ็š„็ฌฌไธ€ไธชๅŒน้…้กนใ€‚ ๆจกๅ—็›ฎๆ ‡ไนŸๅฏไปฅ้€š่ฟ‡ๅ…ถๆ–‡ไปถๅๆฅๆŒ‡ๅฎš๏ผŒๅ†’ๅทๅŽ้ขๆœ‰ไธ€ไธชๅฏ้€‰็š„ๆ–น้ขใ€‚

ๅฏ็”จ็š„ facets ๅ–ๅ†ณไบŽๆ˜ฏๅฆ่ฆๆž„ๅปบๅŒ…ใ€ๅบ“ใ€ๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–ๆจกๅ—ใ€‚ ๅฎƒไปฌๅˆ—ๅœจ ๆœ‰ๅ…ณๆ–น้ข็š„้ƒจๅˆ†ไธญใ€‚

ไฝฟ็”จ ๆœฌๅœฐๅทฅไปถ็ผ“ๅญ˜ ๆ—ถ๏ผŒ-o ้€‰้กนไผšไฟๅญ˜ ๆ˜ ๅฐ„ๆ–‡ไปถ๏ผŒ็”จไบŽ่ทŸ่ธชๆž„ๅปบไธญๆฏไธชๆญฅ้ชค็š„่พ“ๅ…ฅๅ’Œ่พ“ๅ‡บใ€‚ ๆญคๆ–‡ไปถๅฏไธŽ lake cache get ๅ’Œ lake cache put ไธ€่ตทไฝฟ็”จๆฅไธŽ่ฟœ็จ‹็ผ“ๅญ˜ไบคไบ’ใ€‚ ๆ˜ ๅฐ„ๆ–‡ไปถ้‡‡็”จ JSON ่กŒๆ ผๅผ๏ผŒๆฏ่กŒๆœ‰ไธ€ไธชๆœ‰ๆ•ˆ็š„ JSON ๅฏน่ฑก๏ผŒๅ…ถๆ–‡ไปถๆ‰ฉๅฑ•ๅ้€šๅธธไธบ .jsonlใ€‚

Target and Facet Specifications

a

็›ฎๆ ‡ a ็š„ ้ป˜่ฎคๆž„้ข

@a

ๅฐ่ฃ… a ็š„ ้ป˜่ฎค็›ฎๆ ‡

+A

ๆจกๅ— A ็š„ Lean ๅทฅไปถ๏ผˆๅ› ไธบๆจกๅ—็š„้ป˜่ฎคๆ–น้ขๆ˜ฏ leanArts๏ผ‰

@a/b

ๅŒ… a ็š„็›ฎๆ ‡ b ็š„้ป˜่ฎคๆ–น้ข

@a/+A:c

ไปŽ a ๅŒ…็š„ๆจกๅ— A ็ผ–่ฏ‘็š„ C ๆ–‡ไปถ

:foo

ๆ นๅŒ…็š„ๆ–น้ข foo

A/B/C.lean:o

ๆ–‡ไปถ A/B/C.lean ไธญๆจกๅ—็š„ๅทฒ็ผ–่ฏ‘็›ฎๆ ‡ไปฃ็ 

๐Ÿ”—Lake command
lake check-build 

ๅฆ‚ๆžœ ๅทฅไฝœ็ฉบ้—ด ็š„ ๆ นๅŒ… ้…็ฝฎไบ†ไปปไฝ• ้ป˜่ฎค็›ฎๆ ‡๏ผŒๅˆ™้€€ๅ‡บๅนถๆ˜พ็คบไปฃ็  0ใ€‚ ๅฆๅˆ™ๅ‡บ้”™๏ผˆ้€€ๅ‡บไปฃ็ ไธบ 1๏ผ‰ใ€‚

lake check-build ไธ้ชŒ่ฏ้…็ฝฎ็š„้ป˜่ฎค็›ฎๆ ‡ๆ˜ฏๅฆๆœ‰ๆ•ˆใ€‚ ๅฎƒไป…้ชŒ่ฏ่‡ณๅฐ‘ๆŒ‡ๅฎšไบ†ไธ€ไธชใ€‚

๐Ÿ”—Lake command
lake query [targets...]

ๆž„ๅปบไธ€็ป„็›ฎๆ ‡๏ผŒๆŠฅๅ‘Š ๆ ‡ๅ‡†้”™่ฏฏ ็š„่ฟ›ๅบฆๅนถๅœจๆ ‡ๅ‡†่พ“ๅ‡บไธŠ่พ“ๅ‡บ็ป“ๆžœใ€‚ ็›ฎๆ ‡็ป“ๆžœๆŒ‰็…งๅˆ—ๅ‡บ็š„้กบๅบ่พ“ๅ‡บ๏ผŒๅนถไปฅๆข่กŒ็ฌฆ็ป“ๅฐพใ€‚ ๅฆ‚ๆžœ่ฎพ็ฝฎไบ† --json๏ผŒๅˆ™็ป“ๆžœๆ ผๅผไธบ JSONใ€‚ ๅฆๅˆ™๏ผŒๅฎƒไปฌๅฐ†่ขซๆ‰“ๅฐไธบๅŽŸๅง‹ๅญ—็ฌฆไธฒใ€‚

ๆœช้…็ฝฎ่พ“ๅ‡บ็š„็›ฎๆ ‡ๅฐ†ๆ‰“ๅฐไธบ็ฉบๅญ—็ฌฆไธฒๆˆ– nullใ€‚ ๅฏนไบŽๅฏๆ‰ง่กŒ็›ฎๆ ‡๏ผŒ่พ“ๅ‡บๆ˜ฏๆž„ๅปบ็š„ๅฏๆ‰ง่กŒๆ–‡ไปถ็š„่ทฏๅพ„ใ€‚

ไฝฟ็”จไธŽ lake build ไธญ็›ธๅŒ็š„่ฏญๆณ•ๆŒ‡ๅฎš็›ฎๆ ‡ใ€‚

๐Ÿ”—Lake command
lake exe exe-target [args...]

Alias: lake exec

ๅœจๅทฅไฝœๅŒบไธญๆŸฅๆ‰พๅฏๆ‰ง่กŒ็›ฎๆ ‡exe-target๏ผŒๅฆ‚ๆžœ่ฟ‡ๆœŸๅˆ™ๆž„ๅปบๅฎƒ๏ผŒ็„ถๅŽ่ฟ่กŒ ๅฎƒไธŽ Lake ็Žฏๅขƒไธญ็ป™ๅฎš็š„ args ไธ€่ตทไฝฟ็”จใ€‚

ๆœ‰ๅ…ณ็›ฎๆ ‡่ง„่Œƒ็š„่ฏญๆณ•๏ผŒ่ฏทๅ‚้˜… lake build๏ผ›ๆœ‰ๅ…ณๅฆ‚ไฝ•่ฎพ็ฝฎ็Žฏๅขƒ็š„่ฏดๆ˜Ž๏ผŒ่ฏทๅ‚้˜… lake envใ€‚

๐Ÿ”—Lake command
lake clean [packages...]

ๅฆ‚ๆžœๆœชๆŒ‡ๅฎšๅŒ…๏ผŒๅˆ™ๅˆ ้™คๅทฅไฝœๅŒบไธญๆฏไธชๅŒ…็š„ ๆž„ๅปบ็›ฎๅฝ•ใ€‚ ๅฆๅˆ™๏ผŒๅฎƒๅชๅˆ ้™คๆŒ‡ๅฎš็š„ packages ็š„้‚ฃไบ›ใ€‚

๐Ÿ”—Lake command
lake env [cmd [args...]]

ๅฝ“ๆไพ› cmd ๆ—ถ๏ผŒๅฎƒๅฐ†ๅœจ Lake ็Žฏๅขƒไธญไฝฟ็”จๅ‚ๆ•ฐ args ๆ‰ง่กŒใ€‚

ๅฆ‚ๆžœๆœชๆไพ› cmd๏ผŒLake ๅฐ†ๆ‰“ๅฐๅ…ถ่ฟ่กŒๅทฅๅ…ท็š„็Žฏๅขƒใ€‚ ่ฏฅ็Žฏๅขƒๆ˜ฏ็‰นๅฎšไบŽ็ณป็ปŸ็š„ใ€‚

๐Ÿ”—Lake command
lake lean file [-- args...]

ๆž„ๅปบ็ป™ๅฎš file ็š„ๅฏผๅ…ฅ๏ผŒ็„ถๅŽๆŒ‰้กบๅบไฝฟ็”จ ๅทฅไฝœ็ฉบ้—ด ็š„ ๆ นๅŒ… ็š„้™„ๅŠ  Lean ๅ‚ๆ•ฐๅ’Œ็ป™ๅฎš็š„ args ๅœจๅ…ถไธŠ่ฟ่กŒ leanใ€‚ lean่ฟ›็จ‹ๅœจLake็š„็Žฏๅขƒไธญๆ‰ง่กŒใ€‚

24.1.2.7.ย ๆจกๅ—ๅฏผๅ…ฅ๐Ÿ”—

๐Ÿ”—Lake command
lake shake [options...] [module ...]

้€š่ฟ‡ๅˆ†ๆž็”Ÿๆˆ็š„ .olean ๆ–‡ไปถ ๆฅๆŽจๆ–ญๆ‰€้œ€็š„ๅฏผๅ…ฅ๏ผŒๆฃ€ๆŸฅๅฝ“ๅ‰้กน็›ฎๆ˜ฏๅฆๆœ‰ๆœชไฝฟ็”จ็š„ๅฏผๅ…ฅ๏ผŒ็กฎไฟๆฏไธชๅฏผๅ…ฅ้ƒฝ่ดก็Œฎไธ€ไบ›ๅธธ้‡ๆˆ–ๅ…ถไป–็ฒพๅŒ–ไพ่ต–้กนใ€‚

ๅฆ‚ๆžœๆŒ‡ๅฎšไบ† module๏ผŒๅˆ™ไผšๆฃ€ๆŸฅๅฎƒไปฅๅŠๅฏไปŽๅฎƒไผ ้€’่ฎฟ้—ฎ็š„ๆ‰€ๆœ‰ๆ–‡ไปถใ€‚ๅฆๅˆ™๏ผŒๅฐ†ๆฃ€ๆŸฅๅŒ…็š„ ้ป˜่ฎค็›ฎๆ ‡ใ€‚

ๆบๆ–‡ไปถๅฏไปฅๅŒ…ๅซ็‰นๆฎŠๆณจ้‡ŠๆฅๆŽงๅˆถ lake shake ็š„่กŒไธบ๏ผš

module -- shake: keep-downstream

ๅœจๆ‰€ๆœ‰ไธ‹ๆธธๆจกๅ—ไธญไฟ็•™ๆญคๆจกๅ—ใ€‚

module -- shake: keep-all

ไฟ็•™ๆญคๆจกๅ—ไธญ็š„ๆ‰€ๆœ‰็Žฐๆœ‰ๅฏผๅ…ฅใ€‚

import X -- shake: keep

ไฟ็•™ๆญค็‰นๅฎšๅฏผๅ…ฅใ€‚

options ๅฏ่ƒฝๆ˜ฏ๏ผš

--force

่ทณ่ฟ‡ lake build --no-build ๅฅๅ…จๆ€งๆฃ€ๆŸฅ

--keep-implied

ไฟ็•™ๅ…ถไป–ๅฏผๅ…ฅๆ‰€้šๅซ็š„ๅฏผๅ…ฅ

--keep-prefix

ไผ˜ๅ…ˆ้€‰ๆ‹ฉ็ˆถๆจกๅ—ๅฏผๅ…ฅ่€Œไธๆ˜ฏ็‰นๅฎšๅญๆจกๅ—

--keep-public

ไฟ็•™ๆ‰€ๆœ‰ public ๅฏผๅ…ฅ๏ผŒไปฅ็กฎไฟ API ็จณๅฎšๆ€ง

--add-public

ๅฆ‚ๆžœๆ–ฐๅฏผๅ…ฅๅœจๅŽŸๅง‹ๅ…ฌๅผ€ๅ…ณ้—ญไธญ๏ผŒๅˆ™ๅฐ†ๅ…ถๆทปๅŠ ไธบ public

--explain

ๆ˜พ็คบๆฏๆฌกๅฏผๅ…ฅ้œ€่ฆๅ“ชไบ›ๅธธ้‡

--fix

ๅฐ†ๅปบ่ฎฎ็š„ไฟฎๅค็›ดๆŽฅๅบ”็”จๅˆฐๆบๆ–‡ไปถ

--gh-style

ไปฅ GitHub ้—ฎ้ข˜ๅŒน้…ๅ™จๆ ผๅผ่พ“ๅ‡บ

24.1.2.8.ย ๅผ€ๅ‘ๅทฅๅ…ท๐Ÿ”—

Lake ๅŒ…ๆ‹ฌๅฏนๆŒ‡ๅฎšๆ ‡ๅ‡†ๅผ€ๅ‘ๅทฅๅ…ทๅ’Œๅทฅไฝœๆต็จ‹็š„ๆ”ฏๆŒใ€‚ ๅœจๅ‘ฝไปค่กŒไธŠ๏ผŒๅฏไปฅไฝฟ็”จ้€‚ๅฝ“็š„ lake ๅญๅ‘ฝไปค่ฐƒ็”จ่ฟ™ไบ›ๅทฅๅ…ทใ€‚

24.1.2.8.1.ย ๆต‹่ฏ•ๅ’Œๆฃ€ๆŸฅ๐Ÿ”—

๐Ÿ”—Lake command
lake test [-- args...]

ไฝฟ็”จ้…็ฝฎ็š„ ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ ๆต‹่ฏ•ๅทฅไฝœๅŒบ็š„ๆ นๅŒ…ใ€‚

ๅฐ†ๆž„ๅปบไธ€ไธชๅฏๆ‰ง่กŒ็š„ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ๏ผŒ็„ถๅŽไฝฟ็”จๅŒ…้…็ฝฎ็š„ testDriverArgs ๅŠ ไธŠ CLI args ่ฟ่กŒใ€‚ Lake ่„šๆœฌ ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบไฝฟ็”จไธŽๅฏๆ‰ง่กŒๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ็›ธๅŒ็š„ๅ‚ๆ•ฐ่ฟ่กŒใ€‚ ๅฐ†ๅˆšๅˆšๆž„ๅปบไธ€ไธชๅบ“ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ๏ผ›้ข„่ฎกๅฎžๆ–ฝๆต‹่ฏ•ๆ—ถ๏ผŒๅคฑ่ดฅไผšๅฏผ่‡ดๆž„ๅปบๅ› ็ฒพๅŒ–ๆ—ถ้—ด้”™่ฏฏ่€Œๅคฑ่ดฅใ€‚

๐Ÿ”—Lake command
lake lint [options...] [module...] [-- args...]

้ป˜่ฎคๆƒ…ๅ†ตไธ‹๏ผŒไฝฟ็”จๅ…ถ้…็ฝฎ็š„ lint ้ฉฑๅŠจ็จ‹ๅบๅฏนๅทฅไฝœๅŒบ็š„ๆ นๅŒ…่ฟ›่กŒ lint ๅค„็†ใ€‚ ๅฆ‚ๆžœๅœจๅŒ…้…็ฝฎไธญๅฐ† builtinLint ่ฎพ็ฝฎไธบ true๏ผŒๅˆ™ไนŸไผš่ฟ่กŒๅ†…็ฝฎ lintใ€‚

ไฝ็ฝฎ module ๅ‚ๆ•ฐไป…็ผฉๅฐๅ†…็ฝฎ lint๏ผ›ๅฆ‚ๆžœ็œ็•ฅ๏ผŒ ไฝฟ็”จๅทฅไฝœๅŒบ็š„้ป˜่ฎค็›ฎๆ ‡ๆ นใ€‚่ฐƒ็”จ lint ้ฉฑๅŠจ็จ‹ๅบ ไฝฟ็”จๅŒ…้…็ฝฎไธญ็š„ lintDriverArgs ไปฅๅŠไน‹ๅŽ็š„ไปปไฝ•ๅ‚ๆ•ฐ --๏ผ› module ๅˆ—่กจไธไผšไผ ้€’็ป™ๅฎƒใ€‚

่„šๆœฌ lint ้ฉฑๅŠจ็จ‹ๅบๅฐ†ไฝฟ็”จๅŒ…้…็ฝฎ่ฟ่กŒ lintDriverArgs ๅŠ ไธŠ CLI argsใ€‚ๅฏๆ‰ง่กŒ็š„ lint ้ฉฑๅŠจ็จ‹ๅบๅฐ†ๆ˜ฏ ๆž„ๅปบ็„ถๅŽๅƒ่„šๆœฌไธ€ๆ ท่ฟ่กŒใ€‚

ๅ†…็ฝฎ linter ๆ˜ฏไธ€็ป„ๅฏไปฅไฝœไธบๆž„ๅปบ็š„ไธ€้ƒจๅˆ†่ฟ่กŒ็š„ linterใ€‚ๅ…ถไธญไธ€ไบ›ๆ˜ฏ้ป˜่ฎค่ฟ่กŒ็š„๏ผ›่ฟ™ไบ› linter ๅœจๆŒ‡ๅฎš --builtin-lint ๆ—ถ่ฟ่กŒใ€‚ๅ…ถไป–็š„ linter ๆ˜ฏ้ขๅค–็š„ linter๏ผ›ไป…ๅฝ“ๆŒ‡ๅฎš --extra ๆ—ถๆ‰่ฟ่กŒ่ฟ™ไบ› linterใ€‚

options ๅฏ่ƒฝๆ˜ฏ๏ผš

--builtin-lint

่ฟ่กŒ้ป˜่ฎค็š„ๅ†…็ฝฎ็Žฏๅขƒๅ’Œๆ–‡ๆœฌ linter

--builtin-only

ไป…่ฟ่กŒ้ป˜่ฎค็š„ๅ†…็ฝฎ linter๏ผŒ่ทณ่ฟ‡ lint ้ฉฑๅŠจ็จ‹ๅบ

--extra

ไป…่ฟ่กŒ้ž้ป˜่ฎค๏ผˆ้ขๅค–๏ผ‰ๅ†…็ฝฎ linter

--lint-all

่ฟ่กŒๆ‰€ๆœ‰ๅทฒๆณจๅ†Œ็š„ linter๏ผŒๅŒ…ๆ‹ฌ้ป˜่ฎคๅ€ผใ€้ขๅค–ๅ€ผใ€ ไปฅๅŠไปปไฝ•ๅ…ถไป–้ป˜่ฎค็ฆ็”จ็š„ linter

--lint-only <name>

ไป…่ฟ่กŒๆŒ‡ๅฎš็š„ linter๏ผˆๅฏ้‡ๅค๏ผ‰ใ€‚

ๅฏไปฅ้€š่ฟ‡่ฎพ็ฝฎ lintDriver ๅŒ…ๆฅ้…็ฝฎ lint ้ฉฑๅŠจ็จ‹ๅบ ้…็ฝฎ้€‰้กนๆˆ–้€š่ฟ‡ๆ ‡่ฎฐ่„šๆœฌๆˆ–ๅฏๆ‰ง่กŒๆ–‡ไปถ @[lint_driver]ใ€‚ ไพ่ต–้กนไธญ็š„ๅฎšไน‰ๅฏไปฅ็”จไฝœ lint ้ฉฑๅŠจ็จ‹ๅบ๏ผŒๆ–นๆณ•ๆ˜ฏไฝฟ็”จ โ€œlintDriverโ€้…็ฝฎ้€‰้กน็š„ <pkg>/<name> ่ฏญๆณ•ใ€‚

่„šๆœฌ lint ้ฉฑๅŠจ็จ‹ๅบๅฐ†ไฝฟ็”จๅŒ…้…็ฝฎ่ฟ่กŒ lintDriverArgs ๅŠ ไธŠ CLI argsใ€‚ๅฏๆ‰ง่กŒ็š„ lint ้ฉฑๅŠจ็จ‹ๅบๅฐ†ๆ˜ฏ ๆž„ๅปบ็„ถๅŽๅƒ่„šๆœฌไธ€ๆ ท่ฟ่กŒใ€‚

๐Ÿ”—Lake command
lake check-test 

ๆฃ€ๆŸฅๆ˜ฏๅฆๆœ‰ๆญฃ็กฎ้…็ฝฎ็š„ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบ

ๅฆ‚ๆžœๅทฅไฝœๅŒบ็š„ๆ นๅŒ…ๅ…ทๆœ‰ๆญฃ็กฎ็š„่ทฏๅพ„๏ผŒๅˆ™ไปฅไปฃ็  0 ้€€ๅ‡บ ้…็ฝฎ็š„ lint ้ฉฑๅŠจ็จ‹ๅบใ€‚ๅฆๅˆ™้”™่ฏฏ๏ผˆไปฃ็ ไธบ 1๏ผ‰ใ€‚

ไธ้ชŒ่ฏ้…็ฝฎ็š„ๆต‹่ฏ•้ฉฑๅŠจ็จ‹ๅบๆ˜ฏๅฆ็กฎๅฎžๅญ˜ๅœจไบŽ ๅŒ…ๆˆ–ๅ…ถไพ่ต–้กนใ€‚ๅฎƒไป…้ชŒ่ฏๆ˜ฏๅฆๅทฒๆŒ‡ๅฎšใ€‚

่ฟ™ๅฏนไบŽๅŒบๅˆ†ๅคฑ่ดฅ็š„ๆต‹่ฏ•ๅ’Œ้”™่ฏฏ้…็ฝฎ็š„ๅŒ…ๅพˆๆœ‰็”จใ€‚

๐Ÿ”—Lake command
lake check-lint 

ๆฃ€ๆŸฅๆ˜ฏๅฆๆœ‰ๆญฃ็กฎ้…็ฝฎ็š„ lint ้ฉฑๅŠจ็จ‹ๅบ

ๅฆ‚ๆžœๅทฅไฝœๅŒบ็š„ๆ นๅŒ…ๅ…ทๆœ‰ๆญฃ็กฎ็š„่ทฏๅพ„๏ผŒๅˆ™ไปฅไปฃ็  0 ้€€ๅ‡บ ้…็ฝฎ็š„ lint ้ฉฑๅŠจ็จ‹ๅบใ€‚ๅฆๅˆ™้”™่ฏฏ๏ผˆไปฃ็ ไธบ 1๏ผ‰ใ€‚

ไธ้ชŒ่ฏ้…็ฝฎ็š„ lint ้ฉฑๅŠจ็จ‹ๅบๆ˜ฏๅฆ็กฎๅฎžๅญ˜ๅœจไบŽ ๅŒ…ๆˆ–ๅ…ถไพ่ต–้กนใ€‚ๅฎƒไป…้ชŒ่ฏๆ˜ฏๅฆๅทฒๆŒ‡ๅฎšใ€‚

่ฟ™ๅฏนไบŽๅŒบๅˆ†ๅคฑ่ดฅ็š„ lint ๅ’Œ้”™่ฏฏ้…็ฝฎ็š„ๅŒ…ๅพˆๆœ‰็”จใ€‚

24.1.2.8.2.ย ่„šๆœฌ๐Ÿ”—

๐Ÿ”—Lake command
lake script list 

Alias: lake scripts

ๅˆ—ๅ‡บๅทฅไฝœๅŒบไธญๅฏ็”จ็š„ ่„šๆœฌใ€‚

๐Ÿ”—Lake command
lake script run [[package/]script [args...]]

Alias: lake run

ๆญคๅ‘ฝไปค่ฟ่กŒๅทฅไฝœๅŒบ็š„ script๏ผˆๆˆ–ๆŒ‡ๅฎš็š„ package๏ผ‰๏ผŒ ๅฐ† args ไผ ้€’็ป™ๅฎƒใ€‚

่ฃธ lake run ๅ‘ฝไปคๅฐ†่ฟ่กŒๆ นๅŒ…็š„้ป˜่ฎค่„šๆœฌ๏ผˆไธๅธฆๅ‚ๆ•ฐ๏ผ‰ใ€‚

๐Ÿ”—Lake command
lake script doc script

ๆ‰“ๅฐ script ็š„ๆ–‡ๆกฃๆณจ้‡Šใ€‚

24.1.2.8.3.ย ่ฏญ่จ€ๆœๅŠกๅ™จ๐Ÿ”—

๐Ÿ”—Lake command
lake serve [-- args...]

ไฝฟ็”จ ๅŒ…้…็ฝฎ ็š„ moreServerArgs ๅญ—ๆฎตๅ’Œ args ๅœจๅทฅไฝœๅŒบ็š„ๆ น้กน็›ฎไธญ่ฟ่กŒ Lean ่ฏญ่จ€ๆœๅŠกๅ™จใ€‚

ๆญคๅ‘ฝไปค้€šๅธธ็”ฑ็ผ–่พ‘ๅ™จๆˆ–ๅ…ถไป–ๅทฅๅ…ท่ฐƒ็”จ๏ผŒ่€Œไธๆ˜ฏๆ‰‹ๅŠจ่ฐƒ็”จใ€‚

24.1.2.9.ย ไพ่ต–็ฎก็†๐Ÿ”—

๐Ÿ”—Lake command
lake update [packages...]

ๆ›ดๆ–ฐ Lake ่ฝฏไปถๅŒ… manifest๏ผˆๅณ lake-manifest.json๏ผ‰๏ผŒๆ นๆฎ้œ€่ฆไธ‹่ฝฝๅ’Œๅ‡็บง่ฝฏไปถๅŒ…ใ€‚ ๅฏนไบŽๆฏไธชๆ–ฐ็š„๏ผˆๅฏไผ ้€’็š„๏ผ‰Git ไพ่ต–้กน๏ผŒ็›ธๅบ”็š„ๆไบคๅฐ†่ขซๅ…‹้š†ๅˆฐๅทฅไฝœๅŒบ็š„ ๅŒ…็›ฎๅฝ• ็š„ๅญ็›ฎๅฝ•ไธญใ€‚ ๆฒกๆœ‰ๆœฌๅœฐไพ่ต–้กน็š„ๅ‰ฏๆœฌใ€‚

ๅฆ‚ๆžœๆŒ‡ๅฎšไบ†ไธ€็ป„ๅŒ… packages๏ผŒๅˆ™่ฟ™ไบ›ไพ่ต–้กนๅฐ†ๅ‡็บงๅˆฐไธŽๅŒ…็š„้…็ฝฎๅ…ผๅฎน็š„ๆœ€ๆ–ฐ็‰ˆๆœฌ๏ผˆๅฆ‚ๆžœไปŽ้…็ฝฎไธญๅˆ ้™ค๏ผŒๅˆ™ๅฐ†ๅ…ถๅˆ ้™ค๏ผ‰ใ€‚ ๅฆ‚ๆžœๅŒไธ€ๅŒ…็š„ๅคšไธช็‰ˆๆœฌๅญ˜ๅœจไพ่ต–ๅ…ณ็ณป๏ผŒๅˆ™้€‰ๆ‹ฉไปปๆ„็‰ˆๆœฌใ€‚

่ฃธ้œฒ็š„ lake update ๅฐ†ๅ‡็บงๆ‰€ๆœ‰ไพ่ต–้กนใ€‚

24.1.2.10.ย ๅŒ…่ฃ…ๅ’Œๅˆ†้”€๐Ÿ”—

๐Ÿ”—Lake command
lake upload tag

ไฝฟ็”จ tar ๅฐ†ๆ นๅŒ…็š„ buildDir ๆ‰“ๅŒ…ๅˆฐ tar.gz ๅญ˜ๆกฃไธญ๏ผŒ็„ถๅŽไฝฟ็”จไปฅไธ‹ๅ‘ฝไปคๅฐ†่ต„ๆบไธŠไผ ๅˆฐ้ข„ๅ…ˆๅญ˜ๅœจ็š„ GitHub ็‰ˆๆœฌ tag ghใ€‚ ๅฐšไธๆ”ฏๆŒๅ…ถไป–ไธปๆœบใ€‚

24.1.2.10.1.ย ็ผ“ๅญ˜ไบ‘ๆž„ๅปบ๐Ÿ”—

่ฟ™ไบ›ๅ‘ฝไปคไปๅค„ไบŽๅฎž้ชŒ้˜ถๆฎตใ€‚ ๆ นๆฎ็”จๆˆทๅ้ฆˆ๏ผŒๅฎƒไปฌๅฏ่ƒฝไผšๅœจ Lake ็š„ๆœชๆฅ็‰ˆๆœฌไธญๅ‘็”Ÿๆ›ดๆ”นใ€‚ ไฝฟ็”จ Reservoir ไบ‘ๆž„ๅปบๅญ˜ๆกฃ็š„่ฝฏไปถๅŒ…ๅบ”ๅฏ็”จ platformIndependent ่ฎพ็ฝฎใ€‚

๐Ÿ”—Lake command
lake pack [archive.tar.gz]

ไฝฟ็”จ tar ๅฐ†ๆ นๅŒ…็š„ ๆž„ๅปบ็›ฎๅฝ• ๆ‰“ๅŒ…ๅˆฐ gzip ๅŽ‹็ผฉ็š„ tar ๅญ˜ๆกฃไธญใ€‚ ๅฆ‚ๆžœๆœชๆŒ‡ๅฎšๅญ˜ๆกฃ็š„่ทฏๅพ„๏ผŒๅˆ™ๅญ˜ๆกฃไฝไบŽ็จ‹ๅบๅŒ…็š„ Lake ็›ฎๅฝ• (.lake) ไธญ๏ผŒๅนถๆ นๆฎๅ…ถ buildArchive ่ฎพ็ฝฎ่ฟ›่กŒๅ‘ฝๅใ€‚ ๆญคๅ‘ฝไปคไธไผšๆž„ๅปบไปปไฝ•ๅทฅไปถ๏ผšๅฎƒๅชๅฝ’ๆกฃ็Žฐๆœ‰็š„ๅ†…ๅฎนใ€‚ ็”จๆˆทๅบ”็กฎไฟๅœจ่ฟ่กŒๆญคๅ‘ฝไปคไน‹ๅ‰ๅญ˜ๅœจๆ‰€้œ€็š„ๅทฅไปถใ€‚

๐Ÿ”—Lake command
lake unpack [archive.tar.gz]

ๅฐ† gzip ๅŽ‹็ผฉ็š„ tar ๅญ˜ๆกฃ archive.tgz ็š„ๅ†…ๅฎน่งฃๅŽ‹ๅˆฐๆ นๅŒ…็š„ ๆž„ๅปบ็›ฎๅฝ• ไธญใ€‚ ๅฆ‚ๆžœๆœชๆŒ‡ๅฎš archive.tgz๏ผŒๅˆ™ไฝฟ็”จๅŒ…็š„ buildArchive ่ฎพ็ฝฎๆฅ็กฎๅฎšๆ–‡ไปถๅ๏ผŒๅนถไธ”่ฏฅๆ–‡ไปถๅบ”ไฝไบŽๅŒ…็š„ Lake ็›ฎๅฝ• (.lake) ไธญใ€‚

24.1.2.11.ย ๆœฌๅœฐ็ผ“ๅญ˜๐Ÿ”—

lake cache getใ€lake cache put ๅ’Œ lake cache add ็”จไบŽไธŽ่ฟœ็จ‹็ผ“ๅญ˜ๆœๅŠกๅ™จไบคไบ’ใ€‚ ่ฟ™ไบ›ๅ‘ฝไปคๆ˜ฏๅฎž้ชŒๆ€ง็š„๏ผŒๅนถไธ”ไป…ๅœจๅฏ็”จ ๆœฌๅœฐ็ผ“ๅญ˜ ๆ—ถๆ‰ๆœ‰็”จใ€‚

่ฟ™ไบ›ๅ‘ฝไปคๅฏไปฅ้…็ฝฎไธบไฝฟ็”จ ็ผ“ๅญ˜่Œƒๅ›ด๏ผŒๅฎƒๆ˜ฏๅŒ…็š„ไธ€็ป„ๆž„ๅปบ่พ“ๅ‡บ็š„ๆœๅŠกๅ™จ็‰นๅฎšๆ ‡่ฏ†็ฌฆใ€‚ ๅœจ Reservoir ไธŠ๏ผŒ่Œƒๅ›ด็›ฎๅ‰ไธŽ GitHub ๅญ˜ๅ‚จๅบ“็›ธๅŒ๏ผŒไฝ†ๅฐ†ๆฅๅฏ่ƒฝๅŒ…ๆ‹ฌๅทฅๅ…ท้“พๅ’Œๅนณๅฐไฟกๆฏใ€‚ ๅ…ถไป–่ฟœ็จ‹็ผ“ๅญ˜ๅฏไปฅไฝฟ็”จๅฎƒไปฌๆƒณ่ฆ็š„ไปปไฝ•่Œƒๅ›ดๆ–นๆกˆใ€‚ ็ผ“ๅญ˜่Œƒๅ›ดๆ˜ฏไฝฟ็”จ --scope ้€‰้กนๆŒ‡ๅฎš็š„ใ€‚ ็ผ“ๅญ˜่Œƒๅ›ดไธŽ็”จไบŽ่ฆๆฑ‚ Reservoir ไธญ็š„ๅŒ…็š„่Œƒๅ›ดไธๅŒใ€‚

๐Ÿ”—Lake command
lake cache get [mappings] [--max-revs= cn] [--rev= commit-hash] [--service= name] [--repo= github-repo] [--platform= target-triple] [--toolchain=name] [--scope= remote-scope] [--mappings-only] [--force-download]

ๅฐ†ๅทฅไฝœๅŒบไธญๅŒ…็š„ๆž„ๅปบ่พ“ๅ‡บไปŽ่ฟœ็จ‹็ผ“ๅญ˜ๆœๅŠกไธ‹่ฝฝๅˆฐๆœฌๅœฐ Lake ๅทฅไปถ็ผ“ๅญ˜ใ€‚ ไฝฟ็”จ็š„็ผ“ๅญ˜ๆœๅŠกๅฏไปฅ้€š่ฟ‡ --service ้€‰้กนๆŒ‡ๅฎšใ€‚ ๅฆๅˆ™๏ผŒLake ๅฐ†ไฝฟ็”จ็ณป็ปŸ้ป˜่ฎคๅ€ผ๏ผŒๆˆ–่€…๏ผŒๅฆ‚ๆžœๆœช้…็ฝฎ๏ผŒๅˆ™ไฝฟ็”จ Reservoirใ€‚ ๆœ‰ๅ…ณๅฆ‚ไฝ•้…็ฝฎๆœๅŠก็š„ๆ›ดๅคšไฟกๆฏ๏ผŒ่ฏทๅ‚้˜… lake cache servicesใ€‚

ๅฆ‚ๆžœๆไพ›ไบ†่พ“ๅ…ฅๅˆฐ่พ“ๅ‡บ mappings ๆ–‡ไปถใ€remote-scope ๆˆ– github-repo๏ผŒLake ๅฐ†ไธ‹่ฝฝๆ นๅŒ…็š„ๆž„ๅปบ่พ“ๅ‡บใ€‚ ๅฆๅˆ™๏ผŒๅฎƒๅฐ†ๆŒ‰้กบๅบไธ‹่ฝฝๆ นไพ่ต–ๆ ‘ไธญๆฏไธชๅŒ…็š„่พ“ๅ‡บ๏ผˆไฝฟ็”จ Reservoir๏ผ‰ใ€‚ ๅฐ†่ทณ่ฟ‡้ž Reservoir ไพ่ต–้กนใ€‚

ๅฏนไบŽ Reservoir๏ผŒ่ฎพ็ฝฎ --repo ๅฐ†ๅฏผ่‡ด Lake ๆŒ‰ๅญ˜ๅ‚จๅบ“ๅ็งฐ๏ผˆ่€Œไธๆ˜ฏๅŒ…็š„ๅ็งฐ๏ผ‰ๆŸฅๆ‰พๆ นๅŒ…็š„่พ“ๅ‡บใ€‚ ่ฟ™ๅฏ็”จไบŽไธ‹่ฝฝ Reservoir ๅŒ…็š„ๅˆ†ๆ”ฏ็š„่พ“ๅ‡บ๏ผˆๅฆ‚ๆžœๆญค็ฑปๅทฅไปถๅฏ็”จ๏ผ‰ใ€‚ --platform ๅ’Œ --toolchain ้€‰้กนๅฏ็”จไบŽไธ‹่ฝฝ Lake ๆฃ€ๆต‹ๅˆฐ็š„ไธๅŒๅนณๅฐ/ๅทฅๅ…ท้“พ้…็ฝฎ็š„ๅทฅไปถใ€‚ ๅฏนไบŽ่‡ชๅฎšไน‰็ซฏ็‚น๏ผŒLake ไฝฟ็”จ็š„ๅฎŒๆ•ดๅ‰็ผ€ๅฏไปฅ้€š่ฟ‡ --scope ่ฎพ็ฝฎใ€‚

ๅฆ‚ๆžœๆœช่ฎพ็ฝฎ --rev๏ผŒLake ๅฐ†ไฝฟ็”จๅŒ…็š„ๅฝ“ๅ‰็‰ˆๆœฌๆฅๆŸฅๆ‰พๅทฅไปถใ€‚ Lake ๅฐ†ไธ‹่ฝฝๅ…ทๆœ‰ๅฏ็”จๆ˜ ๅฐ„็š„ๆœ€ๆ–ฐๆไบค็š„ๅทฅไปถใ€‚ ๅฎƒๅฐ†ๅ›žๆบฏๅˆฐ --max-revs๏ผŒ้ป˜่ฎคไธบ 100ใ€‚ ๅฆ‚ๆžœ่ฎพ็ฝฎไธบ 0๏ผŒLake ๅฐ†ๆœ็ดขๅญ˜ๅ‚จๅบ“็š„ๆ•ดไธชๅކๅฒ่ฎฐๅฝ•๏ผŒๆˆ–่€…ๅฐฝๅฏ่ƒฝๆ—ฉๅœฐๆœ็ดข Git ๅ…่ฎธ็š„ๅކๅฒ่ฎฐๅฝ•ใ€‚

้ป˜่ฎคๆƒ…ๅ†ตไธ‹๏ผŒLake ๅฐ†ไธ‹่ฝฝๅŒ…็š„่พ“ๅ…ฅๅˆฐ่พ“ๅ‡บๆ˜ ๅฐ„ๅ’Œ่พ“ๅ‡บๅทฅไปถใ€‚ ไฝฟ็”จ --mappings-only ๅฐ†ๅฏผ่‡ด Lake ไป…ไธ‹่ฝฝๆ˜ ๅฐ„ๅนถๅปถ่ฟŸไธ‹่ฝฝๅทฅไปถ๏ผŒ็›ดๅˆฐ้œ€่ฆๅฎƒไปฌไธบๆญขใ€‚ ไฝฟ็”จ --force-download ๅฐ†้‡ๆ–ฐไธ‹่ฝฝ็Žฐๆœ‰ๆ–‡ไปถใ€‚

ไธ‹่ฝฝๆ—ถ๏ผŒๅฆ‚ๆžœๅทฅไปถไธ‹่ฝฝๅคฑ่ดฅๆˆ–ๆ•ดไธชๅŒ…็š„ไธ‹่ฝฝ่ฟ‡็จ‹ๅคฑ่ดฅ๏ผŒLake ๅฐ†็ปง็ปญใ€‚ ไฝ†ๆ˜ฏ๏ผŒๅœจ่ฟ™็งๆƒ…ๅ†ตไธ‹๏ผŒๅฎƒๅฐ†ๆŠฅๅ‘Šๆญคๆƒ…ๅ†ตๅนถไปฅ้ž้›ถ็Šถๆ€ไปฃ็ ้€€ๅ‡บใ€‚

๐Ÿ”—Lake command
lake cache put mappings scope-option

ๅฐ†ๆŒ‡ๅฎšๆ–‡ไปถไธญๅŒ…ๅซ็š„่พ“ๅ…ฅๅˆฐ่พ“ๅ‡บๆ˜ ๅฐ„ไปฅๅŠ็›ธๅบ”็š„่พ“ๅ‡บๅทฅไปถไธŠไผ ๅˆฐ่ฟœ็จ‹็ผ“ๅญ˜ใ€‚ ไฝฟ็”จ็š„็ผ“ๅญ˜ๆœๅŠกๅฏไปฅ้€š่ฟ‡ --service ้€‰้กนๆŒ‡ๅฎšใ€‚ ๅฆ‚ๆžœๆœชๆŒ‡ๅฎš๏ผŒLake ๅฐ†ไฝฟ็”จ็ณป็ปŸ้ป˜่ฎคๅ€ผ๏ผŒๅฆ‚ๆžœๆœช้…็ฝฎๅˆ™ๅ‡บ้”™ใ€‚ ๆœ‰ๅ…ณๅฆ‚ไฝ•้…็ฝฎๆœๅŠก็š„ๆ›ดๅคšไฟกๆฏ๏ผŒ่ฏทๅ‚้˜… lake cache servicesใ€‚

ๆ–‡ไปถ้€š่ฟ‡ curl ไฝฟ็”จ AWS ็ญพๅ็‰ˆๆœฌ 4 ่บซไปฝ้ชŒ่ฏๅ่ฎฎไธŠไผ ใ€‚ ๅ› ๆญค๏ผŒๆœๅŠก้€šๅธธๅบ”่ฏฅๆ˜ฏ S3 ๅ…ผๅฎน็š„ๅญ˜ๅ‚จๆกถใ€‚ ่บซไปฝ้ชŒ่ฏๅฏ†้’ฅ้€š่ฟ‡ LAKE_CACHE_KEY ็Žฏๅขƒๅ˜้‡่ฎพ็ฝฎใ€‚

็”ฑไบŽ Lake ๅฝ“ๅ‰ไธไฝฟ็”จๅŠ ๅฏ†ๅฎ‰ๅ…จๅ“ˆๅธŒๅ€ผ ๅทฅไปถๅ’Œ่พ“ๅ‡บ๏ผŒไธŠไผ ๅˆฐ็ผ“ๅญ˜้ƒฝไปฅ่Œƒๅ›ดไธบๅ‰็ผ€ไปฅ้ฟๅ… ๅ†ฒ็ชใ€‚ๆญค่Œƒๅ›ด้…็ฝฎๆœ‰ไปฅไธ‹้€‰้กน๏ผš

--scope=<remote-scope>

่ฎพ็ฝฎๅ›บๅฎš่Œƒๅ›ด

--repo=<github-repo>

ไฝฟ็”จๅญ˜ๅ‚จๅบ“+ๅทฅๅ…ท้“พๅ’Œๅนณๅฐ

--toolchain=<name>

ไฝฟ็”จ --repo๏ผŒ่ฎพ็ฝฎๅทฅๅ…ท้“พ

--platform=<target-triple>

็”จ--repo๏ผŒ่ฎพ็ฝฎๅนณๅฐ

ๅฟ…้กป่‡ณๅฐ‘่ฎพ็ฝฎ --scope ๆˆ– --repo ไน‹ไธ€ใ€‚ ๅฆ‚ๆžœไฝฟ็”จ --repo๏ผŒLake ๅฐ†ๆ นๆฎ้œ€่ฆไฝฟ็”จๅทฅๅ…ท้“พๅ’Œๅนณๅฐไฟกๆฏๆ‰ฉๅ……ๅญ˜ๅ‚จๅบ“ๆฅ็”Ÿๆˆ่Œƒๅ›ดใ€‚ ๅฆ‚ๆžœ่ฎพ็ฝฎไบ† --scope๏ผŒLake ๅฐ†้€ๅญ—ไฝฟ็”จๆŒ‡ๅฎš็š„่Œƒๅ›ดใ€‚

ๅทฅไปถไธŠไผ ๅˆฐๅทฅไปถ็ซฏ็‚น๏ผŒๆ–‡ไปถๅๆบ่‡ชๅ…ถ Lake ๅ†…ๅฎนๅ“ˆๅธŒ๏ผˆๅนถไปฅๅญ˜ๅ‚จๅบ“ๆˆ–่Œƒๅ›ดไธบๅ‰็ผ€๏ผ‰ใ€‚ ๆ˜ ๅฐ„ๆ–‡ไปถไธŠไผ ๅˆฐไฟฎ่ฎข็ซฏ็‚น๏ผŒๅ…ถๆ–‡ไปถๅๆบ่‡ชๅŒ…็š„ๅฝ“ๅ‰ Git ไฟฎ่ฎข๏ผˆๅนถไปฅๅฎŒๆ•ด่Œƒๅ›ดไธบๅ‰็ผ€๏ผ‰ใ€‚ ๅ› ๆญค๏ผŒๅฆ‚ๆžœๅทฅไฝœๆ ‘ๅฝ“ๅ‰ๅ‘็”Ÿๆ›ดๆ”น๏ผŒ่ฏฅๅ‘ฝไปคๅฐ†ๅ‘ๅ‡บ่ญฆๅ‘Šใ€‚

๐Ÿ”—Lake command
lake cache add mappings [--service= name] [--scope= remote-scope] [--repo= github-repo]

ไปŽๆไพ›็š„ๆ–‡ไปถไธญ่ฏปๅ–่พ“ๅ…ฅๅˆฐ่พ“ๅ‡บๆ˜ ๅฐ„็š„ๅˆ—่กจ๏ผŒๅนถๅฐ†ๅ…ถๆทปๅŠ ๅˆฐๆœฌๅœฐ Lake ็ผ“ๅญ˜ไธญใ€‚ ๅฆ‚ๆžœๆไพ›ไบ† --service๏ผŒๅˆ™ๅฏไปฅๅœจ Lake ๆž„ๅปบๆœŸ้—ดไปŽ่ฏฅๆœๅŠกๅปถ่ฟŸ่Žทๅ–่พ“ๅ‡บๅทฅไปถใ€‚ ่ฏฅๆœๅŠกๅฟ…้กปๆ˜ฏ reservoir ๆˆ–้€š่ฟ‡ Lake ็ณป็ปŸ้…็ฝฎ่ฟ›่กŒ้…็ฝฎ๏ผˆๆœ‰ๅ…ณ่ฏฆ็ป†ไฟกๆฏ๏ผŒ่ฏทๅ‚้˜… lake cache services๏ผ‰ใ€‚

็”ฑไบŽ Lake ๅฝ“ๅ‰ไธไฝฟ็”จๅŠ ๅฏ†ๅฎ‰ๅ…จๅ“ˆๅธŒๆฅๅค„็†ๅทฅไปถๅ’Œ่พ“ๅ‡บ๏ผŒๅ› ๆญค็ผ“ๅญ˜ๆœๅŠกไธญ็š„ๅทฅไปถ้ƒฝไปฅ่Œƒๅ›ดไธบๅ‰็ผ€ไปฅ้ฟๅ…ๅ†ฒ็ชใ€‚ ๅฏนไบŽ Reservoir๏ผŒๆญค่Œƒๅ›ดๅฏไปฅๆ˜ฏๅŒ…๏ผˆ้€š่ฟ‡ --scope ่ฎพ็ฝฎ๏ผ‰ๆˆ–ๅญ˜ๅ‚จๅบ“๏ผˆ้€š่ฟ‡ --repo ่ฎพ็ฝฎ๏ผ‰ใ€‚ ๅฏนไบŽ S3 ๆœๅŠก๏ผŒ่ฟ™ไธคไธช้€‰้กนๆ˜ฏๅŒไน‰่ฏใ€‚

๐Ÿ”—Lake command
lake cache clean 

ๅˆ ้™ค้…็ฝฎ็š„ Lake ๅทฅไปถ็ผ“ๅญ˜ ็›ฎๅฝ•ใ€‚ ๅฆ‚ๆžœๅทฅไฝœๅŒบ้…็ฝฎๅญ˜ๅœจ๏ผŒ่ฟ™ๅฐ†ๅˆ ้™คๅฎƒไฝฟ็”จ็š„็ผ“ๅญ˜็›ฎๅฝ•ใ€‚ ๅฆๅˆ™๏ผŒๅฎƒๅฐ†ๅˆ ้™ค็ณป็ปŸ้ป˜่ฎค็š„Lake็ผ“ๅญ˜็›ฎๅฝ•ใ€‚

๐Ÿ”—Lake command
lake cache services 

ๆ‰“ๅฐๆฏไธช้…็ฝฎ็š„่ฟœ็จ‹็ผ“ๅญ˜ๆœๅŠก็š„ๅ็งฐ๏ผˆๆฏ่กŒไธ€ไธช๏ผ‰ใ€‚ ๅฏไปฅ้€š่ฟ‡ไฟฎๆ”น็ณป็ปŸ Lake ้…็ฝฎๆ–‡ไปถๆฅๆทปๅŠ ๅ…ถไป–ๆœๅŠก๏ผŒ่ฏฅๆ–‡ไปถ้€šๅธธไฝไบŽ ~/.lake/config.toml๏ผŒไฝ†ๅฏไปฅ้€š่ฟ‡ LAKE_CONFIG ็Žฏๅขƒๅ˜้‡่ฟ›่กŒ่ฎพ็ฝฎใ€‚

็ณป็ปŸ็ผ“ๅญ˜็š„้…็ฝฎๅฏ่ƒฝๅฆ‚ไธ‹ๆ‰€็คบ๏ผš

cache.defaultService = "my-s3"
cache.defaultUploadService = "my-s3"

[[cache.service]]
name = "my-s3"
kind = "s3"
artifactEndpoint = "https://my-s3.com/a0"
revisionEndpoint = "https://my-s3.com/r0"

ๅฆ‚ๆžœๆœช้…็ฝฎ cache.defaultService๏ผŒๅˆ™ Lake ๅฐ†้ป˜่ฎคไฝฟ็”จ Reservoirใ€‚

๐Ÿ”—Lake command
lake cache stage mappings staging-directory

ๅˆ›ๅปบ staging-directory ๅนถๅฐ† mappings ๆ–‡ไปถๅคๅˆถๅˆฐๅ…ถไธญใ€‚ ๆญคๅŽ๏ผŒๅฎƒๅฐ†ๆ˜ ๅฐ„ๆ–‡ไปถไธญๆ่ฟฐ็š„ๆ‰€ๆœ‰ๅทฅไปถไปŽ็ผ“ๅญ˜ๅคๅˆถๅˆฐ ๆš‚ๅญ˜็›ฎๅฝ•ใ€‚ ๅฆ‚ๆžœๅœจ็ผ“ๅญ˜ไธญๆ‰พไธๅˆฐๆ‰€ๆ่ฟฐ็š„ไปปไฝ•ๅทฅไปถ๏ผŒๅˆ™่ฟ™ๆ˜ฏไธ€ไธช้”™่ฏฏใ€‚

๐Ÿ”—Lake command
lake cache unstage staging-directory

ๅฐ†ๅญ˜ๅ‚จๅœจ staging-directory๏ผˆไพ‹ๅฆ‚๏ผŒ้€š่ฟ‡ lake cache stage๏ผ‰ไธญ็š„ๆ˜ ๅฐ„ๅ’Œๅทฅไปถๅคๅˆถๅ›ž็ผ“ๅญ˜ไธญใ€‚

่ฏปๅ–ๆš‚ๅญ˜ไธญไฝไบŽ outputs.jsonl ็š„ๆ˜ ๅฐ„ๆ–‡ไปถ ็›ฎๅฝ•ๅนถๅฐ†ๆ˜ ๅฐ„ๅ†™ๅ…ฅ Lake ็ผ“ๅญ˜ใ€‚็„ถๅŽ๏ผŒๅฎƒๅคๅˆถ ๅฐ†ๆ่ฟฐ็š„ๅทฅไปถไปŽๆš‚ๅญ˜็›ฎๅฝ•ๆ”พๅ…ฅ็ผ“ๅญ˜ไธญใ€‚

24.1.2.12.ย ้…็ฝฎๆ–‡ไปถ๐Ÿ”—

๐Ÿ”—Lake command
lake translate-config lang [out-file]

ๅฐ†ๅŠ ่ฝฝ็š„ๅŒ…็š„้…็ฝฎ่ฝฌๆขไธบ Lake ๆ”ฏๆŒ็š„ๅฆไธ€็ง้…็ฝฎ่ฏญ่จ€๏ผˆๅณ lean ๆˆ– toml๏ผ‰ใ€‚ ็”Ÿๆˆ็š„ๆ–‡ไปถๅฐ†ๅ†™ๅ…ฅ out-file๏ผŒๆˆ–่€…ๅฆ‚ๆžœๆœชๆไพ›๏ผŒๅˆ™ๅ†™ๅ…ฅๅ…ทๆœ‰ๆ–ฐ่ฏญ่จ€ๆ‰ฉๅฑ•ๅ็š„้…็ฝฎๆ–‡ไปถ็š„่ทฏๅพ„ใ€‚ ๅฆ‚ๆžœ่พ“ๅ‡บๆ–‡ไปถๅทฒๅญ˜ๅœจ๏ผŒLake ๅฐ†ๅ‡บ้”™ใ€‚

็ฟป่ฏ‘ๆ˜ฏๆœ‰ๆŸ็š„ใ€‚ ๅฎƒไธไฟ็•™ๆณจ้‡Šๆˆ–ๆ ผๅผ๏ผŒๅนถไธ”ไธขๅผƒ้žๅฃฐๆ˜Žๆ€ง้…็ฝฎใ€‚

24.1.3.ย ้…็ฝฎๆ–‡ไปถๆ ผๅผ๐Ÿ”—

Lake ไธบ ๅŒ…้…็ฝฎ ๆ–‡ไปถๆไพ›ไธค็งๆ ผๅผ๏ผš

TOML

TOML ้…็ฝฎๆ ผๅผๆ˜ฏๅฎŒๅ…จๅฃฐๆ˜Žๆ€ง็š„ใ€‚ ไธๅŒ…ๅซ่‡ชๅฎšไน‰็›ฎๆ ‡ใ€ๆž„้ขๆˆ–่„šๆœฌ็š„้กน็›ฎๅฏไปฅไฝฟ็”จ TOML ๆ ผๅผใ€‚ ็”ฑไบŽ TOML ่งฃๆžๅ™จๅฏ็”จไบŽๅคš็ง่ฏญ่จ€๏ผŒๅ› ๆญคไฝฟ็”จๆญคๆ ผๅผๆœ‰ๅŠฉไบŽไธŽ้ž Lean ็ผ–ๅ†™็š„ๅทฅๅ…ท้›†ๆˆใ€‚

Lean

Lean ้…็ฝฎๆ ผๅผๆ›ดๅŠ ็ตๆดป๏ผŒๅ…่ฎธ่‡ชๅฎšไน‰็›ฎๆ ‡ใ€ๆ–น้ขๅ’Œ่„šๆœฌใ€‚ ๅฎƒๅ…ทๆœ‰ๅตŒๅ…ฅๅผ็‰นๅฎšไบŽๅŸŸ็š„่ฏญ่จ€๏ผŒ็”จไบŽๆ่ฟฐ TOML ๆ ผๅผไธญๆไพ›็š„้…็ฝฎ้€‰้กน็š„ๅฃฐๆ˜Žๆ€งๅญ้›†ใ€‚ ๆญคๅค–๏ผŒLake API ๅฏ็”จไบŽ่กจ่พพๅฃฐๆ˜Žๆ€ง้€‰้กนๅฏ่ƒฝๆ€งไน‹ๅค–็š„ๆž„ๅปบ้…็ฝฎใ€‚

ๅ‘ฝไปค lake translate-config ๅฏ็”จไบŽๅœจไธค็งๆ ผๅผไน‹้—ด่‡ชๅŠจ่ฝฌๆขใ€‚

่ฟ™ไธค็งๆ ผๅผ้ƒฝ็”ฑ Lake ่ฟ›่กŒ็ฑปไผผ็š„ๅค„็†๏ผŒๅฎƒไปฅๅ†…้ƒจ็ป“ๆž„็ฑปๅž‹็š„ๅฝขๅผไปŽ้…็ฝฎๆ–‡ไปถไธญๆๅ– ๅŒ…้…็ฝฎใ€‚ ๅฝ“ๅŒ…ไธบ ๅทฒ้…็ฝฎ ๆ—ถ๏ผŒ็”Ÿๆˆ็š„ๆ•ฐๆฎ็ป“ๆž„ๅฐ†ๅ†™ๅ…ฅ ๆž„ๅปบ็›ฎๅฝ• ไธญ็š„ lakefile.oleanใ€‚

24.1.3.1.ย ๅฃฐๆ˜Žๆ€ง TOML ๆ ผๅผ๐Ÿ”—

TOMLTom ๆ˜พ่€Œๆ˜“่ง็š„ๆœ€ๅฐ่ฏญ่จ€ ๆ˜ฏ้…็ฝฎๆ–‡ไปถ็š„ๆ ‡ๅ‡†ๅŒ–ๆ ผๅผใ€‚ ้…็ฝฎๆ–‡ไปถๆ่ฟฐ Lake ๅŒ…้…็ฝฎ ๆ–‡ไปถๆœ€ๅธธ็”จ็š„ๅฃฐๆ˜Žๆ€งๅญ้›†ใ€‚ TOML ๆ–‡ไปถ่กจ็คบtables๏ผŒๅฎƒๅฐ†้”ฎๆ˜ ๅฐ„ๅˆฐๅ€ผใ€‚ ๅ€ผๅฏ่ƒฝ็”ฑๅญ—็ฌฆไธฒใ€ๆ•ฐๅญ—ใ€ๅ€ผๆ•ฐ็ป„ๆˆ–ๅ…ถไป–่กจๆ ผ็ป„ๆˆใ€‚ ็”ฑไบŽ TOML ๅœจๆ–‡ไปถ็ป“ๆž„ๆ–น้ขๅ…ทๆœ‰็›ธๅฝ“ๅคง็š„็ตๆดปๆ€ง๏ผŒๅ› ๆญคๆœฌๅ‚่€ƒๆ–‡ๆกฃ่ฎฐๅฝ•ไบ†้ข„ๆœŸ็š„ๅ€ผ๏ผŒ่€Œไธๆ˜ฏ็”จไบŽ็”Ÿๆˆๅฎƒไปฌ็š„็‰นๅฎš่ฏญๆณ•ใ€‚

lakefile.toml ็š„ๅ†…ๅฎนๅบ”่กจ็คบๆ่ฟฐ Lean ๅŒ…็š„ TOML ่กจใ€‚ ๆญค้…็ฝฎ็”ฑๆ่ฟฐๆ•ดไธชๅŒ…็š„ๆ ‡้‡ๅญ—ๆฎตไปฅๅŠๅŒ…ๅซๅ…ถไป–่กจๆ•ฐ็ป„็š„ไปฅไธ‹ๅญ—ๆฎต็ป„ๆˆ๏ผš

  • require

  • lean_lib

  • lean_exe

็›ฎๅ‰๏ผŒไธๅฑžไบŽๆญคๅค„ๆ่ฟฐ็š„้…็ฝฎ่กจไธ€้ƒจๅˆ†็š„ๅญ—ๆฎตๅฐ†่ขซๅฟฝ็•ฅใ€‚ ไธบไบ†ๅ‡ๅฐ‘ๆ‹ผๅ†™้”™่ฏฏ็š„้ฃŽ้™ฉ๏ผŒ่ฟ™็งๆƒ…ๅ†ตๅฐ†ๆฅๅฏ่ƒฝไผšๆ”นๅ˜ใ€‚ Lake ๆœชไฝฟ็”จ็š„ๅญ—ๆฎตๅ็งฐไธๅบ”็”จไบŽๅญ˜ๅ‚จ่ฆ็”ฑๅ…ถไป–ๅทฅๅ…ทๅค„็†็š„ๅ…ƒๆ•ฐๆฎใ€‚

24.1.3.1.1.ย ๅฐ่ฃ…้…็ฝฎ๐Ÿ”—

lakefile.toml ็š„้กถ็บงๅ†…ๅฎนๆŒ‡ๅฎš้€‚็”จไบŽๅŒ…ๆœฌ่บซ็š„้€‰้กน๏ผŒๅŒ…ๆ‹ฌๅ็งฐๅ’Œ็‰ˆๆœฌ็ญ‰ๅ…ƒๆ•ฐๆฎใ€ๅทฅไฝœ็ฉบ้—ดไธญๆ–‡ไปถ็š„ไฝ็ฝฎใ€็”จไบŽๆ‰€ๆœ‰ ็›ฎๆ ‡ ็š„็ผ–่ฏ‘ๅ™จๆ ‡ๅฟ—๏ผŒไปฅๅŠ ๅ”ฏไธ€็š„ๅฟ…ๅกซๅญ—ๆฎตๆ˜ฏ name๏ผŒๅฎƒๅฃฐๆ˜ŽๅŒ…็š„ๅ็งฐใ€‚

TOML table
Package Configuration

A Package's declarative configuration.

Metadata:

่ฟ™ไบ›้€‰้กนๆ่ฟฐไบ†ๅŒ…ใ€‚ Reservoir ไฝฟ็”จๅฎƒไปฌๆฅ็ดขๅผ•ๅ’Œๆ˜พ็คบๅŒ…ใ€‚ ๅฆ‚ๆžœ็œ็•ฅๆŸไธชๅญ—ๆฎต๏ผŒReservoir ๅฏไปฅไฝฟ็”จๅŒ…็š„ GitHub ๅญ˜ๅ‚จๅบ“ไธญ็š„ไฟกๆฏๆฅๅกซๅ†™่ฏฆ็ป†ไฟกๆฏใ€‚

name

Contains: The package name

ๅŒ…็š„ๅ็งฐใ€‚

version

Contains: Version string

The package version. Versions have the form:

v!"<major>.<minor>.<patch>[-<specialDescr>]"

A version with a - suffix is considered a "prerelease".

Lake suggest the following guidelines for incrementing versions:

  • Major version increment (e.g., v1.3.0 โ†’ v2.0.0) Indicates significant breaking changes in the package. Package users are not expected to update to the new version without manual intervention.

  • Minor version increment (e.g., v1.3.0 โ†’ v1.4.0) Denotes notable changes that are expected to be generally backwards compatible. Package users are expected to update to this version automatically and should be able to fix any breakages and/or warnings easily.

  • Patch version increment (e.g., v1.3.0 โ†’ v1.3.1) Reserved for bug fixes and small touchups. Package users are expected to update automatically and should not expect significant breakage, except in the edge case of users relying on the behavior of patched bugs.

Note that backwards-incompatible changes may occur at any version increment. The is because the current nature of Lean (e.g., transitive imports, rich metaprogramming, reducibility in proofs), makes it infeasible to define a completely stable interface for a package. Instead, the different version levels indicate a change's intended significance and how difficult migration is expected to be.

Versions of form the 0.x.x are considered development versions prior to first official release. Like prerelease, they are not expected to closely follow the above guidelines.

Packages without a defined version default to 0.0.0.

versionTags

Contains: String pattern

Git tags of this package's repository that should be treated as versions. Package indices (e.g., Reservoir) can make use of this information to determine the Git revisions corresponding to released versions.

Defaults to tags that are "version-like". That is, start with a v followed by a digit.

description

Contains: String

A short description for the package (e.g., for Reservoir).

keywords

Contains: Array of strings

Custom keywords associated with the package. Reservoir can make use of a package's keywords to group related packages together and make it easier for users to discover them.

Good keywords include the domain (e.g., math, software-verification, devtool), specific subtopics (e.g., topology, cryptology), and significant implementation details (e.g., dsl, ffi, cli). For instance, Lake's keywords could be devtool, cli, dsl, package-manager, and build-system.

homepage

Contains: String

A URL to information about the package.

Reservoir will already include a link to the package's GitHub repository (if the package is sourced from there). Thus, users are advised to specify something else for this (if anything).

license

Contains: String

The package's license (if one). Should be a valid SPDX License Expression.

Reservoir requires that packages uses an OSI-approved license to be included in its index, and currently only supports single identifier SPDX expressions. For, a list of OSI-approved SPDX license identifiers, see the SPDX LIcense List.

licenseFiles

Contains: Array of paths

Files containing licensing information for the package.

These should be the license files that users are expected to include when distributing package sources, which may be more then one file for some licenses. For example, the Apache 2.0 license requires the reproduction of a NOTICE file along with the license (if such a file exists).

Defaults to #["LICENSE"].

readmeFile

Contains: Path

The path to the package's README.

A README should be a Markdown file containing an overview of the package. Reservoir displays the rendered HTML of this file on a package's page. A nonstandard location can be used to provide a different README for Reservoir and GitHub.

Defaults to README.md.

reservoir

Contains: Boolean

Whether Reservoir should include the package in its index. When set to false, Reservoir will not add the package to its index and will remove it if it was already there (when Reservoir is next updated).

Layout:

่ฟ™ไบ›้€‰้กนๆŽงๅˆถๅŒ…็š„้กถ็บง็›ฎๅฝ•ๅธƒๅฑ€ๅŠๅ…ถๆž„ๅปบ็›ฎๅฝ•ใ€‚ ๅŒ…ๅ†…็š„ๅบ“ใ€ๅฏๆ‰ง่กŒๆ–‡ไปถๅ’Œ็›ฎๆ ‡ๆŒ‡ๅฎš็š„ๅ…ถไป–่ทฏๅพ„ไธŽ่ฟ™ไบ›็›ฎๅฝ•็›ธๅ…ณใ€‚

srcDir

Contains: Path

The directory containing the package's Lean source files. Defaults to the package's directory.

(This will be passed to lean as the -R option.)

buildDir

Contains: Path

The directory to which Lake should output the package's build results. Defaults to defaultBuildDir (i.e., .lake/build).

nativeLibDir

Contains: Path

The build subdirectory to which Lake should output the package's native libraries (e.g., .a, .so, .dll files). Defaults to defaultNativeLibDir (i.e., lib).

binDir

Contains: Path

The build subdirectory to which Lake should output the package's binary executable. Defaults to defaultBinDir (i.e., bin).

irDir

Contains: Path

The build subdirectory to which Lake should output the package's intermediary results (e.g., .c and .o files). Defaults to defaultIrDir (i.e., ir).

packagesDir

Contains: Path

The directory to which Lake should download remote dependencies. Defaults to defaultPackagesDir (i.e., .lake/packages).

Building and Running:

่ฟ™ไบ›้€‰้กน้…็ฝฎไปฃ็ ๅœจๅŒ…ไธญ็š„ๆž„ๅปบๅ’Œ่ฟ่กŒๆ–นๅผใ€‚ ๅŒ…ไธญ็š„ๅบ“ใ€ๅฏๆ‰ง่กŒๆ–‡ไปถๅ’Œๅ…ถไป– ็›ฎๆ ‡ ๅฏไปฅ่ฟ›ไธ€ๆญฅๆทปๅŠ ๅˆฐๆญค้…็ฝฎ็š„้ƒจๅˆ†ใ€‚

extraDepTargets

Contains: Array of strings

An Array of target names to build whenever the package is used.

precompileModules

Contains: Boolean

Whether to compile each of the package's module into a native shared library that is loaded whenever the module is imported. This speeds up evaluation of metaprograms and enables the interpreter to run functions marked @[extern].

Defaults to false.

defaultTargets

Contains: default targets' names (array)

The names of the package's targets to build by default (i.e., on a bare lake build of the package).

moreGlobalServerArgs

Contains: Array of strings

Additional arguments to pass to the Lean language server (i.e., lean --server) launched by lake serve, both for this package and also for any packages browsed from this one in the same session.

leanLibDir

Contains: Path

The build subdirectory to which Lake should output the package's binary Lean libraries (e.g., .olean, .ilean files). Defaults to defaultLeanLibDir (i.e., lib).

buildType

Contains: one of "debug", "relWithDebInfo", "minSizeRel", "release"

The mode in which the modules should be built (e.g., debug, release). Defaults to release.

leanOptions

Contains: Array of Lean options

An Array of additional options to pass to both the Lean language server (i.e., lean --server) launched by lake serve and to lean when compiling a module's Lean source files.

moreLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

weakLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

Unlike moreLeanArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeanArgs.

moreLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Lake already passes some flags based on the buildType, but you can change this by, for example, adding -O0 and -UNDEBUG.

moreServerOptions

Contains: Array of Lean options

Additional options to pass to the Lean language server (i.e., lean --server) launched by lake serve.

weakLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Unlike moreLeancArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeancArgs.

moreLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

weakLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

Unlike moreLinkArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLinkArgs.

platformIndependent

Contains: Boolean (optional)

Asserts whether Lake should assume Lean modules are platform-independent.

  • If false, Lake will add System.Platform.target to the module traces within the code unit (e.g., package or library). This will force Lean code to be re-elaborated on different platforms.

  • If true, Lake will exclude platform-dependent elements (e.g., precompiled modules, external libraries) from a module's trace, preventing re-elaboration on different platforms. Note that this will not effect modules outside the code unit in question. For example, a platform-independent package which depends on a platform-dependent library will still be platform-dependent.

  • If none, Lake will construct traces as natural. That is, it will include platform-dependent artifacts in the trace if they module depends on them, but otherwise not force modules to be platform-dependent.

There is no check for correctness here, so a configuration can lie and Lake will not catch it. Defaults to none.

Testing and Linting:

CLI ๅ‘ฝไปค lake test ๅ’Œ lake lint ไฝฟ็”จ็”ฑ ๅทฅไฝœ็ฉบ้—ด ็š„ ๆ นๅŒ… ้…็ฝฎ็š„ๅฎšไน‰ๆฅๆ‰ง่กŒๆต‹่ฏ•ๅ’Œ lintingใ€‚ ่ฟ่กŒไปฅๆ‰ง่กŒๆต‹่ฏ•ๅ’Œ linting ็š„ไปฃ็ ็งฐไธบๆต‹่ฏ•ๆˆ– lint ้ฉฑๅŠจ็จ‹ๅบใ€‚ ๅœจ Lean ้…็ฝฎๆ–‡ไปถไธญ๏ผŒๅฏไปฅ้€š่ฟ‡ๅฐ† @[test_driver] ๆˆ– @[lint_driver] ๅฑžๆ€งๅบ”็”จไบŽ Lake ่„šๆœฌ ๆˆ–ๅฏๆ‰ง่กŒๆ–‡ไปถๆˆ–ๅบ“็›ฎๆ ‡ๆฅๆŒ‡ๅฎš่ฟ™ไบ›ๆ–‡ไปถใ€‚ ๅœจ Lean ๅ’Œ TOML ้…็ฝฎๆ–‡ไปถไธญ๏ผŒไนŸๅฏไปฅ้€š่ฟ‡่ฎพ็ฝฎ่ฟ™ไบ›้€‰้กนๆฅ้…็ฝฎๅฎƒไปฌใ€‚ ๅฏไปฅไฝฟ็”จๅญ—็ฌฆไธฒ "PKG/TGT" ๅฐ†ไพ่ต–้กน PKG ไธญ็š„็›ฎๆ ‡ๆˆ–่„šๆœฌ TGT ๆŒ‡ๅฎšไธบๆต‹่ฏ•ๆˆ– lint ้ฉฑๅŠจ็จ‹ๅบ

testDriver

Contains: String

The name of the script, executable, or library by lake test when this package is the workspace root. To point to a definition in another package, use the syntax <pkg>/<def>.

A script driver will be run by lake test with the arguments configured in testDriverArgs followed by any specified on the CLI (e.g., via lake lint -- <args>...). An executable driver will be built and then run like a script. A library will just be built.

testDriverArgs

Contains: Array of strings

Arguments to pass to the package's test driver. These arguments will come before those passed on the command line via lake test -- <args>....

lintDriver

Contains: String

The name of the script or executable used by lake lint when this package is the workspace root. To point to a definition in another package, use the syntax <pkg>/<def>.

A script driver will be run by lake lint with the arguments configured in lintDriverArgs followed by any specified on the CLI (e.g., via lake lint -- <args>...). An executable driver will be built and then run like a script.

lintDriverArgs

Contains: Array of strings

Arguments to pass to the package's linter. These arguments will come before those passed on the command line via lake lint -- <args>....

builtinLint

Contains: Boolean (optional)

Whether to run Lake's built-in linter on the package.

  • true โ€” Always run built-in lints. When a lint driver is also configured, built-in lints run before the driver.

  • false โ€” Never run built-in lints by default. lake check-lint will exit with a nonzero code if no lint driver is configured either.

  • none (default) โ€” Currently equivalent to false. In a future release, none will run built-in lints when no lint driver is configured (i.e., act like true as a fallback).

Cloud Releases:

่ฟ™ไบ›้€‰้กนๅฎšไน‰ๅŒ…็š„ไบ‘็‰ˆๆœฌ๏ผŒๅฆ‚ GitHub ็‰ˆๆœฌ็‰ˆๆœฌ ้ƒจๅˆ†ไธญๆ‰€่ฟฐใ€‚

releaseRepo

Contains: String (optional)

The URL of the GitHub repository to upload and download releases of this package. If none (the default), for downloads, Lake uses the URL the package was download from (if it is a dependency) and for uploads, uses gh's default.

buildArchive

Contains: String (optional)

A custom name for the build archive for the GitHub cloud release. If none (the default), Lake defaults to {(pkg-)name}-{System.Platform.target}.tar.gz.

preferReleaseBuild

Contains: Boolean

Whether to prefer downloading a prebuilt release (from GitHub) rather than building this package from the source when this package is used as a dependency.

Other Fields:

bootstrap

Contains: Boolean

For internal use. Whether this package is Lean itself.

enableArtifactCache

Contains: Boolean (optional)

Whether to enables Lake's local, offline artifact cache for the package.

Artifacts (i.e., build products) of packages will be shared across local copies by storing them in a cache associated with the Lean toolchain. This can significantly reduce initial build times and disk space usage when working with multiple copies of large projects or large dependencies.

As a caveat, build targets which support the artifact cache will not be stored in their usual location within the build directory. Thus, projects with custom build scripts that rely on specific location of artifacts may wish to disable this feature.

If none (the default), this will fallback to (in order):

  • The LAKE_ARTIFACT_CACHE environment variable (if set).

  • The workspace root's enableArtifactCache configuration (if set and this package is a dependency).

  • Lake's default: The package can use artifacts from the cache, but cannot write to it.

restoreAllArtifacts

Contains: Boolean (optional)

Whether, when the local artifact cache is enabled, Lake should copy all cached artifacts into the build directory. This ensures the build results are available to external consumers who expect them in the build directory.

If none (the default), this will fallback to (in order):

  • The LAKE_RESTORE_ARTIFACTS environment variable (if set).

  • The workspace root's restoreAllArtifacts configuration (if set and this package is a dependency).

  • Lake's default: false.

libPrefixOnWindows

Contains: Boolean

Whether native libraries (of this package) should be prefixed with lib on Windows.

Unlike Unix, Windows does not require native libraries to start with lib and, by convention, they usually do not. However, for consistent naming across all platforms, users may wish to enable this.

Defaults to false.

allowImportAll

Contains: Boolean

Whether downstream packages can import all modules of this package.

If enabled, downstream users will be able to access the private internals of modules, including definition bodies not marked as @[expose]. This may also, in the future, prevent compiler optimization which rely on private definitions being inaccessible outside their own package.

Defaults to false.

fixedToolchain

Contains: Boolean

Whether this package is expected to function only on a single toolchain (the package's toolchain).

This informs Lake's toolchain update procedure (in lake update) to prioritize this package's toolchain. It also avoids the need to separate input-to-output mappings for this package by toolchain version in the Lake cache.

Defaults to false.

moreLinkObjs

Contains: Array of paths

Additional target objects to use when linking (both static and shared). These will come after the paths of native facets.

moreLinkLibs

Contains: Array of dynamic libraries

Additional target libraries to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of other link objects.

Minimal TOML Package Configuration

Lean package ็š„ๆœ€ๅฐ TOML ้…็ฝฎไป…่ฎพ็ฝฎๅŒ…็š„ๅ็งฐ๏ผŒไฝฟ็”จๆ‰€ๆœ‰ๅ…ถไป–ๅญ—ๆฎต็š„้ป˜่ฎคๅ€ผใ€‚ ่ฏฅ่ฝฏไปถๅŒ…ไธๅŒ…ๅซ targets๏ผŒๅ› ๆญคๆ— ้œ€ๆž„ๅปบไปฃ็ ใ€‚

name = "example-package"
Library TOML Package Configuration

Lean package ็š„ๆœ€ๅฐ TOML ้…็ฝฎ่ฎพ็ฝฎๅŒ…็š„ๅ็งฐๅนถๅฎšไน‰ๅบ“็›ฎๆ ‡ใ€‚ ่ฏฅๅบ“ๅไธบ Sorting๏ผŒๅ…ถๆจกๅ—้ข„่ฎกไฝไบŽ Sorting.* ๅฑ‚ๆฌก็ป“ๆž„ไธ‹ใ€‚

name = "example-package"
defaultTargets = ["Sorting"]

[[lean_lib]]
name = "Sorting"

24.1.3.1.2.ย ไพ่ต–ๅ…ณ็ณป๐Ÿ”—

ไพ่ต–ๅ…ณ็ณปๅœจๅŒ…้…็ฝฎ็š„ [[require]] ๅญ—ๆฎตๆ•ฐ็ป„ไธญๆŒ‡ๅฎš๏ผŒ่ฏฅๆ•ฐ็ป„ๆŒ‡ๅฎšๆฏไธชๅŒ…็š„ๅ็งฐๅ’Œๆบใ€‚ ๆฅๆบๆœ‰ไปฅไธ‹ไธ‰็ง๏ผš

  • Reservoir๏ผŒๆˆ–ๆ›ฟไปฃๅŒ…ๆณจๅ†Œ่กจ

  • Git ๅญ˜ๅ‚จๅบ“๏ผŒๅฏ่ƒฝๆ˜ฏๆœฌๅœฐ่ทฏๅพ„ๆˆ– URL

  • ๆœฌๅœฐ่ทฏๅพ„

TOML table
Requiring Packages โ€” [[require]]

A Dependency of a package. It specifies a package which another package depends on. This encodes the information contained in the require DSL syntax.

path ๅ’Œ git ๅญ—ๆฎตๆŒ‡ๅฎšไพ่ต–้กน็š„ๆ˜พๅผๆบใ€‚ ๅฆ‚ๆžœไธค่€…ๅ‡ๆœชๆไพ›๏ผŒๅˆ™ไปŽ Reservoir ๆˆ–ๅค‡็”จๆณจๅ†Œ่กจ๏ผˆๅฆ‚ๆžœๅทฒ้…็ฝฎ๏ผ‰ไธญ่Žทๅ–ไพ่ต–้กนใ€‚ ไปŽ Reservoir ่Žทๅ–ๅŒ…ๆ—ถ้œ€่ฆ scope ๅญ—ๆฎตใ€‚

Fields:

path

Contains: Path

ๅฏนๆœฌๅœฐๆ–‡ไปถ็ณป็ปŸ็š„ไพ่ต–๏ผŒ็”ฑๅ…ถ่ทฏๅพ„ๆŒ‡ๅฎšใ€‚

git

Contains: Git specification

Git ๅญ˜ๅ‚จๅบ“ไธญ็š„ไพ่ต–้กน๏ผŒ้€š่ฟ‡ๅ…ถ URL ไฝœไธบๅญ—็ฌฆไธฒๆˆ–้€š่ฟ‡ๅธฆๆœ‰้”ฎ็š„่กจๆŒ‡ๅฎš๏ผš

  • url๏ผšๅญ˜ๅ‚จๅบ“ URL

  • subDir๏ผšๅŒ…ๅซๅŒ…ๆบไปฃ็ ็š„ Git ๅญ˜ๅ‚จๅบ“็š„ๅญ็›ฎๅฝ•

rev

Contains: Git revision

ๅฏนไบŽ Git ๆˆ– Reservoir ไพ่ต–้กน๏ผŒๆญคๅญ—ๆฎตๆŒ‡ๅฎš Git ไฟฎ่ฎข็‰ˆๆœฌ๏ผŒๅฏไปฅๆ˜ฏๅˆ†ๆ”ฏๅ็งฐใ€ๆ ‡็ญพๅ็งฐๆˆ–็‰นๅฎšๅ“ˆๅธŒใ€‚ ๅœจ Reservoir ไธŠ๏ผŒversion ๅญ—ๆฎตไผ˜ๅ…ˆไบŽ่ฏฅๅญ—ๆฎตใ€‚

source

Contains: Package Source

ไพ่ต–้กนๆบ๏ผŒๆŒ‡ๅฎšไธบ็‹ฌ็ซ‹่กจ๏ผŒๅฝ“ git ๅ’Œ path ๅฏ†้’ฅ้ƒฝไธๅญ˜ๅœจๆ—ถไฝฟ็”จใ€‚ ๅฏ†้’ฅ type ๅบ”่ฏฅๆ˜ฏๅญ—็ฌฆไธฒ "git" ๆˆ–ๅญ—็ฌฆไธฒ "path"ใ€‚ ๅฆ‚ๆžœ็ฑปๅž‹ไธบ "path"๏ผŒๅˆ™ๅฟ…้กป่ฟ˜ๆœ‰ๅฆไธ€ไธช้”ฎ "path"๏ผŒๅ…ถๅ€ผๆ˜ฏๆไพ›ๅŒ…ๅœจ็ฃ็›˜ไธŠ็š„ไฝ็ฝฎ็š„ๅญ—็ฌฆไธฒใ€‚ ๅฆ‚ๆžœ็ฑปๅž‹ไธบ "git"๏ผŒๅˆ™ๅบ”ๅญ˜ๅœจไปฅไธ‹้”ฎ๏ผš

  • url๏ผšๅญ˜ๅ‚จๅบ“ URL

  • rev๏ผšGit ไฟฎ่ฎข็‰ˆ๏ผŒๅฏไปฅๆ˜ฏๅˆ†ๆ”ฏๅ็งฐใ€ๆ ‡็ญพๅ็งฐๆˆ–็‰นๅฎšๅ“ˆๅธŒ๏ผˆๅฏ้€‰๏ผ‰

  • subDir๏ผšๅŒ…ๅซๅŒ…ๆบไปฃ็ ็š„ Git ๅญ˜ๅ‚จๅบ“็š„ๅญ็›ฎๅฝ•

version

Contains: version as string

The target version of the dependency. A Git revision can be specified with the syntax git#<rev>.

name

Contains: String

The package name of the dependency. This name must match the one declared in its configuration file, as that name is used to index its target data types. For this reason, the package name must also be unique across packages in the dependency graph.

scope

Contains: String

An additional qualifier used to distinguish packages of the same name in a Lake registry. On Reservoir, this is the package owner.

Requiring Packages from Reservoir

ไฝฟ็”จๆญค TOML ้…็ฝฎ๏ผŒๅฏไปฅไปŽ Reservoir ่Žทๅ–่ฝฏไปถๅŒ… example๏ผš

[[require]]
name = "example"
version = "2.12"
scope = "exampleDev"
Requiring Packages from Git

ๅฏไปฅไฝฟ็”จไปฅไธ‹ TOML ้…็ฝฎไปŽ Git ๅญ˜ๅ‚จๅบ“ไธญ่Žทๅ–ๅŒ… example๏ผš

[[require]]
name = "example"
git = "https://git.example.com/example.git"
rev = "main"
version = "2.12"

็‰นๅˆซๆ˜ฏ๏ผŒๅฐ†ไปŽ main ๅˆ†ๆ”ฏๆฃ€ๅ‡บ่ฝฏไปถๅŒ…๏ผŒๅนถไธ”่ฝฏไปถๅŒ…็š„ configuration ไธญๆŒ‡ๅฎš็š„็‰ˆๆœฌๅทๅบ”ไธŽ 2.12 ๅŒน้…ใ€‚

Requiring Packages from a Git tag

ไฝฟ็”จๆญค TOML ้…็ฝฎ๏ผŒๅฏไปฅไปŽ Git ๅญ˜ๅ‚จๅบ“ไธญ็š„ๆ ‡็ญพ v2.12 ่Žทๅ–ๅŒ… example๏ผš

[[require]]
name = "example"
git = "https://git.example.com/example.git"
rev = "v2.12"

ๆœชไฝฟ็”จๅŒ…็š„ configuration ไธญๆŒ‡ๅฎš็š„็‰ˆๆœฌๅทใ€‚

Requiring Reservoir Packages from a Git tag

ไฝฟ็”จ Reservoir ๆ‰พๅˆฐ็š„ๅŒ… example ๅฏไปฅไฝฟ็”จไปฅไธ‹ TOML ้…็ฝฎไปŽๅ…ถ Git ๅญ˜ๅ‚จๅบ“ไธญ็š„ๆ ‡็ญพ v2.12 ่Žทๅ–๏ผš

[[require]]
name = "example"
rev = "v2.12"
scope = "exampleDev"

ๆœชไฝฟ็”จๅŒ…็š„ configuration ไธญๆŒ‡ๅฎš็š„็‰ˆๆœฌๅทใ€‚

Requiring Packages from Paths

ไฝฟ็”จๆญค TOML ้…็ฝฎ๏ผŒๅฏไปฅไปŽๆœฌๅœฐ่ทฏๅพ„ ../example ่Žทๅ–ๅŒ… example๏ผš

[[require]]
name = "example"
path = "../example"

ๅฝ“ๅœจๅ•ไธชๅญ˜ๅ‚จๅบ“ไธญๅผ€ๅ‘ๅคšไธชๅŒ…ๆ—ถ๏ผŒๆˆ–่€…ๅœจๆต‹่ฏ•ๅฏนไพ่ต–้กน็š„ๆ›ดๆ”นๆ˜ฏๅฆไฟฎๅคไบ†ไธ‹ๆธธๅŒ…ไธญ็š„้”™่ฏฏๆ—ถ๏ผŒๅฏนๆœฌๅœฐ่ทฏๅพ„็š„ไพ่ต–ๅ…ณ็ณป้žๅธธๆœ‰็”จใ€‚

Sources as Tables

ๅŒ…ๆฅๆบ็š„ไฟกๆฏๅฏไปฅๅ†™ๅœจไธ€ไธชๆ˜พๅผ็š„่กจไธญใ€‚

[[require]]
name = "example"
source = {type = "git", url = "https://example.com/example.git"}

24.1.3.1.3.ย ๅบ“็›ฎๆ ‡๐Ÿ”—

ๅบ“็›ฎๆ ‡้ข„่ฎกไฝไบŽ lean_lib ่กจๆ•ฐ็ป„ไธญใ€‚

TOML table
Library Targets โ€” [[lean_lib]]

A Lean library's declarative configuration.

Fields:

name

Contains: The library name

ๅบ“็š„ๅ็งฐ๏ผŒ้€šๅธธไธŽๅ…ถๅ•ไธชๆจกๅ—ๆ น็›ธๅŒใ€‚

srcDir

Contains: Path

The subdirectory of the package's source directory containing the library's Lean source files. Defaults simply to said srcDir.

(This will be passed to lean as the -R option.)

roots

Contains: Array of strings

The root module(s) of the library. Submodules of these roots (e.g., Lib.Foo of Lib) are considered part of the library. Defaults to a single root of the target's name.

libName

Contains: String

The name of the library artifact. Used as a base for the file names of its static and dynamic binaries. Defaults to the mangled name of the target.

libPrefixOnWindows

Contains: Boolean

Whether static and shared binaries of this library should be prefixed with lib on Windows.

Unlike Unix, Windows does not require native libraries to start with lib and, by convention, they usually do not. However, for consistent naming across all platforms, users may wish to enable this.

Defaults to false.

needs

Contains: Array of targets

An Array of targets to build before the executable's modules.

extraDepTargets

Contains: Array of strings

Deprecated. Use needs instead. An Array of target names to build before the library's modules.

precompileModules

Contains: Boolean

Whether to compile each of the library's modules into a native shared library that is loaded whenever the module is imported. This speeds up evaluation of metaprograms and enables the interpreter to run functions marked @[extern].

Defaults to false.

defaultFacets

Contains: Array of strings

An Array of library facets to build on a bare lake build of the library. For example, #[LeanLib.sharedFacet] will build the shared library facet.

allowImportAll

Contains: Boolean

Whether downstream packages can import all modules of this library.

If enabled, downstream users will be able to access the private internals of modules, including definition bodies not marked as @[expose]. This may also, in the future, prevent compiler optimization which rely on private definitions being inaccessible outside their own package.

Defaults to false.

buildType

Contains: one of "debug", "relWithDebInfo", "minSizeRel", "release"

The mode in which the modules should be built (e.g., debug, release). Defaults to release.

leanOptions

Contains: Array of Lean options

An Array of additional options to pass to both the Lean language server (i.e., lean --server) launched by lake serve and to lean when compiling a module's Lean source files.

moreLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

weakLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

Unlike moreLeanArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeanArgs.

moreLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Lake already passes some flags based on the buildType, but you can change this by, for example, adding -O0 and -UNDEBUG.

moreServerOptions

Contains: Array of Lean options

Additional options to pass to the Lean language server (i.e., lean --server) launched by lake serve.

weakLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Unlike moreLeancArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeancArgs.

moreLinkObjs

Contains: Array of paths

Additional target objects to use when linking (both static and shared). These will come after the paths of native facets.

moreLinkLibs

Contains: Array of dynamic libraries

Additional target libraries to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of other link objects.

moreLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

weakLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

Unlike moreLinkArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLinkArgs.

platformIndependent

Contains: Boolean (optional)

Asserts whether Lake should assume Lean modules are platform-independent.

  • If false, Lake will add System.Platform.target to the module traces within the code unit (e.g., package or library). This will force Lean code to be re-elaborated on different platforms.

  • If true, Lake will exclude platform-dependent elements (e.g., precompiled modules, external libraries) from a module's trace, preventing re-elaboration on different platforms. Note that this will not effect modules outside the code unit in question. For example, a platform-independent package which depends on a platform-dependent library will still be platform-dependent.

  • If none, Lake will construct traces as natural. That is, it will include platform-dependent artifacts in the trace if they module depends on them, but otherwise not force modules to be platform-dependent.

There is no check for correctness here, so a configuration can lie and Lake will not catch it. Defaults to none.

dynlibs

Contains: Array of dynamic libraries

plugins

Contains: Array of dynamic libraries

Minimal Library Target

่ฏฅๅบ“ๅฃฐๆ˜Žไป…ๆไพ›ไธ€ไธชๅ็งฐ๏ผš

[[lean_lib]]
name = "TacticTools"

่ฏฅๅบ“็š„ๆบไปฃ็ ไฝไบŽๅŒ…็š„้ป˜่ฎคๆบ็›ฎๅฝ•ไธญ๏ผŒไฝไบŽไปฅ TacticTools ไธบๆ น็š„ๆจกๅ—ๅฑ‚ๆฌก็ป“ๆž„ไธญใ€‚

Configured Library Target

่ฏฅๅบ“ๅฃฐๆ˜Žๆไพ›ไบ†ๆ›ดๅคš้€‰้กน๏ผš

[[lean_lib]]
name = "TacticTools"
srcDir = "src"
precompileModules = true

่ฏฅๅบ“็š„ๆบไปฃ็ ไฝไบŽ็›ฎๅฝ• src ไธญ๏ผŒไฝไบŽไปฅ TacticTools ไธบๆ น็š„ๆจกๅ—ๅฑ‚ๆฌก็ป“ๆž„ไธญใ€‚ ๅฆ‚ๆžœๅœจ็ฒพๅŒ–ๆ—ถ้—ด่ฎฟ้—ฎๅ…ถๆจกๅ—๏ผŒๅฎƒไปฌๅฐ†่ขซ็ผ–่ฏ‘ไธบๆœฌๆœบไปฃ็ ๅนถ้“พๆŽฅ๏ผŒ่€Œไธๆ˜ฏๅœจ่งฃ้‡Šๅ™จไธญ่ฟ่กŒใ€‚

24.1.3.1.4.ย ๅฏๆ‰ง่กŒ็›ฎๆ ‡๐Ÿ”—

TOML table
Executable Targets โ€” [[lean_exe]]

A Lean executable's declarative configuration.

Fields:

name

Contains: The executable's name

ๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ๅ็งฐใ€‚

srcDir

Contains: Path

The subdirectory of the package's source directory containing the executable's Lean source file. Defaults simply to said srcDir.

(This will be passed to lean as the -R option.)

root

Contains: String

The root module of the binary executable. Should include a main definition that will serve as the entry point of the program.

The root is built by recursively building its local imports (i.e., fellow modules of the workspace).

Defaults to the name of the target.

exeName

Contains: String

The name of the binary executable. Defaults to the target name with any . replaced with a -.

needs

Contains: Array of targets

An Array of targets to build before the executable's modules.

extraDepTargets

Contains: Array of strings

Deprecated. Use needs instead. An Array of target names to build before the executable's modules.

supportInterpreter

Contains: Boolean

Enables the executable to interpret Lean files (e.g., via Lean.Elab.runFrontend) by exposing symbols within the executable to the Lean interpreter.

Implementation-wise, on Windows, the Lean shared libraries are linked to the executable and, on other systems, the executable is linked with -rdynamic. This increases the size of the binary on Linux and, on Windows, requires libInit_shared.dll and libleanshared.dll to be co-located with the executable or part of PATH (e.g., via lake exe). Thus, this feature should only be enabled when necessary.

Defaults to false.

buildType

Contains: one of "debug", "relWithDebInfo", "minSizeRel", "release"

The mode in which the modules should be built (e.g., debug, release). Defaults to release.

leanOptions

Contains: Array of Lean options

An Array of additional options to pass to both the Lean language server (i.e., lean --server) launched by lake serve and to lean when compiling a module's Lean source files.

moreLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

weakLeanArgs

Contains: Array of strings

Additional arguments to pass to lean when compiling a module's Lean source files.

Unlike moreLeanArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeanArgs.

moreLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Lake already passes some flags based on the buildType, but you can change this by, for example, adding -O0 and -UNDEBUG.

moreServerOptions

Contains: Array of Lean options

Additional options to pass to the Lean language server (i.e., lean --server) launched by lake serve.

weakLeancArgs

Contains: Array of strings

Additional arguments to pass to leanc when compiling a module's C source files generated by lean.

Unlike moreLeancArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLeancArgs.

moreLinkObjs

Contains: Array of paths

Additional target objects to use when linking (both static and shared). These will come after the paths of native facets.

moreLinkLibs

Contains: Array of dynamic libraries

Additional target libraries to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of other link objects.

moreLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

weakLinkArgs

Contains: Array of strings

Additional arguments to pass to leanc when linking (e.g., for shared libraries or binary executables). These will come after the paths of the linked objects.

Unlike moreLinkArgs, these arguments do not affect the trace of the build result, so they can be changed without triggering a rebuild. They come before moreLinkArgs.

platformIndependent

Contains: Boolean (optional)

Asserts whether Lake should assume Lean modules are platform-independent.

  • If false, Lake will add System.Platform.target to the module traces within the code unit (e.g., package or library). This will force Lean code to be re-elaborated on different platforms.

  • If true, Lake will exclude platform-dependent elements (e.g., precompiled modules, external libraries) from a module's trace, preventing re-elaboration on different platforms. Note that this will not effect modules outside the code unit in question. For example, a platform-independent package which depends on a platform-dependent library will still be platform-dependent.

  • If none, Lake will construct traces as natural. That is, it will include platform-dependent artifacts in the trace if they module depends on them, but otherwise not force modules to be platform-dependent.

There is no check for correctness here, so a configuration can lie and Lake will not catch it. Defaults to none.

dynlibs

Contains: Array of dynamic libraries

plugins

Contains: Array of dynamic libraries

Minimal Executable Target

ๆญคๅฏๆ‰ง่กŒๅฃฐๆ˜Žไป…ๆไพ›ไธ€ไธชๅ็งฐ๏ผš

[[lean_exe]]
name = "trustworthytool"

ๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ main ๅ‡ฝๆ•ฐๅบ”ไฝไบŽๅŒ…็š„้ป˜่ฎคๆบๆ–‡ไปถ่ทฏๅพ„ไธญๅไธบ trustworthytool.lean ็š„ๆจกๅ—ไธญใ€‚ ็”Ÿๆˆ็š„ๅฏๆ‰ง่กŒๆ–‡ไปถๅไธบ trustworthytoolใ€‚

Configured Executable Target

็”ฑไบŽ็ ดๆŠ˜ๅท (-)๏ผŒๅ็งฐ trustworthy-tool ไธๆ˜ฏๆœ‰ๆ•ˆ็š„ Lean ๅ็งฐใ€‚ ่ฆๅฐ†ๆญคๅ็งฐ็”จไบŽๅฏๆ‰ง่กŒ็›ฎๆ ‡๏ผŒๅฟ…้กปๆไพ›ๆ˜พๅผๆจกๅ—ๆ นใ€‚ ๅฐฝ็ฎก trustworthy-tool ๆ˜ฏๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ๅฎŒๅ…จๅฏๆŽฅๅ—็š„ๅ็งฐ๏ผŒไฝ†็›ฎๆ ‡่ฟ˜ๆŒ‡ๅฎš็ผ–่ฏ‘ๅ’Œ้“พๆŽฅ็š„็ป“ๆžœๅบ”ๅ‘ฝๅไธบ ttใ€‚

[[lean_exe]]
name = "trustworthy-tool"
root = "TrustworthyTool"
exeName = "tt"

ๅฏๆ‰ง่กŒๆ–‡ไปถ็š„ main ๅ‡ฝๆ•ฐๅบ”ไฝไบŽๅŒ…็š„้ป˜่ฎคๆบๆ–‡ไปถ่ทฏๅพ„ไธญๅไธบ TrustworthyTool.lean ็š„ๆจกๅ—ไธญใ€‚

24.1.3.2.ย Lean ๆ ผๅผ๐Ÿ”—

Lake ๅŒ…้…็ฝฎ ๆ–‡ไปถ็š„ Lean ๆ ผๅผไธบ TOML ๆ ผๅผไธญๆ”ฏๆŒ็š„ๅฃฐๆ˜Žๆ€งๅŠŸ่ƒฝๆไพ›ๅŸŸ็‰นๅฎš่ฏญ่จ€ใ€‚ ๆญคๅค–๏ผŒๅฎƒ่ฟ˜ๆไพ›ไบ†็ผ–ๅ†™ Lean ไปฃ็ ็š„่ƒฝๅŠ›๏ผŒไปฅๅฎž็Žฐไปปไฝ•ๆ— ๆณ•ไปฅๅฃฐๆ˜Žๆ–นๅผ่กจ่พพ็š„ๅฟ…่ฆๆž„ๅปบ้€ป่พ‘ใ€‚ Lean ้…็ฝฎๆ–‡ไปถๅไธบ lakefile.leanใ€‚

็”ฑไบŽ Lean ๆ ผๅผๆ˜ฏ Lean ๆบๆ–‡ไปถ๏ผŒๅ› ๆญคๅฏไปฅไฝฟ็”จ Lean ่ฏญ่จ€ๆœๅŠกๅ™จ็š„ๆ‰€ๆœ‰ๅŠŸ่ƒฝๅฏนๅ…ถ่ฟ›่กŒ็ผ–่พ‘ใ€‚ ๆญคๅค–๏ผŒLean ็š„ๅ…ƒ็ผ–็จ‹ๆก†ๆžถๅ…่ฎธไฝฟ็”จ็ฒพๅŒ–ๆ—ถ้—ดๅ‰ฏไฝœ็”จๆฅๅฎž็Žฐๅฝ“ๅ‰ๅนณๅฐไธŠๆœ‰ๆกไปถ็š„้…็ฝฎๆญฅ้ชค็ญ‰ๅŠŸ่ƒฝใ€‚ ็„ถ่€Œ๏ผŒLean ้…็ฝฎๆ ผๅผๆ˜ฏ Lean ๆ–‡ไปถ็š„็ป“ๆžœๆ˜ฏ๏ผŒไฝฟ็”จๆœฌ่บซไธๆ˜ฏๅœจ Lean ไธญ็ผ–ๅ†™็š„ๅทฅๅ…ทๆฅๅค„็†ๆญค็ฑปๆ–‡ไปถๆ˜ฏไธๅฏ่กŒ็š„ใ€‚

24.1.3.2.1.ย ๅฃฐๆ˜Žๅญ—ๆฎต๐Ÿ”—

Lean ้…็ฝฎๆ ผๅผ็š„ๅฃฐๆ˜Žๆ€งๅญ้›†ไฝฟ็”จๅฃฐๆ˜Žๅญ—ๆฎตๅบๅˆ—ๆฅๆŒ‡ๅฎš้…็ฝฎ้€‰้กนใ€‚

syntaxDeclarative Fields

A field assignment in a declarative configuration.

A field assignment in a declarative configuration. declField ::=
    A field assignment in a declarative configuration. ident := term

24.1.3.2.2.ย ๅฅ—้ค๐Ÿ”—

syntaxPackage Configuration
command ::= ...
    | 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`.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[ attrInstance,* ])?
      package identOrStr
command ::= ...
    | 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`.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      package identOrStr where
        A field assignment in a declarative configuration. declField*
command ::= ...
    | 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`.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      package identOrStr {
        A field assignment in a declarative configuration. declField;*
      }
      (where
        `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl;*)?

ๆฏไธช Lake ้…็ฝฎๆ–‡ไปถๅช่ƒฝๆœ‰ไธ€ไธช Lake.DSL.packageCommand : commandDefines 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`. package ๅฃฐๆ˜Žใ€‚ ๅฎšไน‰็š„ๅฐ่ฃ…้…็ฝฎๅฐ†ไฝœไธบ _package ๅฏไพ›ๅ‚่€ƒใ€‚

syntaxPost-Update Hooks
command ::= ...
    | 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"
```
post_update simpleBinder? (declValSimple
       | declValDo)

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"

24.1.3.2.3.ย ไพ่ต–ๅ…ณ็ณป๐Ÿ”—

ไฝฟ็”จ Lake.DSL.requireDecl : commandAdds a new package dependency to the workspace. The general syntax is: ``` require ["<scope>" /] <pkg-name> [@ <version>] [from <source>] [with <options>] ``` The `from` clause tells Lake where to locate the dependency. See the `fromClause` syntax documentation (e.g., hover over it) to see the different forms this clause can take. Without a `from` clause, Lake will lookup the package in the default registry (i.e., Reservoir) and use the information there to download the package at the requested `version`. The `scope` is used to disambiguate between packages in the registry with the same `pkg-name`. In Reservoir, this scope is the package owner (e.g., `leanprover` of `@leanprover/doc-gen4`). The `with` clause specifies a `NameMap String` of Lake options used to configure the dependency. This is equivalent to passing `-K` options to the dependency on the command line. require ๅฃฐๆ˜ŽๆŒ‡ๅฎšไพ่ต–ๅ…ณ็ณปใ€‚

syntaxRequiring Packages
command ::= ...
    | Adds a new package dependency to the workspace. The general syntax is:

```
require ["<scope>" /] <pkg-name> [@ <version>]
  [from <source>] [with <options>]
```

The `from` clause tells Lake where to locate the dependency.
See the `fromClause` syntax documentation (e.g., hover over it) to see
the different forms this clause can take.

Without a `from` clause, Lake will lookup the package in the default
registry (i.e., Reservoir) and use the information there to download the
package at the requested `version`. The `scope` is used to disambiguate between
packages in the registry with the same `pkg-name`. In Reservoir, this scope
is the package owner (e.g., `leanprover` of `@leanprover/doc-gen4`).

The `with` clause specifies a `NameMap String` of Lake options
used to configure the dependency. This is equivalent to passing `-K`
options to the dependency on the command line.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment
      require depName (The version of the package to require.
To specify a Git revision, use the syntax `@ git <rev>`.
@ git? term)? Specifies a specific source from which to draw the package dependency.
Dependencies that are downloaded from a remote source will be placed
into the workspace's `packagesDir`.

**Path Dependencies**

```
from <path>
```

Lake loads the package located at a fixed `path` relative to the
requiring package's directory.

**Git Dependencies**

```
from git <url> [@ <rev>] [/ <subDir>]
```

Lake clones the Git repository available at the specified fixed Git `url`,
and checks out the specified revision `rev`. The revision can be a commit hash,
branch, or tag. If none is provided, Lake defaults to `master`. After checkout,
Lake loads the package located in `subDir` (or the repository root if no
subdirectory is specified).
fromClause? (with term)?

@ ๅญๅฅๆŒ‡ๅฎšๅŒ…็‰ˆๆœฌ๏ผŒๅœจ้œ€่ฆ Reservoir ไธญ็š„ๅŒ…ๆ—ถไฝฟ็”จใ€‚ ็‰ˆๆœฌๅฏไปฅๆ˜ฏๆŒ‡ๅฎšๅŒ…็š„ version ๅญ—ๆฎตไธญๅฃฐๆ˜Ž็š„็‰ˆๆœฌ็š„ๅญ—็ฌฆไธฒ๏ผŒไนŸๅฏไปฅๆ˜ฏ็‰นๅฎš็š„ Git ไฟฎ่ฎข็‰ˆใ€‚ Git ไฟฎ่ฎข็‰ˆๅฏไปฅๆ˜ฏๅˆ†ๆ”ฏๅ็งฐใ€ๆ ‡็ญพๅ็งฐๆˆ–ๆไบคๅ“ˆๅธŒๅ€ผใ€‚

ๅฏ้€‰็š„ Specifies a specific source from which to draw the package dependency. Dependencies that are downloaded from a remote source will be placed into the workspace's `packagesDir`. **Path Dependencies** ``` from <path> ``` Lake loads the package located at a fixed `path` relative to the requiring package's directory. **Git Dependencies** ``` from git <url> [@ <rev>] [/ <subDir>] ``` Lake clones the Git repository available at the specified fixed Git `url`, and checks out the specified revision `rev`. The revision can be a commit hash, branch, or tag. If none is provided, Lake defaults to `master`. After checkout, Lake loads the package located in `subDir` (or the repository root if no subdirectory is specified). fromClause ๆŒ‡ๅฎš้™ค Reservoir ไน‹ๅค–็š„ๅŒ…ๆบ๏ผŒๅฎƒๅฏไปฅๆ˜ฏ Git ๅญ˜ๅ‚จๅบ“ๆˆ–ๆœฌๅœฐ่ทฏๅพ„ใ€‚

Lake.DSL.requireDecl : commandAdds a new package dependency to the workspace. The general syntax is: ``` require ["<scope>" /] <pkg-name> [@ <version>] [from <source>] [with <options>] ``` The `from` clause tells Lake where to locate the dependency. See the `fromClause` syntax documentation (e.g., hover over it) to see the different forms this clause can take. Without a `from` clause, Lake will lookup the package in the default registry (i.e., Reservoir) and use the information there to download the package at the requested `version`. The `scope` is used to disambiguate between packages in the registry with the same `pkg-name`. In Reservoir, this scope is the package owner (e.g., `leanprover` of `@leanprover/doc-gen4`). The `with` clause specifies a `NameMap String` of Lake options used to configure the dependency. This is equivalent to passing `-K` options to the dependency on the command line. with ๅญๅฅๆŒ‡ๅฎšๅฐ†็”จไบŽ้…็ฝฎไพ่ต–ๆ€ง็š„ Lake ้€‰้กน็š„ NameMap Stringใ€‚ ่ฟ™็›ธๅฝ“ไบŽๅœจๅ‘ฝไปค่กŒไธŠๆž„ๅปบไพ่ต–้กนๆ—ถๅฐ† -K ้€‰้กนไผ ้€’็ป™ lake buildใ€‚

syntaxPackage Sources

Specifies a specific source from which to draw the package dependency. Dependencies that are downloaded from a remote source will be placed into the workspace's packagesDir.

Path Dependencies

from <path>

Lake loads the package located at a fixed path relative to the requiring package's directory.

Git Dependencies

from git <url> [@ <rev>] [/ <subDir>]

Lake clones the Git repository available at the specified fixed Git url, and checks out the specified revision rev. The revision can be a commit hash, branch, or tag. If none is provided, Lake defaults to master. After checkout, Lake loads the package located in subDir (or the repository root if no subdirectory is specified).

fromClause ::=
    Specifies a specific source from which to draw the package dependency.
Dependencies that are downloaded from a remote source will be placed
into the workspace's `packagesDir`.

**Path Dependencies**

```
from <path>
```

Lake loads the package located at a fixed `path` relative to the
requiring package's directory.

**Git Dependencies**

```
from git <url> [@ <rev>] [/ <subDir>]
```

Lake clones the Git repository available at the specified fixed Git `url`,
and checks out the specified revision `rev`. The revision can be a commit hash,
branch, or tag. If none is provided, Lake defaults to `master`. After checkout,
Lake loads the package located in `subDir` (or the repository root if no
subdirectory is specified).
from term
fromClause ::= ...
    | Specifies a specific source from which to draw the package dependency.
Dependencies that are downloaded from a remote source will be placed
into the workspace's `packagesDir`.

**Path Dependencies**

```
from <path>
```

Lake loads the package located at a fixed `path` relative to the
requiring package's directory.

**Git Dependencies**

```
from git <url> [@ <rev>] [/ <subDir>]
```

Lake clones the Git repository available at the specified fixed Git `url`,
and checks out the specified revision `rev`. The revision can be a commit hash,
branch, or tag. If none is provided, Lake defaults to `master`. After checkout,
Lake loads the package located in `subDir` (or the repository root if no
subdirectory is specified).
from git term (@ term)? (/ term)?

24.1.3.2.4.ย ็›ฎๆ ‡๐Ÿ”—

็›ฎๆ ‡ ้€šๅธธ้€š่ฟ‡ๅบ”็”จ default_target ๅฑžๆ€ง่€Œไธๆ˜ฏๆ˜พๅผๅˆ—ๅ‡บๅฎƒไปฌๆฅๆทปๅŠ ๅˆฐ้ป˜่ฎค็›ฎๆ ‡้›†ไธญใ€‚

attributeSpecifying Default Targets
attr ::= ...
    | default_target

ๅฐ†็›ฎๆ ‡ๆ ‡่ฎฐไธบ้ป˜่ฎค็›ฎๆ ‡๏ผŒๅœจๆœชๆŒ‡ๅฎšๅ…ถไป–็›ฎๆ ‡ๆ—ถๆž„ๅปบใ€‚

24.1.3.2.4.1.ย ๅ›พไนฆ้ฆ†๐Ÿ”—
syntaxLibrary Targets

่ฆๅฎšไน‰ไธ€ไธชๅบ“๏ผŒๅ…ถไธญๆ‰€ๆœ‰ๅฏ้…็ฝฎๅญ—ๆฎต้ƒฝๅ…ทๆœ‰้ป˜่ฎคๅ€ผ๏ผŒ่ฏทไฝฟ็”จ Lake.DSL.leanLibCommand : commandDefine 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 -/ ``` lean_lib๏ผŒไธๅธฆๅ…ถไป–ๅญ—ๆฎตใ€‚

command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      attributes?
      lean_lib identOrStr

ๅฏไปฅ้€š่ฟ‡ๆไพ›ๆ–ฐๅ€ผๆฅไฟฎๆ”น้ป˜่ฎค้…็ฝฎใ€‚

command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      attributes?
      lean_lib identOrStr where
        A field assignment in a declarative configuration. declField*
command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      attributes?
      lean_lib identOrStr {
        A field assignment in a declarative configuration. declField;*
      }
      (where
        `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl;*)?

Lake.DSL.leanLibCommand : commandDefine 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 -/ ``` lean_lib ็š„ๅญ—ๆฎตๆ˜ฏ LeanLibConfig ็ป“ๆž„็š„ๅญ—ๆฎตใ€‚

๐Ÿ”—structure
Lake.LeanLibConfig (name : Lean.Name) : Type
Lake.LeanLibConfig (name : Lean.Name) : Type

A Lean library's declarative configuration.

Constructor

Lake.LeanLibConfig.mk

Extends

Fields

buildType : Lake.BuildType
Inherited from
  1. Lake.LeanConfig
leanOptions : Array Lean.LeanOption
Inherited from
  1. Lake.LeanConfig
moreLeanArgs : Array String
Inherited from
  1. Lake.LeanConfig
weakLeanArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreLeancArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreServerOptions : Array Lean.LeanOption
Inherited from
  1. Lake.LeanConfig
weakLeancArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreLinkObjs : Lake.TargetArray System.FilePath
Inherited from
  1. Lake.LeanConfig
moreLinkLibs : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
moreLinkArgs : Array String
Inherited from
  1. Lake.LeanConfig
weakLinkArgs : Array String
Inherited from
  1. Lake.LeanConfig
backend : Lake.Backend
Inherited from
  1. Lake.LeanConfig
platformIndependent : Option Bool
Inherited from
  1. Lake.LeanConfig
dynlibs : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
plugins : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
srcDir : System.FilePath

The subdirectory of the package's source directory containing the library's Lean source files. Defaults simply to said srcDir.

(This will be passed to lean as the -R option.)

roots : Array Lean.Name

The root module(s) of the library. Submodules of these roots (e.g., Lib.Foo of Lib) are considered part of the library. Defaults to a single root of the target's name.

globs : Array Lake.Glob

An Array of module Globs to build for the library. Defaults to a Glob.one of each of the library's roots.

Submodule globs build every source file within their directory. Local imports of glob'ed files (i.e., fellow modules of the workspace) are also recursively built.

libName : String

The name of the library artifact. Used as a base for the file names of its static and dynamic binaries. Defaults to the mangled name of the target.

libPrefixOnWindows : Bool

Whether static and shared binaries of this library should be prefixed with lib on Windows.

Unlike Unix, Windows does not require native libraries to start with lib and, by convention, they usually do not. However, for consistent naming across all platforms, users may wish to enable this.

Defaults to false.

needs : Array Lake.PartialBuildKey

An Array of targets to build before the executable's modules.

extraDepTargets : Array Lean.Name

Deprecated. Use needs instead. An Array of target names to build before the library's modules.

precompileModules : Bool

Whether to compile each of the library's modules into a native shared library that is loaded whenever the module is imported. This speeds up evaluation of metaprograms and enables the interpreter to run functions marked @[extern].

Defaults to false.

defaultFacets : Array Lean.Name

An Array of library facets to build on a bare lake build of the library. For example, #[LeanLib.sharedFacet] will build the shared library facet.

nativeFacets : Bool โ†’ Array (Lake.ModuleFacet System.FilePath)

The module facets to build and combine into the library's static and shared libraries. If shouldExport is true, the module facets should export any symbols a user may expect to lookup in the library. For example, the Lean interpreter will use exported symbols in linked libraries.

Defaults to a singleton of Module.oExportFacet (if shouldExport) or Module.oFacet. That is, the object files compiled from the Lean sources, potentially with exported Lean symbols.

allowImportAll : Bool

Whether downstream packages can import all modules of this library.

If enabled, downstream users will be able to access the private internals of modules, including definition bodies not marked as @[expose]. This may also, in the future, prevent compiler optimization which rely on private definitions being inaccessible outside their own package.

Defaults to false.

24.1.3.2.4.2.ย ๅฏๆ‰ง่กŒๆ–‡ไปถ๐Ÿ”—
syntaxExecutable Targets

่ฆๅฎšไน‰ๅ…ถไธญๆ‰€ๆœ‰ๅฏ้…็ฝฎๅญ—ๆฎตๅ‡ๅ…ทๆœ‰้ป˜่ฎคๅ€ผ็š„ๅฏๆ‰ง่กŒๆ–‡ไปถ๏ผŒ่ฏทไฝฟ็”จไธๅธฆๅ…ถไป–ๅญ—ๆฎต็š„ Lake.DSL.leanExeCommand : commandDefine 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 -/ ``` lean_exeใ€‚

command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment? attributes?
      lean_exe identOrStr

ๅฏไปฅ้€š่ฟ‡ๆไพ›ๆ–ฐๅ€ผๆฅไฟฎๆ”น้ป˜่ฎค้…็ฝฎใ€‚

command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment? attributes?
      lean_exe identOrStr where
        A field assignment in a declarative configuration. declField*
command ::= ...
    | 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 -/
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment? attributes?
      lean_exe identOrStr {
        A field assignment in a declarative configuration. declField;*
      }
      (where
        `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl;*)?

Lake.DSL.leanExeCommand : commandDefine 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 -/ ``` lean_exe ็š„ๅญ—ๆฎตๆ˜ฏ LeanExeConfig ็ป“ๆž„็š„ๅญ—ๆฎตใ€‚

๐Ÿ”—structure
Lake.LeanExeConfig (name : Lean.Name) : Type
Lake.LeanExeConfig (name : Lean.Name) : Type

A Lean executable's declarative configuration.

Constructor

Lake.LeanExeConfig.mk

Extends

Fields

buildType : Lake.BuildType
Inherited from
  1. Lake.LeanConfig
leanOptions : Array Lean.LeanOption
Inherited from
  1. Lake.LeanConfig
moreLeanArgs : Array String
Inherited from
  1. Lake.LeanConfig
weakLeanArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreLeancArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreServerOptions : Array Lean.LeanOption
Inherited from
  1. Lake.LeanConfig
weakLeancArgs : Array String
Inherited from
  1. Lake.LeanConfig
moreLinkObjs : Lake.TargetArray System.FilePath
Inherited from
  1. Lake.LeanConfig
moreLinkLibs : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
moreLinkArgs : Array String
Inherited from
  1. Lake.LeanConfig
weakLinkArgs : Array String
Inherited from
  1. Lake.LeanConfig
backend : Lake.Backend
Inherited from
  1. Lake.LeanConfig
platformIndependent : Option Bool
Inherited from
  1. Lake.LeanConfig
dynlibs : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
plugins : Lake.TargetArray Lake.Dynlib
Inherited from
  1. Lake.LeanConfig
srcDir : System.FilePath

The subdirectory of the package's source directory containing the executable's Lean source file. Defaults simply to said srcDir.

(This will be passed to lean as the -R option.)

root : Lean.Name

The root module of the binary executable. Should include a main definition that will serve as the entry point of the program.

The root is built by recursively building its local imports (i.e., fellow modules of the workspace).

Defaults to the name of the target.

exeName : String

The name of the binary executable. Defaults to the target name with any . replaced with a -.

needs : Array Lake.PartialBuildKey

An Array of targets to build before the executable's modules.

extraDepTargets : Array Lean.Name

Deprecated. Use needs instead. An Array of target names to build before the executable's modules.

supportInterpreter : Bool

Enables the executable to interpret Lean files (e.g., via Lean.Elab.runFrontend) by exposing symbols within the executable to the Lean interpreter.

Implementation-wise, on Windows, the Lean shared libraries are linked to the executable and, on other systems, the executable is linked with -rdynamic. This increases the size of the binary on Linux and, on Windows, requires libInit_shared.dll and libleanshared.dll to be co-located with the executable or part of PATH (e.g., via lake exe). Thus, this feature should only be enabled when necessary.

Defaults to false.

nativeFacets : Bool โ†’ Array (Lake.ModuleFacet System.FilePath)

The module facets to build and combine into the executable. If shouldExport is true, the module facets should export any symbols a user may expect to lookup in the executable. For example, the Lean interpreter will use exported symbols in the executable. Thus, shouldExport will be true if supportInterpreter := true.

Defaults to a singleton of Module.oExportFacet (if shouldExport) or Module.oFacet. That is, the object file compiled from the Lean source, potentially with exported Lean symbols.

24.1.3.2.4.3.ย ๅค–้ƒจๅบ“๐Ÿ”—

็”ฑไบŽๅค–้ƒจๅบ“ๅฏไปฅ็”จไปปไฝ•่ฏญ่จ€็ผ–ๅ†™ๅนถไธ”้œ€่ฆไปปๆ„ๆž„ๅปบๆญฅ้ชค๏ผŒๅ› ๆญคๅฎƒไปฌ่ขซๅฎšไน‰ไธบ็”จ FetchM monad ็ผ–ๅ†™็š„็จ‹ๅบ๏ผŒ็”Ÿๆˆ Jobใ€‚ ๅค–้ƒจๅบ“็›ฎๆ ‡ๅบ”่ฏฅ็”Ÿๆˆไธ€ไธชๆž„ๅปบไฝœไธšๆฅๆ‰ง่กŒๆž„ๅปบ๏ผŒ็„ถๅŽ่ฟ”ๅ›ž็”Ÿๆˆ็š„้™ๆ€ๅบ“็š„ไฝ็ฝฎใ€‚ ไธบไบ†ไฝฟๅค–้ƒจๅบ“ๅœจ precompileModules ๆ‰“ๅผ€ๆ—ถๆญฃ็กฎ้“พๆŽฅ๏ผŒextern_lib ็›ฎๆ ‡็”Ÿๆˆ็š„้™ๆ€ๅบ“ๅฟ…้กป้ตๅพชๅนณๅฐ็š„ๅบ“ๅ‘ฝๅ็บฆๅฎš๏ผˆๅณ๏ผŒๅœจ Windows ไธŠๅ‘ฝๅไธบ foo.a๏ผŒๅœจ็ฑป Unix ็ณป็ปŸไธŠๅ‘ฝๅไธบ libfoo.a๏ผ‰ใ€‚ ๅฎž็”จ็จ‹ๅบๅ‡ฝๆ•ฐ Lake.nameToStaticLib ๅฐ†ๅบ“ๅ็งฐ่ฝฌๆขไธบๅฝ“ๅ‰ๅนณๅฐ็š„ๆญฃ็กฎๆ–‡ไปถๅใ€‚

syntaxExternal Library Targets
command ::= ...
    | Define a new external library target for the package. Has one form:

```lean
extern_lib ยซtarget-nameยป (pkg : NPackage _package.name) :=
  /- build term of type `FetchM (Job FilePath)` -/
```

The `pkg` parameter (and its type specifier) is optional.
It is of type `NPackage _package.name` to provably demonstrate the package
provided is the package in which the target is defined.

The term should build the external library's **static** library.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      attributes?
      extern_lib identOrStr simpleBinder? := term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new external library target for the package. Has one form:

extern_lib ยซtarget-nameยป (pkg : NPackage _package.name) :=
  /- build term of type `FetchM (Job FilePath)` -/

The pkg parameter (and its type specifier) is optional. It is of type NPackage _package.name to provably demonstrate the package provided is the package in which the target is defined.

The term should build the external library's static library.

24.1.3.2.4.4.ย ่‡ชๅฎšไน‰็›ฎๆ ‡๐Ÿ”—

่‡ชๅฎšไน‰็›ฎๆ ‡ๅฏ็”จไบŽไฝฟ็”จ Lake API ๅฎšไน‰ไปปไฝ•ๅขž้‡ๆž„ๅปบ็š„ๅทฅไปถใ€‚

syntaxCustom Targets
command ::= ...
    | Define a new custom target for the package. Has one form:

```lean
target ยซtarget-nameยป (pkg : NPackage _package.name) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/
```

The `pkg` parameter (and its type specifier) is optional.
It is of type `NPackage _package.name` to provably demonstrate the package
provided is the package in which the target is defined.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      attributes?
      target identOrStr simpleBinder? : term := term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new external library target for the package. Has one form:

extern_lib ยซtarget-nameยป (pkg : NPackage _package.name) :=
  /- build term of type `FetchM (Job FilePath)` -/

The pkg parameter (and its type specifier) is optional. It is of type NPackage _package.name to provably demonstrate the package provided is the package in which the target is defined.

The term should build the external library's static library.

24.1.3.2.4.5.ย ่‡ชๅฎšไน‰ๆ–น้ข๐Ÿ”—

่‡ชๅฎšไน‰ๆ–น้ขๅ…่ฎธไปŽๆจกๅ—ใ€ๅบ“ๆˆ–ๅŒ…ๅขž้‡ๆž„ๅปบๅ…ถไป–ๅทฅไปถใ€‚

syntaxCustom Package Facets

ๅŒ…ๆ–น้ขๅ…่ฎธไปŽๆ•ดไธชๅŒ…็”Ÿๆˆไธ€ไธชๅทฅไปถๆˆ–ไธ€็ป„ๅทฅไปถใ€‚ Lake API ๅฏไปฅๆŸฅ่ฏขๅŒ…็š„ๅบ“๏ผ›ๅ› ๆญค๏ผŒๅŒ…ๆž„้ข็š„ไธ€ไธชๅธธ่ง็”จ้€”ๆ˜ฏๆž„ๅปบๆฏไธชๅบ“็š„็ป™ๅฎšๆž„้ขใ€‚

command ::= ...
    | Define a new package facet. Has one form:

```lean
package_facet ยซfacet-nameยป (pkg : Package) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/
```

The `pkg` parameter (and its type specifier) is optional.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      package_facet identOrStr simpleBinder? : term := term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new package facet. Has one form:

package_facet ยซfacet-nameยป (pkg : Package) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/

The pkg parameter (and its type specifier) is optional.

syntaxCustom Library Facets

ๅบ“ๆ–น้ขๅ…่ฎธไปŽๅบ“ไธญ็”Ÿๆˆไธ€ไธชๅทฅไปถๆˆ–ไธ€็ป„ๅทฅไปถใ€‚ Lake API ๅฏไปฅๆŸฅ่ฏขๅบ“็š„ๆจกๅ—๏ผ›ๅ› ๆญค๏ผŒๅบ“ๆž„้ข็š„ไธ€ไธชๅธธ่ง็”จ้€”ๆ˜ฏๆž„ๅปบๆฏไธชๆจกๅ—็š„็ป™ๅฎšๆž„้ขใ€‚

command ::= ...
    | Define a new library facet. Has one form:

```lean
library_facet ยซfacet-nameยป (lib : LeanLib) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/
```

The `lib` parameter (and its type specifier) is optional.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      library_facet identOrStr simpleBinder? : term := term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new library facet. Has one form:

library_facet ยซfacet-nameยป (lib : LeanLib) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/

The lib parameter (and its type specifier) is optional.

syntaxCustom Module Facets

ๆจกๅ—ๆ–น้ขๅ…่ฎธไปŽๆจกๅ—็”Ÿๆˆไธ€ไธชๅทฅไปถๆˆ–ไธ€็ป„ๅทฅไปถ๏ผŒ้€šๅธธ้€š่ฟ‡่ฐƒ็”จๅ‘ฝไปค่กŒๅทฅๅ…ทๆฅๅฎž็Žฐใ€‚

command ::= ...
    | Define a new module facet. Has one form:

```lean
module_facet ยซfacet-nameยป (mod : Module) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/
```

The `mod` parameter (and its type specifier) is optional.
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      module_facet identOrStr simpleBinder? : term := term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new module facet. Has one form:

module_facet ยซfacet-nameยป (mod : Module) : ฮฑ :=
  /- build term of type `FetchM (Job ฮฑ)` -/

The mod parameter (and its type specifier) is optional.

24.1.3.2.5.ย ้…็ฝฎๅ€ผ็ฑปๅž‹๐Ÿ”—

๐Ÿ”—inductive type

Lake equivalent of CMake's CMAKE_BUILD_TYPE.

Constructors

Lake.BuildType.debug : Lake.BuildType

Debug optimization, asserts enabled, custom debug code enabled, and debug info included in executable (so you can step through the code with a debugger and have address to source-file:line-number translation). For example, passes -O0 -g when compiling C code.

Lake.BuildType.relWithDebInfo : Lake.BuildType

Optimized, with debug info, but no debug code or asserts (e.g., passes -O3 -g -DNDEBUG when compiling C code).

Lake.BuildType.minSizeRel : Lake.BuildType

Same as release but optimizing for size rather than speed (e.g., passes -Os -DNDEBUG when compiling C code).

Lake.BuildType.release : Lake.BuildType

High optimization level and no debug info, code, or asserts (e.g., passes -O3 -DNDEBUG when compiling C code).

ๅœจ Lake ็š„ DSL ไธญ๏ผŒglobs ๆ˜ฏๅŒน้…ๆจกๅ—ๅ็งฐ้›†็š„ๆจกๅผใ€‚ ๅญ˜ๅœจไปŽๅ็งฐๅˆฐไธŽๆ‰€่ฎจ่ฎบ็š„ๅ็งฐๅŒน้…็š„ๅ…จๅฑ€ๅ˜้‡็š„ๅผบๅˆถ๏ผŒๅนถไธ”ๆœ‰ไธคไธชๅŽ็ผ€่ฟ็ฎ—็ฌฆ็”จไบŽๆž„้€ ๆ›ดๅคšๅ…จๅฑ€ๅ˜้‡ใ€‚

syntaxGlob Syntax

glob ๆจกๅผ N.* ไธŽ N ๆˆ–ไปฅ N ไธบๅ‰็ผ€็š„ไปปไฝ•ๅญๆจกๅ—ๅŒน้…ใ€‚

term ::= ...
    | name.*

ๅ…จๅฑ€ๆจกๅผ N.+ ไธŽไปปไฝ•ไปฅ N ไธบไธฅๆ ผๅ‰็ผ€็š„ๅญๆจกๅ—ๅŒน้…๏ผŒไฝ†ไธไธŽ N ๆœฌ่บซๅŒน้…ใ€‚

term ::= ...
    | name.+

ๅ็งฐๅ’Œ .* ๆˆ– .+ ไน‹้—ดไธๅ…่ฎธๆœ‰็ฉบๆ ผใ€‚

๐Ÿ”—inductive type
Lake.Glob : Type
Lake.Glob : Type

A specification of a set of module names.

Constructors

Lake.Glob.one : Lean.Name โ†’ Lake.Glob

Selects just the specified module name.

Lake.Glob.submodules : Lean.Name โ†’ Lake.Glob

Selects all submodules of the specified module, but not the module itself.

Lake.Glob.andSubmodules : Lean.Name โ†’ Lake.Glob

Selects the specified module and all submodules.

๐Ÿ”—structure

An option that is used by Lean as if it was passed using -D.

Constructor

Lean.LeanOption.mk

Fields

name : Lean.Name

The option's name.

value : Lean.LeanOptionValue

The option's value.

๐Ÿ”—inductive type

Compiler backend with which to compile Lean.

Constructors

Lake.Backend.c : Lake.Backend

Force the C backend.

Lake.Backend.llvm : Lake.Backend

Force the LLVM backend.

Lake.Backend.default : Lake.Backend

Use the default backend. Can be overridden by more specific configuration.

24.1.3.2.6.ย ่„šๆœฌ๐Ÿ”—

Lake ่„šๆœฌ็”จไบŽ่‡ชๅŠจๆ‰ง่กŒ้œ€่ฆ่ฎฟ้—ฎๅŒ…้…็ฝฎไฝ†ไธๅ‚ไธŽไปฃ็ ๅทฅไปถๅขž้‡ๆž„ๅปบ็š„ไปปๅŠกใ€‚ ่„šๆœฌๅœจ ScriptM monad ไธญ่ฟ่กŒ๏ผŒๅณ IO ไปฅๅŠ้™„ๅŠ ็š„ reader monad transformer๏ผŒๆไพ›ๅฏนๅŒ…้…็ฝฎ็š„่ฎฟ้—ฎใ€‚ ็‰นๅˆซๆ˜ฏ๏ผŒ่„šๆœฌ็š„็ฑปๅž‹ๅบ”ไธบ List String โ†’ ScriptM UInt32ใ€‚ ่„šๆœฌไธญ็š„ๅทฅไฝœ็ฉบ้—ดไฟกๆฏไธป่ฆ้€š่ฟ‡ MonadWorkspace ScriptM ๅฎžไพ‹่ฎฟ้—ฎใ€‚

syntaxScript Declarations
command ::= ...
    | Define a new Lake script for the package.

**Example**

```
/-- Display a greeting -/
script ยซscript-nameยป (args) do
  if h : 0 < args.length then
    IO.println s!"Hello, {args[0]'h}!"
  else
    IO.println "Hello, world!"
  return 0
```
A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like
a regular comment (that is, as whitespace); it is parsed and forms part of the syntax tree structure.

At parse time, `docComment` checks the value of the `doc.verso` option. If it is true, the contents
are parsed as Verso markup. If not, the contents are treated as plain text or Markdown. Use
`plainDocComment` to always treat the contents as plain text.

A plain text doc comment node contains a `/--` atom and then the remainder of the comment, `foo -/`
in this example. Use `TSyntax.getDocString` to extract the body text from a doc string syntax node.
A Verso comment node contains the `/--` atom, the document's syntax tree, and a closing `-/` atom.
docComment?
      (@[attrInstance,*])?
      script identOrStr simpleBinder? :=
        term
      Termination hints are `termination_by` and `decreasing_by`, in that order.
(where
        `letRecDecl` matches the body of a let-rec declaration: a doc comment, attributes, and then
a let declaration without the `let` keyword, such as `/-- foo -/ @[simp] bar := 1`. letRecDecl*)?

Define a new Lake script for the package.

Example

/-- Display a greeting -/ script ยซscript-nameยป (args) do if h : 0 < args.length then IO.println s!"Hello, {args[0]'h}!" else IO.println "Hello, world!" return 0
๐Ÿ”—def
Lake.ScriptM (ฮฑ : Type) : Type
Lake.ScriptM (ฮฑ : Type) : Type

The type of a Script's monad.

It is an IO monad equipped information about the Lake configuration.

attributeDefault Scripts
attr ::= ...
    | default_script

ๅฐ† Lake ่„šๆœฌ ๆ ‡่ฎฐไธบ package ็š„้ป˜่ฎคๅ€ผใ€‚

24.1.3.2.7.ย ๅ…ฌ็”จไบ‹ไธš๐Ÿ”—

syntaxThe Current Directory
term ::= ...
    | A macro that expands to the path of package's directory
during the Lakefile's elaboration.
__dir__

A macro that expands to the path of package's directory during the Lakefile's elaboration.

syntaxConfiguration Options
term ::= ...
    | A macro that expands to the specified configuration option (or `none`,
if the option has not been set) during the Lakefile's elaboration.

Configuration arguments are set either via the Lake CLI (by the `-K` option)
or via the `with` clause in a `require` statement.
get_config? ident

A macro that expands to the specified configuration option (or none, if the option has not been set) during the Lakefile's elaboration.

Configuration arguments are set either via the Lake CLI (by the -K option) or via the with clause in a require statement.

syntaxCompile-Time Conditionals
command ::= ...
    | The `meta if` command has two forms:

```lean
meta if <c:term> then <a:command>
meta if <c:term> then <a:command> else <b:command>
```

It expands to the command `a` if the term `c` evaluates to true
(at elaboration time). Otherwise, it expands to command `b` (if an `else`
clause is provided).

One can use this command to specify, for example, external library targets
only available on specific platforms:

```lean
meta if System.Platform.isWindows then
extern_lib winOnlyLib := ...
else meta if System.Platform.isOSX then
extern_lib macOnlyLib := ...
else
extern_lib linuxOnlyLib := ...
```
meta if term then
        The `do` command syntax groups multiple similarly indented commands together.
The group can then be passed to another command that usually only accepts a
single command (e.g., `meta if`).
cmdDo
      (else The `do` command syntax groups multiple similarly indented commands together.
The group can then be passed to another command that usually only accepts a
single command (e.g., `meta if`).
cmdDo)?

The meta if command has two forms:

meta if <c:term> then <a:command>
meta if <c:term> then <a:command> else <b:command>

It expands to the command a if the term c evaluates to true (at elaboration time). Otherwise, it expands to command b (if an else clause is provided).

One can use this command to specify, for example, external library targets only available on specific platforms:

meta if System.Platform.isWindows then
extern_lib winOnlyLib := ...
else meta if System.Platform.isOSX then
extern_lib macOnlyLib := ...
else
extern_lib linuxOnlyLib := ...
syntaxCommand Sequences
cmdDo ::= ...
    | The `do` command syntax groups multiple similarly indented commands together.
The group can then be passed to another command that usually only accepts a
single command (e.g., `meta if`).
command
cmdDo ::= ...
    | The `do` command syntax groups multiple similarly indented commands together.
The group can then be passed to another command that usually only accepts a
single command (e.g., `meta if`).
do
        command
        command*

The do command syntax groups multiple similarly indented commands together. The group can then be passed to another command that usually only accepts a single command (e.g., meta if).

syntaxCompile-Time Side Effects
term ::= ...
    | Executes a term of type `IO ฮฑ` at elaboration-time
and produces an expression corresponding to the result via `ToExpr ฮฑ`.
run_io doSeq

Executes a term of type IO ฮฑ at elaboration-time and produces an expression corresponding to the result via ToExpr ฮฑ.

24.1.4.ย ่„šๆœฌ API ๅ‚่€ƒ๐Ÿ”—

้™คไบ†ๆ™ฎ้€š็š„ IO ๆ•ˆๆžœไน‹ๅค–๏ผŒLake ่„šๆœฌ่ฟ˜ๅฏไปฅ่ฎฟ้—ฎ Lake ็Žฏๅขƒ๏ผˆๆไพ›ๆœ‰ๅ…ณๅฝ“ๅ‰ๅทฅๅ…ท้“พ็š„ไฟกๆฏ๏ผŒไพ‹ๅฆ‚ Lean ็ผ–่ฏ‘ๅ™จ็š„ไฝ็ฝฎ๏ผ‰ๅ’Œๅฝ“ๅ‰ๅทฅไฝœๅŒบใ€‚ ScriptM ไธญๆไพ›ไบ†ๆญค่ฎฟ้—ฎๆƒ้™ใ€‚

๐Ÿ”—def
Lake.ScriptM (ฮฑ : Type) : Type
Lake.ScriptM (ฮฑ : Type) : Type

The type of a Script's monad.

It is an IO monad equipped information about the Lake configuration.

24.1.4.1.ย ่ฎฟ้—ฎ็Žฏๅขƒ๐Ÿ”—

ๆไพ›ๅฏนๆœ‰ๅ…ณๅฝ“ๅ‰ Lake ็Žฏๅขƒ็š„ไฟกๆฏ๏ผˆไพ‹ๅฆ‚ Leanใ€Lake ๅ’Œๅ…ถไป–ๅทฅๅ…ท็š„ไฝ็ฝฎ๏ผ‰็š„่ฎฟ้—ฎ็š„ Monad ๅ…ทๆœ‰ MonadLakeEnv ๅฎžไพ‹ใ€‚ ๅฏนไบŽ Lake API ไธญ็š„ๆ‰€ๆœ‰ๅ•ๅญ๏ผˆๅŒ…ๆ‹ฌ ScriptM๏ผ‰้ƒฝๆ˜ฏๅฆ‚ๆญคใ€‚

๐Ÿ”—def
Lake.MonadLakeEnv.{u} (m : Type โ†’ Type u) : Type u
Lake.MonadLakeEnv.{u} (m : Type โ†’ Type u) : Type u

A monad equipped with a (read-only) detected environment for Lake.

๐Ÿ”—def
Lake.getLakeEnv.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] : m Lake.Env
Lake.getLakeEnv.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] : m Lake.Env

Gets the current Lake environment.

๐Ÿ”—def
Lake.getNoCache.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] [Lake.MonadBuild m] : m Bool
Lake.getNoCache.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] [Lake.MonadBuild m] : m Bool

Returns the LAKE_NO_CACHE/ Lake configuration.

๐Ÿ”—def
Lake.getTryCache.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] [Lake.MonadBuild m] : m Bool
Lake.getTryCache.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] [Lake.MonadBuild m] : m Bool

Returns whether the LAKE_NO_CACHE/ Lake configuration is NOT set.

๐Ÿ”—def
Lake.getPkgUrlMap.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Lean.NameMap String)
Lake.getPkgUrlMap.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Lean.NameMap String)

Returns the LAKE_PACKAGE_URL_MAP for the Lake environment. Empty if none.

๐Ÿ”—def
Lake.getElanToolchain.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m String
Lake.getElanToolchain.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m String

Returns the name of Elan toolchain for the Lake environment. Empty if none.

24.1.4.1.1.ย ๆœ็ดข่ทฏๅพ„ๅŠฉๆ‰‹๐Ÿ”—

๐Ÿ”—def
Lake.getEnvLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath
Lake.getEnvLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath

Returns the detected LEAN_PATH value of the Lake environment.

๐Ÿ”—def
Lake.getEnvLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath
Lake.getEnvLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath

Returns the detected LEAN_SRC_PATH value of the Lake environment.

๐Ÿ”—def
Lake.getEnvSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath
Lake.getEnvSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.SearchPath

Returns the detected sharedLibPathEnvVar value of the Lake environment.

24.1.4.1.2.ย Elan ๅฎ‰่ฃ…ๅŠฉๆ‰‹๐Ÿ”—

๐Ÿ”—def
Lake.getElanInstall?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option Lake.ElanInstall)
Lake.getElanInstall?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option Lake.ElanInstall)

Returns the detected Elan installation (if one).

๐Ÿ”—def
Lake.getElanHome?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option System.FilePath)
Lake.getElanHome?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option System.FilePath)

Returns the root directory of the detected Elan installation (i.e., ELAN_HOME).

๐Ÿ”—def
Lake.getElan?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option System.FilePath)
Lake.getElan?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option System.FilePath)

Returns the path of the elan binary in the detected Elan installation.

24.1.4.1.3.ย Lean ๅฎ‰่ฃ…ๅŠฉๆ‰‹๐Ÿ”—

๐Ÿ”—def
Lake.getLeanInstall.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m Lake.LeanInstall
Lake.getLeanInstall.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m Lake.LeanInstall

Returns the detected Lean installation.

๐Ÿ”—def
Lake.getLeanSysroot.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanSysroot.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Returns the root directory of the detected Lean installation.

๐Ÿ”—def
Lake.getLeanSrcDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanSrcDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Returns the Lean source directory of the detected Lean installation.

๐Ÿ”—def
Lake.getLeanLibDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanLibDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Returns the Lean library directory of the detected Lean installation.

๐Ÿ”—def

Returns the C include directory of the detected Lean installation.

๐Ÿ”—def

Returns the system library directory of the detected Lean installation.

๐Ÿ”—def
Lake.getLean.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLean.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Returns the path of the lean binary in the detected Lean installation.

๐Ÿ”—def
Lake.getLeanc.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanc.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Returns the path of the leanc binary in the detected Lean installation.

๐Ÿ”—def

Returns the path of the libleanshared library in the detected Lean installation.

๐Ÿ”—def
Lake.getLeanAr.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanAr.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the path of the ar binary in the detected Lean installation.

๐Ÿ”—def
Lake.getLeanCc.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLeanCc.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the path of C compiler in the detected Lean installation.

๐Ÿ”—def
Lake.getLeanCc?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option String)
Lake.getLeanCc?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m (Option String)

Get the optional LEAN_CC compiler override of the detected Lean installation.

24.1.4.1.4.ย Lake ๅฎ‰่ฃ…ๅŠฉๆ‰‹๐Ÿ”—

๐Ÿ”—def
Lake.getLakeInstall.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m Lake.LakeInstall
Lake.getLakeInstall.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m Lake.LakeInstall

Get the detected Lake installation.

๐Ÿ”—def
Lake.getLakeHome.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLakeHome.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the root directory of the detected Lake installation (e.g., LAKE_HOME).

๐Ÿ”—def
Lake.getLakeSrcDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLakeSrcDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the source directory of the detected Lake installation.

๐Ÿ”—def
Lake.getLakeLibDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLakeLibDir.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the Lean library directory of the detected Lake installation.

๐Ÿ”—def
Lake.getLake.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath
Lake.getLake.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadLakeEnv m] [Functor m] : m System.FilePath

Get the path of the lake binary in the detected Lake installation.

24.1.4.2.ย ่ฎฟ้—ฎๅทฅไฝœๅŒบ๐Ÿ”—

ๆไพ›ๅฏนๆœ‰ๅ…ณๅฝ“ๅ‰ Lake ๅทฅไฝœ็ฉบ้—ด็š„ไฟกๆฏ็š„่ฎฟ้—ฎ็š„ Monad ๅ…ทๆœ‰ MonadWorkspace ๅฎžไพ‹ใ€‚ ็‰นๅˆซๆ˜ฏ๏ผŒๅญ˜ๅœจ ScriptM ๅ’Œ LakeM ็š„ๅฎžไพ‹ใ€‚

๐Ÿ”—type class
Lake.MonadWorkspace.{u} (m : Type โ†’ Type u) : Type u
Lake.MonadWorkspace.{u} (m : Type โ†’ Type u) : Type u

A monad equipped with a (read-only) Lake Workspace.

Instance Constructor

Lake.MonadWorkspace.mk.{u}

Methods

getWorkspace : m Lake.Workspace

Gets the current Lake workspace.

๐Ÿ”—def
Lake.getRootPackage.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m Lake.Package
Lake.getRootPackage.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m Lake.Package

Returns the root package of the context's workspace.

๐Ÿ”—def
Lake.findPackageByName?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.Package)
Lake.findPackageByName?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.Package)

Returns the first package in the workspace (if any) that has been assigned the name.

This can be used to find the package corresponding to a user-provided name. If the package's unique identifier is already available, use findPackageByKey?instead.

๐Ÿ”—def
Lake.findPackageByKey?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (keyName : Lean.Name) : m (Option (Lake.NPackage keyName))
Lake.findPackageByKey?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (keyName : Lean.Name) : m (Option (Lake.NPackage keyName))

Returns the unique package in the workspace (if any) that is identified by keyName.

๐Ÿ”—def
Lake.findModule?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.Module)
Lake.findModule?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.Module)

Locate the named, buildable, importable, local module in the workspace.

๐Ÿ”—def
Lake.findLeanExe?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.LeanExe)
Lake.findLeanExe?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.LeanExe)

Try to find a Lean executable in the workspace with the given name.

๐Ÿ”—def
Lake.findLeanLib?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.LeanLib)
Lake.findLeanLib?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.LeanLib)

Try to find a Lean library in the workspace with the given name.

๐Ÿ”—def
Lake.findExternLib?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.ExternLib)
Lake.findExternLib?.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] (name : Lean.Name) : m (Option Lake.ExternLib)

Try to find an external library in the workspace with the given name.

๐Ÿ”—def
Lake.getLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the paths added to LEAN_PATH by the context's workspace.

๐Ÿ”—def
Lake.getLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the paths added to LEAN_SRC_PATH by the context's workspace.

๐Ÿ”—def
Lake.getSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the paths added to the shared library path by the context's workspace.

๐Ÿ”—def
Lake.getAugmentedLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getAugmentedLeanPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the augmented LEAN_PATH set by the context's workspace.

๐Ÿ”—def
Lake.getAugmentedLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getAugmentedLeanSrcPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the augmented LEAN_SRC_PATH set by the context's workspace.

๐Ÿ”—def
Lake.getAugmentedSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath
Lake.getAugmentedSharedLibPath.{u_1} {m : Type โ†’ Type u_1} [Lake.MonadWorkspace m] [Functor m] : m System.SearchPath

Returns the augmented shared library path set by the context's workspace.

๐Ÿ”—def

Returns the augmented environment variables set by the context's workspace.