feat: lake: build by source path#7909
Merged
tydeu merged 9 commits intoleanprover:masterfrom Apr 15, 2025
Merged
Conversation
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 11, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 11, 2025
|
Mathlib CI status (docs):
|
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 11, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 11, 2025
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 12, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 12, 2025
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 12, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 12, 2025
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 12, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 12, 2025
a1f97e8 to
dfce48d
Compare
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 15, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 15, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 19, 2025
This PR fixes bugs in #7809 and #7909 that were not caught partially because the `badImport` test had been disabled. **Bugs Fixed:** * Building by path no longer drops top-level logs. * "bad import" errors are once again printed. * Transitively imported precompiled modules are once again loaded during elaboration.
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 1, 2025
This PR makes Lake tests much more verbose in output. It also fixes some bugs that had been missed due to disabled tests. Most significantly, the target specifier `@pkg` (e.g., in `lake build`) is now always interpreted as a package. It was previously ambiguously interpreted due to changes in #7909.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 23, 2025
This PR adds support to the server for the new module setup process by changing how `lake setup-file` is used. In the new server setup, `lake setup-file` is invoked with the file name of the edited module passed as a CLI argument and with the parsed header passed to standard input in JSON form. Standard input is used to avoid potentially exceeding the CLI length limits on Windows. Lake will build the module's imports along with any other dependencies and then return the module's workspace configuration via JSON (now in the form of `ModuleSetup`). The server then post-processes this configuration a bit and returns it back to the Lean language processor. The server's header is currently only fully respected by Lake for external modules (files that are not part of any workspace library). For workspace modules, the saved module header is currently used to build imports (as has been done since #7909). A follow-up Lake PR will align both cases to follow the server's header. Lean search paths (e.g., `LEAN_PATH`, `LEAN_SRC_PATH`) are no longer negotiated between the server and Lake. These environment variables are already configured during sever setup by `lake serve` and do not change on a per-file basis. Lake can also pre-resolve the `.olean` files of imports via the `importArts` field of `ModuleSetup`, limiting the potential utility of communicating `LEAN_PATH`.
wkrozowski
pushed a commit
to wkrozowski/lean4
that referenced
this pull request
Jun 24, 2025
This PR adds support to the server for the new module setup process by changing how `lake setup-file` is used. In the new server setup, `lake setup-file` is invoked with the file name of the edited module passed as a CLI argument and with the parsed header passed to standard input in JSON form. Standard input is used to avoid potentially exceeding the CLI length limits on Windows. Lake will build the module's imports along with any other dependencies and then return the module's workspace configuration via JSON (now in the form of `ModuleSetup`). The server then post-processes this configuration a bit and returns it back to the Lean language processor. The server's header is currently only fully respected by Lake for external modules (files that are not part of any workspace library). For workspace modules, the saved module header is currently used to build imports (as has been done since leanprover#7909). A follow-up Lake PR will align both cases to follow the server's header. Lean search paths (e.g., `LEAN_PATH`, `LEAN_SRC_PATH`) are no longer negotiated between the server and Lake. These environment variables are already configured during sever setup by `lake serve` and do not change on a per-file basis. Lake can also pre-resolve the `.olean` files of imports via the `importArts` field of `ModuleSetup`, limiting the potential utility of communicating `LEAN_PATH`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Lake support for building modules given their source file path. This is made use of in both the CLI and the sever.
As a target specifier,
lake build Foo/Bar.leanwill now look for a module in the workspace whose source file isFoo/Bar.leanand build it. Facets are support vialake build Foo/Bar.lean:o. As such,:is an illegal character in such file names (which is reasonable considering its use in search paths likePATHon Linux).In the server,
lake setup-file Foo/Bar.leanwill now try to lookup a module for the source and and build its dependencies, ignoring the imports specified. This allows Lake to return more specific configuration for the module requested (e.g., library-specific dynlibs and plugins). If the path cannot be found in the workspace, Lake will fallback to its previous behavior.Finally, like
setup-file,lake lean Foo/Bar.leanwill try to lookup a module for the source path and use its more specific configuration if possible.Closes #2756.