Skip to content

Commit

Permalink
Fix #6565 Include Cabal flags set manually in the source map hash
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed May 4, 2024
1 parent 37873ca commit dd9b3a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
9 changes: 9 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.6.1:**

Major changes:
Expand All @@ -14,6 +19,10 @@ Other enhancements:

Bug fixes:

* 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.6.1 (release candidate)

Release notes:
Expand Down
7 changes: 0 additions & 7 deletions doc/build_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,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 dd9b3a0

Please sign in to comment.