From d060d245e9825aab90b9ee7688b8910879144b81 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 13 Nov 2017 17:07:49 -0800 Subject: [PATCH] Apply package specific "ghc-options" after more general ones #3573 The order was: specific, $targets, $locals, $everything The order now is: $everything, $locals, $targets, specific I figured it made sense for targets flags to come after locals, since it is often a subset. --- ChangeLog.md | 3 +++ src/Stack/Build/Source.hs | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 648b2ee2e0..4d33f706c5 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -45,6 +45,9 @@ Behavior changes: * Stack will ask before saving hackage credentials to file. This new prompt can be avoided by using the `save-hackage-creds` setting. Please see [#2159](https://github.com/commercialhaskell/stack/issues/2159). +* `ghc-options:` for specific packages will now come after the options + specified for all packages / particular sets of packages. See + [#3573](https://github.com/commercialhaskell/stack/issues/3573). Other enhancements: diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index fac69783ed..6d2aab5fad 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -148,14 +148,14 @@ getLocalFlags bconfig boptsCli name = Map.unions -- configuration and commandline. getGhcOptions :: BuildConfig -> BuildOptsCLI -> PackageName -> Bool -> Bool -> [Text] getGhcOptions bconfig boptsCli name isTarget isLocal = concat - [ Map.findWithDefault [] name (configGhcOptionsByName config) - , if isTarget - then Map.findWithDefault [] AGOTargets (configGhcOptionsByCat config) - else [] + [ Map.findWithDefault [] AGOEverything (configGhcOptionsByCat config) , if isLocal then Map.findWithDefault [] AGOLocals (configGhcOptionsByCat config) else [] - , Map.findWithDefault [] AGOEverything (configGhcOptionsByCat config) + , if isTarget + then Map.findWithDefault [] AGOTargets (configGhcOptionsByCat config) + else [] + , Map.findWithDefault [] name (configGhcOptionsByName config) , concat [["-fhpc"] | isLocal && toCoverage (boptsTestOpts bopts)] , if boptsLibProfile bopts || boptsExeProfile bopts then ["-fprof-auto","-fprof-cafs"]