fix: lake: no LEAN_GITHASH for bootstrap (#10012)

This PR changes Lake to not set `LEAN_GITHASH` when in core (i.e.
`bootstrap = true`). This avoids Lake rebuilding modules when the Lake
watchdog is on one build of Lean/Lake and the command line is on a
different one.
This commit is contained in:
Mac Malone 2025-08-20 22:44:36 -04:00 committed by GitHub
parent 6b4c356c5b
commit 6a7111ed0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View file

@ -215,7 +215,6 @@ def baseVars (env : Env) : Array (String × Option String) :=
("LAKE_ARTIFACT_CACHE", toString env.enableArtifactCache),
("LAKE_CACHE_DIR", if env.lakeCache.isDisabled then none else env.lakeCache.dir.toString),
("LEAN", env.lean.lean.toString),
("LEAN_GITHASH", env.leanGithash),
("LEAN_SYSROOT", env.lean.sysroot.toString),
("LEAN_AR", env.lean.ar.toString),
("LEAN_CC", env.lean.leanCc?)
@ -226,6 +225,7 @@ def vars (env : Env) : Array (String × Option String) :=
let vars := env.baseVars ++ #[
("LEAN_PATH", some env.leanPath.toString),
("LEAN_SRC_PATH", some env.leanSrcPath.toString),
("LEAN_GITHASH", env.leanGithash),
("PATH", some env.path.toString)
]
if Platform.isWindows then

View file

@ -41,6 +41,10 @@ hydrate_opaque_type OpaqueWorkspace Workspace
namespace Workspace
/-- **For internal use.** Whether this workspace is Lean itself. -/
@[inline] def bootstrap (ws : Workspace) : Bool :=
ws.root.bootstrap
/-- The Lake cache. May be disabled. -/
@[inline] def lakeCache (ws : Workspace) : Cache :=
ws.lakeEnv.lakeCache
@ -234,13 +238,15 @@ def augmentedSharedLibPath (self : Workspace) : SearchPath :=
self.lakeEnv.lean.sharedLibPath ++ self.sharedLibPath ++ self.lakeEnv.initSharedLibPath
/--
The detected environment augmented with Lake's and the workspace's paths.
The detected environment augmented with Lake's and the workspace's configuration.
These are the settings use by `lake env` / `Lake.env` to run executables.
-/
def augmentedEnvVars (self : Workspace) : Array (String × Option String) :=
let vars := self.lakeEnv.baseVars ++ #[
("LEAN_PATH", some self.augmentedLeanPath.toString),
("LEAN_SRC_PATH", some self.augmentedLeanSrcPath.toString),
-- Allow the Lean version to change dynamically within core
("LEAN_GITHASH", if self.bootstrap then none else some self.lakeEnv.leanGithash),
("PATH", some self.augmentedPath.toString)
]
if Platform.isWindows then

View file

@ -1,5 +1,7 @@
#include "util/options.h"
// dear bot, please update stage0
namespace lean {
options get_default_options() {
options opts;