feat: GitHub cloud releases do not clobber prebuilt artifacts (#6218)

This PR makes Lake no longer automatically fetch GitHub cloud releases
if the package build directory is already present (mirroring the
behavior of the Reservoir cache). This prevents the cache from
clobbering existing prebuilt artifacts. Users can still manually fetch
the cache and clobber the build directory by running `lake build
<pkg>:release`.
This commit is contained in:
Mac Malone 2024-11-26 17:10:42 -05:00 committed by GitHub
parent 54c48363ca
commit 3ece36de9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,10 +47,10 @@ def Package.optBuildCacheFacetConfig : PackageFacetConfig optBuildCacheFacet :=
def Package.maybeFetchBuildCache (self : Package) : FetchM (BuildJob Bool) := do
let shouldFetch :=
(← getTryCache) &&
!(← self.buildDir.pathExists) && -- do not automatically clobber prebuilt artifacts
(self.preferReleaseBuild || -- GitHub release
((self.scope == "leanprover" || self.scope == "leanprover-community")
&& !(← getElanToolchain).isEmpty
&& !(← self.buildDir.pathExists))) -- Reservoir
&& !(← getElanToolchain).isEmpty)) -- Reservoir
if shouldFetch then
self.optBuildCache.fetch
else