fix: lake: log refactor bugs (#4033)

Fixes some bugs with the log refactor (#3835). Namely, quiet mode
progress printing and missing string interpolation in the fetching cloud
release caption.
This commit is contained in:
Mac Malone 2024-04-30 19:25:32 -04:00 committed by GitHub
parent f8d2ebd47a
commit cc2ccf71d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View file

@ -50,7 +50,7 @@ def Package.extraDepFacetConfig : PackageFacetConfig extraDepFacet :=
/-- Download and unpack the package's prebuilt release archive (from GitHub). -/
def Package.fetchRelease (self : Package) : SpawnM (BuildJob Unit) :=
withRegisterJob "Fetching {self.name} cloud release" <| Job.async do
withRegisterJob s!"Fetching {self.name} cloud release" <| Job.async do
let repo := GitRepo.mk self.dir
let repoUrl? := self.releaseRepo? <|> self.remoteUrl?
let some repoUrl := repoUrl? <|> (← repo.getFilteredRemoteUrl?)

View file

@ -48,7 +48,8 @@ def Workspace.runFetchM
let failLv : LogLevel := if ctx.failIfWarnings then .warning else .error
let failed := log.any (·.level ≥ failLv)
if !failed && io.isEmpty && !log.hasVisibleEntries verbosity then
if useANSI then out.putStr "\x1B[2K\r" else out.putStr "\n"
if showProgress then
if useANSI then out.putStr "\x1B[2K\r" else out.putStr "\n"
else
unless showProgress do
out.putStr header
@ -72,7 +73,8 @@ def Workspace.runFetchM
let failed := log.any (·.level ≥ failLv)
if failed then modify (·.push caption)
if !(failed || log.hasVisibleEntries verbosity) then
if useANSI then out.putStr "\x1B[2K\r" else out.putStr "\n"
if showProgress then
if useANSI then out.putStr "\x1B[2K\r" else out.putStr "\n"
else
unless showProgress do
out.putStr header

View file

@ -8,6 +8,9 @@ $LAKE exe hello
$LAKE exe hello Bob Bill
.lake/build/bin/hello
# Tests that quiet mode (-q) produces no output on no-op build
$LAKE -q build hello 2>&1 | diff - /dev/null
# Tests that build produces a manifest if there is none.
# Related: https://github.com/leanprover/lean4/issues/2549
test -f lake-manifest.json