Commit b3e5c678 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

hadrian: Throw error on duplicate-named flavours

Throw an error if the user requests a flavour for which there is more
than one match.

Fixes #17156.
parent 0a5e4f5f
Pipeline #15076 failed with stages
in 1 minute and 13 seconds
......@@ -58,12 +58,14 @@ flavour :: Action Flavour
flavour = do
flavourName <- fromMaybe userDefaultFlavour <$> cmdFlavour
kvs <- userSetting ([] :: [KeyVal])
let unknownFlavour = error $ "Unknown build flavour: " ++ flavourName
flavours = hadrianFlavours ++ userFlavours
let flavours = hadrianFlavours ++ userFlavours
(_settingErrs, tweak) = applySettings kvs
return $ maybe unknownFlavour tweak $
find ((== flavourName) . name) flavours
return $
case filter (\fl -> name fl == flavourName) flavours of
[] -> error $ "Unknown build flavour: " ++ flavourName
[f] -> tweak f
_ -> error $ "Multiple build flavours named " ++ flavourName
getIntegerPackage :: Expr Package
getIntegerPackage = expr (integerLibrary =<< flavour)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment