feat(Cache): Allow arguments of the form Mathlib.Data.+ which correspond to a folder but not a file#21838
feat(Cache): Allow arguments of the form Mathlib.Data.+ which correspond to a folder but not a file#21838joneugster wants to merge 2 commits intomasterfrom
Mathlib.Data.+ which correspond to a folder but not a file#21838Conversation
|
|
PR summary 88bb6d226aImport changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 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 No changes to technical debt.You can run this locally as
|
8c89c93 to
053bfae
Compare
|
Note to myself: check if something like the following is needed: -- TODO: This could be `(argₛ : FilePath).normalize` if the comment there got addressed
-- (which says "TODO: normalize `a/`, `a//b`, etc.")
let arg : FilePath := System.mkFilePath <| (argₛ : FilePath).components.filter (· != "") |
|
This PR/issue depends on: |
|
I've tested this with two |
|
|
||
| 1. `Mathlib.Algebra.Fields.Basic`: there exists such a Lean file | ||
| 2. `Mathlib.Algebra.Fields`: no Lean file exists but a folder (TODO) | ||
| 2. `Mathlib.Algebra.Fields`: no Lean file exists but a folder |
There was a problem hiding this comment.
I think we should match lake here, and use .+ syntax. Otherwise we're stuck if both Foo/Bar.lean and Foo/Bar/Baz.lean exist.
We could also support .* syntax, which would mean "load both of the above", though of course the user has to remember to escape it in some shells.
There was a problem hiding this comment.
Implemented both your suggestions
|
This pull request has conflicts, please merge |
Mathlib.Data which correspond to a folder but not a fileMathlib.Data.+ which correspond to a folder but not a file
| else | ||
| -- provided a module | ||
| let mod := argₛ.toName | ||
| -- user might provide `.*` or `.+` to include folders |
There was a problem hiding this comment.
Perhaps this shoudl be parsed with Lake.Glob.ofString??
There was a problem hiding this comment.
(and then use glob.forEachModuleIn)
There was a problem hiding this comment.
That's a good idea. However, if I understand things correctly, I cannot import Lake.Glob.ofString? since Cache is not a module yet and Lake.Glob.ofString? is not public.
I could offer to create a follow-up PR (once this PR has been merged) to convert Cache into a module and incorporate this suggestion there.
There was a problem hiding this comment.
I've added this as TODO comment
There was a problem hiding this comment.
You can use open private from batteries I think,
There was a problem hiding this comment.
Implemented your suggestion 👍
677ebdc to
068bac4
Compare
|
This PR has been migrated to a fork-based workflow: #35414 |
Extend
lake exe cache getto get cache for all files inside a specified folder, as well as the dependencies of these files.his can be used as
lake exe cache get Mathlib/Data/orlake exe cache get Mathlib.Data.+. There is also the syntaxlake exe cache get Mathlib.Data.*which means either file or folder.