Skip to content

Commit

Permalink
Fix #6524 Exclude snapshot package DB for build-type: Configure
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Mar 17, 2024
1 parent b9ac532 commit a9fed04
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .stan.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@

# Anti-pattern: Data.ByteString.Char8.pack
[[ignore]]
id = "OBS-STAN-0203-erw24B-1024:3"
id = "OBS-STAN-0203-erw24B-1034:3"
# ✦ Description: Usage of 'pack' function that doesn't handle Unicode characters
# ✦ Category: #AntiPattern
# ✦ File: src\Stack\Build\ExecuteEnv.hs
#
# 1023
# 1024 ┃ S8.pack . formatTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%6Q"
# 1025 ┃ ^^^^^^^
# 1033
# 1034 ┃ S8.pack . formatTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%6Q"
# 1035 ┃ ^^^^^^^

# Anti-pattern: Data.ByteString.Char8.pack
[[ignore]]
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Behaviour changes:
* The `haddock --haddock-for-hackage` command only seeks to create an archive of
the `<package_version>-docs` directory for build targets and if flags
excluding the building of project packages are not set.
* Stack no longer includes the snapshot package database when compiling the
setup executable for a package with `build-type: Configure`.

Other enhancements:

Expand Down
32 changes: 21 additions & 11 deletions src/Stack/Build/ExecuteEnv.hs
Original file line number Diff line number Diff line change
Expand Up @@ -793,20 +793,30 @@ withSingleContext
-- explicitly requested in the stack.yaml file.
Nothing -> do
warnCustomNoDeps
pure $
cabalPackageArg
let packageDBArgs' = case package.buildType of
-- The Configure build type is very similar to Simple. As
-- such, Stack builds the setup executable in much the
-- same way as it would in the case of Simple.
C.Configure ->
[ "-hide-all-packages"
, "-package base"
]
-- NOTE: This is different from packageDBArgs above in
-- that it does not include the local database and does
-- not pass in the -hide-all-packages argument
<> ( "-clear-package-db"
: "-global-package-db"
: map
(("-package-db=" ++) . toFilePathNoTrailingSep)
ee.baseConfigOpts.extraDBs
<> [ "-package-db="
<> toFilePathNoTrailingSep ee.baseConfigOpts.snapDB
]
)
_ ->
map
(("-package-db=" ++) . toFilePathNoTrailingSep)
ee.baseConfigOpts.extraDBs
<> [ "-package-db="
<> toFilePathNoTrailingSep ee.baseConfigOpts.snapDB
]
pure $
[ "-clear-package-db"
, "-global-package-db"
]
<> packageDBArgs'
<> cabalPackageArg

setupArgs =
("--builddir=" ++ toFilePathNoTrailingSep distRelativeDir') : args
Expand Down

0 comments on commit a9fed04

Please sign in to comment.