Skip to content

Change default flag value to True in solver DSL. #3058

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

Merged
merged 1 commit into from
Jan 16, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ exAvSrcPkg ex =
extractFlags (ExFlag f a b) = C.MkFlag {
C.flagName = C.FlagName f
, C.flagDescription = ""
, C.flagDefault = False
, C.flagDefault = True
, C.flagManual = False
}
: concatMap extractFlags (deps a ++ deps b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ tests = [
testBuildable "avoid building component with unknown dependency" (ExAny "unknown")
, testBuildable "avoid building component with unknown extension" (ExExt (UnknownExtension "unknown"))
, testBuildable "avoid building component with unknown language" (ExLang (UnknownLanguage "unknown"))
, runTest $ mkTest dbBuildable1 "choose flags that set buildable to false" ["pkg"] (Just [("flag1-true", 1), ("flag2-false", 1), ("pkg", 1)])
, runTest $ mkTest dbBuildable1 "choose flags that set buildable to false" ["pkg"] (Just [("flag1-false", 1), ("flag2-true", 1), ("pkg", 1)])
, runTest $ mkTest dbBuildable2 "choose version that sets buildable to false" ["A"] (Just [("A", 1), ("B", 2)])
]
]
Expand Down Expand Up @@ -440,39 +440,39 @@ dbLangs1 = [
, Right $ exAv "C" 1 [ExLang (UnknownLanguage "Haskell3000"), ExAny "B"]
]

-- | cabal must choose +disable-lib for "pkg" in order to avoid the unavailable
-- dependency. False is the default. The flag choice causes "pkg" to depend on
-- "true-dep".
-- | cabal must set enable-lib to false in order to avoid the unavailable
-- dependency. Flags are true by default. The flag choice causes "pkg" to
-- depend on "false-dep".
testBuildable :: String -> ExampleDependency -> TestTree
testBuildable testName unavailableDep =
runTest $ mkTestExtLang (Just []) (Just []) db testName ["pkg"] expected
where
expected = (Just [("pkg", 1), ("true-dep", 1)])
expected = Just [("false-dep", 1), ("pkg", 1)]
db = [
Right $ exAv "pkg" 1 [
unavailableDep
, ExFlag "disable-lib" NotBuildable (Buildable [])
, ExTest "test" [exFlag "disable-lib"
, ExFlag "enable-lib" (Buildable []) NotBuildable
, ExTest "test" [exFlag "enable-lib"
[ExAny "true-dep"]
[ExAny "false-dep"]]
]
, Right $ exAv "true-dep" 1 []
, Right $ exAv "false-dep" 1 []
]

-- | cabal must choose +flag1 -flag2 for "pkg", which requires packages
-- "flag1-true" and "flag2-false".
-- | cabal must choose -flag1 +flag2 for "pkg", which requires packages
-- "flag1-false" and "flag2-true".
dbBuildable1 :: ExampleDb
dbBuildable1 = [
Right $ exAv "pkg" 1
[ ExAny "unknown"
, ExFlag "flag1" NotBuildable (Buildable [])
, ExFlag "flag2" NotBuildable (Buildable [])
, ExFlag "flag1" (Buildable []) NotBuildable
, ExFlag "flag2" (Buildable []) NotBuildable
, ExTest "optional-test"
[ ExAny "unknown"
, ExFlag "flag1"
(Buildable [ExFlag "flag2" (Buildable []) NotBuildable])
(Buildable [])]
(Buildable [])
(Buildable [ExFlag "flag2" NotBuildable (Buildable [])])]
, ExTest "test" [ exFlag "flag1" [ExAny "flag1-true"] [ExAny "flag1-false"]
, exFlag "flag2" [ExAny "flag2-true"] [ExAny "flag2-false"]]
]
Expand Down