forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply local configuration to install targets
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
- Loading branch information
Showing
5 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
cabal-testsuite/PackageTests/Install/T7297-8909-7236/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
#ifdef TEST1 | ||
main = putStrLn "hi1" | ||
#endif | ||
|
||
#ifdef TEST2 | ||
main = putStrLn "hi2" | ||
#endif | ||
|
||
#ifdef TEST3 | ||
main = putStrLn "hi3" | ||
#endif | ||
|
||
#ifdef TEST4 | ||
main = putStrLn "hi4" | ||
#endif | ||
|
||
#ifdef TEST5 | ||
main = putStrLn "hi5" | ||
#endif | ||
|
||
#ifdef TEST6 | ||
main = putStrLn "hi6" | ||
#endif |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/Install/T7297-8909-7236/cabal.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: . |
22 changes: 22 additions & 0 deletions
22
cabal-testsuite/PackageTests/Install/T7297-8909-7236/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
env <- getTestEnv | ||
recordMode DoNotRecord $ do | ||
let | ||
installdir = testPrefixDir env </> "bin" | ||
commonOpts v = ["--ghc-options=-DTEST" ++ show v, "--overwrite-policy=always", "--installdir=" ++ installdir] | ||
installWithTgt tgt v = do | ||
cabal "install" (tgt:commonOpts v) | ||
runInstalledExe' "my-exe" [] | ||
>>= assertOutputContains ("hi" ++ show v) | ||
|
||
cabal "install" (commonOpts 1) -- no target | ||
runInstalledExe' "my-exe" [] | ||
>>= assertOutputContains "hi1" | ||
|
||
installWithTgt "t7297-89097236a" 2 | ||
installWithTgt "exe:my-exe" 3 | ||
installWithTgt "my-exe" 4 | ||
installWithTgt "all" 5 | ||
installWithTgt "all:exes" 6 |
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/Install/T7297-8909-7236/t7297-89097236a.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: t7297-89097236a | ||
version: 1.0 | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
|
||
executable my-exe | ||
main-is: Main.hs | ||
build-depends: base |