Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
chore(scripts/mk_all.sh): allow 'mk_all.sh ../test' (#10628)
Browse files Browse the repository at this point in the history
Helpful for mathport CI, cf leanprover-community/mathport#64



Co-authored-by: Scott Morrison <[email protected]>
  • Loading branch information
2 people authored and jcommelin committed Dec 18, 2021
1 parent 4ce0899 commit ae5e7cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/mk_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
# Examples:
# ./scripts/mk_all.sh
# ./scripts/mk_all.sh data/real
# ./scripts/mk_all.sh ../archive
#
# Makes a mathlib/src/$directory/all.lean importing all files inside $directory.
# If $directory is omitted, creates `mathlib/src/all.lean`.

cd "$( dirname "${BASH_SOURCE[0]}" )"/../src
if [[ $# = 1 ]]; then
dir="$1"
dir="${1%/}" # remove trailing slash if present
else
dir="."
fi

# remove an initial `./`
# replace an initial `../test/` with just `.` (similarly for `roadmap`/`archive`/...)
# replace all `/` with `.`
# strip the `.lean` suffix
# prepend `import `
find "$dir" -name \*.lean -not -name all.lean \
| sed 's,^\./,,;s,\.lean$,,;s,/,.,g;s,^,import ,' \
| sed 's,^\./,,;s,^\.\./[^/]*,,;s,/,.,g;s,\.lean$,,;s,^,import ,' \
| sort >"$dir"/all.lean

0 comments on commit ae5e7cd

Please sign in to comment.