Compare commits

...

16 Commits

Author SHA1 Message Date
Mac Malone
6d22e0e5cc fix: lake: do not delete path dependencies (#5878)
Fixes a serious issue where Lake would delete path dependencies when
attempting to cleanup a dependency required with an incorrect name.

Closes #5876. Originally part of #5684, but also independently
discovered by François.

(cherry picked from commit 4714f84fb9)
2024-10-30 13:57:53 +11:00
Sebastian Ullrich
480d7314a2 fix: do not force snapshot tree too early (#5752)
This turns out to be the issue behind #5736, though really it is yet
another indicator of a general thread pool weakness.

(cherry picked from commit fc5e3cc66e)
2024-10-22 09:51:28 +11:00
Mac Malone
bfd4b64645 fix: lake: make package extraDep intransitive (#5641)
A Lake build of target within a a package will no longer build a
package's dependencies package-level extra targets dependencies. At the
technical level, a package's `extraDep` facet no longer transitively
builds its dependencies' `extraDep` facet.

Closes #5633.

(cherry picked from commit 7942b9eaae)
2024-10-19 13:56:18 -04:00
Mac Malone
68aecd782f refactor: lake: restrict cache fetch to leanprover* (#5642)
Lake will now only automatically fetch Reservoir build caches for
package in the the `leanprover` and `leanprover-community`
organizations. We are not planning to expand the Reservoir build cache
to other packages until farther in the future.

(cherry picked from commit 068208091f)
2024-10-19 13:47:54 -04:00
Sebastian Ullrich
64b81274b9 fix: don't block on snapshot tree if tracing is not enabled (#5736)
While there appears to be an underlying issue of blocking tasks that
this specific PR is not resolving, it should alleviate the problems
described in
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/reliable.20file.20desync.20on.20Linux.20Mint
as it effectively reverts the relevant change introduced in 4.13.0-rc1
when the trace option is not set.

(cherry picked from commit 79583d63f3)
2024-10-17 15:35:36 +11:00
Kim Morrison
01d414ac36 Reapply "refactor: reduce Reservoir build fetch attempts & warnings (#5600)"
This reverts commit 1cf7623d3a.
2024-10-04 16:55:48 +10:00
Kim Morrison
3c14e9d44c Reapply "fix: --no-cache on server DependencyBuildMode.never (#5583)"
This reverts commit 6dc87541dc.
2024-10-04 16:55:47 +10:00
Kim Morrison
385abfb965 Reapply "feat: lake: selective build cache fetch & display (#5572)"
This reverts commit f87859f333.
2024-10-04 16:55:46 +10:00
Kim Morrison
6e15da216c Reapply "doc: update README w/ Reservoir package options (#5546)"
This reverts commit ed1f5b9945.
2024-10-04 16:55:45 +10:00
Kim Morrison
19919436b4 Reapply "feat: lake: Reservoir build cache (#5486)"
This reverts commit b1b73a444f.
2024-10-04 16:55:42 +10:00
Kim Morrison
b1b73a444f Revert "feat: lake: Reservoir build cache (#5486)"
This reverts commit ffb4c5becf.
2024-10-04 10:52:50 +10:00
Kim Morrison
ed1f5b9945 Revert "doc: update README w/ Reservoir package options (#5546)"
This reverts commit 4771741fa2.
2024-10-04 10:50:58 +10:00
Kim Morrison
f87859f333 Revert "feat: lake: selective build cache fetch & display (#5572)"
This reverts commit 5eb6c67a78.
2024-10-04 10:49:59 +10:00
Kim Morrison
6dc87541dc Revert "fix: --no-cache on server DependencyBuildMode.never (#5583)"
This reverts commit 9dcd2ad2a3.
2024-10-04 10:49:14 +10:00
Kim Morrison
1cf7623d3a Revert "refactor: reduce Reservoir build fetch attempts & warnings (#5600)"
This reverts commit a01166f045.
2024-10-04 10:48:15 +10:00
Kim Morrison
4cb90dddfc chore: update CMakeLists.txt 2024-10-03 20:57:18 +10:00
11 changed files with 41 additions and 25 deletions

View File

@@ -8,6 +8,11 @@ This file contains work-in-progress notes for the upcoming release, as well as p
Please check the [releases](https://github.com/leanprover/lean4/releases) page for the current status
of each version.
v4.13.0
----------
Release notes to be written.
v4.12.0
----------

View File

@@ -10,9 +10,9 @@ endif()
include(ExternalProject)
project(LEAN CXX C)
set(LEAN_VERSION_MAJOR 4)
set(LEAN_VERSION_MINOR 12)
set(LEAN_VERSION_MINOR 13)
set(LEAN_VERSION_PATCH 0)
set(LEAN_VERSION_IS_RELEASE 0) # This number is 1 in the release revision, and 0 otherwise.
set(LEAN_VERSION_IS_RELEASE 1) # This number is 1 in the release revision, and 0 otherwise.
set(LEAN_SPECIAL_VERSION_DESC "" CACHE STRING "Additional version description like 'nightly-2018-03-11'")
set(LEAN_VERSION_STRING "${LEAN_VERSION_MAJOR}.${LEAN_VERSION_MINOR}.${LEAN_VERSION_PATCH}")
if (LEAN_SPECIAL_VERSION_DESC)

View File

@@ -528,11 +528,12 @@ def elabCommandTopLevel (stx : Syntax) : CommandElabM Unit := withRef stx do pro
let mut msgs := ( get).messages
for tree in ( getInfoTrees) do
trace[Elab.info] ( tree.format)
if let some snap := ( read).snap? then
-- We can assume that the root command snapshot is not involved in parallelism yet, so this
-- should be true iff the command supports incrementality
if ( IO.hasFinished snap.new.result) then
liftCoreM <| Language.ToSnapshotTree.toSnapshotTree snap.new.result.get |>.trace
if ( isTracingEnabledFor `Elab.snapshotTree) then
if let some snap := ( read).snap? then
-- We can assume that the root command snapshot is not involved in parallelism yet, so this
-- should be true iff the command supports incrementality
if ( IO.hasFinished snap.new.result) then
liftCoreM <| Language.ToSnapshotTree.toSnapshotTree snap.new.result.get |>.trace
modify fun st => { st with
messages := initMsgs ++ msgs
infoState := { st.infoState with trees := initInfoTrees ++ st.infoState.trees }

View File

@@ -243,11 +243,16 @@ instance : ToSnapshotTree SnapshotLeaf where
structure DynamicSnapshot where
/-- Concrete snapshot value as `Dynamic`. -/
val : Dynamic
/-- Snapshot tree retrieved from `val` before erasure. -/
tree : SnapshotTree
/--
Snapshot tree retrieved from `val` before erasure. We do thunk even the first level as accessing
it too early can create some unnecessary tasks from `toSnapshotTree` that are otherwise avoided by
`(sync := true)` when accessing only after elaboration has finished. Early access can even lead to
deadlocks when later forcing these unnecessary tasks on a starved thread pool.
-/
tree : Thunk SnapshotTree
instance : ToSnapshotTree DynamicSnapshot where
toSnapshotTree s := s.tree
toSnapshotTree s := s.tree.get
/-- Creates a `DynamicSnapshot` from a typed snapshot value. -/
def DynamicSnapshot.ofTyped [TypeName α] [ToSnapshotTree α] (val : α) : DynamicSnapshot where

View File

@@ -44,9 +44,9 @@ 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 == "leanprover" || self.scope == "leanprover-community")
&& !( getElanToolchain).isEmpty
&& !( self.buildDir.pathExists))) -- Reservoir
if shouldFetch then
self.optBuildCache.fetch
else
@@ -79,15 +79,12 @@ def Package.maybeFetchBuildCacheWithWarning (self : Package) := do
def Package.fetchOptRelease := @maybeFetchBuildCacheWithWarning
/--
Build the `extraDepTargets` for the package and its transitive dependencies.
Also fetch pre-built releases for the package's' dependencies.
Build the `extraDepTargets` for the package.
Also, if the package is a dependency, maybe fetch its build cache.
-/
def Package.recBuildExtraDepTargets (self : Package) : FetchM (BuildJob Unit) :=
withRegisterJob s!"{self.name}:extraDep" do
let mut job := BuildJob.nil
-- Build dependencies' extra dep targets
for dep in self.deps do
job := job.mix <| dep.extraDep.fetch
-- Fetch build cache if this package is a dependency
if self.name ( getWorkspace).root.name then
job := job.add <| self.maybeFetchBuildCacheWithWarning

View File

@@ -210,10 +210,11 @@ def updateDep
| .git (inputRev? := some rev) .. => s!" @ {repr rev}"
| _ => ""
logError (stdMismatchError depPkg.name.toString rev)
if let .error e IO.FS.removeDirAll depPkg.dir |>.toBaseIO then -- cleanup
-- Deleting git repositories via IO.FS.removeDirAll does not work reliably on Windows
logError s!"'{dep.name}' was downloaded incorrectly; \
you will need to manually delete '{depPkg.dir}': {e}"
if matDep.manifestEntry.src matches .git .. then
if let .error e IO.FS.removeDirAll depPkg.dir |>.toBaseIO then -- cleanup
-- Deleting git repositories via IO.FS.removeDirAll does not work reliably on Windows
logError s!"'{dep.name}' was downloaded incorrectly; \
you will need to manually delete '{depPkg.dir}': {e}"
error s!"{pkg.name}: package '{depPkg.name}' was required as '{dep.name}'"
return depPkg

View File

@@ -0,0 +1 @@
import Dep

View File

View File

@@ -5,3 +5,5 @@ package dep where
preferReleaseBuild := true
releaseRepo := "https://example.com"
buildArchive := "release.tgz"
lean_lib Dep

View File

@@ -40,9 +40,10 @@ 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
⚠ [3/6] Ran dep:extraDep
warning: building from source; failed to fetch GitHub release (run with '-v' for details)
✔ [4/5] Built Test
✔ [4/6] Built Dep
✔ [5/6] Built Test
Build completed successfully.
EOF
) -
@@ -56,7 +57,7 @@ mkdir -p .lake/packages/dep/.lake/build
$LAKE -d .lake/packages/dep pack 2>&1 | grep --color "packing"
test -f .lake/packages/dep/.lake/release.tgz
echo 4225503363911572621 > .lake/packages/dep/.lake/release.tgz.trace
rmdir .lake/packages/dep/.lake/build
rm -rf .lake/packages/dep/.lake/build
$LAKE build dep:release -v | grep --color "tar"
test -d .lake/packages/dep/.lake/build

View File

@@ -18,6 +18,9 @@ $LAKE -v -f git.toml build @Cli:extraDep |
./clean.sh
$LAKE -f barrel.lean update
# Test that a barrel is not fetched for an unbuilt dependency
$LAKE -v -f barrel.lean build @test:extraDep |
grep --color "Cli:optBarrel" && exit 1 || true
# 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) |