From 60f19691eb985bb80ccaba7886b23b51b7e94951 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Thu, 9 Aug 2018 09:52:41 +0200 Subject: [PATCH] --verbose flag shows file names, not passed on to GF --- Make.hs | 24 +++++++++++++----------- Make.sh | 5 ----- README.md | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Make.hs b/Make.hs index bae1bade4..98e5a5406 100644 --- a/Make.hs +++ b/Make.hs @@ -125,20 +125,20 @@ getRGLBuildDir info mode = infoBuildDir info getRGLBuildSubDir mode getRGLBuildSubDir :: Mode -> String getRGLBuildSubDir mode = case mode of - AllTenses -> "alltenses" Present -> "present" + AllTenses -> "alltenses" ------------------------------------------------------------------------------- -- Build modes -data Mode = AllTenses | Present +data Mode = Present | AllTenses deriving (Show,Eq) all_modes :: [String] -all_modes = ["alltenses","present"] +all_modes = ["present","alltenses"] default_modes :: [Mode] -default_modes = [AllTenses,Present] +default_modes = [Present,AllTenses] -- | An RGL build command data RGLCommand = RGLCommand @@ -156,8 +156,9 @@ rglCommands = createDirectoryIfMissing True prelude_dst_dir files <- getDirectoryContents prelude_src_dir let modules = [prelude_src_dir file | file <- files, file /= "." && file /= ".."] - putStrLn $ "Building [Prelude] " ++ unwords (map dropSourceDir modules) - run_gfc bi ([if infoVerbose bi then "--verbose" else "--quiet", "--gfo-dir="++prelude_dst_dir] ++ modules) + putStrLn $ "Building [Prelude]" + when (infoVerbose bi) $ putStrLn (unwords (map dropSourceDir modules)) + run_gfc bi (["--gfo-dir="++prelude_dst_dir] ++ modules) , RGLCommand "all" True $ gfcp [l,s,c,t,sc] , RGLCommand "lang" False $ gfcp [l,s] @@ -174,7 +175,7 @@ rglCommands = Just mfull -> flip mapM_ modes $ \mode -> do let dst = getRGLBuildDir bi mode putStrLn $ "Building [" ++ show mode ++ "] " ++ dropSourceDir mfull - run_gfc bi [if infoVerbose bi then "--verbose" else "--quiet", "--gfo-dir="++dst, mfull] + run_gfc bi ["--gfo-dir="++dst, mfull] ] where @@ -393,13 +394,14 @@ gfcn :: Info -> Mode -> String -> [FilePath] -> IO () gfcn bi mode summary files = do let dir = getRGLBuildDir bi mode preproc = case mode of - AllTenses -> "" Present -> "--preproc=mkPresent" + AllTenses -> "" createDirectoryIfMissing True dir if length files > 0 then do - putStrLn $ "Building [" ++ show mode ++ "] " ++ summary - run_gfc bi ([if infoVerbose bi then "--verbose" else "--quiet", "--no-pmcfg", preproc, "--gfo-dir="++dir] ++ files) + putStrLn $ "Building [" ++ show mode ++ "]" + when (infoVerbose bi) (putStrLn summary) + run_gfc bi (["--no-pmcfg", preproc, "--gfo-dir="++dir] ++ files) else putStrLn $ "Skipping [" ++ show mode ++ "] (nothing to build)" @@ -407,7 +409,7 @@ gfcn bi mode summary files = do run_gfc :: Info -> [String] -> IO () run_gfc bi args = do let - args' = ["--batch"] ++ filter (not . null) args + args' = ["--batch", "--quiet"] ++ filter (not . null) args gf = infoGFPath bi execute gf args' diff --git a/Make.sh b/Make.sh index 4aa66b7e2..ce194b44e 100755 --- a/Make.sh +++ b/Make.sh @@ -54,11 +54,6 @@ src="src" dist="dist" gfc="${gf} --batch --quiet" -# Redirect stderr if not verbose -if [ $verbose = false ]; then - exec 2> /dev/null -fi - # Make directories if not present mkdir -p "${dist}/prelude" mkdir -p "${dist}/present" diff --git a/README.md b/README.md index 3c6f862fe..acca5ba7d 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Simply run the script to build the entire RGL and install in the default locatio You can pass the following flags: - `--dest=...` to manually specify the install location - `--gf=...` to specify the path to the `gf` executable, if not available on the system path -- `--verbose` or `-v` to show all GF warnings and errors +- `--verbose` or `-v` to show a list of files being built (errors will always be shown) ## Windows batch file: `Make.bat`