-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update mk_all script and use it in CI (#11849)
Prompted by [this Zulip message](https://leanprover.zulipchat.com/#narrow/stream/116290-rss/topic/Recent.20Commits.20to.20mathlib4.3Amaster/near/430753770), I unified all the uses that I could find of "list all files in some dir and create an 'import file' for them". In the process, I added a slight flexibility to the `mk_all` script: if you pass it a space-separated list of target dirs, it will produce 'import files' for each dir in the list.
- Loading branch information
1 parent
0e249c5
commit 613a154
Showing
6 changed files
with
46 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,37 @@ | ||
#! /usr/bin/env bash | ||
|
||
# Generate a file importing all the files of a Lean folder. | ||
# By default, it generates the files for the libraries | ||
# `Mathlib.lean`, `Mathlib/Tactic.lean`, `Archive.lean` and `Counterexamples.lean`. | ||
|
||
## Standard use: | ||
## ./scripts/mk_all.sh | ||
## | ||
## updates `Mathlib` `Mathlib/Tactic` `Counterexamples` `Archive` | ||
## | ||
## Advanced use: | ||
## ./scripts/mk_all.sh <space_separated_list_of_dirs> | ||
## | ||
## for each dir in <space_separated_list_of_dirs>, create a file with all the imports of the dir | ||
## | ||
## The two commands | ||
## ./scripts/mk_all.sh | ||
## ./scripts/mk_all.sh Mathlib Mathlib/Tactic Counterexamples Archive | ||
## | ||
## are equivalent. | ||
|
||
cd "$(git rev-parse --show-toplevel)" || exit 1 | ||
for gp in Mathlib Mathlib/Tactic Counterexamples Archive | ||
|
||
# assign `targets` to be the input if provided, default to "the usual Mathlib suspects" otherwise | ||
if [ -n "${*}" ] | ||
then | ||
targets=${*} | ||
else | ||
targets="Mathlib Mathlib/Tactic Counterexamples Archive" | ||
fi | ||
|
||
## Note: *no* quotes around `${targets}`, since we want the spaces to matter | ||
for gp in ${targets} | ||
do | ||
git ls-files "$gp/*.lean" | LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > "$gp.lean" | ||
done |