diff --git a/src/lake/Lake/Build/Module.lean b/src/lake/Lake/Build/Module.lean index 290a5b5c42..832f34f667 100644 --- a/src/lake/Lake/Build/Module.lean +++ b/src/lake/Lake/Build/Module.lean @@ -817,7 +817,7 @@ def Module.packLtar (self : Module) (arts : ModuleOutputArtifacts) : JobM Artifa return args proc (quiet := true) {cmd := (← getLeantar).toString, args} if (← self.pkg.isArtifactCacheWritable) then - cacheArtifact self.ltarFile "ltar" (← self.pkg.restoreAllArtifacts) + cacheArtifact self.ltarFile "ltar" (useLocalFile := ← self.pkg.restoreAllArtifacts) else computeArtifact self.ltarFile "ltar" diff --git a/tests/lake/tests/ltar/restoreAll.toml b/tests/lake/tests/ltar/restoreAll.toml new file mode 100644 index 0000000000..7f7b73f8c7 --- /dev/null +++ b/tests/lake/tests/ltar/restoreAll.toml @@ -0,0 +1,6 @@ +name = "test" +enableArtifactCache = true +restoreAllArtifacts = true + +[[lean_lib]] +name = "Test" diff --git a/tests/lake/tests/ltar/test.sh b/tests/lake/tests/ltar/test.sh index d3bfcfc708..37d1a0609f 100755 --- a/tests/lake/tests/ltar/test.sh +++ b/tests/lake/tests/ltar/test.sh @@ -45,6 +45,15 @@ test_exp -f .lake/build/ir/Test.ltar rm -rf .lake/build .lake/cache/artifacts/*.[!l]* test_out "leantar" build +Test --no-build -v +# Test caching an `ltar` through `-o` (with `restoreAllArtifacts = true`) +# This tests caching the ltar from within `Module.packLtar` +rm -rf .lake/cache .lake/build +test_run -f restoreAll.toml build +Test -v --wfail +test_exp ! -f .lake/build/ir/Test.ltar +test_run -f restoreAll.toml build +Test -v --wfail -o .lake/outputs.jsonl +test_cmd ls .lake/cache/artifacts/*.ltar +test_exp -f .lake/build/ir/Test.ltar + # Test producing an `ltar` without already restored artifacts rm -rf .lake/cache .lake/build LAKE_ARTIFACT_CACHE=true test_run build +Test -v