Skip to content

Commit

Permalink
Revert "refactor: reduce Reservoir build fetch attempts & warnings (#…
Browse files Browse the repository at this point in the history
…5600)"

This reverts commit a01166f.
  • Loading branch information
kim-em committed Oct 4, 2024
1 parent 4cb90dd commit 1cf7623
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
15 changes: 5 additions & 10 deletions src/lake/Lake/Build/Package.lean
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ def Package.maybeFetchBuildCache (self : Package) : FetchM (BuildJob Bool) := do
let shouldFetch :=
(← getTryCache) &&
(self.preferReleaseBuild || -- GitHub release
!(self.scope.isEmpty -- no Reservoir
|| (← getElanToolchain).isEmpty
|| (← self.buildDir.pathExists)))
(!self.scope.isEmpty && !(← getElanToolchain).isEmpty)) -- Reservoir
if shouldFetch then
self.optBuildCache.fetch
else
Expand All @@ -67,12 +65,9 @@ def Package.maybeFetchBuildCacheWithWarning (self : Package) := do
let job ← self.maybeFetchBuildCache
job.bindSync fun success t => do
unless success do
if self.preferReleaseBuild then
let details ← self.optFacetDetails optGitHubReleaseFacet
logWarning s!"building from source; failed to fetch GitHub release{details}"
else
let details ← self.optFacetDetails optReservoirBarrelFacet
logVerbose s!"building from source; failed to fetch Reservoir build{details}"
let details ← self.optFacetDetails <| if self.preferReleaseBuild then
optGitHubReleaseFacet else optReservoirBarrelFacet
logWarning s!"building from source; failed to fetch cloud build{details}"
return ((), t)

@[deprecated maybeFetchBuildCacheWithWarning (since := "2024-09-27")]
Expand Down Expand Up @@ -178,7 +173,7 @@ def Package.optBarrelFacetConfig : PackageFacetConfig optReservoirBarrelFacet :=

/-- The `PackageFacetConfig` for the builtin `reservoirBarrelFacet`. -/
def Package.barrelFacetConfig : PackageFacetConfig reservoirBarrelFacet :=
mkBuildArchiveFacetConfig optReservoirBarrelFacet "Reservoir build"
mkBuildArchiveFacetConfig optReservoirBarrelFacet "Reservoir barrel"

/-- The `PackageFacetConfig` for the builtin `optGitHubReleaseFacet`. -/
def Package.optGitHubReleaseFacetConfig : PackageFacetConfig optGitHubReleaseFacet :=
Expand Down
2 changes: 1 addition & 1 deletion src/lake/tests/noRelease/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ EOF
# Test that an indirect fetch on the release does not cause the build to fail
$LAKE build Test | diff -u --strip-trailing-cr <(cat << EOF
⚠ [2/5] Ran dep:extraDep
warning: building from source; failed to fetch GitHub release (run with '-v' for details)
warning: building from source; failed to fetch cloud build (run with '-v' for details)
✔ [4/5] Built Test
Build completed successfully.
EOF
Expand Down
9 changes: 3 additions & 6 deletions src/lake/tests/online/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ $LAKE -v -f git.toml build @Cli:extraDep |

./clean.sh
$LAKE -f barrel.lean update
# Test that barrels are not fetched after the build directory is created.
mkdir -p .lake/packages/Cli/.lake/build
($LAKE -v -f barrel.lean build @Cli:extraDep) |
grep --color "Cli:optBarrel" && exit 1 || true
rmdir .lake/packages/Cli/.lake/build
# Test that barrels are not fetched without a toolchain
# Test that narrels are not fetched without a toolchain
(ELAN_TOOLCHAIN= $LAKE -v -f barrel.lean build @Cli:extraDep) |
grep --color "Cli:optBarrel" && exit 1 || true
($LAKE -v -f barrel.lean build @Cli:barrel && exit 1 || true) |
Expand All @@ -33,6 +28,8 @@ $LAKE -v -f barrel.lean build @Cli:extraDep |
grep --color "Cli:optBarrel"
$LAKE -f barrel.lean build @Cli:extraDep |
grep --color "Cli:optBarrel" && exit 1 || true
$LAKE -f barrel.lean build @Cli:extraDep |
grep --color "(run with '-v' for details)"
# Test cache toggle
(LAKE_NO_CACHE=1 $LAKE -v -f barrel.lean build @Cli:extraDep) |
grep --color "Cli:optBarrel" && exit 1 || true
Expand Down

0 comments on commit 1cf7623

Please sign in to comment.