Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compilation progress log #2969

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ runPipelineOptions m = do
g <- askGlobalOptions
let opt =
defaultPipelineOptions
{ _pipelineNumThreads = g ^. globalNumThreads
{ _pipelineNumThreads = g ^. globalNumThreads,
_pipelineShowThreadId = g ^. globalDevShowThreadIds
}
runReader opt m

Expand Down
28 changes: 13 additions & 15 deletions app/Commands/Dev/ImportTree/Print.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ import Juvix.Compiler.Pipeline.Loader.PathResolver
import Juvix.Compiler.Pipeline.Loader.PathResolver.ImportTree

runCommand :: (Members AppEffects r) => PrintOptions -> Sem r ()
runCommand PrintOptions {..} = runReader opts . runPipelineSetup $ do
tree <- case _printInputFile of
Nothing -> ask
Just appInputFile -> do
inputFile <- fromAppPathFile appInputFile
mkImportTree (Just inputFile)
renderStdOut (ppOutDefaultNoComments tree)
when _printStats $ do
let stats = mkImportTreeStats tree
renderStdOut (ppOutDefaultNoComments stats)
where
opts =
defaultPipelineOptions
{ _pipelineImportStrategy = _printScanStrategy
}
runCommand PrintOptions {..} = runPipelineOptions
. local (set pipelineImportStrategy _printScanStrategy)
. runPipelineSetup
$ do
tree <- case _printInputFile of
Nothing -> ask
Just appInputFile -> do
inputFile <- fromAppPathFile appInputFile
mkImportTree (Just inputFile)
renderStdOut (ppOutDefaultNoComments tree)
when _printStats $ do
let stats = mkImportTreeStats tree
renderStdOut (ppOutDefaultNoComments stats)
2 changes: 1 addition & 1 deletion app/Commands/Typecheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import Commands.Typecheck.Options
runCommand :: (Members AppEffects r) => TypecheckOptions -> Sem r ()
runCommand localOpts = do
case localOpts ^. typecheckInputFile of
Just _inputFile -> void (runPipelineNoOptions (localOpts ^. typecheckInputFile) upToCoreTypecheck)
Just inputFile -> void (runPipelineNoOptions (Just inputFile) upToCoreTypecheck)
Nothing -> void (runPipelineOptions . runPipelineSetup $ processProject)
logInfo "Well done! It type checks"
2 changes: 0 additions & 2 deletions app/CommonOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module CommonOptions
( module CommonOptions,
module Juvix.Prelude,
module Juvix.Prelude.Pretty,
module Parallel.ProgressLog,
module Options.Applicative,
module Prettyprinter.Render.Terminal,
)
Expand All @@ -28,7 +27,6 @@ import Juvix.Prelude.Parsing qualified as P
import Juvix.Prelude.Pretty hiding (group, list)
import Options.Applicative hiding (helpDoc)
import Options.Applicative qualified as Opt
import Parallel.ProgressLog
import Prettyprinter.Render.Terminal hiding (renderIO, renderStrict)
import System.Process
import Text.Read (readMaybe)
Expand Down
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Asm/Interpreter/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Juvix.Compiler.Asm.Interpreter.Base
)
where

import Juvix.Compiler.Asm.Language
import Juvix.Compiler.Asm.Language hiding (logMessage)
import Juvix.Compiler.Tree.Language.Value hiding (Value)
import Juvix.Compiler.Tree.Language.Value qualified as Tree

Expand Down
3 changes: 3 additions & 0 deletions src/Juvix/Compiler/Concrete/Print/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ instance PrettyPrint KeywordRef where
$ p
)

docNoCommentsDefault :: (PrettyPrint c) => c -> Doc Ann
docNoCommentsDefault = docHelper Nothing defaultOptions

docNoComments :: (PrettyPrint c) => Options -> c -> Doc Ann
docNoComments = docHelper Nothing

Expand Down
6 changes: 2 additions & 4 deletions src/Juvix/Compiler/Pipeline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ import Juvix.Compiler.Tree qualified as Tree
import Juvix.Data.Effect.Git
import Juvix.Data.Effect.Process
import Juvix.Data.Field
import Parallel.ProgressLog (ProgressLog)
import Parallel.ProgressLog

type PipelineAppEffects = '[TaggedLock, Reader PipelineOptions, Logger, EmbedIO]

type PipelineLocalEff =
'[ ModuleInfoCache,
ProgressLog,
JvoCache,
Reader ImportTree,
Reader ImportScanStrategy,
Expand All @@ -74,7 +75,6 @@ type PipelineLocalEff =
Error GitProcessError,
Process,
Log,
ProgressLog,
Reader EntryPoint,
Files,
Error JuvixError,
Expand All @@ -93,8 +93,6 @@ type PipelineEff r =
]
++ PipelineEff' r

makeLenses ''PipelineOptions

--------------------------------------------------------------------------------
-- Workflows from source
--------------------------------------------------------------------------------
Expand Down
Loading
Loading