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

Don't allow to specify --hadrian and --config #1085

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 19 additions & 11 deletions lib-opt/GHCup/OptParse/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Examples:

ghcCompileOpts :: Parser GHCCompileOptions
ghcCompileOpts =
GHCCompileOptions
(\targetGhc bootstrapGhc jobs patches crossTarget addConfArgs setCompile overwriteVer buildFlavour (buildSystem, buildConfig) isolateDir -> GHCCompileOptions {..})
<$> ((GHC.SourceDist <$> option
(eitherReader
(first (const "Not a valid version") . version . T.pack)
Expand Down Expand Up @@ -216,14 +216,6 @@ ghcCompileOpts =
<> (completer $ listCompleter $ fmap show ([1..12] :: [Int]))
)
)
<*> optional
(option
str
(short 'c' <> long "config" <> metavar "CONFIG" <> help
"Absolute path to build config file"
<> completer (bashCompleter "file")
)
)
<*> (optional
(
(fmap Right $ many $ option
Expand Down Expand Up @@ -275,13 +267,29 @@ ghcCompileOpts =
)
)
<*> (
(\b -> if b then Just Hadrian else Nothing) <$> switch
(\b -> (, Nothing) $ if b then Just Hadrian else Nothing) <$> switch
(long "hadrian" <> help "Use the hadrian build system instead of make. Tries to detect by default."
)
<|>
(\b -> if b then Just Make else Nothing) <$> switch
((\b c -> case (b, c) of
-- --make specified
(True, _) -> (Just Make, c)
-- only --config specified... assume make
(False, Just _) -> (Just Make, c)
-- otherwise fall back to runtime detection of build
-- system
(False, _) -> (Nothing, c)) <$> switch
(long "make" <> help "Use the make build system instead of hadrian. Tries to detect by default."
)
<*> optional
(option
str
(short 'c' <> long "config" <> metavar "CONFIG" <> help
"Absolute path to build config file (implies make)"
<> completer (bashCompleter "file")
)
)
)
)
<*> optional
(option
Expand Down
4 changes: 2 additions & 2 deletions test/optparse-test/CompileTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ compileGhcCheckList = mapSecond CompileGHC
)
, (baseCmd <> "-j20", baseOptions{GHC.jobs = Just 20})
, (baseCmd <> "--jobs 10", baseOptions{GHC.jobs = Just 10})
, (baseCmd <> "-c build.mk", baseOptions{GHC.buildConfig = Just "build.mk"})
, (baseCmd <> "--config build.mk", baseOptions{GHC.buildConfig = Just "build.mk"})
, (baseCmd <> "-c build.mk", baseOptions{GHC.buildConfig = Just "build.mk", GHC.buildSystem = Just Make})
, (baseCmd <> "--config build.mk", baseOptions{GHC.buildConfig = Just "build.mk", GHC.buildSystem = Just Make})
#ifdef IS_WINDOWS
, (baseCmd <> "--patch file:c:/example.patch", baseOptions{GHC.patches = Just $ Right [[uri|file:c:/example.patch|]]})
#else
Expand Down
Loading