Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: also port test/archive/counterexamples #64

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# This is not a "real" makefile, i.e. it does not detect dependencies between targets.

## Targets:
# `build`: compile mathport
# `mathbin-source`: clone mathlib3, and create `all.lean`
# `lean3-source`: clone lean3, and create `all.lean` (run after `mathbin-source`, to get the right commit)
# `lean3-predata`: create `.ast` and `.tlean` files from Lean3
# `mathbin-predata`: create `.ast` and `.tlean` files from mathlib3
# `build`: compile mathport
# `port-lean`: run mathport on Lean3
# `port-mathbin`: run mathport on mathlib3

Expand Down Expand Up @@ -38,7 +38,8 @@ mathbin-source:
cd sources && git clone https://github.com/leanprover-community/mathlib.git; \
fi
cd sources/mathlib && git clean -xfd && git checkout $(MATHBIN_COMMIT)
cd sources/mathlib && leanpkg configure && ./scripts/mk_all.sh
cd sources/mathlib && leanpkg configure && \
./scripts/mk_all.sh && ./scripts/mk_all.sh ../test && ./scripts/mk_all.sh ../archive && ./scripts/mk_all.sh ../counterexamples

# Obtain the commit from (community edition) Lean 3 which mathlib is using, and create `all.lean`.
lean3-source: mathbin-source
Expand Down Expand Up @@ -70,6 +71,9 @@ mathbin-predata: mathbin-source
find sources/mathlib -name "*.olean" -delete # ast only exported when oleans not present
# By changing into the directory, `elan` automatically dispatches to the correct binary.
cd sources/mathlib && lean --make --recursive --ast --tlean src
cd sources/mathlib && lean --make --recursive --ast --tlean test
cd sources/mathlib && lean --make --recursive --ast --tlean archive
cd sources/mathlib && lean --make --recursive --ast --tlean counterexamples
cp -r sources/mathlib PreData/Mathbin
find PreData/ -name "*.lean" -delete
find PreData/ -name "*.olean" -delete
Expand All @@ -93,7 +97,10 @@ port-lean: init-logs build
cp lean-toolchain Lean4Packages/lean3port/

port-mathbin: port-lean
LEAN_PATH=$(MATHPORT_LIB):$(MATHLIB4_LIB):$(LEANBIN_LIB):$(MATHBIN_LIB) ./build/bin/mathport config.json Leanbin::all Mathbin::all >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)
LEAN_PATH=$(MATHPORT_LIB):$(MATHLIB4_LIB):$(LEANBIN_LIB):$(MATHBIN_LIB) ./build/bin/mathport config.json Leanbin::all Mathbin::all >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)
LEAN_PATH=$(MATHPORT_LIB):$(MATHLIB4_LIB):$(LEANBIN_LIB):$(MATHBIN_LIB) ./build/bin/mathport config.json Leanbin::all Mathbin::all Mathbin_test::all >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)
LEAN_PATH=$(MATHPORT_LIB):$(MATHLIB4_LIB):$(LEANBIN_LIB):$(MATHBIN_LIB) ./build/bin/mathport config.json Leanbin::all Mathbin::all Mathbin_archive::all >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)
LEAN_PATH=$(MATHPORT_LIB):$(MATHLIB4_LIB):$(LEANBIN_LIB):$(MATHBIN_LIB) ./build/bin/mathport config.json Leanbin::all Mathbin::all Mathbin_counterexamples::all >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)
cp lean-toolchain Lean4Packages/mathlib3port/

test-import-leanbin:
Expand Down
9 changes: 7 additions & 2 deletions Mathport/Util/Parse.lean
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def parseTLeanImports (tlean : FilePath) : IO (Array Name) := do
let nImports := tokens[1].toNat!
let mut paths := #[]
for i in [:nImports] do
if tokens[2+2*i+1] ≠ "-1" then throw $ IO.userError "found relative import!"
paths := paths.push $ tokens[2+2*i].toName
if tokens[2+2*i+1] ≠ "-1" then
-- This was previously an error,
-- but we would like to be able to port `test/`, which has relative imports.
-- TODO: find a better solution than simply dropping relative imports.
dbg_trace "warning: found relative import!"
else
paths := paths.push $ tokens[2+2*i].toName
return paths
5 changes: 4 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"outRoot": "Outputs",
"packages": {
"Leanbin": "PreData/Leanbin",
"Mathbin": "PreData/Mathbin/src"
"Mathbin": "PreData/Mathbin/src",
"Mathbin_test": "PreData/Mathbin/test",
"Mathbin_archive": "PreData/Mathbin/archive",
"Mathbin_counterexamples": "PreData/Mathbin/counterexamples"
}
},
"stringsToKeep": [
Expand Down