Skip to content

Commit a49b446

Browse files
committed
Cut off update: warnings, build reason, log file
1 parent 31aba1a commit a49b446

File tree

14 files changed

+1096
-908
lines changed

14 files changed

+1096
-908
lines changed

app/Command/Compile.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import Language.PureScript qualified as P
1616
import Language.PureScript.CST qualified as CST
1717
import Language.PureScript.Errors.JSON (JSONResult(..), toJSONErrors)
1818
import Language.PureScript.Glob (toInputGlobs, PSCGlobs(..), warnFileTypeNotFound)
19-
import Language.PureScript.Make (buildMakeActions, inferForeignModules, runMake)
19+
import Language.PureScript.Make (buildMakeActions, inferForeignModules, progressWithFile, printProgress, runMake)
2020
import Options.Applicative qualified as Opts
2121
import SharedCLI qualified
2222
import System.Console.ANSI qualified as ANSI
2323
import System.Exit (exitSuccess, exitFailure)
24-
import System.Directory (getCurrentDirectory)
24+
import System.FilePath ((</>))
25+
import System.Directory (createDirectoryIfMissing, getCurrentDirectory)
2526
import System.IO (hPutStr, stderr, stdout)
2627
import System.IO.UTF8 (readUTF8FilesT)
2728

@@ -68,11 +69,18 @@ compile PSCMakeOptions{..} = do
6869
]
6970
exitFailure
7071
moduleFiles <- readUTF8FilesT input
72+
73+
_ <- createDirectoryIfMissing True pscmOutputDir
74+
let logFile = pscmOutputDir </> "compile.log"
75+
let cleanFile = True
76+
7177
(makeErrors, makeWarnings) <- runMake pscmOpts $ do
7278
ms <- CST.parseModulesFromFiles id moduleFiles
7379
let filePathMap = M.fromList $ map (\(fp, pm) -> (P.getModuleName $ CST.resPartial pm, Right fp)) ms
7480
foreigns <- inferForeignModules filePathMap
75-
let makeActions = buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix
81+
logProgress <- progressWithFile logFile cleanFile
82+
let makeActions = (buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix)
83+
{ P.progress = (*>) <$> printProgress <*> logProgress }
7684
P.make_ makeActions (map snd ms)
7785
printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors moduleFiles makeWarnings makeErrors
7886
exitSuccess

src/Language/PureScript/AST/SourcePos.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,6 @@ widenSourceSpan (SourceSpan n1 s1 e1) (SourceSpan n2 s2 e2) =
116116

117117
widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn
118118
widenSourceAnn (s1, _) (s2, _) = (widenSourceSpan s1 s2, [])
119+
120+
replaceSpanName :: String -> SourceSpan -> SourceSpan
121+
replaceSpanName name (SourceSpan _ sps spe) = SourceSpan name sps spe

src/Language/PureScript/Docs/Collect.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ compileForDocs outputDir inputFiles = do
9696
foreigns <- P.inferForeignModules filePathMap
9797
let makeActions =
9898
(P.buildMakeActions outputDir filePathMap foreigns False)
99-
{ P.progress = liftIO . TIO.hPutStr stdout . (<> "\n") . P.renderProgressMessage "documentation for "
99+
{ P.progress = liftIO . maybe (pure ()) (TIO.hPutStr stdout . (<> "\n")) . P.renderProgressMessage "documentation for "
100100
}
101101
P.make makeActions (map snd ms)
102102
either throwError return result

src/Language/PureScript/Ide/Rebuild.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ rebuildFile file actualFile codegenTargets runOpenBuild = do
8080
-- Rebuild the single module using the cached externs
8181
(result, warnings) <- logPerf (labelTimespec "Rebuilding Module") $
8282
liftIO $ P.runMake (P.defaultOptions { P.optionsCodegenTargets = codegenTargets }) do
83-
newExterns <- P.rebuildModule makeEnv externs m
83+
newExterns <- P.rebuildModule makeEnv externs (pwarnings, m)
8484
unless pureRebuild
8585
$ updateCacheDb codegenTargets outputDirectory file actualFile moduleName
8686
pure newExterns
@@ -166,7 +166,7 @@ rebuildModuleOpen
166166
-> m ()
167167
rebuildModuleOpen makeEnv externs m = void $ runExceptT do
168168
(openResult, _) <- liftIO $ P.runMake P.defaultOptions $
169-
P.rebuildModule (shushProgress (shushCodegen makeEnv)) externs (openModuleExports m)
169+
P.rebuildModule (shushProgress (shushCodegen makeEnv)) externs (mempty, openModuleExports m)
170170
case openResult of
171171
Left _ ->
172172
throwError (GeneralError "Failed when rebuilding with open exports")
@@ -183,7 +183,7 @@ shushProgress ma =
183183
-- | Stops any kind of codegen
184184
shushCodegen :: Monad m => P.MakeActions m -> P.MakeActions m
185185
shushCodegen ma =
186-
ma { P.codegen = \_ _ _ -> pure ()
186+
ma { P.codegen = \_ _ _ _ -> pure ()
187187
, P.ffiCodegen = \_ -> pure ()
188188
}
189189

src/Language/PureScript/Interactive.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ rebuild
6060
-> P.Module
6161
-> P.Make (P.ExternsFile, P.Environment)
6262
rebuild loadedExterns m = do
63-
externs <- P.rebuildModule buildActions loadedExterns m
63+
externs <- P.rebuildModule buildActions loadedExterns (mempty, m)
6464
return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment (loadedExterns ++ [externs]))
6565
where
6666
buildActions :: P.MakeActions P.Make

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy