lean4-htt/tests/lake/examples/deps/test.sh
Mac Malone 41ecccec6d
feat: lake: hoist compiled configurations (#13683)
This PR moves the compiled Lake configurations (e.g., `lakefile.olean`)
from the package's `.lake/config` directory to the workspace's
`.lake/config`. This removes a potential source contention between
workspaces sharing a dependency.
2026-05-08 18:00:37 +00:00

68 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
set -exo pipefail
LAKE=${LAKE:-../../.lake/build/bin/lake}
./clean.sh
$LAKE -d bar build --update
# Test that the update produces the expected manifest.
# Serves as a regression test to ensure that multiples of a package in
# the dependency tree do not produce duplicate entries in the manifest.
# https://github.com/leanprover/lean4/pull/3957
diff -u --strip-trailing-cr bar/lake-manifest.expected.json bar/lake-manifest.json
$LAKE -d foo build --update
./foo/.lake/build/bin/foo
./bar/.lake/build/bin/bar
# Test compiled configurations are hoisted
test -d foo/.lake/config/0
test -d foo/.lake/config/1
test -d foo/.lake/config/2
test -d foo/.lake/config/3
test ! -d foo/.lake/config/4
test -d bar/.lake/config/0
test -d bar/.lake/config/1
test -d bar/.lake/config/2
test -d bar/.lake/config/3
test -d bar/.lake/config/4
test ! -d bar/.lake/config/5
# Test setup-file works (i.e., does not error)
$LAKE -d foo setup-file ./foo/Foo.lean
# Test `lake clean`
test -d a/.lake/build
test -d b/.lake/build
$LAKE -d foo clean a b
test ! -d a/.lake/build
test ! -d b/.lake/build
test -d root/.lake/build
test -d foo/.lake/build
$LAKE -d foo clean
test ! -d root/.lake/build
test ! -d foo/.lake/build
./clean.sh
$LAKE -d bar -f lakefile.toml build --update
diff -u --strip-trailing-cr bar/lake-manifest.expected.json bar/lake-manifest.json
$LAKE -d foo -f lakefile.toml build --update
./foo/.lake/build/bin/foo
./bar/.lake/build/bin/bar
# Test compiled configurations are hoisted
# and that the TOML configuration produces none
test ! -d foo/.lake/config/0
test -d foo/.lake/config/1
test -d foo/.lake/config/2
test -d foo/.lake/config/3
test ! -d foo/.lake/config/4
test ! -d bar/.lake/config/0
test -d bar/.lake/config/1
test -d bar/.lake/config/2
test -d bar/.lake/config/3
test -d bar/.lake/config/4
test ! -d bar/.lake/config/5