diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-14 15:18:23 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-14 15:18:23 -0500 |
| commit | 2440b88782e08f3411c7425d6fe496990d68ce9c (patch) | |
| tree | 9c951d148efb9f7fd730e3e8ad3d0d7a7c4e4485 | |
| parent | d2c2c69581518b54783812a7cd013f4c271c06fd (diff) | |
Clean up build output and add [+] for analyzing phase
- Remove all label prefixes from build logs (bild:, nix:, etc) -
Show [+] Namespace when first reserving a line (analyzing) - Show [~]
Namespace: output when building with subprocess output - Show [✓]
Namespace (green) on success - Show [x] Namespace (red) on failure
| -rwxr-xr-x | Omni/Bild.hs | 10 | ||||
| -rw-r--r-- | Omni/Log/Concurrent.hs | 14 |
2 files changed, 16 insertions, 8 deletions
diff --git a/Omni/Bild.hs b/Omni/Bild.hs index f84b08c..1bb42db 100755 --- a/Omni/Bild.hs +++ b/Omni/Bild.hs @@ -964,19 +964,15 @@ build andTest loud jobs cpus analysis = do result <- case compiler of CPython -> case out of Just _ -> - LogC.updateCurrentLine namespace "bild: nix: python" - >> nixBuild loud jobs cpus target + nixBuild loud jobs cpus target +> (\r -> (isSuccess (fst r) && andTest) ?: (test loud target, pure r)) Nothing -> - LogC.updateCurrentLine namespace "cannot build library" - >> pure (Exit.ExitSuccess, mempty) + pure (Exit.ExitSuccess, mempty) Gcc -> - LogC.updateCurrentLine namespace "bild: nix: gcc" - >> nixBuild loud jobs cpus target + nixBuild loud jobs cpus target Ghc -> case out of Nothing -> pure (Exit.ExitSuccess, mempty) Just _ -> do - LogC.updateCurrentLine namespace ("bild: nix: " <> user <> "@" <> host) result <- nixBuild loud jobs cpus target if andTest && (isSuccess <| fst result) then test loud target diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs index 05426aa..47e9404 100644 --- a/Omni/Log/Concurrent.hs +++ b/Omni/Log/Concurrent.hs @@ -119,7 +119,19 @@ reserveLine LineManager {..} ns = linesMap' = Map.insert lineNum (Just status) linesMap in (linesMap', Just lineNum) case mLine of - Just lineNum -> modifyIORef' namespaceLines (Map.insert ns lineNum) + Just lineNum -> do + modifyIORef' namespaceLines (Map.insert ns lineNum) + currentLine <- readIORef lmCurrentLine + ANSI.hSaveCursor IO.stderr + ANSI.hSetCursorColumn IO.stderr 0 + let linesToMove = currentLine - lineNum + when (linesToMove > 0) <| ANSI.hCursorUp IO.stderr linesToMove + when (linesToMove < 0) <| ANSI.hCursorDown IO.stderr (abs linesToMove) + ANSI.hClearLine IO.stderr + let nsText = Text.pack (Namespace.toPath ns) + IO.hPutStr IO.stderr (Text.unpack <| "[+] " <> nsText) + IO.hFlush IO.stderr + ANSI.hRestoreCursor IO.stderr Nothing -> pure () pure mLine where |
