Skip to content

Commit

Permalink
Merge pull request #6568 from commercialhaskell/fix6565-1
Browse files Browse the repository at this point in the history
Fix #6565 Include Cabal flags set manually in the source map hash
  • Loading branch information
mpilgrem committed May 4, 2024
2 parents f345721 + fd23491 commit e0a17cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

Release notes:

* The hash that Stack uses to distinguish one build plan from another has
changed for plans that set (as opposed to unset) manually Cabal flags for
immutable dependencies. This will cause Stack to rebuild dependencies for such
plans.

**Changes since v2.15.5:**

Behaviour changes:
Expand Down Expand Up @@ -74,6 +79,9 @@ Bug fixes:
that form.
* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
`stack build` to be slower than previously.
* The hashes that Stack uses to distinguish one build plan from another now
include the Cabal flags for immutable dependencies set manually. Previously,
in error, only such flags that were unset manually were included.

## v2.15.5 - 2024-03-28

Expand Down
7 changes: 0 additions & 7 deletions doc/build_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ This overrides:
In order to set a Cabal flag for a GHC boot package, the package must be
specified as an [extra-dep](yaml_configuration.md#extra-deps).

!!! warning

Stack creates snapshots when building immutable dependencies of projects.
The names of Cabal flags that have been unset manually distinguish one such
snapshot from another. However, the names of Cabal flags that have been set
manually do not do so.

### `--[no-]force-dirty` flag

Default: Disabled
Expand Down
7 changes: 0 additions & 7 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,6 @@ in the snapshot.
In order to set a Cabal flag for a GHC boot package, the package must be
specified as an [extra-dep](#extra-deps).

!!! warning

Stack creates snapshots when building immutable dependencies of projects.
The names of Cabal flags that have been unset manually distinguish one such
snapshot from another. However, the names of Cabal flags that have been set
manually do not do so.

### drop-packages

[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
Expand Down
4 changes: 1 addition & 3 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ depPackageHashableContent dp =
PLMutable _ -> pure ""
PLImmutable pli -> do
let flagToBs (f, enabled) =
if enabled
then ""
else "-" <> fromString (C.unFlagName f)
(if enabled then "" else "-") <> fromString (C.unFlagName f)
flags = map flagToBs $ Map.toList dp.depCommon.flags
ghcOptions = map display dp.depCommon.ghcOptions
cabalConfigOpts = map display dp.depCommon.cabalConfigOpts
Expand Down

0 comments on commit e0a17cd

Please sign in to comment.