Skip to content

Commit

Permalink
Don't allow to specify --hadrian and --config
Browse files Browse the repository at this point in the history
Improves UX wrt #1082
  • Loading branch information
hasufell committed Jun 24, 2024
1 parent c17fafb commit 73f9c3f
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions lib-opt/GHCup/OptParse/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,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 @@ -215,14 +215,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 @@ -274,13 +266,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

0 comments on commit 73f9c3f

Please sign in to comment.