Skip to content

[Merged by Bors] - refactor(Cache): use the Lean search path instead of lake-manifest to determine Mathlib root. - #21666

Closed
joneugster wants to merge 10 commits into
masterfrom
eugster/cache_cleanup_use_search_path
Closed

joneugster wants to merge 10 commits into
masterfrom
eugster/cache_cleanup_use_search_path

Conversation

@joneugster

@joneugster joneugster commented Feb 10, 2025 •

Copy link
Copy Markdown
Member

Instead of manually parsing the lake manifest, use the search path from the env variable LEAN_SRC_PATH (using initSrcSearchPath) to find where the file Mathlib.lean is located.


Open in Gitpod

@joneugster joneugster added the t-meta Tactics, attributes or user commands label Feb 10, 2025
@github-actions

github-actions Bot commented Feb 10, 2025 •

Copy link
Copy Markdown

PR summary 61e573b48f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- mathlibDepPath

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@joneugster
joneugster force-pushed the eugster/cache_cleanup_use_search_path branch from d7de0d0 to f9979c0 Compare February 10, 2025 15:53
@joneugster
joneugster changed the base branch from eugster/cache_cleanup_1 to master February 10, 2025 15:53
@joneugster joneugster added the CI Modifies the continuous integration setup or other automation label Feb 10, 2025
@joneugster joneugster changed the title chore(Cache): use the Lean search path instead of lake-manifest to determine Mathlib root. refactor(Cache): use the Lean search path instead of lake-manifest to determine Mathlib root. Feb 10, 2025
Comment thread Cache/IO.lean Resolved
Comment thread Cache/IO.lean Resolved

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to test this in a downstream project successfully?

@joneugster

joneugster commented Feb 11, 2025 •

Copy link
Copy Markdown
Member Author

CI does this automatically: The step "check the cache" (see source) tests on a sample downstream project.

Additionally I did created two sample projects, one depending on mathlib from this commit and one depending on a local copy of mathlib lying in the same folder; both with rm -rf .lake && lake exe cache get && lake build --no-build Mathlib which were both successful

Comment thread Cache/IO.lean Resolved

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors d+

I guess we'll learn pretty quickly if this breaks people!

@mathlib-bors

mathlib-bors Bot commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

✌️ joneugster can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Feb 11, 2025
@joneugster

Copy link
Copy Markdown
Member Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Feb 11, 2025
… determine Mathlib root. (#21666)

Instead of manually parsing the lake manifest, use the search path from the env variable `LEAN_SRC_PATH `  (using `initSrcSearchPath`) to find where the file `Mathlib.lean` is located.
Comment thread Cache/IO.lean
mathlibDepPath := mathlibSource,
srcSearchPath := sp,
packageDirs := .ofList [
("Mathlib", mathlibSource),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these all be parsed from the source path as well (in a future PR)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, #21238 will then use let packageDir? := sp.find? (·.contains sourceFile) instead of this packageDirs

@mathlib-bors

mathlib-bors Bot commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(Cache): use the Lean search path instead of lake-manifest to determine Mathlib root. [Merged by Bors] - refactor(Cache): use the Lean search path instead of lake-manifest to determine Mathlib root. Feb 11, 2025
@mathlib-bors mathlib-bors Bot closed this Feb 11, 2025
@mathlib-bors
mathlib-bors Bot deleted the eugster/cache_cleanup_use_search_path branch February 11, 2025 21:08
mhuisi added a commit to leanprover/vscode-lean4 that referenced this pull request Apr 9, 2026
This PR splits the 'Fetch Mathlib Build Cache For Current Imports'
command into three:
1. 'Fetch Mathlib Build Cache For Open Files': Displayed in the forall
menu and the command prompt. Displays a quick select dialog where all
open files are selected by default and allows configuring the set of
files to fetch the cache for.
2. 'Fetch Mathlib Build Cache For All Open Files': Only displayed in the
command prompt (can also be bound to a keyboard shortcut). Fetches the
cache for all open files without displaying a selection dialog.
3. 'Fetch Mathlib Build Cache For Current File': Only displayed in the
command prompt (can also be bound to a keyboard shortcut). Fetches the
cache for the currently displayed file without displaying a selection
dialog. Re-uses the command ID of the previous 'Fetch Mathlib Build
Cache For Current Imports' command, which had the same functionality.

Also ensures that these commands can be used downstream of Mathlib,
which was added in
[mathlib4#21666](leanprover-community/mathlib4#21666).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Modifies the continuous integration setup or other automation delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants