lean4-htt/script
Sebastian Ullrich e0650a0336
feat: shake: make Mathlib-ready (#11496)
This PR implements new flags and annotations for `shake` for use in
Mathlib:

> Options:
>   --keep-implied
> Preserves existing imports that are implied by other imports and thus
not technically needed
>     anymore
> 
>   --keep-prefix
> If an import `X` would be replaced in favor of a more specific import
`X.Y...` it implies,
> preserves the original import instead. More generally, prefers
inserting `import X` even if it
> was not part of the original imports as long as it was in the original
transitive import closure
>     of the current module.
> 
>   --keep-public
> Preserves all `public` imports to avoid breaking changes for external
downstream modules
> 
>   --add-public
> Adds new imports as `public` if they have been in the original public
closure of that module.
> In other words, public imports will not be removed from a module
unless they are unused even
> in the private scope, and those that are removed will be re-added as
`public` in downstream
> modules even if only needed in the private scope there. Unlike
`--keep-public`, this may
> introduce breaking changes but will still limit the number of inserted
imports.
> 
> Annotations:
> The following annotations can be added to Lean files in order to
configure the behavior of
> `shake`. Only the substring `shake: ` directly followed by a directive
is checked for, so multiple
> directives can be mixed in one line such as `-- shake:
keep-downstream, shake: keep-all`, and they
> can be surrounded by arbitrary comments such as `-- shake: keep
(metaprogram output dependency)`.
> 
>   * `module -- shake: keep-downstream`:
> Preserves this module in all (current) downstream modules, adding new
imports of it if needed.
> 
>   * `module -- shake: keep-all`:
> Preserves all existing imports in this module as is. New imports now
needed because of upstream
>     changes may still be added.
> 
>   * `import X -- shake: keep`:
> Preserves this specific import in the current module. The most common
use case is to preserve a
> public import that will be needed in downstream modules to make sense
of the output of a
> metaprogram defined in this module. For example, if a tactic is
defined that may synthesize a
> reference to a theorem when run, there is no way for `shake` to detect
this by itself and the
> module of that theorem should be publicly imported and annotated with
`keep` in the tactic's
>     module.
>     ```
>     public import X  -- shake: keep (metaprogram output dependency)
> 
>     ...
> 
>     elab \"my_tactic\" : tactic => do
> ... mkConst ``f -- `f`, defined in `X`, may appear in the output of
this tactic
>     ```
2025-12-05 09:37:58 +00:00
..
lib chore: fix spelling mistakes in non-Lean files (#5430) 2024-09-23 21:11:20 +00:00
apply.lean fix: deallocation for closures in non default configurations (#11217) 2025-11-17 16:27:20 +00:00
benchReelabRss.lean test: re-enable re-elab benchmarks and add watchdog re-elab benchmark (#11284) 2025-11-20 22:53:08 +00:00
benchReelabWatchdogRss.lean test: re-enable re-elab benchmarks and add watchdog re-elab benchmark (#11284) 2025-11-20 22:53:08 +00:00
collideProfiles.lean feat: trace.profiler export to Firefox Profiler (#3801) 2024-04-15 12:13:14 +00:00
diff_changelogs.py chore(script): fix nightlies... finally? 2018-03-26 16:17:42 +02:00
gen_constants_cpp.py chore: fix more typos in comments 2023-10-08 14:37:34 -07:00
gen_tokens_cpp.py chore: fix more typos in comments 2023-10-08 14:37:34 -07:00
issues_summary.sh feat: script to summarize issues (#3952) 2024-04-24 06:11:07 +00:00
lakefile.toml feat: shake: make Mathlib-ready (#11496) 2025-12-05 09:37:58 +00:00
lean-toolchain feat: scripts/Modulize.lean (#10460) 2025-09-24 11:40:17 +00:00
mathlib-bench feat: move lean-pr-testing-NNNN branches to a fork (#8933) 2025-06-24 03:30:43 +00:00
merge_remote.py feat: updates to release process for v4.23.0 (#10383) 2025-09-14 23:52:19 +00:00
Modulize.lean chore: rename String.endPos -> String.rawEndPos (#10853) 2025-10-21 11:25:30 +00:00
patch.sh fix(script/patch): apply changes 2019-08-09 08:52:49 -07:00
prepare-llvm-linux.sh chore: CI: fix Linux release jobs (#11424) 2025-11-28 16:27:32 +00:00
prepare-llvm-macos.sh fix: set LLVM sysroot consistently (#6574) 2025-01-08 12:56:27 +00:00
prepare-llvm-mingw.sh chore: remove old LEAN_AUTO_THREAD_FINALIZATION workaround (#8885) 2025-06-20 08:52:17 +00:00
push_repo_release_tag.py feat: further release automation (#9092) 2025-06-30 05:44:10 +00:00
rebase-stage0.sh chore: add ./script/rebase-stage0.sh (#3984) 2024-05-02 12:26:25 +00:00
reformat.lean chore: fix script/reformat.lean 2022-11-28 15:47:17 +01:00
release_checklist.py chore: run Mathlib's verify_version_tags.py in release_checklist.py (#11392) 2025-11-27 04:10:43 +00:00
release_notes.py chore: update script/release_notes.py for changelog-tactics (#10436) 2025-09-18 07:22:53 +00:00
release_repos.yml chore: include lean-lang.org in release checklist (#10450) 2025-09-19 03:46:32 +00:00
release_steps.py chore: release_steps runs lake exe cache get when needed (#10882) 2025-10-21 22:49:38 +00:00
Shake.lean feat: shake: make Mathlib-ready (#11496) 2025-12-05 09:37:58 +00:00