File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,17 @@ post_update pkg do
159159 if rootPkg.name = pkg.name then
160160 return -- do not run in Mathlib itself
161161 if (← IO.getEnv "MATHLIB_NO_CACHE_ON_UPDATE" ) != some "1" then
162+ -- Check if Lake version matches toolchain version
163+ let toolchainFile := rootPkg.dir / "lean-toolchain"
164+ let toolchainContent ← IO.FS.readFile toolchainFile
165+ let toolchainVersion := match toolchainContent.trim.splitOn ":" with
166+ | [_, version] => version
167+ | _ => toolchainContent.trim -- fallback to full content if format is unexpected
168+ if Lean.versionString ≠ toolchainVersion then
169+ IO.println s! "Not running `lake exe cache get` yet, \
170+ as the `lake` version does not match the toolchain version in the project.\n \
171+ You should run `lake exe cache get` manually."
172+ return
162173 let exeFile ← runBuild cache.fetch
163174 -- Run the command in the root package directory,
164175 -- which is the one that holds the .lake folder and lean-toolchain file.
You can’t perform that action at this time.
0 commit comments