fix: lake: ltar caching bug with build -o (#12993)
This PR fixes a bug with Lake where caching an `ltar` produced via `lake build -o` would fail if `restoreAllArtifacts` was also `true`.
This commit is contained in:
parent
518a135777
commit
d78525b302
3 changed files with 16 additions and 1 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
6
tests/lake/tests/ltar/restoreAll.toml
Normal file
6
tests/lake/tests/ltar/restoreAll.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
name = "test"
|
||||
enableArtifactCache = true
|
||||
restoreAllArtifacts = true
|
||||
|
||||
[[lean_lib]]
|
||||
name = "Test"
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue