Skip to content

Commit 3276af2

Browse files
Merge branch 'compiler_and_flags' into test_runner_option
2 parents 7d5a9b5 + fa04b1f commit 3276af2

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

bootstrap/src/Fpm.hs

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Control.Monad.Extra ( concatMapM
1717
, when
1818
)
1919
import Data.Hashable ( hash )
20-
import Data.List ( isSuffixOf
20+
import Data.List ( intercalate
21+
, isSuffixOf
2122
, find
2223
, nub
2324
)
@@ -35,6 +36,7 @@ import Development.Shake.FilePath ( (</>)
3536
import Options.Applicative ( Parser
3637
, (<**>)
3738
, (<|>)
39+
, auto
3840
, command
3941
, execParser
4042
, fullDesc
@@ -45,6 +47,7 @@ import Options.Applicative ( Parser
4547
, long
4648
, many
4749
, metavar
50+
, option
4851
, optional
4952
, progDesc
5053
, short
@@ -90,15 +93,15 @@ data Arguments =
9093
, runFlags :: [String]
9194
, runRunner :: Maybe String
9295
, runTarget :: Maybe String
93-
, runArgs :: Maybe String
96+
, runArgs :: Maybe [String]
9497
}
9598
| Test
9699
{ testRelease :: Bool
97100
, testCompiler :: FilePath
98101
, testFlags :: [String]
99102
, testRunner :: Maybe String
100103
, testTarget :: Maybe String
101-
, testArgs :: Maybe String
104+
, testArgs :: Maybe [String]
102105
}
103106

104107
data TomlSettings = TomlSettings {
@@ -183,7 +186,7 @@ app args settings = case args of
183186
Just r -> r ++ " "
184187
commandSufix = case runArgs of
185188
Nothing -> ""
186-
Just a -> " " ++ a
189+
Just a -> " " ++ (intercalate " " a)
187190
in case whichOne of
188191
Nothing -> do
189192
exitCodes <- mapM
@@ -228,7 +231,7 @@ app args settings = case args of
228231
Just r -> r ++ " "
229232
commandSufix = case testArgs of
230233
Nothing -> ""
231-
Just a -> " " ++ a
234+
Just a -> " " ++ (intercalate " " a)
232235
in case whichOne of
233236
Nothing -> do
234237
exitCodes <- mapM
@@ -433,11 +436,19 @@ runArguments =
433436
)
434437
)
435438
<*> optional
436-
(strArgument
437-
(metavar "TARGET" <> help "Name of the executable to run")
439+
(strOption
440+
(long "target" <> metavar "TARGET" <> help
441+
"Name of the executable to run"
442+
)
438443
)
439444
<*> optional
440-
(strArgument (metavar "ARGS" <> help "Arguments to the executable"))
445+
(many
446+
(strArgument
447+
( metavar "ARGS"
448+
<> help "Arguments to the executable(s) (should follow '--')"
449+
)
450+
)
451+
)
441452

442453
testArguments :: Parser Arguments
443454
testArguments =
@@ -468,8 +479,18 @@ testArguments =
468479
)
469480
)
470481
<*> optional
471-
(strArgument (metavar "TARGET" <> help "Name of the test to run"))
472-
<*> optional (strArgument (metavar "ARGS" <> help "Arguments to the test"))
482+
(strOption
483+
(long "target" <> metavar "TARGET" <> help "Name of the test to run"
484+
)
485+
)
486+
<*> optional
487+
(many
488+
(strArgument
489+
( metavar "ARGS"
490+
<> help "Arguments to the test(s) (should follow '--')"
491+
)
492+
)
493+
)
473494

474495
getDirectoriesFiles :: [FilePath] -> [FilePattern] -> IO [FilePath]
475496
getDirectoriesFiles dirs exts = getDirectoryFilesIO "" newPatterns

0 commit comments

Comments
 (0)