Skip to content

Commit

Permalink
Apply package specific "ghc-options" after more general ones #3573
Browse files Browse the repository at this point in the history
The order was: specific, $targets, $locals, *
The order now is: *, $locals, $targets, specific

I figured it made sense for targets flags to come after locals, since it is
often a subset.
  • Loading branch information
mgsloan committed Nov 14, 2017
1 parent e022171 commit 04dfb37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 04dfb37

Please sign in to comment.