1
0
forked from GitHub/gf-rgl

--verbose flag shows file names, not passed on to GF

This commit is contained in:
John J. Camilleri
2018-08-09 09:52:41 +02:00
parent e73d42379c
commit 60f19691eb
3 changed files with 14 additions and 17 deletions

24
Make.hs
View File

@@ -125,20 +125,20 @@ getRGLBuildDir info mode = infoBuildDir info </> getRGLBuildSubDir mode
getRGLBuildSubDir :: Mode -> String getRGLBuildSubDir :: Mode -> String
getRGLBuildSubDir mode = getRGLBuildSubDir mode =
case mode of case mode of
AllTenses -> "alltenses"
Present -> "present" Present -> "present"
AllTenses -> "alltenses"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Build modes -- Build modes
data Mode = AllTenses | Present data Mode = Present | AllTenses
deriving (Show,Eq) deriving (Show,Eq)
all_modes :: [String] all_modes :: [String]
all_modes = ["alltenses","present"] all_modes = ["present","alltenses"]
default_modes :: [Mode] default_modes :: [Mode]
default_modes = [AllTenses,Present] default_modes = [Present,AllTenses]
-- | An RGL build command -- | An RGL build command
data RGLCommand = RGLCommand data RGLCommand = RGLCommand
@@ -156,8 +156,9 @@ rglCommands =
createDirectoryIfMissing True prelude_dst_dir createDirectoryIfMissing True prelude_dst_dir
files <- getDirectoryContents prelude_src_dir files <- getDirectoryContents prelude_src_dir
let modules = [prelude_src_dir </> file | file <- files, file /= "." && file /= ".."] let modules = [prelude_src_dir </> file | file <- files, file /= "." && file /= ".."]
putStrLn $ "Building [Prelude] " ++ unwords (map dropSourceDir modules) putStrLn $ "Building [Prelude]"
run_gfc bi ([if infoVerbose bi then "--verbose" else "--quiet", "--gfo-dir="++prelude_dst_dir] ++ modules) 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 "all" True $ gfcp [l,s,c,t,sc]
, RGLCommand "lang" False $ gfcp [l,s] , RGLCommand "lang" False $ gfcp [l,s]
@@ -174,7 +175,7 @@ rglCommands =
Just mfull -> flip mapM_ modes $ \mode -> do Just mfull -> flip mapM_ modes $ \mode -> do
let dst = getRGLBuildDir bi mode let dst = getRGLBuildDir bi mode
putStrLn $ "Building [" ++ show mode ++ "] " ++ dropSourceDir mfull 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 where
@@ -393,13 +394,14 @@ gfcn :: Info -> Mode -> String -> [FilePath] -> IO ()
gfcn bi mode summary files = do gfcn bi mode summary files = do
let dir = getRGLBuildDir bi mode let dir = getRGLBuildDir bi mode
preproc = case mode of preproc = case mode of
AllTenses -> ""
Present -> "--preproc=mkPresent" Present -> "--preproc=mkPresent"
AllTenses -> ""
createDirectoryIfMissing True dir createDirectoryIfMissing True dir
if length files > 0 if length files > 0
then do then do
putStrLn $ "Building [" ++ show mode ++ "] " ++ summary putStrLn $ "Building [" ++ show mode ++ "]"
run_gfc bi ([if infoVerbose bi then "--verbose" else "--quiet", "--no-pmcfg", preproc, "--gfo-dir="++dir] ++ files) when (infoVerbose bi) (putStrLn summary)
run_gfc bi (["--no-pmcfg", preproc, "--gfo-dir="++dir] ++ files)
else else
putStrLn $ "Skipping [" ++ show mode ++ "] (nothing to build)" putStrLn $ "Skipping [" ++ show mode ++ "] (nothing to build)"
@@ -407,7 +409,7 @@ gfcn bi mode summary files = do
run_gfc :: Info -> [String] -> IO () run_gfc :: Info -> [String] -> IO ()
run_gfc bi args = do run_gfc bi args = do
let let
args' = ["--batch"] ++ filter (not . null) args args' = ["--batch", "--quiet"] ++ filter (not . null) args
gf = infoGFPath bi gf = infoGFPath bi
execute gf args' execute gf args'

View File

@@ -54,11 +54,6 @@ src="src"
dist="dist" dist="dist"
gfc="${gf} --batch --quiet" gfc="${gf} --batch --quiet"
# Redirect stderr if not verbose
if [ $verbose = false ]; then
exec 2> /dev/null
fi
# Make directories if not present # Make directories if not present
mkdir -p "${dist}/prelude" mkdir -p "${dist}/prelude"
mkdir -p "${dist}/present" mkdir -p "${dist}/present"

View File

@@ -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: You can pass the following flags:
- `--dest=...` to manually specify the install location - `--dest=...` to manually specify the install location
- `--gf=...` to specify the path to the `gf` executable, if not available on the system path - `--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` ## Windows batch file: `Make.bat`