From b5934c13922700bca9c2b0198be97f14f2a66cd0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Thu, 19 Feb 2026 01:45:20 +0000 Subject: [PATCH 01/75] Release Preparation Step C --- ChangeLog.md | 16 +++++++++++++++- cabal.config | 2 +- package.yaml | 2 +- stack.cabal | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 40122875d8..c7058289ac 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,12 +4,26 @@ Release notes: -**Changes since v3.9.1:** +**Changes since v3.9.3:** + +Major changes: Behavior changes: Other enhancements: +Bug fixes: + +## v3.9.3 + +Release notes: + +* This release fixes a potential bug for users of Stack's Docker integration. + +**Changes since v3.9.1:** + +Other enhancements: + * The `resolver` synonym for `snapshot`, informally deprecated from Stack 3.1.1, is formally deprecated in online and in-app documentation. diff --git a/cabal.config b/cabal.config index a1b4bb3f62..bc73024f38 100644 --- a/cabal.config +++ b/cabal.config @@ -176,7 +176,7 @@ constraints: , silently ==1.2.5.4 , split ==0.2.5 , splitmix ==0.1.3.1 - , stack ==3.9.2.0 + , stack ==3.10.0 , static-bytes ==0.1.1 , stm ==2.5.3.1 , stm-chans ==3.0.0.9 diff --git a/package.yaml b/package.yaml index d3b3f3028e..52cda3e04a 100644 --- a/package.yaml +++ b/package.yaml @@ -2,7 +2,7 @@ spec-version: 0.35.0 name: stack -version: '3.9.2.0' +version: '3.10.0' synopsis: A program for developing Haskell projects description: | Stack (the Haskell Tool Stack) is a program for developing Haskell projects. diff --git a/stack.cabal b/stack.cabal index 618bbf5f5c..0a35d9cecb 100644 --- a/stack.cabal +++ b/stack.cabal @@ -5,7 +5,7 @@ cabal-version: 2.2 -- see: https://github.com/sol/hpack name: stack -version: 3.9.2.0 +version: 3.10.0 synopsis: A program for developing Haskell projects description: Stack (the Haskell Tool Stack) is a program for developing Haskell projects. It is aimed at new and experienced users of Haskell and seeks to support them From cf097eb36f1abd9651d50694d857f826c0335a75 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Thu, 19 Feb 2026 20:28:47 +0000 Subject: [PATCH 02/75] Release process Step I --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ebbd2e38ae..daf617389d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -5,7 +5,7 @@ about: Report a bug in Stack Please follow the steps below for reporting a bug in Stack: -Make sure that you are using the latest release (currently Stack 3.9.1). See the +Make sure that you are using the latest release (currently Stack 3.9.3). See the [upgrade instructions](http://docs.haskellstack.org/en/stable/install_and_upgrade/#upgrade) to upgrade. @@ -45,7 +45,7 @@ stack --verbose ~~~text stack --version -Version 3.9.1, Git revision 49377548db1244e55d577b2e4107cf8f8579e060 x86_64 hpack-0.39.1 +Version 3.9.3, Git revision c7eb8487a82d5c3e0b88d56f8b8a98be23223eb5 x86_64 hpack-0.39.1 ~~~ ### Method of installation diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 04d58b4dd1..699675f815 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature Request about: Request a feature be added to Stack, or discuss such a feature --- -Make sure that you are using the latest release (currently Stack 3.9.1). See the +Make sure that you are using the latest release (currently Stack 3.9.3). See the [upgrade instructions](http://docs.haskellstack.org/en/stable/install_and_upgrade/#upgrade) to upgrade. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 5b4aba2a2c..90e340d705 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -16,7 +16,7 @@ the [stack-templates](https://github.com/commercialhaskell/stack-templates) repository instead. If you still want to ask the question here instead, please make sure that you -are using the latest release (currently Stack 3.7.1). See the +are using the latest release (currently Stack 3.9.3). See the [upgrade instructions](http://docs.haskellstack.org/en/stable/install_and_upgrade/#upgrade) to upgrade. @@ -24,7 +24,7 @@ to upgrade. ~~~text stack --version -Version 3.9.1, Git revision 49377548db1244e55d577b2e4107cf8f8579e060 x86_64 hpack-0.39.1 +Version 3.9.3, Git revision c7eb8487a82d5c3e0b88d56f8b8a98be23223eb5 x86_64 hpack-0.39.1 ~~~ ### Method of installation From 3737f0e2b2632e71ebf061938a0f45026cff9460 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 19 Feb 2026 16:51:59 +0100 Subject: [PATCH 03/75] Add flags for semaphore and pass to Cabal --- src/Stack/Build/ExecutePackage.hs | 5 +++-- src/Stack/BuildOpts.hs | 1 + src/Stack/Config/Build.hs | 1 + src/Stack/Options/BuildMonoidParser.hs | 6 ++++++ src/Stack/Types/BuildOpts.hs | 8 ++++++++ src/Stack/Types/BuildOptsMonoid.hs | 12 ++++++++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Stack/Build/ExecutePackage.hs b/src/Stack/Build/ExecutePackage.hs index 33d95f05d2..ff0e38cfdb 100644 --- a/src/Stack/Build/ExecutePackage.hs +++ b/src/Stack/Build/ExecutePackage.hs @@ -1298,13 +1298,14 @@ extraBuildOptions :: extraBuildOptions wc bopts = do colorOpt <- appropriateGhcColorFlag let optsFlag = compilerOptionsCabalFlag wc + semaphoreFlag = if bopts.semaphore then [ "--semaphore", "/tmp/temp" ] else [] baseOpts = maybe "" (" " ++) colorOpt if bopts.testOpts.coverage then do hpcIndexDir <- toFilePathNoTrailingSep <$> hpcRelativeDir - pure [optsFlag, "-hpcdir " ++ hpcIndexDir ++ baseOpts] + pure $ semaphoreFlag ++ [optsFlag, "-hpcdir " ++ hpcIndexDir ++ baseOpts] else - pure [optsFlag, baseOpts] + pure $ semaphoreFlag ++ [optsFlag, baseOpts] -- Library, sub-library, foreign library and executable build components. primaryComponentOptions :: LocalPackage -> [String] diff --git a/src/Stack/BuildOpts.hs b/src/Stack/BuildOpts.hs index 86d27dd834..649c26250e 100644 --- a/src/Stack/BuildOpts.hs +++ b/src/Stack/BuildOpts.hs @@ -62,6 +62,7 @@ defaultBuildOpts = BuildOpts , interleavedOutput = defaultFirstTrue buildMonoid.interleavedOutput , progressBar = CappedBar , ddumpDir = Nothing + , semaphore = defaultFirstFalse buildMonoid.semaphore } where buildMonoid = undefined :: BuildOptsMonoid diff --git a/src/Stack/Config/Build.hs b/src/Stack/Config/Build.hs index 8a43b8df21..afd020a9f8 100644 --- a/src/Stack/Config/Build.hs +++ b/src/Stack/Config/Build.hs @@ -95,6 +95,7 @@ buildOptsFromMonoid buildMonoid = BuildOpts , interleavedOutput = fromFirstTrue buildMonoid.interleavedOutput , progressBar = fromFirst CappedBar buildMonoid.progressBar , ddumpDir = getFirst buildMonoid.ddumpDir + , semaphore = fromFirstFalse buildMonoid.semaphore } where isHaddockFromHackage = fromFirstFalse buildMonoid.haddockForHackage diff --git a/src/Stack/Options/BuildMonoidParser.hs b/src/Stack/Options/BuildMonoidParser.hs index 640836e7c1..718dba30c0 100644 --- a/src/Stack/Options/BuildMonoidParser.hs +++ b/src/Stack/Options/BuildMonoidParser.hs @@ -70,6 +70,7 @@ buildOptsMonoidParser hide0 = BuildOptsMonoid <*> interleavedOutput <*> progressBar <*> ddumpDir + <*> semaphore where hideBool = hide0 /= BuildCmdGlobalOpts hide :: Mod f a @@ -244,6 +245,11 @@ buildOptsMonoidParser hide0 = BuildOptsMonoid <> help "Specify output directory for ddump-files." <> hide )) + semaphore = firstBoolFlagsFalse + "semaphore" + "Use Cabal's --semaphore feature to build modules of the same package in \ + \parallel." + hide -- | Parser for Cabal verbosity options cabalVerbosityOptsParser :: Bool -> Parser (First CabalVerbosity) diff --git a/src/Stack/Types/BuildOpts.hs b/src/Stack/Types/BuildOpts.hs index 1a7da7eddd..4c4f83fcbb 100644 --- a/src/Stack/Types/BuildOpts.hs +++ b/src/Stack/Types/BuildOpts.hs @@ -18,6 +18,7 @@ module Stack.Types.BuildOpts , BenchmarkOpts (..) , buildOptsHaddockL , buildOptsInstallExesL + , buildOptsSemaphoreL ) where import Stack.Prelude @@ -95,6 +96,9 @@ data BuildOpts = BuildOpts , progressBar :: !ProgressBarFormat -- ^ Format of the progress bar , ddumpDir :: !(Maybe Text) + , semaphore :: !Bool + -- ^ Use Cabal's --semaphore feature to build modules of the same package + -- in parallel. } deriving Show @@ -131,3 +135,7 @@ buildOptsInstallExesL = buildOptsHaddockL :: Lens' BuildOpts Bool buildOptsHaddockL = lens (.buildHaddocks) (\bopts t -> bopts {buildHaddocks = t}) + +buildOptsSemaphoreL :: Lens' BuildOpts Bool +buildOptsSemaphoreL = + lens (.semaphore) (\bopts t -> bopts {semaphore = t}) diff --git a/src/Stack/Types/BuildOptsMonoid.hs b/src/Stack/Types/BuildOptsMonoid.hs index 8d02a106e3..e8477f43b2 100644 --- a/src/Stack/Types/BuildOptsMonoid.hs +++ b/src/Stack/Types/BuildOptsMonoid.hs @@ -24,6 +24,7 @@ module Stack.Types.BuildOptsMonoid , buildOptsMonoidTestsL , buildOptsMonoidBenchmarksL , buildOptsMonoidInstallExesL + , buildOptsMonoidSemaphoreL , toFirstCabalVerbosity , readProgressBarFormat ) where @@ -80,6 +81,7 @@ data BuildOptsMonoid = BuildOptsMonoid , interleavedOutput :: !FirstTrue , progressBar :: !(First ProgressBarFormat) , ddumpDir :: !(First Text) + , semaphore :: !FirstFalse } deriving (Generic, Show) @@ -121,6 +123,7 @@ instance FromJSON (WithJSONWarnings BuildOptsMonoid) where interleavedOutput <- FirstTrue <$> o ..:? interleavedOutputName progressBar <- First <$> o ..:? progressBarName ddumpDir <- o ..:? ddumpDirName ..!= mempty + semaphore <- FirstFalse <$> o ..:? semaphoreArgName pure BuildOptsMonoid { trace , profile @@ -156,6 +159,7 @@ instance FromJSON (WithJSONWarnings BuildOptsMonoid) where , interleavedOutput , progressBar , ddumpDir + , semaphore } libProfileArgName :: Text @@ -254,6 +258,9 @@ progressBarName = "progress-bar" ddumpDirName :: Text ddumpDirName = "ddump-dir" +semaphoreArgName :: Text +semaphoreArgName = "semaphore" + instance Semigroup BuildOptsMonoid where (<>) = mappenddefault @@ -403,6 +410,11 @@ buildOptsMonoidInstallExesL = lens (.installExes.firstFalse) (\buildMonoid t -> buildMonoid {installExes = FirstFalse t}) +buildOptsMonoidSemaphoreL :: Lens' BuildOptsMonoid (Maybe Bool) +buildOptsMonoidSemaphoreL = + lens (.semaphore.firstFalse) + (\buildMonoid t -> buildMonoid {semaphore = FirstFalse t}) + -- Type representing formats of Stack's progress bar when building. data ProgressBarFormat = NoBar -- No progress bar at all. From 58ed210e9bd496966059b1816b124f2450751b2b Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 19 Feb 2026 22:34:48 +0100 Subject: [PATCH 04/75] Create and pass semaphore to Cabal --- package.yaml | 1 + src/Stack/Build/ExecuteEnv.hs | 15 ++++++++++++++- src/Stack/Build/ExecutePackage.hs | 11 ++++++++--- stack.cabal | 6 +++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package.yaml b/package.yaml index 52cda3e04a..42f8aa4354 100644 --- a/package.yaml +++ b/package.yaml @@ -120,6 +120,7 @@ dependencies: - random - rio >= 0.1.22.0 && ( < 0.1.23.0 || > 0.1.23.0 ) - rio-prettyprint >= 0.1.8.0 +- semaphore-compat - split - stm - tar >= 0.6.2.0 diff --git a/src/Stack/Build/ExecuteEnv.hs b/src/Stack/Build/ExecuteEnv.hs index 11f4837b88..63caa37887 100644 --- a/src/Stack/Build/ExecuteEnv.hs +++ b/src/Stack/Build/ExecuteEnv.hs @@ -115,6 +115,7 @@ import qualified System.Directory as D import System.Environment ( lookupEnv ) import System.FileLock ( SharedExclusive (..), withFileLock, withTryFileLock ) +import System.Semaphore ( Semaphore, freshSemaphore, destroySemaphore ) -- | Type representing environments in which the @Setup.hs@ commands of Cabal -- (the library) can be executed. @@ -147,6 +148,8 @@ data ExecuteEnv = ExecuteEnv -- ^ For nicer interleaved output: track the largest package name size , pathEnvVar :: !Text -- ^ Value of the PATH environment variable + , semaphore :: !(Maybe Semaphore) + -- ^ Semaphore used for job control, if --semaphore is given } -- | Type representing setup executable circumstances. @@ -256,6 +259,9 @@ getSetupExe setupHs setupShimHs tmpdir = do renameFile tmpExePath exePath pure $ Just exePath +semaphorePrefix :: String +semaphorePrefix = "stack" + -- | Execute a function that takes an t'ExecuteEnv'. withExecuteEnv :: forall env a. HasEnvConfig env @@ -330,6 +336,10 @@ withExecuteEnv logFiles <- liftIO $ atomically newTChan let totalWanted = length $ filter (.wanted) locals pathEnvVar <- liftIO $ maybe mempty T.pack <$> lookupEnv "PATH" + jobs <- view $ configL . to (.jobs) + semaphore <- if buildOpts.semaphore + then Just <$> liftIO (freshSemaphore semaphorePrefix jobs) + else pure Nothing inner ExecuteEnv { buildOpts , buildOptsCLI @@ -355,7 +365,10 @@ withExecuteEnv , customBuilt , largestPackageName , pathEnvVar - } `finally` dumpLogs logFiles totalWanted + , semaphore + } `finally` do + liftIO (whenJust semaphore destroySemaphore) + dumpLogs logFiles totalWanted where toDumpPackagesByGhcPkgId = Map.fromList . map (\dp -> (dp.ghcPkgId, dp)) diff --git a/src/Stack/Build/ExecutePackage.hs b/src/Stack/Build/ExecutePackage.hs index ff0e38cfdb..b03d1d2b02 100644 --- a/src/Stack/Build/ExecutePackage.hs +++ b/src/Stack/Build/ExecutePackage.hs @@ -151,6 +151,7 @@ import System.IO.Error ( isDoesNotExistError ) import System.PosixCompat.Files ( createLink, getFileStatus, modificationTime ) import System.Random ( randomIO ) +import System.Semaphore ( Semaphore (..), SemaphoreName (..) ) -- | Generate the t'ConfigCache' value. getConfigCache :: @@ -569,7 +570,7 @@ realConfigAndBuild <> display actualCompiler ) config <- view configL - extraOpts <- extraBuildOptions wc ee.buildOpts + extraOpts <- extraBuildOptions wc ee.buildOpts ee.semaphore let stripTHLoading | config.hideTHLoading = ExcludeTHLoading | otherwise = KeepTHLoading @@ -1294,11 +1295,15 @@ extraBuildOptions :: (HasEnvConfig env, HasRunner env) => WhichCompiler -> BuildOpts + -> Maybe Semaphore -> RIO env [String] -extraBuildOptions wc bopts = do +extraBuildOptions wc bopts semaphore = do colorOpt <- appropriateGhcColorFlag let optsFlag = compilerOptionsCabalFlag wc - semaphoreFlag = if bopts.semaphore then [ "--semaphore", "/tmp/temp" ] else [] + semaphoreFlag = maybe + [] + (("--semaphore":) . L.singleton . getSemaphoreName . semaphoreName) + semaphore baseOpts = maybe "" (" " ++) colorOpt if bopts.testOpts.coverage then do diff --git a/stack.cabal b/stack.cabal index 0a35d9cecb..58e9c912c0 100644 --- a/stack.cabal +++ b/stack.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.39.1. +-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack @@ -473,6 +473,7 @@ library , random , rio >=0.1.22.0 && (<0.1.23.0 || >0.1.23.0) , rio-prettyprint >=0.1.8.0 + , semaphore-compat , split , stm , tar >=0.6.2.0 @@ -596,6 +597,7 @@ executable stack , random , rio >=0.1.22.0 && (<0.1.23.0 || >0.1.23.0) , rio-prettyprint >=0.1.8.0 + , semaphore-compat , split , stack , stm @@ -701,6 +703,7 @@ executable stack-integration-test , random , rio >=0.1.22.0 && (<0.1.23.0 || >0.1.23.0) , rio-prettyprint >=0.1.8.0 + , semaphore-compat , split , stm , tar >=0.6.2.0 @@ -819,6 +822,7 @@ test-suite stack-unit-test , raw-strings-qq , rio >=0.1.22.0 && (<0.1.23.0 || >0.1.23.0) , rio-prettyprint >=0.1.8.0 + , semaphore-compat , split , stack , stm From 1e52319f63037ae50de12475e7192793a66b2c2f Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 19 Feb 2026 22:59:30 +0100 Subject: [PATCH 05/75] Add changelog entry --- ChangeLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 7bc39a1831..9390cbb439 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,6 +12,9 @@ Behavior changes: Other enhancements: +* Added `--semaphore`, which allows modules within the same package to be built + in parallel. + Bug fixes: ## v3.9.3 - 2026-02-19 From 83027b8bbd313cfd426d3eb6f0e4a7d9ae77fc48 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 20 Feb 2026 01:05:03 +0100 Subject: [PATCH 06/75] Add documentation for --semaphore --- doc/commands/build_command.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index 3515acd25d..94ee4dc366 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -1140,7 +1140,14 @@ where the test suite takes the form of an executable and the executable takes nothing on the standard input stream (`stdin`). Pass this flag to override that specification and allow the executable to receive input on that stream. If you pass `--no-tests-allow-stdin` and the executable seeks input on the standard -input stream, an exception will be thown. +input stream, an exception will be thrown. + +### `--[no]-semaphore` flag + +Default: Disabled + +Uses the semaphore feature in Cabal/GHC to build multiple modules from the same +package in parallel. (see GHC's documentation on `-jsem`) ## Examples From 9ea5ae06dccb2b8571ca30f47c70e6ef1e004070 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 20 Feb 2026 23:49:42 +0000 Subject: [PATCH 07/75] Extend documentation and conform to other docs Also moves `--[no-]semaphore` higher up the list of `stack build --help` options. --- ChangeLog.md | 5 ++-- doc/commands/build_command.md | 35 +++++++++++++++++--------- doc/configure/yaml/non-project.md | 4 +++ src/Stack/Build/ExecuteEnv.hs | 5 ++-- src/Stack/Options/BuildMonoidParser.hs | 8 +++--- src/Stack/Types/BuildOpts.hs | 4 +-- src/Stack/Types/BuildOptsMonoid.hs | 8 +++--- 7 files changed, 43 insertions(+), 26 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 9390cbb439..779d5e7aa3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,8 +12,9 @@ Behavior changes: Other enhancements: -* Added `--semaphore`, which allows modules within the same package to be built - in parallel. +* Add flag `--[no-]semaphore` (default: disabled) to Stack's `build` command, + to allow GHC to use a system semaphore to perform compilation in parallel when + possible. Supported, by default, by GHC 9.10.1 or later. Bug fixes: diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index 94ee4dc366..f9245105e5 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -7,11 +7,12 @@ stack build [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--flag PACKAGE:[-]FLAG] [--dependencies-only | --only-snapshot | --only-dependencies | --only-locals] [--file-watch | --file-watch-poll] [--watch-all] [--exec COMMAND [ARGUMENT(S)]] - [--only-configure] [--trace] [--profile] [--no-strip] - [--[no-]library-profiling] [--[no-]executable-profiling] - [--[no-]library-stripping] [--[no-]executable-stripping] - [--[no-]haddock] [--haddock-arguments HADDOCK_ARGS] - [--[no-]open] [--[no-]haddock-deps] [--[no-]haddock-internal] + [--only-configure] [--[no-]semaphore] [--trace] [--profile] + [--no-strip] [--[no-]library-profiling] + [--[no-]executable-profiling] [--[no-]library-stripping] + [--[no-]executable-stripping] [--[no-]haddock] + [--haddock-arguments HADDOCK_ARGS] [--[no-]open] + [--[no-]haddock-deps] [--[no-]haddock-internal] [--[no-]haddock-hyperlink-source] [--[no-]haddock-for-hackage] [--[no-]copy-bins] [--[no-]copy-compiler-tool] [--[no-]prefetch] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] @@ -916,6 +917,23 @@ expressions, and generate a profiling report in tests or benchmarks. The flag affects the location of the local project installation directory. See the [`stack path --local-install-root`](path_command.md) command. +### `--[no]-semaphore` flag + +:octicons-tag-24: UNRELEASED + +Default: Disabled + +This flag allows GHC to use a system semaphore to perform compilation in +parallel when possible. + +!!! info + + GHC 9.8.1 and later can act as a jobserver client, which enables two or more + GHC processes running at once to share system resources with each other, + communicating via a system semaphore. This GHC feature is supported by + Cabal 3.12.0.0 (a boot package of GHC 9.10.1) and later. The flag is ignored + with a warning when the feature is unsupported. + ### `--[no-]split-objs` flag :octicons-beaker-24: Experimental @@ -1142,13 +1160,6 @@ specification and allow the executable to receive input on that stream. If you pass `--no-tests-allow-stdin` and the executable seeks input on the standard input stream, an exception will be thrown. -### `--[no]-semaphore` flag - -Default: Disabled - -Uses the semaphore feature in Cabal/GHC to build multiple modules from the same -package in parallel. (see GHC's documentation on `-jsem`) - ## Examples All the following examples assume that: diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index e05ccd93a7..29c1944350 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -157,6 +157,10 @@ Default: ~~~yaml build: + # Since Stack UNRELEASED. Supported by GHC 9.8.1 or later with Cabal 3.12.0.0 + # (a boot package of GHC 9.10.1) or later. + semaphore: false + library-profiling: false executable-profiling: false library-stripping: true diff --git a/src/Stack/Build/ExecuteEnv.hs b/src/Stack/Build/ExecuteEnv.hs index 63caa37887..0b0d8df60a 100644 --- a/src/Stack/Build/ExecuteEnv.hs +++ b/src/Stack/Build/ExecuteEnv.hs @@ -115,7 +115,8 @@ import qualified System.Directory as D import System.Environment ( lookupEnv ) import System.FileLock ( SharedExclusive (..), withFileLock, withTryFileLock ) -import System.Semaphore ( Semaphore, freshSemaphore, destroySemaphore ) +import System.Semaphore + ( Semaphore, destroySemaphore, freshSemaphore ) -- | Type representing environments in which the @Setup.hs@ commands of Cabal -- (the library) can be executed. @@ -149,7 +150,7 @@ data ExecuteEnv = ExecuteEnv , pathEnvVar :: !Text -- ^ Value of the PATH environment variable , semaphore :: !(Maybe Semaphore) - -- ^ Semaphore used for job control, if --semaphore is given + -- ^ The semaphore that is used for job control, if --semaphore is given } -- | Type representing setup executable circumstances. diff --git a/src/Stack/Options/BuildMonoidParser.hs b/src/Stack/Options/BuildMonoidParser.hs index 718dba30c0..7de4eeaa78 100644 --- a/src/Stack/Options/BuildMonoidParser.hs +++ b/src/Stack/Options/BuildMonoidParser.hs @@ -36,7 +36,8 @@ import Stack.Types.ComponentUtils ( unqualCompFromString ) -- | Parse command line arguments for build configuration. buildOptsMonoidParser :: GlobalOptsContext -> Parser BuildOptsMonoid buildOptsMonoidParser hide0 = BuildOptsMonoid - <$> trace' + <$> semaphore + <*> trace' <*> profile <*> noStrip <*> libProfiling @@ -70,7 +71,6 @@ buildOptsMonoidParser hide0 = BuildOptsMonoid <*> interleavedOutput <*> progressBar <*> ddumpDir - <*> semaphore where hideBool = hide0 /= BuildCmdGlobalOpts hide :: Mod f a @@ -247,8 +247,8 @@ buildOptsMonoidParser hide0 = BuildOptsMonoid )) semaphore = firstBoolFlagsFalse "semaphore" - "Use Cabal's --semaphore feature to build modules of the same package in \ - \parallel." + "the use of a system semaphore to perform compilation in parallel when \ + \possible. Supported, by default, by GHC 9.10.1 or later." hide -- | Parser for Cabal verbosity options diff --git a/src/Stack/Types/BuildOpts.hs b/src/Stack/Types/BuildOpts.hs index 4c4f83fcbb..bdff5a886a 100644 --- a/src/Stack/Types/BuildOpts.hs +++ b/src/Stack/Types/BuildOpts.hs @@ -97,8 +97,8 @@ data BuildOpts = BuildOpts -- ^ Format of the progress bar , ddumpDir :: !(Maybe Text) , semaphore :: !Bool - -- ^ Use Cabal's --semaphore feature to build modules of the same package - -- in parallel. + -- ^ Use Cabal's --semaphore=SEMAPHORE option to build modules of the same + -- package in parallel. } deriving Show diff --git a/src/Stack/Types/BuildOptsMonoid.hs b/src/Stack/Types/BuildOptsMonoid.hs index e8477f43b2..a6f378f60c 100644 --- a/src/Stack/Types/BuildOptsMonoid.hs +++ b/src/Stack/Types/BuildOptsMonoid.hs @@ -44,7 +44,8 @@ import Stack.Types.ComponentUtils ( StackUnqualCompName ) -- | Build options that may be specified as non-project specific configuration -- options under the build key (with certain exceptions) or from the CLI. data BuildOptsMonoid = BuildOptsMonoid - { trace :: !Any + { semaphore :: !FirstFalse + , trace :: !Any -- ^ Cannot be specified under the build key , profile :: !Any -- ^ Cannot be specified under the build key @@ -81,7 +82,6 @@ data BuildOptsMonoid = BuildOptsMonoid , interleavedOutput :: !FirstTrue , progressBar :: !(First ProgressBarFormat) , ddumpDir :: !(First Text) - , semaphore :: !FirstFalse } deriving (Generic, Show) @@ -125,7 +125,8 @@ instance FromJSON (WithJSONWarnings BuildOptsMonoid) where ddumpDir <- o ..:? ddumpDirName ..!= mempty semaphore <- FirstFalse <$> o ..:? semaphoreArgName pure BuildOptsMonoid - { trace + { semaphore + , trace , profile , noStrip , libProfile @@ -159,7 +160,6 @@ instance FromJSON (WithJSONWarnings BuildOptsMonoid) where , interleavedOutput , progressBar , ddumpDir - , semaphore } libProfileArgName :: Text From 6dc43743192062c264bba2e62312420886f81b3c Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 21 Feb 2026 00:53:38 +0000 Subject: [PATCH 08/75] Ignore unsupported `--semaphore` with a warning --- doc/configure/yaml/non-project.md | 3 ++- src/Stack/Build/ExecuteEnv.hs | 30 ++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index 29c1944350..8607963bdb 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -158,7 +158,8 @@ Default: ~~~yaml build: # Since Stack UNRELEASED. Supported by GHC 9.8.1 or later with Cabal 3.12.0.0 - # (a boot package of GHC 9.10.1) or later. + # (a boot package of GHC 9.10.1) or later. Ignored with a warning when + # unsupported. semaphore: false library-profiling: false diff --git a/src/Stack/Build/ExecuteEnv.hs b/src/Stack/Build/ExecuteEnv.hs index 0b0d8df60a..dfee2c548e 100644 --- a/src/Stack/Build/ExecuteEnv.hs +++ b/src/Stack/Build/ExecuteEnv.hs @@ -54,6 +54,7 @@ import qualified Distribution.Simple.Build.Macros as C import Distribution.System ( OS (..), Platform (..) ) import Distribution.Types.PackageName ( mkPackageName ) import Distribution.Verbosity ( showForCabal ) +import Distribution.Version ( mkVersion ) import Path ( PathException, (), parent, parseRelDir, parseRelFile ) import Path.Extra ( forgivingResolveFile, toFilePathNoTrailingSep ) @@ -86,7 +87,9 @@ import Stack.Types.BuildOpts ( BuildOpts (..) ) import Stack.Types.BuildOptsCLI ( BuildOptsCLI (..) ) import Stack.Types.BuildOptsMonoid ( CabalVerbosity (..) ) import Stack.Types.Compiler - ( WhichCompiler (..), compilerVersionString, whichCompilerL ) + ( WhichCompiler (..), compilerVersionString + , getGhcVersion, whichCompilerL + ) import Stack.Types.CompilerPaths ( CompilerPaths (..), HasCompiler (..), cabalVersionL , getCompilerPath @@ -327,6 +330,8 @@ withExecuteEnv ignoringAbsence (removeFile setupO) ignoringAbsence (removeFile setupShimHi) ignoringAbsence (removeFile setupShimO) + compilerVersion <- view actualCompilerVersionL + let ghcVersion = getGhcVersion compilerVersion cabalPkgVer <- view cabalVersionL globalDB <- view $ compilerPathsL . to (.globalDB) let globalDumpPkgs = toDumpPackagesByGhcPkgId globalPackages @@ -338,9 +343,26 @@ withExecuteEnv let totalWanted = length $ filter (.wanted) locals pathEnvVar <- liftIO $ maybe mempty T.pack <$> lookupEnv "PATH" jobs <- view $ configL . to (.jobs) - semaphore <- if buildOpts.semaphore - then Just <$> liftIO (freshSemaphore semaphorePrefix jobs) - else pure Nothing + let semaphoreSupported = + (cabalPkgVer >= mkVersion [3, 12, 0, 0]) + && (ghcVersion >= mkVersion [9, 8, 1]) + semaphoreUnsupportedWarning = + prettyWarnL + [ "The" + , style Shell "--semaphore" + , flow "flag was specified, which is supported by GHC 9.8.1 or \ + \later with Cabal 3.12.0.0 (a boot package of GHC 9.10.1) \ + \or later. GHC version" + , fromString (versionString ghcVersion) + , flow "and Cabal version" + , fromString (versionString cabalPkgVer) + , flow "was found. The flag will be ignored." + ] + semaphore <- if not buildOpts.semaphore + then pure Nothing + else if semaphoreSupported + then Just <$> liftIO (freshSemaphore semaphorePrefix jobs) + else semaphoreUnsupportedWarning >> pure Nothing inner ExecuteEnv { buildOpts , buildOptsCLI From fa0f84025651522bd83098585b81954c7b692cfa Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 21 Feb 2026 01:19:19 +0000 Subject: [PATCH 09/75] Update unit test --- tests/unit/Stack/ConfigSpec.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/Stack/ConfigSpec.hs b/tests/unit/Stack/ConfigSpec.hs index cbabbede89..0f66d79f45 100644 --- a/tests/unit/Stack/ConfigSpec.hs +++ b/tests/unit/Stack/ConfigSpec.hs @@ -61,6 +61,7 @@ buildOptsConfig = "snapshot: lts-24.24\n" ++ "packages: ['.']\n" ++ "build:\n" ++ + " semaphore: true\n" ++ " library-profiling: true\n" ++ " executable-profiling: true\n" ++ " library-stripping: false\n" ++ @@ -228,6 +229,7 @@ spec = beforeAll setup $ do writeFile (toFilePath stackDotYaml) buildOptsConfig loadConfig' $ \config -> liftIO $ do let bopts = config.build + bopts.semaphore `shouldBe` True bopts.libProfile `shouldBe` True bopts.exeProfile `shouldBe` True bopts.libStrip `shouldBe` False From 4eff6501213c30b4daaae8db49d77a749e38e12b Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 21 Feb 2026 16:16:20 +0000 Subject: [PATCH 10/75] Update STAN exceptions --- .stan.toml | 80 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.stan.toml b/.stan.toml index 586019edb7..f5108a97ce 100644 --- a/.stan.toml +++ b/.stan.toml @@ -67,57 +67,57 @@ # Infinite: base/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists [[ignore]] - id = "OBS-STAN-0102-luLR/n-533:30" + id = "OBS-STAN-0102-luLR/n-540:30" # ✦ Category: #Infinite #List # ✦ File: src\Stack\New.hs # -# 532 ┃ -# 533 ┃ let isPkgSpec f = ".cabal" `L.isSuffixOf` f || "package.yaml" `L.isSuffixOf` f -# 534 ┃ ^^^^^^^^^^^^^^ +# 539 ┃ +# 540 ┃ let isPkgSpec f = ".cabal" `L.isSuffixOf` f || "package.yaml" `L.isSuffixOf` f +# 541 ┃ ^^^^^^^^^^^^^^ # Infinite: base/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists [[ignore]] - id = "OBS-STAN-0102-luLR/n-533:65" + id = "OBS-STAN-0102-luLR/n-540:65" # ✦ Category: #Infinite #List # ✦ File: src\Stack\New.hs # -# 532 ┃ -# 533 ┃ let isPkgSpec f = ".cabal" `L.isSuffixOf` f || "package.yaml" `L.isSuffixOf` f -# 534 ┃ ^^^^^^^^^^^^^^ +# 539 ┃ +# 540 ┃ let isPkgSpec f = ".cabal" `L.isSuffixOf` f || "package.yaml" `L.isSuffixOf` f +# 541 ┃ ^^^^^^^^^^^^^^ # Infinite: ghc-internal/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists [[ignore]] - id = "OBS-STAN-0102-8cspI6-400:41" + id = "OBS-STAN-0102-8cspI6-404:41" # ✦ Category: #Infinite #List # ✦ File: src\Stack\Coverage.hs # -# 399 ┃ -# 400 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) -# 401 ┃ ^^^^^^^^^^^^^^ +# 403 ┃ +# 404 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) +# 405 ┃ ^^^^^^^^^^^^^^ # Infinite: ghc-internal/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists [[ignore]] - id = "OBS-STAN-0102-8cspI6-433:31" + id = "OBS-STAN-0102-8cspI6-437:31" # ✦ Category: #Infinite #List # ✦ File: src\Stack\Coverage.hs # -# 432 ┃ -# 433 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) -# 434 ┃ ^^^^^^^^^^^^^^ +# 436 ┃ +# 437 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) +# 438 ┃ ^^^^^^^^^^^^^^ # Infinite: ghc-internal/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists [[ignore]] - id = "OBS-STAN-0102-8cspI6-664:30" + id = "OBS-STAN-0102-8cspI6-668:30" # ✦ Category: #Infinite #List # ✦ File: src\Stack\Coverage.hs # -# 663 ┃ -# 664 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) -# 665 ┃ ^^^^^^^^^^^^^^ +# 667 ┃ +# 668 ┃ pure (filter ((".tix" `L.isSuffixOf`) . toFilePath) files) +# 669 ┃ ^^^^^^^^^^^^^^ # Infinite: ghc-internal/isSuffixOf # Usage of the 'isSuffixOf' function that hangs on infinite lists @@ -140,25 +140,25 @@ # Anti-pattern: Data.ByteString.Char8.pack [[ignore]] - id = "OBS-STAN-0203-erw24B-1043:3" + id = "OBS-STAN-0203-erw24B-1079:3" # ✦ Description: Usage of 'pack' function that doesn't handle Unicode characters # ✦ Category: #AntiPattern # ✦ File: src\Stack\Build\ExecuteEnv.hs # -# 1042 ┃ -# 1043 ┃ S8.pack . formatTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%6Q" -# 1044 ┃ ^^^^^^^ +# 1078 ┃ +# 1079 ┃ S8.pack . formatTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%6Q" +# 1080 ┃ ^^^^^^^ # Anti-pattern: Data.ByteString.Char8.pack [[ignore]] - id = "OBS-STAN-0203-tuE+RG-249:24" + id = "OBS-STAN-0203-tuE+RG-250:24" # ✦ Description: Usage of 'pack' function that doesn't handle Unicode characters # ✦ Category: #AntiPattern # ✦ File: src\Stack\Build\ExecutePackage.hs # -# 248 ┃ -# 249 ┃ newConfigFileRoot <- S8.pack . toFilePath <$> view configFileRootL -# 250 ┃ ^^^^^^^ +# 249 ┃ +# 250 ┃ newConfigFileRoot <- S8.pack . toFilePath <$> view configFileRootL +# 251 ┃ ^^^^^^^ # Anti-pattern: Data.ByteString.Char8.pack [[ignore]] @@ -258,36 +258,36 @@ # Anti-pattern: unsafe functions [[ignore]] - id = "OBS-STAN-0212-FNS1cF-67:17" + id = "OBS-STAN-0212-FNS1cF-68:17" # ✦ Description: Usage of unsafe functions breaks referential transparency # ✦ Category: #Unsafe #AntiPattern # ✦ File: src\Stack\BuildOpts.hs # -# 66 ┃ -# 67 ┃ buildMonoid = undefined :: BuildOptsMonoid -# 68 ┃ ^^^^^^^^^ +# 67 ┃ +# 68 ┃ buildMonoid = undefined :: BuildOptsMonoid +# 69 ┃ ^^^^^^^^^ # Anti-pattern: unsafe functions [[ignore]] - id = "OBS-STAN-0212-FNS1cF-79:14" + id = "OBS-STAN-0212-FNS1cF-80:14" # ✦ Description: Usage of unsafe functions breaks referential transparency # ✦ Category: #Unsafe #AntiPattern # ✦ File: src\Stack\BuildOpts.hs # -# 78 ┃ -# 79 ┃ toMonoid = undefined :: TestOptsMonoid -# 80 ┃ ^^^^^^^^^ +# 79 ┃ +# 80 ┃ toMonoid = undefined :: TestOptsMonoid +# 81 ┃ ^^^^^^^^^ # Anti-pattern: unsafe functions [[ignore]] - id = "OBS-STAN-0212-FNS1cF-90:15" + id = "OBS-STAN-0212-FNS1cF-91:15" # ✦ Description: Usage of unsafe functions breaks referential transparency # ✦ Category: #Unsafe #AntiPattern # ✦ File: src/Stack/BuildOpts.hs # -# 89 ┃ -# 90 ┃ beoMonoid = undefined :: BenchmarkOptsMonoid -# 91 ┃ ^^^^^^^^^ +# 90 ┃ +# 91 ┃ beoMonoid = undefined :: BenchmarkOptsMonoid +# 92 ┃ ^^^^^^^^^ # Anti-pattern: Pattern matching on '_' # Pattern matching on '_' for sum types can create maintainability issues From 343b43716a7fadbc8ccd8afbc462ed1836218ef3 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 22 Feb 2026 00:15:02 +0000 Subject: [PATCH 11/75] Label semaphore feature as experimental --- ChangeLog.md | 8 +++++--- doc/commands/build_command.md | 9 +++++++++ doc/configure/yaml/non-project.md | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 779d5e7aa3..fab94bed08 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,9 +12,11 @@ Behavior changes: Other enhancements: -* Add flag `--[no-]semaphore` (default: disabled) to Stack's `build` command, - to allow GHC to use a system semaphore to perform compilation in parallel when - possible. Supported, by default, by GHC 9.10.1 or later. +* Experimental: Add flag `--[no-]semaphore` (default: disabled) to Stack's + `build` command, to allow GHC to use a system semaphore to perform compilation + in parallel when possible. Supported, by default, by GHC 9.10.1 or later. The + option is considered experiemental because, on Linux only, musl and non-musl + semaphores are incompatible. Bug fixes: diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index f9245105e5..25a5bae607 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -919,6 +919,8 @@ the [`stack path --local-install-root`](path_command.md) command. ### `--[no]-semaphore` flag +:octicons-beaker-24: Experimental + :octicons-tag-24: UNRELEASED Default: Disabled @@ -934,6 +936,13 @@ parallel when possible. Cabal 3.12.0.0 (a boot package of GHC 9.10.1) and later. The flag is ignored with a warning when the feature is unsupported. +!!! warning + + On Linux, musl and non-musl system semaphores are incompatible. That means + that a Stack executable built on Alpine Linux (such as the official Stack + for Linux) creates system semaphores that cannot be used by a GHC executable + built on non-musl Linux distributions. + ### `--[no-]split-objs` flag :octicons-beaker-24: Experimental diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index 8607963bdb..b8940c2417 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -157,9 +157,9 @@ Default: ~~~yaml build: - # Since Stack UNRELEASED. Supported by GHC 9.8.1 or later with Cabal 3.12.0.0 - # (a boot package of GHC 9.10.1) or later. Ignored with a warning when - # unsupported. + # Experimental. Since Stack UNRELEASED. Supported by GHC 9.8.1 or later with + # Cabal 3.12.0.0 (a boot package of GHC 9.10.1) or later. Ignored with a + # warning when unsupported. semaphore: false library-profiling: false From 42f9d133accf1da10d62406321317d67b9bf2a28 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Tue, 17 Feb 2026 22:55:42 +0000 Subject: [PATCH 12/75] Minor refactor --- src/Stack/Ghci.hs | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 4ae118ee59..8db0e71196 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -916,32 +916,37 @@ makeGhciPkgInfo :: -> RIO env GhciPkgInfo makeGhciPkgInfo installMap installedMap locals addPkgs mfileTargets pkgDesc = do bopts <- view buildOptsL - let pkg = pkgDesc.package + let package = pkgDesc.package cabalFP = pkgDesc.cabalFP target = pkgDesc.target - name = pkg.name - (mods, files, opts) <- - getPackageOpts pkg installMap installedMap locals addPkgs cabalFP - let filteredOpts = filterWanted opts + name = package.name + dir = parent cabalFP + targetFiles = mfileTargets >>= M.lookup name + (mods, files, allOpts) <- + getPackageOpts package installMap installedMap locals addPkgs cabalFP + let opts = M.toList $ filterWanted allOpts filterWanted :: Map NamedComponent a -> Map NamedComponent a filterWanted = M.filterWithKey (\k _ -> k `S.member` allWanted) - allWanted = wantedPackageComponents bopts target pkg - pure GhciPkgInfo - { name - , opts = M.toList filteredOpts - , dir = parent cabalFP - , modules = unionModuleMaps $ + allWanted = wantedPackageComponents bopts target package + modules = unionModuleMaps $ map ( \(comp, mp) -> M.map - (\fp -> M.singleton fp (S.singleton (pkg.name, comp))) + (\fp -> M.singleton fp (S.singleton (name, comp))) mp ) (M.toList (filterWanted mods)) - , mainIs = M.map (mapMaybe dotCabalMainPath) files - , cFiles = mconcat + mainIs = M.map (mapMaybe dotCabalMainPath) files + cFiles = mconcat (M.elems (filterWanted (M.map (mapMaybe dotCabalCFilePath) files))) - , targetFiles = mfileTargets >>= M.lookup name - , package = pkg + pure GhciPkgInfo + { name + , opts + , dir + , modules + , mainIs + , cFiles + , targetFiles + , package } -- NOTE: this should make the same choices as the components code in From 02bc319c0d9b106ee0730a9e09745f593fe3b15a Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 1 Mar 2026 13:43:23 +0000 Subject: [PATCH 13/75] Re #6848 Update CI on update of Docker images --- .github/workflows/integration-tests.yml | 35 ++++++++++++++----------- .github/workflows/unit-tests.yml | 26 ++++++++++-------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 216721db97..c3ffc0dae7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -16,10 +16,13 @@ on: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# As of 2026-01-30, ubuntu-latest and windows-latest come with Stack 3.9.1 and -# GHC 9.14.1. However, macos-15-intel and macos-latest do not come with Haskell -# tools. windows-latest no longer comes with NSIS 3.10, for which the default -# value of the 'Unicode' installer attribute is 'true'. However, that is not the +# As of 2026-03-01: +# * ubuntu-latest comes with Stack 3.9.3 and GHC 9.14.1; and +# * windows-latest comes with Stack 3.9.1 and GHC 9.14.1. +# However, macos-15-intel and macos-latest do not come with Haskell tools. +# +# windows-latest no longer comes with NSIS 3.10, for which the default value of +# the 'Unicode' installer attribute is 'true'. However, that is not the # 'large strings' build of NSIS and creates installers that corrupt the PATH # environment variable if the default string length of 1024 characters is # exceeded. @@ -40,7 +43,7 @@ jobs: # Stack's project-level configuration (stack.yaml) specifies the # multi-architecture (including Linux/Aarch64) Docker image published # by Oliver Benz (@benz0li, on GitHub). That image comes with - # Stack 3.9.1. (Note that the online documentation for + # Stack 3.9.3. (Note that the online documentation for # '--docker-stack-exe image' specifies that the host Stack and image # Stack must have the same version number.) release-args: "--alpine --stack-args --docker-stack-exe=image" @@ -99,11 +102,21 @@ jobs: if [[ "${{ matrix.os }}" == "ubuntu-24.04-arm" || "${{ matrix.os }}" == "macos-15-intel" || "${{ matrix.os }}" == "macos-latest" ]] then - # ubuntu-24.04-arm, macos-15-intel and macos-latest do not include - # Haskell tools as at 2026-01-30. + # As at 2026-03-01: + # + # * ubuntu-24.04-arm, macos-15-intel and macos-latest do not include + # Haskell tools. curl -sSL https://get.haskellstack.org/ | sh fi + if [[ "${{ matrix.os }}" == "windows-latest" ]] + then + # As at 2026-03-01: + # + # * windows-latest does not include Stack 3.9.3. + stack upgrade + fi + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]] then # Install a faster linker (lld) than Ubuntu's default. @@ -151,14 +164,6 @@ jobs: EOF fi - # A temporary fix, due to Docker 29.0.0 and later producing an error - # message in a format not recognised by Stack 3.9.1 or earlier. See - # https://github.com/commercialhaskell/stack/issues/6848 - if [[ "${{ matrix.release-args }}" == "--alpine" ]] - then - docker pull quay.io/benz0li/ghc-musl:9.10.3 - fi - # In case GHCup hooks have been created, remove them if [ -d $(stack path --stack-root)/hooks ] then diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3abd28e94c..fd955780a5 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -9,8 +9,10 @@ on: - rc/** workflow_dispatch: -# As of 2026-01-30, ubuntu-latest and windows-latest come with Stack 3.9.1 -# and GHC 9.14.1. However, macos-latest does not come with Haskell tools. +# As of 2026-03-01: +# * ubuntu-latest comes with Stack 3.9.3 and GHC 9.14.1; and +# * windows-latest comes with Stack 3.9.1 and GHC 9.14.1. +# However, macos-15-intel and macos-latest do not come with Haskell tools. jobs: pedantic: @@ -76,10 +78,20 @@ jobs: if [[ "${{ matrix.os }}" == "macos-latest" ]] then - # macos-latest does not include Haskell tools as at 2026-01-30. + # As at 2026-03-01: + # + # * macos-latest does not include Haskell tools. curl -sSL https://get.haskellstack.org/ | sh fi + if [[ "${{ matrix.os }}" == "windows-latest" ]] + then + # As at 2026-03-01: + # + # * windows-latest does not include Stack 3.9.3. + stack upgrade + fi + if [[ "${{ matrix.extra-suffix }}" == "alpine" ]] then mkdir -p ~/.stack @@ -93,14 +105,6 @@ jobs: EOF fi - # A temporary fix, due to Docker 29.0.0 and later producing an error - # message in a format not recognised by Stack 3.9.1 or earlier. See - # https://github.com/commercialhaskell/stack/issues/6848 - if [[ "${{ matrix.extra-suffix }}" == "alpine" ]] - then - docker pull quay.io/benz0li/ghc-musl:9.10.3 - fi - stack test ${{ matrix.stack-args }} --haddock --no-haddock-deps --ghc-options="-Werror -O0" --copy-bins --local-bin-path bin # Get output about whether the exe is dynamically linked From c21d5fdc23ee721ea7750f3228a5d76621694dd2 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 2 Mar 2026 00:00:45 +0000 Subject: [PATCH 14/75] Update Nix in CI --- .github/workflows/integration-tests.yml | 4 ++-- .../tests/4095-utf8-pure-nix/files/stack.yaml | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c3ffc0dae7..bd20431e2c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -136,10 +136,10 @@ jobs: # Enter the Nix environment... . ~/.nix-profile/etc/profile.d/nix.sh # Add a channel named 'nixpkgs' to the list of subscribed channels... - nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs + nix-channel --add https://nixos.org/channels/nixos-25.11 nixpkgs # Download the Nix expressions for all subscribed channels... # - # As at 2023-08-21, nixos-23.05 provides GHC 9.2.8. + # As at 2026-03-01, nixos-25.11 provides GHC 9.10.2. nix-channel --update # The NIX_PATH environment variable sets a list of directories used to # look up the location of Nix expressions using paths enclosed in diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml b/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml index 59a3225477..acc9a9581d 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml +++ b/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml @@ -1,4 +1,10 @@ -# As of 20 August 2023, there is no Nix package haskell.compiler.ghc946. -# Available options include ghc92 (GHC 9.2.8), ghc926, ghc927, -# ghc94 (GHC 9.4.5), ghc942, ghc943 or ghc944. -snapshot: lts-20.26 # GHC 9.2.8 +# As of 2026-03-01, with channel nixos-25.11, avaiable Nix packages +# haskell.compiler.ghc*, based on: +# +# $ nix-instantiate --eval -E "with import {}; lib.attrNames haskell.compiler" +# +# are: +# +# 948 (GHC 9.4.8), 967 (GHC 9.6.7), 984 (GHC 9.8.4), 9102 (GHC 9.10.2), +# 9103 (GHC 9.10.3), 9122 (GHC 9.12.2). +snapshot: lts-24.32 # GHC 9.10.3 From aad1865ae54ddcfc91eb1788b42952f20f6844be Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 1 Mar 2026 16:00:32 +0000 Subject: [PATCH 15/75] Re #6753 Use tls versions that reduce dependency on unmaintained packages --- CONTRIBUTING.md | 3 ++- cabal.config | 26 +++++++++++------- stack.cabal | 2 +- stack.yaml | 18 +++++++++++++ stack.yaml.lock | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b6c3147df..6cc43e2e90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -354,7 +354,8 @@ not aim to be compatible with more than one version of the `Cabal` package at any time. At the time of writing (January 2026) the package versions are primarily ones in Stackage snapshot LTS Haskell 24.24 (for GHC 9.10.3), the latest version of `Cabal` released on Hackage (`Cabal-3.16.0.0`), -`pantry-0.11.2`, and `persistent-2.18.0.0`. +`pantry-0.11.2`, `persistent-2.18.0.0` and the latest version of packages in +the `tls` family (which reduce dependencies on unmaintained packages). A Stack executable makes use of Cabal (the library) through a small 'Setup' executable that it compiles from Haskell source code. The executable compiles diff --git a/cabal.config b/cabal.config index bc73024f38..ac763c0758 100644 --- a/cabal.config +++ b/cabal.config @@ -14,9 +14,6 @@ constraints: , ansi-terminal-types ==1.1.3 , appar ==0.1.8 , array ==0.5.8.0 - , asn1-encoding ==0.9.6 - , asn1-parse ==0.9.5 - , asn1-types ==0.3.4 , assoc ==1.1.1 , async ==2.2.5 , atomic-counter ==0.1.2.4 @@ -25,7 +22,9 @@ constraints: , auto-update ==0.2.6 , base ==4.20.2.0 , base-orphans ==0.9.3 + , base16 ==1.0 , base16-bytestring ==1.0.2.0 + , base64 ==1.0 , base64-bytestring ==1.2.1.0 , basement ==0.0.16 , bifunctors ==5.6.2 @@ -55,13 +54,17 @@ constraints: , cookie ==0.5.1 , cryptohash-sha256 ==0.11.102.1 , crypton ==1.0.4 + , crypton-asn1-encoding ==0.10.0 + , crypton-asn1-parse ==0.10.0 + , crypton-asn1-types ==0.4.1 , crypton-conduit ==0.2.3 , crypton-connection ==0.4.5 + , crypton-pem ==0.3.0 , crypton-socks ==0.6.2 - , crypton-x509 ==1.7.7 - , crypton-x509-store ==1.6.12 - , crypton-x509-system ==1.6.7 - , crypton-x509-validation ==1.6.14 + , crypton-x509 ==1.8.0 + , crypton-x509-store ==1.8.0 + , crypton-x509-system ==1.8.0 + , crypton-x509-validation ==1.8.0 , data-default ==0.8.0.1 , data-default-class ==0.2.0.0 , data-fix ==0.3.4 @@ -72,6 +75,7 @@ constraints: , distributive ==0.6.2.1 , dlist ==1.0 , easy-file ==0.2.5 + , ech-config ==0.0.1 , echo ==0.1.4 , ed25519 ==0.0.5.0 , exceptions ==0.10.9 @@ -99,9 +103,9 @@ constraints: , haskell-src-exts ==1.23.1 , haskell-src-meta ==0.8.15 , hi-file-parser ==0.1.8.0 - , hourglass ==0.2.12 , hpack ==0.39.1 , hpc ==0.7.0.2 + , hpke ==0.0.0 , http-api-data ==0.6.2 , http-client ==0.7.19 , http-client-tls ==0.3.6.4 @@ -135,6 +139,7 @@ constraints: , mustache ==2.4.3.1 , neat-interpolation ==0.5.1.4 , network ==3.2.8.0 + , network-byte-order ==0.1.7 , network-uri ==2.6.4.2 , old-locale ==1.0.0.7 , old-time ==1.1.0.4 @@ -148,7 +153,6 @@ constraints: , path ==0.9.6 , path-io ==1.8.2 , path-pieces ==0.2.1 - , pem ==0.2.4 , persistent ==2.18.0.0 , persistent-sqlite ==2.13.3.1 , persistent-template ==2.12.0.0 @@ -170,6 +174,7 @@ constraints: , safe ==0.3.21 , safe-exceptions ==0.1.7.4 , scientific ==0.3.8.0 + , semaphore-compat ==1.0.0 , semialign ==1.3.1 , semigroupoids ==6.0.1 , serialise ==0.2.6.1 @@ -205,7 +210,8 @@ constraints: , these ==1.2.1 , time ==1.12.2 , time-compat ==1.9.8 - , tls ==2.1.8 + , time-hourglass ==0.3.0 + , tls ==2.2.2 , transformers ==0.6.1.1 , transformers-base ==0.4.6 , transformers-compat ==0.7.2 diff --git a/stack.cabal b/stack.cabal index 58e9c912c0..d6671e9a9d 100644 --- a/stack.cabal +++ b/stack.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.38.1. +-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack diff --git a/stack.yaml b/stack.yaml index e70fd9b25b..038d95d7af 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,12 +4,30 @@ extra-deps: # lts-24.24 specifies Cabal-3.12.1.0 - Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 - Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +# lts-24.24 does not include crypton-asn1-* +- crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 +- crypton-asn1-parse-0.10.0@sha256:4a2cfc4980957d1a279ef69137ee5f665c247ccd8bb962812d5b071d543893fb,1359 +- crypton-asn1-types-0.4.1@sha256:02f3ec473011b3da92f7bf738bea19cadf88a6470b25a6cb5042216c7549c912,1326 +# lts-24.24 specifies crypton-connection-0.4.5 (before revision) +- crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 +# lts-24.24 specifies crypton-x509-1.7.7 +- crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +# lts-24.24 specifies crypton-x509-store-1.6.12 +- crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +# lts-24.24 specifies crypton-x509-system-1.6.7 +- crypton-x509-system-1.8.0 +# lts-24.24 specifies crypton-x509-validation-1.6.14 +- crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 # lts-24.24 specifies hpack-0.38.3 - hpack-0.39.1@sha256:d7378debd96e805760540e3640aeda3a1ebee1d000dac99726ed55c827c81a94,5229 # lts-24.24 specifies pantry-0.10.1 - pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 # lts-24.24 specifies persistent-2.17.1.0 - persistent-2.18.0.0@sha256:baa3e0959cf10bbd1da462efeb61d4f073d0cc924a149325494ba5ce29bc17a4,7096 +# lts-24.24 does not include time-hourglass +- time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 +# lts-24.24 specifies tls-2.1.8 +- tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 docker: enable: false diff --git a/stack.yaml.lock b/stack.yaml.lock index 02abb3fef1..1979ca1c32 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -18,6 +18,62 @@ packages: size: 11238 original: hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +- completed: + hackage: crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 + pantry-tree: + sha256: c2ff6c426e6910075a971ee2801d200c8dc0f88cfcb8619534097902e6e655a8 + size: 1011 + original: + hackage: crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 +- completed: + hackage: crypton-asn1-parse-0.10.0@sha256:4a2cfc4980957d1a279ef69137ee5f665c247ccd8bb962812d5b071d543893fb,1359 + pantry-tree: + sha256: c78bd2c09da1390c124cff07844ddb99778a8cff82df98c5d53b52adb04dfef9 + size: 326 + original: + hackage: crypton-asn1-parse-0.10.0@sha256:4a2cfc4980957d1a279ef69137ee5f665c247ccd8bb962812d5b071d543893fb,1359 +- completed: + hackage: crypton-asn1-types-0.4.1@sha256:02f3ec473011b3da92f7bf738bea19cadf88a6470b25a6cb5042216c7549c912,1326 + pantry-tree: + sha256: 03e810ce724980eacfd49ed816d769ae74769f3941d8cc3c9067de4a896eedf2 + size: 722 + original: + hackage: crypton-asn1-types-0.4.1@sha256:02f3ec473011b3da92f7bf738bea19cadf88a6470b25a6cb5042216c7549c912,1326 +- completed: + hackage: crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 + pantry-tree: + sha256: f15579ede43437fc33a1425115e7001a95a5706f71e07525d88211e9e1a42d13 + size: 464 + original: + hackage: crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 +- completed: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 + pantry-tree: + sha256: 882a699e305fffcb77dd40bd40f959f062a8997a53560dca64462087aed3e4cd + size: 1132 + original: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +- completed: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 + pantry-tree: + sha256: 2c7e00e593d399624264172cbd5e2fa55feaf8239cf33bee7e33bbc7509d0a2e + size: 458 + original: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +- completed: + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 + pantry-tree: + sha256: 9ac33c993a82ac4da84804028c5398caec7aada7a83beeec3f28883fe470d68f + size: 512 + original: + hackage: crypton-x509-system-1.8.0 +- completed: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 + pantry-tree: + sha256: 64baf1be6e65ade9ad8eaef819c9cc4c0fcb7d3b968641dcf28a3f859fe87dc5 + size: 691 + original: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 - completed: hackage: hpack-0.39.1@sha256:d7378debd96e805760540e3640aeda3a1ebee1d000dac99726ed55c827c81a94,5229 pantry-tree: @@ -39,6 +95,20 @@ packages: size: 7184 original: hackage: persistent-2.18.0.0@sha256:baa3e0959cf10bbd1da462efeb61d4f073d0cc924a149325494ba5ce29bc17a4,7096 +- completed: + hackage: time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 + pantry-tree: + sha256: 7d6acc1a643fe8692d1858c96cc04a417b8da53e53b6bdba6fe0ce6aa6aba774 + size: 1594 + original: + hackage: time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 +- completed: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 + pantry-tree: + sha256: 6ddac1e644efe75dbf62bbd35fa38897caca307d62bac538ae29b0c54bf6ff00 + size: 7056 + original: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 snapshots: - completed: sha256: 4bc8e0388916c4000645c068dff642482d6ed1b68b747c2d4d444857979963e0 From e869263cbd84a9e59ce1fa467e82993c8e7fb1dd Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Wed, 4 Mar 2026 00:10:00 +0000 Subject: [PATCH 16/75] Add Nix's cacert package to Stack's Nix integration --- ChangeLog.md | 3 +++ doc/topics/nix_integration.md | 5 +++-- src/Stack/Nix.hs | 4 +++- stack.yaml | 2 +- stack.yaml.lock | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index fab94bed08..6257019cac 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,6 +10,9 @@ Major changes: Behavior changes: +* Stack's default Nix integration now includes the `cacert` Nix package, in + order to support Stack's use of `crypton-x509-system >= 1.6.8`. + Other enhancements: * Experimental: Add flag `--[no-]semaphore` (default: disabled) to Stack's diff --git a/doc/topics/nix_integration.md b/doc/topics/nix_integration.md index 3726391a21..7d822529d1 100644 --- a/doc/topics/nix_integration.md +++ b/doc/topics/nix_integration.md @@ -37,8 +37,9 @@ environment: 1. provide a list of [Nix packages][nix-search-packages]. To these, Stack will add Nix packages for the GHC compiler, `git` (the distributed version control - system), `gcc` (the GNU compiler collection) and `gmp` (the GNU multiple - precision arithmetic library); and + system), `gcc` (the GNU compiler collection), `gmp` (the GNU multiple + precision arithmetic library) and `cacert` (a bundle of X.509 certificates of + public Certificate Authorities); and 2. provide a `shell.nix` file that gives you more control over the libraries and tools available inside the shell. diff --git a/src/Stack/Nix.hs b/src/Stack/Nix.hs index d25d678a19..0387706ef5 100644 --- a/src/Stack/Nix.hs +++ b/src/Stack/Nix.hs @@ -80,7 +80,9 @@ runShellAndExit = do ghc <- either throwIO pure $ nixCompiler compilerVersion ghcVersion <- either throwIO pure $ nixCompilerVersion compilerVersion let pkgsInConfig = config.nix.packages - pkgs = pkgsInConfig ++ [ghc, "git", "gcc", "gmp"] + -- It appears that cacert needs to be specified in order for + -- crypton-x509-system >= 1.6.8 to work with Stack's Nix integration: + pkgs = pkgsInConfig ++ [ghc, "git", "gcc", "gmp", "cacert"] pkgsStr = "[" <> T.intercalate " " pkgs <> "]" pureShell = config.nix.pureShell addGCRoots = config.nix.addGCRoots diff --git a/stack.yaml b/stack.yaml index 038d95d7af..9f5ad519fb 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ extra-deps: # lts-24.24 specifies crypton-x509-store-1.6.12 - crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 # lts-24.24 specifies crypton-x509-system-1.6.7 -- crypton-x509-system-1.8.0 +- crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 # lts-24.24 specifies crypton-x509-validation-1.6.14 - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 # lts-24.24 specifies hpack-0.38.3 diff --git a/stack.yaml.lock b/stack.yaml.lock index 1979ca1c32..d40f5d4603 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -66,7 +66,7 @@ packages: sha256: 9ac33c993a82ac4da84804028c5398caec7aada7a83beeec3f28883fe470d68f size: 512 original: - hackage: crypton-x509-system-1.8.0 + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 - completed: hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 pantry-tree: From 32e015bfa09da4a037f387eeab89796283ac7abf Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 6 Mar 2026 19:36:43 +0000 Subject: [PATCH 17/75] Use casa-client-0.0.4 --- stack.yaml | 2 ++ stack.yaml.lock | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/stack.yaml b/stack.yaml index 9f5ad519fb..78aef21612 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,6 +4,8 @@ extra-deps: # lts-24.24 specifies Cabal-3.12.1.0 - Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 - Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +# lts-24.24 specifies casa-client-0.0.3 +- casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 # lts-24.24 does not include crypton-asn1-* - crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 - crypton-asn1-parse-0.10.0@sha256:4a2cfc4980957d1a279ef69137ee5f665c247ccd8bb962812d5b071d543893fb,1359 diff --git a/stack.yaml.lock b/stack.yaml.lock index d40f5d4603..a28e915ece 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -18,6 +18,13 @@ packages: size: 11238 original: hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +- completed: + hackage: casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 + pantry-tree: + sha256: 7297f4d57587a66e63dbc8c192a9424cf0fc694891d5cf17bacd3dc7c6d89ff3 + size: 220 + original: + hackage: casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 - completed: hackage: crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 pantry-tree: From 7dc9582eb73726273cf9511c54a4f1eaa52067e4 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 6 Mar 2026 21:59:47 +0000 Subject: [PATCH 18/75] Fix #6856 Add --reach option to dot and ls dependencies commands --- ChangeLog.md | 5 ++++- doc/commands/dot_command.md | 10 +++++---- doc/commands/ls_command.md | 6 +++-- src/Stack/DependencyGraph.hs | 40 +++++++++++++++++++++++++++++++--- src/Stack/Options/DotParser.hs | 8 +++++++ src/Stack/Types/DotOpts.hs | 3 +++ 6 files changed, 62 insertions(+), 10 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6257019cac..4ba4b18917 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,7 +11,7 @@ Major changes: Behavior changes: * Stack's default Nix integration now includes the `cacert` Nix package, in - order to support Stack's use of `crypton-x509-system >= 1.6.8`. + order to support Stack's use of `crypton-x509-system >= 1.6.8`. Other enhancements: @@ -20,6 +20,9 @@ Other enhancements: in parallel when possible. Supported, by default, by GHC 9.10.1 or later. The option is considered experiemental because, on Linux only, musl and non-musl semaphores are incompatible. +* Add option `--reach ` to Stack's `dot` and `ls dependencies` + commands, to prune packages that cannot reach any of the specified packages in + the dependency graph. Bug fixes: diff --git a/doc/commands/dot_command.md b/doc/commands/dot_command.md index 618f9fc813..9edddb781a 100644 --- a/doc/commands/dot_command.md +++ b/doc/commands/dot_command.md @@ -4,8 +4,8 @@ ~~~text stack dot [--[no-]external] [--[no-]include-base] [--depth DEPTH] - [--prune PACKAGES] [TARGET] [--flag PACKAGE:[-]FLAG] - [--test] [--bench] [--global-hints] + [--prune PACKAGES] [--reach PACKAGES] [TARGET] + [--flag PACKAGE:[-]FLAG] [--test] [--bench] [--global-hints] ~~~ A package and its dependencies and the direct dependency relationships between @@ -28,8 +28,10 @@ By default: `--depth ` option to limit the depth; * all relevant packages are included in the output. Pass the `--prune ` option to exclude the specified packages (including - project packages), where `` is a list of package names separated - by commas; + project packages). Pass the `--reach ` option to exclude packages + (including project packages) that cannot reach any of the specified packages + in the dependency graph. In both cases, `` is a list of package + names separated by commas; * for all relevant project packages, relevant dependencies are included in the output. However, each project package for which dependencies are included can be specified as a target argument. The argument uses the same format as diff --git a/doc/commands/ls_command.md b/doc/commands/ls_command.md index 1d6c952b93..9485b849d1 100644 --- a/doc/commands/ls_command.md +++ b/doc/commands/ls_command.md @@ -69,8 +69,10 @@ By default: `--depth ` option to limit the depth; * all relevant packages are included in the output. Pass the `--prune ` option to exclude the specified packages (including - project packages), where `` is a list of package names separated - by commas; + project packages). Pass the `--reach ` option to exclude packages + (including project packages) that cannot reach any of the specified packages + in the dependency graph. In both cases, `` is a list of package + names separated by commas; * for all relevant project packages, relevant dependencies are included in the output. However, each project package for which dependencies are included can be specified as a target argument. The argument uses the same format as diff --git a/src/Stack/DependencyGraph.hs b/src/Stack/DependencyGraph.hs index c95be77ed9..2ad8e4db4f 100644 --- a/src/Stack/DependencyGraph.hs +++ b/src/Stack/DependencyGraph.hs @@ -117,9 +117,12 @@ createPrunedDependencyGraph dotOpts = withDotConfig dotOpts $ do localNames <- view $ buildConfigL . to (Map.keysSet . (.smWanted.project)) logDebug "Creating dependency graph" (compiler, resultGraph) <- createDependencyGraph dotOpts - let pkgsToPrune = if dotOpts.includeBase - then dotOpts.prune - else Set.insert "base" dotOpts.prune + let pkgsToPrune = Set.union + ( if dotOpts.includeBase + then dotOpts.prune + else Set.insert "base" dotOpts.prune + ) + (nonParentDependencies resultGraph dotOpts.reach) prunedGraph = pruneGraph localNames pkgsToPrune resultGraph logDebug "Returning pruned dependency graph" pure (compiler, localNames, prunedGraph) @@ -413,5 +416,36 @@ pruneUnreachable dontPrune = fixpoint prune reachable k = k `F.elem` dontPrune || k `Set.member` reachables reachables = F.fold (fst <$> graph') +nonParentDependencies :: + F.Foldable f + => Map PackageName (Set PackageName, a) + -> f PackageName + -> Set PackageName +nonParentDependencies graph names + | F.null names = Set.empty + | otherwise = + Set.difference (Map.keysSet graph) (backwardReachable names graph) + +backwardReachable :: + F.Foldable f + => f PackageName + -> Map PackageName (Set PackageName, a) + -> Set PackageName +backwardReachable names graph = go Set.empty (F.toList names) + where + reverseGraph = + Map.fromListWith Set.union + [ (dep, Set.singleton name) + | (name, (deps, _)) <- Map.toList graph + , dep <- Set.toList deps + ] + + go seen [] = seen + go seen (x : xs) + | x `Set.member` seen = go seen xs + | otherwise = + let parents = Map.findWithDefault Set.empty x reverseGraph + in go (Set.insert x seen) (Set.toList parents <> xs) + localPackageToPackage :: LocalPackage -> Package localPackageToPackage lp = fromMaybe lp.package lp.testBench diff --git a/src/Stack/Options/DotParser.hs b/src/Stack/Options/DotParser.hs index 56dc22c592..3572c50464 100644 --- a/src/Stack/Options/DotParser.hs +++ b/src/Stack/Options/DotParser.hs @@ -34,6 +34,7 @@ dotOptsParser externalDefault = DotOpts <*> includeBase <*> depthLimit <*> fmap (maybe Set.empty $ Set.fromList . splitNames) prunedPkgs + <*> fmap (maybe Set.empty $ Set.fromList . splitNames) reachPkgs <*> targetsParser <*> flagsParser <*> testTargets @@ -59,6 +60,13 @@ dotOptsParser externalDefault = DotOpts <> help "Prune specified package(s). PACKAGES is a comma-separated list of \ \package names." )) + reachPkgs = optional (strOption + ( long "reach" + <> metavar "PACKAGES" + <> help "Prune packages that cannot reach any of the specified package(s) \ + \in the dependency graph. PACKAGES is a comma-separated list of \ + \package names." + )) targetsParser :: Parser [Text] targetsParser = diff --git a/src/Stack/Types/DotOpts.hs b/src/Stack/Types/DotOpts.hs index a0683c6f60..dd8f4c9ba0 100644 --- a/src/Stack/Types/DotOpts.hs +++ b/src/Stack/Types/DotOpts.hs @@ -27,6 +27,9 @@ data DotOpts = DotOpts -- fixpoint , prune :: !(Set PackageName) -- ^ Package names to prune from the graph + , reach :: !(Set PackageName) + -- ^ If not empty, packages in the pruned graph must be able to reach one or + -- more of these packages , dotTargets :: [Text] -- ^ Stack TARGETs to trace dependencies for , flags :: !(Map ApplyCLIFlag (Map FlagName Bool)) From 1ce06745a66f122493cdadbd88a7cf3b7d4a0a9b Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 6 Mar 2026 22:50:36 +0000 Subject: [PATCH 19/75] Fix #6858 Don't prune when all dependencies pruned --- ChangeLog.md | 3 +++ doc/commands/dot_command.md | 3 +-- doc/commands/ls_command.md | 3 +-- src/Stack/DependencyGraph.hs | 4 +--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4ba4b18917..034489bd67 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -26,6 +26,9 @@ Other enhancements: Bug fixes: +* Stack's `dot` and `ls dependencies` commands no longer prune a package with + dependencies only because all its direct dependencies are to be pruned. + ## v3.9.3 - 2026-02-19 Release notes: diff --git a/doc/commands/dot_command.md b/doc/commands/dot_command.md index cc9e99fe18..9edddb781a 100644 --- a/doc/commands/dot_command.md +++ b/doc/commands/dot_command.md @@ -31,8 +31,7 @@ By default: project packages). Pass the `--reach ` option to exclude packages (including project packages) that cannot reach any of the specified packages in the dependency graph. In both cases, `` is a list of package - names separated by commas. A package with dependencies is pruned if all of - its direct dependencies are pruned; + names separated by commas; * for all relevant project packages, relevant dependencies are included in the output. However, each project package for which dependencies are included can be specified as a target argument. The argument uses the same format as diff --git a/doc/commands/ls_command.md b/doc/commands/ls_command.md index 42a2632350..9485b849d1 100644 --- a/doc/commands/ls_command.md +++ b/doc/commands/ls_command.md @@ -72,8 +72,7 @@ By default: project packages). Pass the `--reach ` option to exclude packages (including project packages) that cannot reach any of the specified packages in the dependency graph. In both cases, `` is a list of package - names separated by commas. A package with dependencies is pruned if all of - its direct dependencies are pruned; + names separated by commas; * for all relevant project packages, relevant dependencies are included in the output. However, each project package for which dependencies are included can be specified as a target argument. The argument uses the same format as diff --git a/src/Stack/DependencyGraph.hs b/src/Stack/DependencyGraph.hs index 2ad8e4db4f..b5a484d572 100644 --- a/src/Stack/DependencyGraph.hs +++ b/src/Stack/DependencyGraph.hs @@ -397,9 +397,7 @@ pruneGraph dontPrune names = if pkg `F.elem` names then Nothing else let filtered = Set.filter (`F.notElem` names) pkgDeps - in if Set.null filtered && not (Set.null pkgDeps) - then Nothing - else Just (filtered, x)) + in Just (filtered, x)) -- | Make sure that all unreachable nodes (orphans) are pruned pruneUnreachable :: From 844df522dfb211b80765a909bd5644d11c865d90 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 7 Mar 2026 20:53:00 +0000 Subject: [PATCH 20/75] Add example for stack dot --reach --- doc/commands/dot_command.md | 9 + doc/img/dot_command/wreq-example7.svg | 457 ++++++++++++++++++++++++++ 2 files changed, 466 insertions(+) create mode 100644 doc/img/dot_command/wreq-example7.svg diff --git a/doc/commands/dot_command.md b/doc/commands/dot_command.md index 9edddb781a..83975ff71a 100644 --- a/doc/commands/dot_command.md +++ b/doc/commands/dot_command.md @@ -115,3 +115,12 @@ output in the form of a SVG file named `wreq-example*.svg`. ~~~ [![wreq-example6.svg](https://cdn.jsdelivr.net/gh/commercialhaskell/stack@master/doc/img/dot_command/wreq-example6.svg)](https://cdn.jsdelivr.net/gh/commercialhaskell/stack@master/doc/img/dot_command/wreq-example6.svg) + +* Include external dependencies and prune packages that cannot reach any of + `memory` and `basement` in the dependency graph: + + ~~~text + stack dot --external --reach memory,basement | dot -Tsvg -o wreq-example7.svg + ~~~ + + [![wreq-example7.svg](https://cdn.jsdelivr.net/gh/commercialhaskell/stack@master/doc/img/dot_command/wreq-example7.svg)](https://cdn.jsdelivr.net/gh/commercialhaskell/stack@master/doc/img/dot_command/wreq-example7.svg) diff --git a/doc/img/dot_command/wreq-example7.svg b/doc/img/dot_command/wreq-example7.svg new file mode 100644 index 0000000000..d78d538314 --- /dev/null +++ b/doc/img/dot_command/wreq-example7.svg @@ -0,0 +1,457 @@ + + + + + + +deps + + + +wreq + +wreq + + + +memory + +memory + + + +wreq->memory + + + + + +authenticate-oauth + +authenticate-oauth + + + +wreq->authenticate-oauth + + + + + +crypton + +crypton + + + +wreq->crypton + + + + + +http-client-tls + +http-client-tls + + + +wreq->http-client-tls + + + + + +wreq-examples + +wreq-examples + + + +wreq-examples->wreq + + + + + +basement + +basement + + + +RSA + +RSA + + + +crypto-pubkey-types + +crypto-pubkey-types + + + +RSA->crypto-pubkey-types + + + + + +asn1-encoding + +asn1-encoding + + + +crypto-pubkey-types->asn1-encoding + + + + + +asn1-types + +asn1-types + + + +crypto-pubkey-types->asn1-types + + + + + +asn1-encoding->asn1-types + + + + + +asn1-types->memory + + + + + +asn1-parse + +asn1-parse + + + +asn1-parse->asn1-encoding + + + + + +asn1-parse->asn1-types + + + + + +memory->basement + + + + + +authenticate-oauth->RSA + + + + + +authenticate-oauth->crypto-pubkey-types + + + + + +crypton->basement + + + + + +crypton->memory + + + + + +crypton-connection + +crypton-connection + + + +crypton-x509-store + +crypton-x509-store + + + +crypton-connection->crypton-x509-store + + + + + +crypton-x509-system + +crypton-x509-system + + + +crypton-connection->crypton-x509-system + + + + + +tls + +tls + + + +crypton-connection->tls + + + + + +crypton-x509-store->asn1-encoding + + + + + +crypton-x509-store->asn1-types + + + + + +crypton-x509-store->crypton + + + + + +crypton-x509 + +crypton-x509 + + + +crypton-x509-store->crypton-x509 + + + + + +pem + +pem + + + +crypton-x509-store->pem + + + + + +crypton-x509-system->asn1-encoding + + + + + +crypton-x509-system->crypton-x509-store + + + + + +crypton-x509-system->crypton-x509 + + + + + +crypton-x509-system->pem + + + + + +tls->asn1-encoding + + + + + +tls->asn1-types + + + + + +tls->memory + + + + + +tls->crypton + + + + + +tls->crypton-x509-store + + + + + +tls->crypton-x509 + + + + + +crypton-x509-validation + +crypton-x509-validation + + + +tls->crypton-x509-validation + + + + + +crypton-x509->asn1-encoding + + + + + +crypton-x509->asn1-types + + + + + +crypton-x509->asn1-parse + + + + + +crypton-x509->memory + + + + + +crypton-x509->crypton + + + + + +crypton-x509->pem + + + + + +pem->basement + + + + + +pem->memory + + + + + +crypton-x509-validation->asn1-encoding + + + + + +crypton-x509-validation->asn1-types + + + + + +crypton-x509-validation->memory + + + + + +crypton-x509-validation->crypton + + + + + +crypton-x509-validation->crypton-x509-store + + + + + +crypton-x509-validation->crypton-x509 + + + + + +crypton-x509-validation->pem + + + + + +http-client-tls->memory + + + + + +http-client-tls->crypton + + + + + +http-client-tls->crypton-connection + + + + + +http-client-tls->tls + + + + + From ed8ad93eb1a578e5b318cbff0656b4ea4105d5af Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 15 Mar 2026 20:09:48 +0000 Subject: [PATCH 21/75] Re #6861 Prettify existing Nix integration exceptions --- doc/maintainers/stack_errors.md | 8 ++--- src/Stack/Config/Nix.hs | 62 ++++++++++++++++++++++----------- src/Stack/Nix.hs | 21 ++++++----- 3 files changed, 58 insertions(+), 33 deletions(-) diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index e24a902b13..3f6b93190f 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -5,7 +5,7 @@ In connection with considering Stack's support of the [Haskell Error Index](https://errors.haskell.org/) initiative, this page seeks to take stock of the errors that Stack itself can raise, by reference to the -`master` branch of the Stack repository. Last updated: 2025-08-16. +`master` branch of the Stack repository. Last updated: 2026-03-15. * `Stack.main`: catches exceptions from action `commandLineHandler`. @@ -78,10 +78,10 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-8575] = SnapshotNotSupportedException (Maybe Project) (Maybe AbstractSnapshot) ~~~ - - `Stack.Config.Nix.ConfigNixException` + - `Stack.Config.Nix.ConfigNixPrettyException` ~~~haskell - [S-2726] = NixCannotUseShellFileAndPackagesException + [S-2726] = NixCannotUseShellFileAndPackagesException FilePath [Text] [S-9317] | GHCMajorVersionUnspecified [S-8605] | OnlyGHCSupported ~~~ @@ -208,7 +208,7 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-3113] | AttemptedOverwrites [Path Abs File] ~~~ - - `Stack.Nix.NixException` + - `Stack.Nix.NixPrettyException` ~~~haskell [S-7384] = CannotDetermineProjectRoot diff --git a/src/Stack/Config/Nix.hs b/src/Stack/Config/Nix.hs index c80b866543..90a64d35f7 100644 --- a/src/Stack/Config/Nix.hs +++ b/src/Stack/Config/Nix.hs @@ -12,13 +12,13 @@ Nix configuration. -} module Stack.Config.Nix - ( ConfigNixException + ( ConfigNixPrettyException , nixCompiler , nixCompilerVersion , nixOptsFromMonoid ) where -import Control.Monad.Extra ( ifM ) +import Control.Monad.Extra ( ifM, whenJust ) import qualified Data.Text as T import qualified Data.Text.IO as TIO import Distribution.System ( OS (..) ) @@ -28,26 +28,47 @@ import Stack.Types.Runner ( HasRunner ) import Stack.Types.Nix ( NixOpts (..), NixOptsMonoid (..) ) import System.Directory ( doesFileExist ) --- | Type representing exceptions thrown by functions exported by the +-- | Type representing \'pretty\' exceptions thrown by functions exported by the -- "Stack.Config.Nix" module. -data ConfigNixException - = NixCannotUseShellFileAndPackagesException +data ConfigNixPrettyException + = NixCannotUseShellFileAndPackagesException !FilePath ![Text] -- ^ Nix can't be given packages and a shell file at the same time | GHCMajorVersionUnspecified | OnlyGHCSupported deriving Show -instance Exception ConfigNixException where - displayException NixCannotUseShellFileAndPackagesException = - "Error: [S-2726]\n" - ++ "You cannot have packages and a shell-file filled at the same time \ - \in your nix-shell configuration." - displayException GHCMajorVersionUnspecified = - "Error: [S-9317]\n" - ++ "GHC major version not specified." - displayException OnlyGHCSupported = - "Error: [S-8605]\n" - ++ "Only GHC is supported by 'stack --nix'." +instance Pretty ConfigNixPrettyException where + pretty (NixCannotUseShellFileAndPackagesException initFile packages) = + "[S-2726]" + <> line + <> flow "The configuration of Stack's Nix integration cannot specify both \ + \a Nix shell file and Nix packages. You have specified:" + <> blankLine + <> spacedBulletedList + [ fillSep + [ flow "Shell file:" + , style File (fromString initFile) <> ";" + , "and" + ] + , fillSep $ + flow "Nix packages:" + : mkNarrativeList (Just Shell) False prettyPackages + ] + where + prettyPackages :: [StyleDoc] + prettyPackages = map (fromString . T.unpack) packages + pretty GHCMajorVersionUnspecified = + "[S-9317]" + <> line + <> flow "Stack's Nix integration requires at least a major version of GHC \ + \to be specified. No major version is specified." + pretty OnlyGHCSupported = + "[S-8605]" + <> line + <> flow "Stack's Nix integration supports only GHC binary distributions as \ + \compiler." + +instance Exception ConfigNixPrettyException -- | Interprets NixOptsMonoid options. nixOptsFromMonoid :: @@ -79,8 +100,9 @@ nixOptsFromMonoid nixMonoid os = do pure False else pure nixEnable0 - when (not (null packages) && isJust initFile) $ - throwIO NixCannotUseShellFileAndPackagesException + unless (null packages) $ whenJust initFile $ \fp -> + prettyThrowIO $ NixCannotUseShellFileAndPackagesException fp packages + pure NixOpts { enable , pureShell @@ -93,7 +115,7 @@ nixOptsFromMonoid nixMonoid os = do prefixAll p (x:xs) = p : x : prefixAll p xs prefixAll _ _ = [] -nixCompiler :: WantedCompiler -> Either ConfigNixException T.Text +nixCompiler :: WantedCompiler -> Either ConfigNixPrettyException T.Text nixCompiler compilerVersion = case compilerVersion of WCGhc version -> @@ -119,7 +141,7 @@ nixCompiler compilerVersion = WCGhcjs{} -> Left OnlyGHCSupported WCGhcGit{} -> Left OnlyGHCSupported -nixCompilerVersion :: WantedCompiler -> Either ConfigNixException T.Text +nixCompilerVersion :: WantedCompiler -> Either ConfigNixPrettyException T.Text nixCompilerVersion compilerVersion = case compilerVersion of WCGhc version -> diff --git a/src/Stack/Nix.hs b/src/Stack/Nix.hs index 0387706ef5..666280052e 100644 --- a/src/Stack/Nix.hs +++ b/src/Stack/Nix.hs @@ -36,17 +36,20 @@ import Stack.Types.Version ( showStackVersion ) import System.Environment ( getArgs, lookupEnv ) import qualified System.FilePath as F --- | Type representing exceptions thrown by functions exported by the --- "Stack.Nix" module. -data NixException +-- | Type representing \'pretty\' exceptions thrown by functions exported by +-- the "Stack.Nix" module. +data NixPrettyException = CannotDetermineProjectRoot -- ^ Can't determine the project root (location of the shell file if any). deriving Show -instance Exception NixException where - displayException CannotDetermineProjectRoot = - "Error: [S-7384]\n" - ++ "Cannot determine project root directory." +instance Pretty NixPrettyException where + pretty CannotDetermineProjectRoot = + "[S-7384]" + <> line + <> flow "Cannot determine project root directory." + +instance Exception NixPrettyException -- | Execute @nix-shell@, replacing the current process. runShellAndExit :: RIO Config void @@ -77,8 +80,8 @@ runShellAndExit = do -- (thus the void return type) compilerVersion <- withBuildConfig $ view wantedCompilerVersionL - ghc <- either throwIO pure $ nixCompiler compilerVersion - ghcVersion <- either throwIO pure $ nixCompilerVersion compilerVersion + ghc <- either prettyThrowIO pure $ nixCompiler compilerVersion + ghcVersion <- either prettyThrowIO pure $ nixCompilerVersion compilerVersion let pkgsInConfig = config.nix.packages -- It appears that cacert needs to be specified in order for -- crypton-x509-system >= 1.6.8 to work with Stack's Nix integration: From 4abde19e262b1941e7a56a0061c1897e0d0d9ff1 Mon Sep 17 00:00:00 2001 From: Dan Burton Date: Sat, 4 Apr 2026 14:34:29 -0700 Subject: [PATCH 22/75] --test-suite-timeout-grace --- ChangeLog.md | 4 ++ doc/commands/bench_command.md | 1 + doc/commands/build_command.md | 1 + doc/commands/haddock_command.md | 3 +- doc/commands/install_command.md | 3 +- doc/commands/test_command.md | 1 + doc/configure/yaml/non-project.md | 2 + src/Stack/Build/ExecutePackage.hs | 54 ++++++++++++++----- src/Stack/BuildOpts.hs | 1 + src/Stack/Config/Build.hs | 4 ++ src/Stack/Options/TestParser.hs | 5 ++ src/Stack/Types/BuildOpts.hs | 2 + src/Stack/Types/BuildOptsMonoid.hs | 6 +++ src/unix/Stack/Build/TestSuiteTimeout.hs | 40 ++++++++++++++ src/windows/Stack/Build/TestSuiteTimeout.hs | 29 ++++++++++ stack.cabal | 2 + .../tests/6867-timeout-grace/Main.hs | 34 ++++++++++++ .../6867-timeout-grace/files/package.yaml | 17 ++++++ .../tests/6867-timeout-grace/files/stack.yaml | 3 ++ .../6867-timeout-grace/files/test/Main.hs | 16 ++++++ .../files/timeout-grace-fixture.cabal | 27 ++++++++++ tests/unit/Stack/ConfigSpec.hs | 2 + 22 files changed, 242 insertions(+), 15 deletions(-) create mode 100644 src/unix/Stack/Build/TestSuiteTimeout.hs create mode 100644 src/windows/Stack/Build/TestSuiteTimeout.hs create mode 100644 tests/integration/tests/6867-timeout-grace/Main.hs create mode 100644 tests/integration/tests/6867-timeout-grace/files/package.yaml create mode 100644 tests/integration/tests/6867-timeout-grace/files/stack.yaml create mode 100644 tests/integration/tests/6867-timeout-grace/files/test/Main.hs create mode 100644 tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal diff --git a/ChangeLog.md b/ChangeLog.md index 034489bd67..2784db0590 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -23,6 +23,10 @@ Other enhancements: * Add option `--reach ` to Stack's `dot` and `ls dependencies` commands, to prune packages that cannot reach any of the specified packages in the dependency graph. +* Add option `--test-suite-timeout-grace ARG` (and corresponding non-project + configuration key `test-suite-timeout-grace`) to pair with + `--test-suite-timeout ARG` and perform staged timeout termination for test + suites. Bug fixes: diff --git a/doc/commands/bench_command.md b/doc/commands/bench_command.md index 52ff529810..0498b7e70d 100644 --- a/doc/commands/bench_command.md +++ b/doc/commands/bench_command.md @@ -17,6 +17,7 @@ stack bench [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] + [--test-suite-timeout-grace ARG] [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index 8b483c1de5..526bd561bc 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -18,6 +18,7 @@ stack build [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] + [--test-suite-timeout-grace ARG] [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | diff --git a/doc/commands/haddock_command.md b/doc/commands/haddock_command.md index e1c5bff14a..362eed0af1 100644 --- a/doc/commands/haddock_command.md +++ b/doc/commands/haddock_command.md @@ -17,7 +17,8 @@ stack haddock [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] - [--test-suite-timeout ARG] [--[no-]tests-allow-stdin] + [--test-suite-timeout ARG] [--test-suite-timeout-grace ARG] + [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] diff --git a/doc/commands/install_command.md b/doc/commands/install_command.md index 653981a2d4..f579bcc4a3 100644 --- a/doc/commands/install_command.md +++ b/doc/commands/install_command.md @@ -17,7 +17,8 @@ stack install [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] - [--test-suite-timeout ARG] [--[no-]tests-allow-stdin] + [--test-suite-timeout ARG] [--test-suite-timeout-grace ARG] + [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] diff --git a/doc/commands/test_command.md b/doc/commands/test_command.md index cb0f2cb9c9..bd740116f7 100644 --- a/doc/commands/test_command.md +++ b/doc/commands/test_command.md @@ -17,6 +17,7 @@ stack test [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] + [--test-suite-timeout-grace ARG] [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index 5c2e14b2c5..a521c22529 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -216,6 +216,8 @@ build: no-run-tests: false # The option is ignored if the specified number of seconds is not positive: test-suite-timeout: 0 + # Grace period in seconds after test-suite-timeout before force kill. + test-suite-timeout-grace: 1 bench: false benchmark-opts: diff --git a/src/Stack/Build/ExecutePackage.hs b/src/Stack/Build/ExecutePackage.hs index b03d1d2b02..04804ebd86 100644 --- a/src/Stack/Build/ExecutePackage.hs +++ b/src/Stack/Build/ExecutePackage.hs @@ -68,6 +68,8 @@ import Stack.Build.ExecuteEnv ( ExcludeTHLoading (..), ExecuteEnv (..), KeepOutputOpen (..) , OutputType (..), withSingleContext ) +import Stack.Build.TestSuiteTimeout + ( forceKill, prepareForEscalation, terminateGracefully ) import Stack.Build.Source ( addUnlistedToBuildCache ) import Stack.Config.ConfigureScript ( ensureConfigureScript ) import Stack.ConfigureOpts @@ -1156,13 +1158,47 @@ singleTest topts testsToRun ac ee task installedMap = do ) createSource OTLogFile _ h -> Nothing <$ useHandleOpen h - optionalTimeout action + runOutput p = + case (getStdout p, getStderr p) of + (Nothing, Nothing) -> pure () + (Just x, Just y) -> concurrently_ x y + (x, y) -> assert False $ + concurrently_ + (fromMaybe (pure ()) x) + (fromMaybe (pure ()) y) + timeoutWithGrace p maxSecs graceSecs = do + mExit <- timeout (maxSecs * 1000000) (waitExitCode p) + case mExit of + Just ec -> pure (Just ec) + Nothing -> do + terminateGracefully p + mGraceExit <- timeout (graceSecs * 1000000) + (waitExitCode p) + case mGraceExit of + Just _ -> pure Nothing + Nothing -> do + forceKill p + void $ waitExitCode p + pure Nothing + runWithTimeout pc + | Just maxSecs <- topts.maximumTimeSeconds, maxSecs > 0 + , Just graceSecs <- topts.timeoutGraceSeconds + , graceSecs > 0 = + withProcessWait (prepareForEscalation pc) $ \p -> do + (_, mec') <- concurrently + (runOutput p) + (timeoutWithGrace p maxSecs graceSecs) + pure mec' | Just maxSecs <- topts.maximumTimeSeconds, maxSecs > 0 = - timeout (maxSecs * 1000000) action - | otherwise = Just <$> action + timeout (maxSecs * 1000000) $ + withProcessWait pc $ \p -> do + runOutput p + waitExitCode p + | otherwise = + Just <$> withProcessWait pc (\p -> runOutput p *> waitExitCode p) mec <- withWorkingDir (toFilePath pkgDir) $ - optionalTimeout $ proc (toFilePath exePath) args $ \pc0 -> do + proc (toFilePath exePath) args $ \pc0 -> do changeStdin <- if isTestTypeLib then do @@ -1185,15 +1221,7 @@ singleTest topts testsToRun ac ee task installedMap = do $ setStdout output $ setStderr output pc0 - withProcessWait pc $ \p -> do - case (getStdout p, getStderr p) of - (Nothing, Nothing) -> pure () - (Just x, Just y) -> concurrently_ x y - (x, y) -> assert False $ - concurrently_ - (fromMaybe (pure ()) x) - (fromMaybe (pure ()) y) - waitExitCode p + runWithTimeout pc -- Add a trailing newline, incase the test -- output didn't finish with a newline. case outputType of diff --git a/src/Stack/BuildOpts.hs b/src/Stack/BuildOpts.hs index 649c26250e..b843a5b4a8 100644 --- a/src/Stack/BuildOpts.hs +++ b/src/Stack/BuildOpts.hs @@ -74,6 +74,7 @@ defaultTestOpts = TestOpts , coverage = defaultFirstFalse toMonoid.coverage , runTests = defaultFirstTrue toMonoid.runTests , maximumTimeSeconds = Nothing + , timeoutGraceSeconds = Nothing , allowStdin = defaultFirstTrue toMonoid.allowStdin } where diff --git a/src/Stack/Config/Build.hs b/src/Stack/Config/Build.hs index afd020a9f8..3731527744 100644 --- a/src/Stack/Config/Build.hs +++ b/src/Stack/Config/Build.hs @@ -135,6 +135,10 @@ testOptsFromMonoid toMonoid madditional = defaultTestOpts fromFirst defaultTestOpts.maximumTimeSeconds toMonoid.maximumTimeSeconds + , TestOpts.timeoutGraceSeconds = + fromFirst + defaultTestOpts.timeoutGraceSeconds + toMonoid.timeoutGraceSeconds , TestOpts.allowStdin = fromFirstTrue toMonoid.allowStdin } diff --git a/src/Stack/Options/TestParser.hs b/src/Stack/Options/TestParser.hs index 1a708e9ca6..d6171ddc50 100644 --- a/src/Stack/Options/TestParser.hs +++ b/src/Stack/Options/TestParser.hs @@ -47,6 +47,11 @@ testOptsParser hide0 = TestOptsMonoid <> help "Maximum test suite run time in seconds." <> hide )) + <*> optionalFirst (option (fmap Just auto) + ( long "test-suite-timeout-grace" + <> help "Grace period in seconds after timeout before force termination." + <> hide + )) <*> firstBoolFlagsTrue "tests-allow-stdin" "allow standard input in test suites." diff --git a/src/Stack/Types/BuildOpts.hs b/src/Stack/Types/BuildOpts.hs index bdff5a886a..cf7c335db8 100644 --- a/src/Stack/Types/BuildOpts.hs +++ b/src/Stack/Types/BuildOpts.hs @@ -115,6 +115,8 @@ data TestOpts = TestOpts , coverage :: !Bool -- ^ Generate a code coverage report , runTests :: !Bool -- ^ Enable running of tests , maximumTimeSeconds :: !(Maybe Int) -- ^ test suite timeout in seconds + , timeoutGraceSeconds :: !(Maybe Int) + -- ^ additional grace period after timeout before force-killing , allowStdin :: !Bool -- ^ Whether to allow standard input } deriving (Eq, Show) diff --git a/src/Stack/Types/BuildOptsMonoid.hs b/src/Stack/Types/BuildOptsMonoid.hs index a6f378f60c..26847527bb 100644 --- a/src/Stack/Types/BuildOptsMonoid.hs +++ b/src/Stack/Types/BuildOptsMonoid.hs @@ -274,6 +274,7 @@ data TestOptsMonoid = TestOptsMonoid , coverage :: !FirstFalse , runTests :: !FirstTrue , maximumTimeSeconds :: !(First (Maybe Int)) + , timeoutGraceSeconds :: !(First (Maybe Int)) , allowStdin :: !FirstTrue } deriving (Show, Generic) @@ -285,6 +286,7 @@ instance FromJSON (WithJSONWarnings TestOptsMonoid) where coverage <- FirstFalse <$> o ..:? coverageArgName runTests <- FirstTrue . (not <$>) <$> o ..:? noRunTestsArgName maximumTimeSeconds <- First <$> o ..:? maximumTimeSecondsArgName + timeoutGraceSeconds <- First <$> o ..:? timeoutGraceSecondsArgName allowStdin <- FirstTrue <$> o ..:? testsAllowStdinName pure TestOptsMonoid { rerunTests @@ -292,6 +294,7 @@ instance FromJSON (WithJSONWarnings TestOptsMonoid) where , coverage , runTests , maximumTimeSeconds + , timeoutGraceSeconds , allowStdin } @@ -310,6 +313,9 @@ noRunTestsArgName = "no-run-tests" maximumTimeSecondsArgName :: Text maximumTimeSecondsArgName = "test-suite-timeout" +timeoutGraceSecondsArgName :: Text +timeoutGraceSecondsArgName = "test-suite-timeout-grace" + testsAllowStdinName :: Text testsAllowStdinName = "tests-allow-stdin" diff --git a/src/unix/Stack/Build/TestSuiteTimeout.hs b/src/unix/Stack/Build/TestSuiteTimeout.hs new file mode 100644 index 0000000000..e496a661d9 --- /dev/null +++ b/src/unix/Stack/Build/TestSuiteTimeout.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +{-| +Module : Stack.Build.TestSuiteTimeout +Description : OS-specific test suite timeout termination helpers. +License : BSD-3-Clause +-} + +module Stack.Build.TestSuiteTimeout + ( prepareForEscalation + , terminateGracefully + , forceKill + ) where + +import RIO.Process ( ProcessConfig, setNewSession ) +import qualified RIO.Process as RP ( Process, unsafeProcessHandle ) +import Stack.Prelude +import System.Posix.Signals + ( sigKILL, sigTERM, signalProcess, signalProcessGroup ) +import qualified System.Process as Process + +prepareForEscalation :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr +prepareForEscalation = setNewSession True + +terminateGracefully :: RP.Process stdin stdout stderr -> RIO env () +terminateGracefully p = do + let processHandle = RP.unsafeProcessHandle p + mpid <- liftIO $ Process.getPid processHandle + forM_ mpid $ \pid -> do + -- In a new session, the initial pid is also the process group id. + void $ tryAny $ liftIO $ signalProcessGroup sigTERM pid + void $ tryAny $ liftIO $ signalProcess sigTERM pid + +forceKill :: RP.Process stdin stdout stderr -> RIO env () +forceKill p = do + let processHandle = RP.unsafeProcessHandle p + mpid <- liftIO $ Process.getPid processHandle + forM_ mpid $ \pid -> do + void $ tryAny $ liftIO $ signalProcessGroup sigKILL pid + void $ tryAny $ liftIO $ signalProcess sigKILL pid diff --git a/src/windows/Stack/Build/TestSuiteTimeout.hs b/src/windows/Stack/Build/TestSuiteTimeout.hs new file mode 100644 index 0000000000..2603b01ce1 --- /dev/null +++ b/src/windows/Stack/Build/TestSuiteTimeout.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +{-| +Module : Stack.Build.TestSuiteTimeout +Description : OS-specific test suite timeout termination helpers. +License : BSD-3-Clause +-} + +module Stack.Build.TestSuiteTimeout + ( prepareForEscalation + , terminateGracefully + , forceKill + ) where + +import RIO.Process ( ProcessConfig ) +import qualified RIO.Process as RP ( Process, unsafeProcessHandle ) +import Stack.Prelude +import qualified System.Process as Process + +prepareForEscalation :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr +prepareForEscalation = id + +terminateGracefully :: RP.Process stdin stdout stderr -> RIO env () +terminateGracefully p = + void $ tryAny $ liftIO $ Process.terminateProcess $ RP.unsafeProcessHandle p + +forceKill :: RP.Process stdin stdout stderr -> RIO env () +forceKill p = + void $ tryAny $ liftIO $ Process.terminateProcess $ RP.unsafeProcessHandle p diff --git a/stack.cabal b/stack.cabal index d6671e9a9d..4cfdc9f0b1 100644 --- a/stack.cabal +++ b/stack.cabal @@ -509,6 +509,7 @@ library cpp-options: -DSTACK_DISABLE_STACK_UPLOAD=False if os(windows) other-modules: + Stack.Build.TestSuiteTimeout Stack.Constants.UsrLibDirs Stack.Docker.Handlers System.Posix.User @@ -517,6 +518,7 @@ library src/windows/ else other-modules: + Stack.Build.TestSuiteTimeout Stack.Constants.UsrLibDirs Stack.Docker.Handlers System.Uname diff --git a/tests/integration/tests/6867-timeout-grace/Main.hs b/tests/integration/tests/6867-timeout-grace/Main.hs new file mode 100644 index 0000000000..e3f58e6e09 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/Main.hs @@ -0,0 +1,34 @@ +import Data.Char (toLower) +import Data.IORef (newIORef, readIORef, writeIORef) +import Data.List (isInfixOf) +import Data.Time.Clock (diffUTCTime, getCurrentTime) +import StackTest +import Control.Monad (unless) + +main :: IO () +main = do + start <- getCurrentTime + errRef <- newIORef "" + stackErrStderr + [ "test" + , "--test-suite-timeout", "1" + , "--test-suite-timeout-grace", "1" + ] + (writeIORef errRef) + end <- getCurrentTime + err <- readIORef errRef + + let errLower = map toLower err + elapsedSecs :: Double + elapsedSecs = realToFrac (diffUTCTime end start) + + unless ("timed out" `isInfixOf` errLower) $ + error "Expected test-suite timeout message in stderr output." + + if isWindows + then unless (elapsedSecs < 5.0) $ + error $ "Expected timeout+grace run to finish quickly on Windows, took " + ++ show elapsedSecs ++ "s" + else unless (elapsedSecs > 1.5 && elapsedSecs < 5.0) $ + error $ "Expected timeout+grace run to take about timeout+grace on Unix, took " + ++ show elapsedSecs ++ "s" diff --git a/tests/integration/tests/6867-timeout-grace/files/package.yaml b/tests/integration/tests/6867-timeout-grace/files/package.yaml new file mode 100644 index 0000000000..a0efe93896 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/files/package.yaml @@ -0,0 +1,17 @@ +name: timeout-grace-fixture +version: 0.1.0.0 +license: BSD-3-Clause + +ghc-options: +- -Wall + +tests: + timeout-grace-fixture-test: + main: Main.hs + source-dirs: test + dependencies: + - base + when: + - condition: '!os(windows)' + dependencies: + - unix diff --git a/tests/integration/tests/6867-timeout-grace/files/stack.yaml b/tests/integration/tests/6867-timeout-grace/files/stack.yaml new file mode 100644 index 0000000000..da98263e48 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/files/stack.yaml @@ -0,0 +1,3 @@ +snapshot: lts-24.24 +packages: +- . diff --git a/tests/integration/tests/6867-timeout-grace/files/test/Main.hs b/tests/integration/tests/6867-timeout-grace/files/test/Main.hs new file mode 100644 index 0000000000..7d2c6cf974 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/files/test/Main.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE CPP #-} + +module Main (main) where + +import Control.Concurrent (threadDelay) + +#ifndef mingw32_HOST_OS +import System.Posix.Signals (Handler (Ignore), installHandler, sigTERM) +#endif + +main :: IO () +main = do +#ifndef mingw32_HOST_OS + _ <- installHandler sigTERM Ignore Nothing +#endif + threadDelay 6000000 diff --git a/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal b/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal new file mode 100644 index 0000000000..4813ac2d66 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal @@ -0,0 +1,27 @@ +cabal-version: 2.2 + +-- This file has been generated from package.yaml by hpack version 0.39.1. +-- +-- see: https://github.com/sol/hpack + +name: timeout-grace-fixture +version: 0.1.0.0 +license: BSD-3-Clause +build-type: Simple + +test-suite timeout-grace-fixture-test + type: exitcode-stdio-1.0 + main-is: Main.hs + other-modules: + Paths_timeout_grace_fixture + autogen-modules: + Paths_timeout_grace_fixture + hs-source-dirs: + test + ghc-options: -Wall + build-depends: + base + default-language: Haskell2010 + if !os(windows) + build-depends: + unix diff --git a/tests/unit/Stack/ConfigSpec.hs b/tests/unit/Stack/ConfigSpec.hs index 0f66d79f45..b64dce1df1 100644 --- a/tests/unit/Stack/ConfigSpec.hs +++ b/tests/unit/Stack/ConfigSpec.hs @@ -90,6 +90,7 @@ buildOptsConfig = " additional-args: ['-fprof']\n" ++ " coverage: true\n" ++ " no-run-tests: true\n" ++ + " test-suite-timeout-grace: 30\n" ++ " bench: true\n" ++ " benchmark-opts:\n" ++ " benchmark-arguments: -O2\n" ++ @@ -259,6 +260,7 @@ spec = beforeAll setup $ do , coverage = True , runTests = False , maximumTimeSeconds = Nothing + , timeoutGraceSeconds = Just 30 , allowStdin = True } bopts.benchmarks `shouldBe` True From 0e8e6a81e0673a2375c30c8d614bb6f6ad16f852 Mon Sep 17 00:00:00 2001 From: Dan Burton Date: Sat, 4 Apr 2026 14:45:03 -0700 Subject: [PATCH 23/75] --test-suite-timeout-grace: improve docs --- doc/commands/build_command.md | 10 ++++++++++ doc/configure/yaml/non-project.md | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index 526bd561bc..70b0730952 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -827,6 +827,16 @@ suite in a timeout so that the test suite fails if no result is available within the specified number of seconds. The option is ignored if the number of seconds is not positive. +### `--test-suite-timeout-grace` option + +Default: None + +`stack build --test --test-suite-timeout= --test-suite-timeout-grace=` +uses staged timeout termination for each running test suite: after +`--test-suite-timeout` is reached, Stack waits the specified grace period before +force termination. The option is ignored if the number of seconds is not +positive. + ## Flags affecting GHC's behaviour ### `--[no-]executable-profiling` flag diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index a521c22529..594b32cfc8 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -217,7 +217,8 @@ build: # The option is ignored if the specified number of seconds is not positive: test-suite-timeout: 0 # Grace period in seconds after test-suite-timeout before force kill. - test-suite-timeout-grace: 1 + # Ignored if not positive, or if test-suite-timeout is not positive. + test-suite-timeout-grace: 0 bench: false benchmark-opts: From 6cccc1be060dce1049d506d8fde06bb3da860bb5 Mon Sep 17 00:00:00 2001 From: Dan Burton Date: Sat, 4 Apr 2026 15:10:07 -0700 Subject: [PATCH 24/75] updated stan ignore lines --- .stan.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.stan.toml b/.stan.toml index f5108a97ce..066f2ef802 100644 --- a/.stan.toml +++ b/.stan.toml @@ -151,7 +151,7 @@ # Anti-pattern: Data.ByteString.Char8.pack [[ignore]] - id = "OBS-STAN-0203-tuE+RG-250:24" + id = "OBS-STAN-0203-tuE+RG-252:24" # ✦ Description: Usage of 'pack' function that doesn't handle Unicode characters # ✦ Category: #AntiPattern # ✦ File: src\Stack\Build\ExecutePackage.hs @@ -269,7 +269,7 @@ # Anti-pattern: unsafe functions [[ignore]] - id = "OBS-STAN-0212-FNS1cF-80:14" + id = "OBS-STAN-0212-FNS1cF-81:14" # ✦ Description: Usage of unsafe functions breaks referential transparency # ✦ Category: #Unsafe #AntiPattern # ✦ File: src\Stack\BuildOpts.hs @@ -280,7 +280,7 @@ # Anti-pattern: unsafe functions [[ignore]] - id = "OBS-STAN-0212-FNS1cF-91:15" + id = "OBS-STAN-0212-FNS1cF-92:15" # ✦ Description: Usage of unsafe functions breaks referential transparency # ✦ Category: #Unsafe #AntiPattern # ✦ File: src/Stack/BuildOpts.hs From 7ad06ec8efe75cba4a3ad4888a0c364cabfeb0d2 Mon Sep 17 00:00:00 2001 From: Dan Burton Date: Sat, 4 Apr 2026 18:03:03 -0700 Subject: [PATCH 25/75] 6867: prebuild to get better elapsed measurement --- tests/integration/tests/6867-timeout-grace/Main.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/tests/6867-timeout-grace/Main.hs b/tests/integration/tests/6867-timeout-grace/Main.hs index e3f58e6e09..c81128476a 100644 --- a/tests/integration/tests/6867-timeout-grace/Main.hs +++ b/tests/integration/tests/6867-timeout-grace/Main.hs @@ -7,6 +7,8 @@ import Control.Monad (unless) main :: IO () main = do + stack ["test", "--no-run-tests"] -- pre-build to avoid counting build time in the test + start <- getCurrentTime errRef <- newIORef "" stackErrStderr @@ -22,6 +24,8 @@ main = do elapsedSecs :: Double elapsedSecs = realToFrac (diffUTCTime end start) + logInfo $ "Elapsed time: " ++ show elapsedSecs ++ "s" + unless ("timed out" `isInfixOf` errLower) $ error "Expected test-suite timeout message in stderr output." From d67585934f769b92cd924b6e0d7d67917c8784f0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 5 Apr 2026 21:31:58 +0100 Subject: [PATCH 26/75] Re #6867 Extend, and conform, test suite timeout docs --- ChangeLog.md | 8 ++++---- doc/commands/bench_command.md | 14 +++++++------- doc/commands/build_command.md | 28 ++++++++++++++++++---------- doc/commands/haddock_command.md | 4 ++-- doc/commands/install_command.md | 4 ++-- doc/commands/test_command.md | 14 +++++++------- doc/configure/yaml/non-project.md | 3 +-- src/Stack/Options/TestParser.hs | 7 +++++-- 8 files changed, 46 insertions(+), 36 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 2784db0590..a749288d7a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -23,10 +23,10 @@ Other enhancements: * Add option `--reach ` to Stack's `dot` and `ls dependencies` commands, to prune packages that cannot reach any of the specified packages in the dependency graph. -* Add option `--test-suite-timeout-grace ARG` (and corresponding non-project - configuration key `test-suite-timeout-grace`) to pair with - `--test-suite-timeout ARG` and perform staged timeout termination for test - suites. +* Add option `--test-suite-timeout-grace=SECONDS` to Stack's `build` command to + request termination of a timed-out test suite process and, after the specified + grace period, force termination. Used together with the existing + `--test-suite-timeout=SECONDS` option. Bug fixes: diff --git a/doc/commands/bench_command.md b/doc/commands/bench_command.md index 0498b7e70d..e4b014b39e 100644 --- a/doc/commands/bench_command.md +++ b/doc/commands/bench_command.md @@ -16,13 +16,13 @@ stack bench [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]copy-bins] [--[no-]copy-compiler-tool] [--[no-]prefetch] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] - [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] - [--test-suite-timeout-grace ARG] - [--[no-]tests-allow-stdin] [--[no-]bench] - [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] - [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | - --[no-]cabal-verbose] [--[no-]split-objs] [--skip ARG] - [--[no-]interleaved-output] [--ddump-dir ARG] + [--coverage] [--[no-]run-tests] [--test-suite-timeout SECONDS] + [--test-suite-timeout-grace SECONDS] [--[no-]tests-allow-stdin] + [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] + [--[no-]run-benchmarks] [--[no-]reconfigure] + [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] + [--[no-]split-objs] [--skip ARG] [--[no-]interleaved-output] + [--ddump-dir ARG] ~~~ `stack bench` is a synonym for `stack build --bench`. For further information, diff --git a/doc/commands/build_command.md b/doc/commands/build_command.md index 70b0730952..57df5563b1 100644 --- a/doc/commands/build_command.md +++ b/doc/commands/build_command.md @@ -17,13 +17,13 @@ stack build [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]copy-bins] [--[no-]copy-compiler-tool] [--[no-]prefetch] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] - [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] - [--test-suite-timeout-grace ARG] - [--[no-]tests-allow-stdin] [--[no-]bench] - [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] - [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | - --[no-]cabal-verbose] [--[no-]split-objs] [--skip ARG] - [--[no-]interleaved-output] [--ddump-dir ARG] + [--coverage] [--[no-]run-tests] [--test-suite-timeout SECONDS] + [--test-suite-timeout-grace SECONDS] [--[no-]tests-allow-stdin] + [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] + [--[no-]run-benchmarks] [--[no-]reconfigure] + [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] + [--[no-]split-objs] [--skip ARG] [--[no-]interleaved-output] + [--ddump-dir ARG] ~~~ `stack build` and its synonyms (`stack test`, `stack bench`, `stack haddock` and @@ -827,14 +827,22 @@ suite in a timeout so that the test suite fails if no result is available within the specified number of seconds. The option is ignored if the number of seconds is not positive. +!!! note + + The `--test-suite-timeout` option, in isolation, is not guaranteed to + terminate a timed-out test suite process. In that regard, see the + [`--test-suite-timeout-grace`](#-test-suite-timeout-option). + ### `--test-suite-timeout-grace` option Default: None `stack build --test --test-suite-timeout= --test-suite-timeout-grace=` -uses staged timeout termination for each running test suite: after -`--test-suite-timeout` is reached, Stack waits the specified grace period before -force termination. The option is ignored if the number of seconds is not +uses staged timeout termination for each running test suite: if +[`--test-suite-timeout`](#-test-suite-timeout-option) causes the test suite to +fail, Stack requests the termination of the test suite process and waits the +specified number of seconds as a grace period before termination of the +process is forced. The option is ignored if the number of seconds is not positive. ## Flags affecting GHC's behaviour diff --git a/doc/commands/haddock_command.md b/doc/commands/haddock_command.md index 362eed0af1..519fa5a933 100644 --- a/doc/commands/haddock_command.md +++ b/doc/commands/haddock_command.md @@ -17,8 +17,8 @@ stack haddock [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] - [--test-suite-timeout ARG] [--test-suite-timeout-grace ARG] - [--[no-]tests-allow-stdin] + [--test-suite-timeout SECONDS] + [--test-suite-timeout-grace SECONDS] [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] diff --git a/doc/commands/install_command.md b/doc/commands/install_command.md index f579bcc4a3..6e73f574ae 100644 --- a/doc/commands/install_command.md +++ b/doc/commands/install_command.md @@ -17,8 +17,8 @@ stack install [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] [--coverage] [--[no-]run-tests] - [--test-suite-timeout ARG] [--test-suite-timeout-grace ARG] - [--[no-]tests-allow-stdin] + [--test-suite-timeout SECONDS] + [--test-suite-timeout-grace SECONDS] [--[no-]tests-allow-stdin] [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] diff --git a/doc/commands/test_command.md b/doc/commands/test_command.md index bd740116f7..12f37f5544 100644 --- a/doc/commands/test_command.md +++ b/doc/commands/test_command.md @@ -16,13 +16,13 @@ stack test [TARGET] [--dry-run] [--pedantic] [--fast] [--ghc-options OPTIONS] [--[no-]copy-bins] [--[no-]copy-compiler-tool] [--[no-]prefetch] [--[no-]keep-going] [--[no-]keep-tmp-files] [--[no-]force-dirty] [--[no-]test] [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS] - [--coverage] [--[no-]run-tests] [--test-suite-timeout ARG] - [--test-suite-timeout-grace ARG] - [--[no-]tests-allow-stdin] [--[no-]bench] - [--ba|--benchmark-arguments BENCH_ARGS] [--[no-]run-benchmarks] - [--[no-]reconfigure] [--cabal-verbosity VERBOSITY | - --[no-]cabal-verbose] [--[no-]split-objs] [--skip ARG] - [--[no-]interleaved-output] [--ddump-dir ARG] + [--coverage] [--[no-]run-tests] [--test-suite-timeout SECONDS] + [--test-suite-timeout-grace SECONDS] [--[no-]tests-allow-stdin] + [--[no-]bench] [--ba|--benchmark-arguments BENCH_ARGS] + [--[no-]run-benchmarks] [--[no-]reconfigure] + [--cabal-verbosity VERBOSITY | --[no-]cabal-verbose] + [--[no-]split-objs] [--skip ARG] [--[no-]interleaved-output] + [--ddump-dir ARG] ~~~ `stack test` is a synonym for `stack build --test`. For further information, diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index 594b32cfc8..ac04b082d3 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -216,8 +216,7 @@ build: no-run-tests: false # The option is ignored if the specified number of seconds is not positive: test-suite-timeout: 0 - # Grace period in seconds after test-suite-timeout before force kill. - # Ignored if not positive, or if test-suite-timeout is not positive. + # The option is ignored if the specified number of seconds is not positive: test-suite-timeout-grace: 0 bench: false benchmark-opts: diff --git a/src/Stack/Options/TestParser.hs b/src/Stack/Options/TestParser.hs index d6171ddc50..4571d55c6c 100644 --- a/src/Stack/Options/TestParser.hs +++ b/src/Stack/Options/TestParser.hs @@ -44,12 +44,15 @@ testOptsParser hide0 = TestOptsMonoid hide <*> optionalFirst (option (fmap Just auto) ( long "test-suite-timeout" - <> help "Maximum test suite run time in seconds." + <> metavar "SECONDS" + <> help "For each test suite, maximum run time before it fails." <> hide )) <*> optionalFirst (option (fmap Just auto) ( long "test-suite-timeout-grace" - <> help "Grace period in seconds after timeout before force termination." + <> metavar "SECONDS" + <> help "Request termination of timed-out test suite process. Grace \ + \period after timeout before termination is forced." <> hide )) <*> firstBoolFlagsTrue From 6964d711029b8c3c74d78bf50b2b290ff16f31df Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 11 Apr 2026 22:17:43 +0100 Subject: [PATCH 27/75] Fix #6872 Better output for TestSuiteExeMissing --- src/Stack/Build/ExecutePackage.hs | 2 +- src/Stack/Types/Build/Exception.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stack/Build/ExecutePackage.hs b/src/Stack/Build/ExecutePackage.hs index 04804ebd86..9ef4fc1a8a 100644 --- a/src/Stack/Build/ExecutePackage.hs +++ b/src/Stack/Build/ExecutePackage.hs @@ -1255,7 +1255,7 @@ singleTest topts testsToRun ac ee task installedMap = do else do unless expectFailure $ logError $ - displayShow $ TestSuiteExeMissing + fromString $ displayException $ TestSuiteExeMissing (package.buildType == C.Simple) exeName (packageNameString package.name) diff --git a/src/Stack/Types/Build/Exception.hs b/src/Stack/Types/Build/Exception.hs index e5f375aecf..77ef8d012b 100644 --- a/src/Stack/Types/Build/Exception.hs +++ b/src/Stack/Types/Build/Exception.hs @@ -183,7 +183,7 @@ instance Exception BuildException where isSimpleBuildType $ concat [ "Test suite executable \"" , exeName - , " not found for " + , "\" not found for " , pkgName' , ":test:" , testName From 29fb8dd99808b724552780495898bc6d890c07c5 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Mon, 13 Apr 2026 09:23:35 +0300 Subject: [PATCH 28/75] Use dedicated JSON endpoint for snapshots Closes https://github.com/commercialhaskell/stack/issues/6871 For context on the changing API, see: * https://github.com/commercialhaskell/stackage-server/issues/355 (initial change) * https://github.com/commercialhaskell/stackage-server/issues/365 (bugfix for breaking Stack) --- src/Stack/Ls.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stack/Ls.hs b/src/Stack/Ls.hs index de8f3c03e9..c3e872d65b 100644 --- a/src/Stack/Ls.hs +++ b/src/Stack/Ls.hs @@ -223,7 +223,7 @@ handleRemote lsOpts = do LsStyles _ -> pure () LsTools _ -> pure () where - urlInfo = "https://www.stackage.org/snapshots" + urlInfo = "https://www.stackage.org/api/v1/snapshots" -- | Function underlying the @stack ls@ command. lsCmd :: LsCmdOpts -> RIO Runner () From b0c7ee55078fc07e59fba4192f2ca4da6352c682 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 13 Apr 2026 22:49:34 +0100 Subject: [PATCH 29/75] Re #6871 Add recent-snapshots configuration option --- ChangeLog.md | 6 ++++ doc/configure/yaml/non-project.md | 15 +++++++-- doc/maintainers/stack_errors.md | 1 + src/Stack/Config.hs | 4 +++ src/Stack/Ls.hs | 30 ++++++++++------- src/Stack/Types/Config.hs | 7 ++++ src/Stack/Types/ConfigMonoid.hs | 54 +++++++++++++++++++++++++------ 7 files changed, 95 insertions(+), 22 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index a749288d7a..0b212a6dbc 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,6 +12,9 @@ Behavior changes: * Stack's default Nix integration now includes the `cacert` Nix package, in order to support Stack's use of `crypton-x509-system >= 1.6.8`. +* Following a change to the Stackage project's server API, the default value of + the `urls` key includes + `recent-snapshots: https://stackage.org/api/v1/snapshots`. Other enhancements: @@ -27,6 +30,9 @@ Other enhancements: request termination of a timed-out test suite process and, after the specified grace period, force termination. Used together with the existing `--test-suite-timeout=SECONDS` option. +* In YAML configuration files, the `recent-snapshots` key is introduced (under + the `urls` key), to specify the URL used by Stack's `ls snapshots remote` + command. Bug fixes: diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index ac04b082d3..a2b441956e 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -1586,18 +1586,29 @@ Default: ~~~yaml urls: latest-snapshot: https://stackage-haddock.haskell.org/snapshots.json + recent-snapshots: https://www.stackage.org/api/v1/snapshots ~~~ -Customize the URLs where Stack looks for snapshot build plans. +Customize the URLs where Stack looks for information about available snapshots, +either +([:octicons-tag-24: 1.1.0](https://github.com/commercialhaskell/stack/releases/tag/v1.1.0)) +the latest LTS and Nightly snapshots (`latest-snapshots`) or +(:octicons-tag-24: UNRELEASED) recently-published snapshots (`recent-snapshots`). !!! note - The default for Stack 1.3.0 to 2.15.3 was + The default for `latest-snapshots` for Stack 1.3.0 to 2.15.3 was https://s3.amazonaws.com/haddock.stackage.org/snapshots.json. Following the handover of the Stackage project to the Haskell Foundation in early 2024, the file at that URL may not be up to date. Users of those versions of Stack should configure the URL to be the default above. +!!! note + + The default for `recent-snapshots` for Stack 1.7.1 to 3.9.3 was + https://www.stackage.org/snapshots. The Stackage server API may cease to use + that end point in the future. + ## with-gcc Command line equivalent (takes precedence): `--with-gcc` option diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index 3f6b93190f..6fff751aee 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -194,6 +194,7 @@ to take stock of the errors that Stack itself can raise, by reference to the ~~~haskell [S-3421] = ParseFailure [Value] + [S-9131] | ParseRecentSnapshotsUrlFailed HttpException ~~~ - `Stack.New.NewPrettyException` diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 0def9f8ca2..3da44541d7 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -282,6 +282,9 @@ configFromConfigMonoid latestSnapshot = fromFirst "https://stackage-haddock.haskell.org/snapshots.json" configMonoid.latestSnapshot + recentSnapshots = fromFirst + "https://www.stackage.org/api/v1/snapshots" + configMonoid.recentSnapshots clConnectionCount = fromFirst 8 configMonoid.connectionCount hideTHLoading = fromFirstTrue configMonoid.hideTHLoading prefixTimestamps = fromFirst False configMonoid.prefixTimestamps @@ -596,6 +599,7 @@ configFromConfigMonoid , ghcVariant , ghcBuild , latestSnapshot + , recentSnapshots , systemGHC , installGHC , installMsys diff --git a/src/Stack/Ls.hs b/src/Stack/Ls.hs index c3e872d65b..f8c060f341 100644 --- a/src/Stack/Ls.hs +++ b/src/Stack/Ls.hs @@ -31,8 +31,8 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Vector as V import Network.HTTP.StackClient - ( addRequestHeader, hAccept, httpJSON, getResponseBody - , parseRequest + ( HttpException (..), addRequestHeader, getResponseBody + , hAccept, httpJSON, parseUrlThrow ) import Path ( parent ) import RIO.List ( sort ) @@ -48,7 +48,8 @@ import Stack.Setup.Installed import Stack.SourceMap ( globalsFromHints ) import Stack.Types.BuildConfig ( BuildConfig (..), HasBuildConfig (..) ) -import Stack.Types.Config ( Config (..), HasConfig (..) ) +import Stack.Types.Config + ( Config (..), HasConfig (..), askRecentSnapshotsUrl ) import Stack.Types.DependencyTree ( DependencyGraph, DependencyTree (..), DotPayload (..) , licenseText, versionText @@ -63,7 +64,7 @@ import Stack.Types.LsOpts , ListStylesOpts (..), ListToolsOpts (..), LsView (..) , SnapshotOpts (..) ) -import Stack.Types.Runner ( HasRunner, Runner, terminalL ) +import Stack.Types.Runner ( Runner, terminalL ) import Stack.Types.SourceMap ( SMWanted (..) ) import System.Console.ANSI.Codes ( SGR (Reset), setSGRCode, sgrToCode ) @@ -73,8 +74,9 @@ import System.IO ( putStrLn ) -- | Type representing exceptions thrown by functions exported by the "Stack.Ls" -- module. -newtype LsException - = ParseFailure [Value] +data LsException + = ParseFailure ![Value] + | ParseRecentSnapshotsUrlFailed !HttpException deriving Show instance Exception LsException where @@ -82,6 +84,11 @@ instance Exception LsException where "Error: [S-3421]\n" ++ "Failure to parse values as a snapshot: " ++ show val + displayException (ParseRecentSnapshotsUrlFailed e) = + "Error: [S-9131]\n" + ++ "While trying to parse the recent snapshots URL, Stack encountered the \ + \following error:\n" + ++ displayException e -- | Type representing Stackage snapshot types. data SnapshotType @@ -199,9 +206,12 @@ handleLocal lsOpts = do LsStyles _ -> pure () LsTools _ -> pure () -handleRemote :: HasRunner env => LsCmdOpts -> RIO env () +handleRemote :: HasConfig env => LsCmdOpts -> RIO env () handleRemote lsOpts = do - req <- liftIO $ parseRequest urlInfo + urlInfoText <- askRecentSnapshotsUrl + req <- catch + (parseUrlThrow $ T.unpack urlInfoText) + (throwM . ParseRecentSnapshotsUrlFailed) isStdoutTerminal <- view terminalL let req' = addRequestHeader hAccept "application/json" req result <- httpJSON req' @@ -222,8 +232,6 @@ handleRemote lsOpts = do LsDependencies _ -> pure () LsStyles _ -> pure () LsTools _ -> pure () - where - urlInfo = "https://www.stackage.org/api/v1/snapshots" -- | Function underlying the @stack ls@ command. lsCmd :: LsCmdOpts -> RIO Runner () @@ -232,7 +240,7 @@ lsCmd lsOpts = LsSnapshot sopt -> case sopt.viewType of Local -> handleLocal lsOpts - Remote -> handleRemote lsOpts + Remote -> withConfig NoReexec $ handleRemote lsOpts LsGlobals globalsOpts -> withConfig NoReexec $ listGlobalsCmd globalsOpts LsDependencies depOpts -> listDependencies depOpts LsStyles stylesOpts -> withConfig NoReexec $ listStylesCmd stylesOpts diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index a61112314f..0beb310792 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -18,6 +18,7 @@ module Stack.Types.Config Config (..) , HasConfig (..) , askLatestSnapshotUrl + , askRecentSnapshotsUrl , configProjectRoot , ghcInstallHook -- * Lens helpers @@ -95,6 +96,8 @@ data Config = Config -- tinfo6) , latestSnapshot :: !Text -- ^ URL of a JSON file providing the latest LTS and Nightly snapshots. + , recentSnapshots :: !Text + -- ^ URL of a JSON file providing recently-published snapshots. , systemGHC :: !Bool -- ^ Should we use the system-installed GHC (on the PATH) if -- available? Can be overridden by command line options. @@ -240,6 +243,10 @@ configProjectRoot c = askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text askLatestSnapshotUrl = view $ configL . to (.latestSnapshot) +-- | Get the URL to request the information on the recently-published snapshots +askRecentSnapshotsUrl :: (MonadReader env m, HasConfig env) => m Text +askRecentSnapshotsUrl = view $ configL . to (.recentSnapshots) + -- | @STACK_ROOT\/hooks\/@ hooksDir :: HasConfig env => RIO env (Path Abs Dir) hooksDir = do diff --git a/src/Stack/Types/ConfigMonoid.hs b/src/Stack/Types/ConfigMonoid.hs index b66f1d673e..beffb65ba8 100644 --- a/src/Stack/Types/ConfigMonoid.hs +++ b/src/Stack/Types/ConfigMonoid.hs @@ -21,7 +21,7 @@ module Stack.Types.ConfigMonoid , configMonoidSystemGHCName ) where -import Data.Aeson.Types ( Object, Value ) +import Data.Aeson.Types ( FromJSON (..), Object, Value ) import Data.Aeson.WarningParser ( WarningParser, WithJSONWarnings, (..:?), (..!=) , jsonSubWarnings, jsonSubWarningsT, withObjectWarnings @@ -84,6 +84,8 @@ data ConfigMonoid = ConfigMonoid -- ^ See: 'Stack.Types.Config.prefixTimestamps' , latestSnapshot :: !(First Text) -- ^ See: 'Stack.Types.Config.latestSnapshot' + , recentSnapshots :: !(First Text) + -- ^ See: 'Stack.Types.Config.recentSnapshots' , packageIndex :: !(First PackageIndexConfig) -- ^ See: 'withPantryConfig' , systemGHC :: !(First Bool) @@ -228,6 +230,43 @@ instance Monoid ConfigMonoid where mempty = memptydefault mappend = (<>) +-- | An uninterpreted representation of URLs options. Configurations may be +-- "cascaded" using mappend (left-biased). +data UrlsOptsMonoid = UrlsOptsMonoid + { latestSnapshot :: !(First Text) + -- ^ See: 'Stack.Types.Config.latestSnapshot' + , recentSnapshots :: !(First Text) + -- ^ See: 'Stack.Types.Config.recentSnapshots' + } + deriving Generic + +-- | Decode uninterpreted URLs options from JSON/YAML. +instance FromJSON (WithJSONWarnings UrlsOptsMonoid) where + parseJSON = withObjectWarnings "UrlsOptsMonoid" $ \o -> do + latestSnapshot <- First <$> o ..:? latestSnapshotArgName + recentSnapshots <- First <$> o ..:? recentSnapshotsArgName + pure UrlsOptsMonoid + { latestSnapshot + , recentSnapshots + } + +-- | Left-biased combine URLs options +instance Semigroup UrlsOptsMonoid where + (<>) = mappenddefault + +-- | Left-biased combine URLs options +instance Monoid UrlsOptsMonoid where + mempty = memptydefault + mappend = (<>) + +-- | URLs latest snapshots argument name. +latestSnapshotArgName :: Text +latestSnapshotArgName = "latest-snapshot" + +-- | URLs recent snapshots argument name. +recentSnapshotsArgName :: Text +recentSnapshotsArgName = "recent-snapshots" + parseConfigMonoid :: Path Abs Dir -> Value @@ -249,14 +288,10 @@ parseConfigMonoidObject rootDir obj = do connectionCount <- First <$> obj ..:? configMonoidConnectionCountName hideTHLoading <- FirstTrue <$> obj ..:? configMonoidHideTHLoadingName prefixTimestamps <- First <$> obj ..:? configMonoidPrefixTimestampsName - - latestSnapshot <- obj ..:? configMonoidUrlsName >>= \case - Nothing -> pure $ First Nothing - Just urls -> jsonSubWarnings $ lift $ withObjectWarnings - "urls" - (\o -> First <$> o ..:? "latest-snapshot" :: WarningParser (First Text)) - (urls :: Value) - + urlsOpts :: UrlsOptsMonoid <- + jsonSubWarnings (obj ..:? configMonoidUrlsName ..!= mempty) + let latestSnapshot = urlsOpts.latestSnapshot + recentSnapshots = urlsOpts.recentSnapshots packageIndex <- First <$> jsonSubWarningsT (obj ..:? configMonoidPackageIndexName) systemGHC <- First <$> obj ..:? configMonoidSystemGHCName @@ -380,6 +415,7 @@ parseConfigMonoidObject rootDir obj = do , hideTHLoading , prefixTimestamps , latestSnapshot + , recentSnapshots , packageIndex , systemGHC , installGHC From 894fc8701f502a260ca31b0e9c48c2c9f437358d Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 18 Apr 2026 00:27:47 +0100 Subject: [PATCH 30/75] Re #6871 Prettier Stack.Ls errors --- doc/maintainers/stack_errors.md | 2 +- src/Stack/Ls.hs | 45 ++++++++++++------- src/Stack/Prelude.hs | 5 ++- stack-ghc-9.12.3.yaml | 25 ----------- stack-ghc-9.12.3.yaml.lock | 26 ----------- stack-ghc-9.12.4.yaml | 34 ++++++++++++++ stack-ghc-9.12.4.yaml.lock | 68 ++++++++++++++++++++++++++++ stack-ghc-9.14.1.yaml | 23 +++++++++- stack-ghc-9.14.1.yaml.lock | 80 ++++++++++++++++++++++++++++++--- stack.yaml | 4 +- stack.yaml.lock | 13 ++++-- 11 files changed, 244 insertions(+), 81 deletions(-) delete mode 100644 stack-ghc-9.12.3.yaml delete mode 100644 stack-ghc-9.12.3.yaml.lock create mode 100644 stack-ghc-9.12.4.yaml create mode 100644 stack-ghc-9.12.4.yaml.lock diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index 6fff751aee..4c5ecbbb6f 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -190,7 +190,7 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-1353] = WritingLockFileError (Path Abs File) Locked ~~~ - - `Stack.Ls.LsException` * + - `Stack.Ls.LsPrettyException` ~~~haskell [S-3421] = ParseFailure [Value] diff --git a/src/Stack/Ls.hs b/src/Stack/Ls.hs index f8c060f341..1e978441ad 100644 --- a/src/Stack/Ls.hs +++ b/src/Stack/Ls.hs @@ -72,23 +72,34 @@ import System.Process.Pager ( pageText ) import System.Directory ( listDirectory ) import System.IO ( putStrLn ) --- | Type representing exceptions thrown by functions exported by the "Stack.Ls" --- module. -data LsException +-- | Type representing \'pretty\' exceptions thrown by functions exported by the +-- "Stack.Ls" module. +data LsPrettyException = ParseFailure ![Value] | ParseRecentSnapshotsUrlFailed !HttpException - deriving Show - -instance Exception LsException where - displayException (ParseFailure val) = - "Error: [S-3421]\n" - ++ "Failure to parse values as a snapshot: " - ++ show val - displayException (ParseRecentSnapshotsUrlFailed e) = - "Error: [S-9131]\n" - ++ "While trying to parse the recent snapshots URL, Stack encountered the \ - \following error:\n" - ++ displayException e + +deriving instance Show LsPrettyException + +instance Pretty LsPrettyException where + pretty (ParseFailure val) = + "[S-3421]" + <> line + <> fillSep + [ flow "Failure to parse values as a snapshot:" + , string (show val) + ] + pretty (ParseRecentSnapshotsUrlFailed err) = + "[S-9131]" + <> line + <> fillSep + [ flow "While trying to parse the" + , style Shell "recent-snapshots" + , flow "URL, Stack encountered the following error:" + ] + <> blankLine + <> fromString (displayException err) + +instance Exception LsPrettyException -- | Type representing Stackage snapshot types. data SnapshotType @@ -127,7 +138,7 @@ toSnapshot [String snapId, String title, String time] = , title , time } -toSnapshot val = impureThrow $ ParseFailure val +toSnapshot val = prettyImpureThrow $ ParseFailure val parseSnapshot :: Value -> A.Parser Snapshot parseSnapshot = A.withArray "array of snapshot" (pure . toSnapshot . V.toList) @@ -211,7 +222,7 @@ handleRemote lsOpts = do urlInfoText <- askRecentSnapshotsUrl req <- catch (parseUrlThrow $ T.unpack urlInfoText) - (throwM . ParseRecentSnapshotsUrlFailed) + (prettyThrowM . ParseRecentSnapshotsUrlFailed) isStdoutTerminal <- view terminalL let req' = addRequestHeader hAccept "application/json" req result <- httpJSON req' diff --git a/src/Stack/Prelude.hs b/src/Stack/Prelude.hs index b0976e669d..e7c5856b26 100644 --- a/src/Stack/Prelude.hs +++ b/src/Stack/Prelude.hs @@ -38,6 +38,7 @@ module Stack.Prelude , ppException , prettyThrowIO , prettyThrowM + , prettyImpureThrow , mcons , MungedPackageId (..) , MungedPackageName (..) @@ -133,8 +134,8 @@ import RIO.PrettyPrint ) import RIO.PrettyPrint.DefaultStyles (defaultStyles) import RIO.PrettyPrint.PrettyException - ( PrettyException (..), ppException, prettyThrowIO - , prettyThrowM + ( PrettyException (..), ppException, prettyImpureThrow + , prettyThrowIO, prettyThrowM ) import RIO.PrettyPrint.StylesUpdate ( StylesUpdate (..), parseStylesUpdateFromString ) diff --git a/stack-ghc-9.12.3.yaml b/stack-ghc-9.12.3.yaml deleted file mode 100644 index a07c6c760f..0000000000 --- a/stack-ghc-9.12.3.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# This is an experimental project-level configuration, to see if Stack can be -# built with GHC 9.12.3. -# -# GHC 9.12.3 is, however, not recommended for use, due to: -# https://gitlab.haskell.org/ghc/ghc/-/issues/26711 -snapshot: nightly-2026-01-04 # GHC 9.12.3 - -extra-deps: -# nightly-2026-01-04 specifies Cabal-3.14.2.0 -- Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 -- Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 - -docker: - enable: false - repo: quay.io/benz0li/ghc-musl:9.12.3 - -nix: - # --nix on the command-line to enable. - packages: - - zlib - - unzip - -flags: - stack: - developer-mode: true diff --git a/stack-ghc-9.12.3.yaml.lock b/stack-ghc-9.12.3.yaml.lock deleted file mode 100644 index b51132c024..0000000000 --- a/stack-ghc-9.12.3.yaml.lock +++ /dev/null @@ -1,26 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/topics/lock_files - -packages: -- completed: - hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 - pantry-tree: - sha256: ddc689c4070a034cacd73c39c1df2673ed16e0b38b5ca476fc6ef2aa87b6f40f - size: 12139 - original: - hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 -- completed: - hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 - pantry-tree: - sha256: 4de976261238dd4045dd3addebf6a006d4aff3873ee680bac7af83dcbf068280 - size: 11238 - original: - hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 -snapshots: -- completed: - sha256: b55db959b8fa7b6e87f83cfca88db0d54126158fbf8501a658c4642ba229b27c - size: 716307 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2026/1/4.yaml - original: nightly-2026-01-04 diff --git a/stack-ghc-9.12.4.yaml b/stack-ghc-9.12.4.yaml new file mode 100644 index 0000000000..d7d09b8c8c --- /dev/null +++ b/stack-ghc-9.12.4.yaml @@ -0,0 +1,34 @@ +# This is an experimental project-level configuration, to see if Stack can be +# built with GHC 9.12.4. +snapshot: nightly-2026-04-17 # GHC 9.12.4 + +extra-deps: +# nightly-2026-04-17 specifies Cabal-3.14.2.0 +- Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 +- Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +# nightly-2026-04-17 specifies crypton-x509-1.7.7 +- crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +# nightly-2026-04-17 specifies crypton-x509-store-1.6.14 +- crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +# nightly-2026-04-17 specifies crypton-x509-system-1.6.8 +- crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 +# nightly-2026-04-17 specifies crypton-x509-validation-1.6.14 +- crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +# nightly-2026-04-17 specifies rio-prettyprint-0.1.8.0 +- rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 +# nightly-2026-04-17 specifies tls-2.1.14 +- tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 + +docker: + enable: false + repo: quay.io/benz0li/ghc-musl:9.12.4 + +nix: + # --nix on the command-line to enable. + packages: + - zlib + - unzip + +flags: + stack: + developer-mode: true diff --git a/stack-ghc-9.12.4.yaml.lock b/stack-ghc-9.12.4.yaml.lock new file mode 100644 index 0000000000..66dd35ed61 --- /dev/null +++ b/stack-ghc-9.12.4.yaml.lock @@ -0,0 +1,68 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: +- completed: + hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 + pantry-tree: + sha256: ddc689c4070a034cacd73c39c1df2673ed16e0b38b5ca476fc6ef2aa87b6f40f + size: 12139 + original: + hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 +- completed: + hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 + pantry-tree: + sha256: 4de976261238dd4045dd3addebf6a006d4aff3873ee680bac7af83dcbf068280 + size: 11238 + original: + hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +- completed: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 + pantry-tree: + sha256: 882a699e305fffcb77dd40bd40f959f062a8997a53560dca64462087aed3e4cd + size: 1132 + original: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +- completed: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 + pantry-tree: + sha256: 2c7e00e593d399624264172cbd5e2fa55feaf8239cf33bee7e33bbc7509d0a2e + size: 458 + original: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +- completed: + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 + pantry-tree: + sha256: 9ac33c993a82ac4da84804028c5398caec7aada7a83beeec3f28883fe470d68f + size: 512 + original: + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 +- completed: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 + pantry-tree: + sha256: 64baf1be6e65ade9ad8eaef819c9cc4c0fcb7d3b968641dcf28a3f859fe87dc5 + size: 691 + original: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +- completed: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 + pantry-tree: + sha256: c840f1193718b7af6c004fc62a67919e223b56cc1658a168c8e490e53a632aa0 + size: 779 + original: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 +- completed: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 + pantry-tree: + sha256: 6ddac1e644efe75dbf62bbd35fa38897caca307d62bac538ae29b0c54bf6ff00 + size: 7056 + original: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 +snapshots: +- completed: + sha256: f4d90db84aefb7c9590dd224ebdabfd8304f81bbad4652a715ee8350c4b9d396 + size: 738802 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2026/4/17.yaml + original: nightly-2026-04-17 diff --git a/stack-ghc-9.14.1.yaml b/stack-ghc-9.14.1.yaml index aaeb09c513..78ab438005 100644 --- a/stack-ghc-9.14.1.yaml +++ b/stack-ghc-9.14.1.yaml @@ -1,8 +1,29 @@ # This is an experimental project-level configuration, to see if Stack can be # built with GHC 9.14.1. -snapshot: nightly-2025-12-20 # GHC 9.12.2 +snapshot: nightly-2026-04-17 # GHC 9.12.4 compiler: ghc-9.14.1 +extra-deps: +# nightly-2026-04-17 specifies Cabal-3.14.2.0 +- Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 +- Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +# nightly-2026-04-17 specifies crypton-x509-1.7.7 +- crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +# nightly-2026-04-17 specifies crypton-x509-store-1.6.14 +- crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +# nightly-2026-04-17 specifies crypton-x509-system-1.6.8 +- crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 +# nightly-2026-04-17 specifies crypton-x509-validation-1.6.14 +- crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +# nightly-2026-04-17 specifies http-api-data-0.6.7 +- http-api-data-0.7@sha256:b8145755fced98db1ac67f4f98c8010cd5f82c121a82b65addea2556b5fbd6d5,3157 +# nightly-2026-04-17 specifies rio-prettyprint-0.1.8.0 +- rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 +# nightly-2026-04-17 specifies tagged-0.8.9 +- tagged-0.8.10@sha256:e9b97c98e9827981d62f37c5febf9e6bbb67acec92b8bd41fd9f7ace5eb31d32,2201 +# nightly-2026-04-17 specifies tls-2.1.14 +- tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 + docker: enable: false repo: quay.io/benz0li/ghc-musl:9.14.1 diff --git a/stack-ghc-9.14.1.yaml.lock b/stack-ghc-9.14.1.yaml.lock index 683fe18dcf..64940d1e68 100644 --- a/stack-ghc-9.14.1.yaml.lock +++ b/stack-ghc-9.14.1.yaml.lock @@ -3,10 +3,80 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/topics/lock_files -packages: [] +packages: +- completed: + hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 + pantry-tree: + sha256: ddc689c4070a034cacd73c39c1df2673ed16e0b38b5ca476fc6ef2aa87b6f40f + size: 12139 + original: + hackage: Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 +- completed: + hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 + pantry-tree: + sha256: 4de976261238dd4045dd3addebf6a006d4aff3873ee680bac7af83dcbf068280 + size: 11238 + original: + hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 +- completed: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 + pantry-tree: + sha256: 882a699e305fffcb77dd40bd40f959f062a8997a53560dca64462087aed3e4cd + size: 1132 + original: + hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 +- completed: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 + pantry-tree: + sha256: 2c7e00e593d399624264172cbd5e2fa55feaf8239cf33bee7e33bbc7509d0a2e + size: 458 + original: + hackage: crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 +- completed: + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 + pantry-tree: + sha256: 9ac33c993a82ac4da84804028c5398caec7aada7a83beeec3f28883fe470d68f + size: 512 + original: + hackage: crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 +- completed: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 + pantry-tree: + sha256: 64baf1be6e65ade9ad8eaef819c9cc4c0fcb7d3b968641dcf28a3f859fe87dc5 + size: 691 + original: + hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +- completed: + hackage: http-api-data-0.7@sha256:b8145755fced98db1ac67f4f98c8010cd5f82c121a82b65addea2556b5fbd6d5,3157 + pantry-tree: + sha256: 4e67cbe25b355b6af68aee79c36b0f3c78428dbdd1be4298f4afaf000f3bc9a9 + size: 819 + original: + hackage: http-api-data-0.7 +- completed: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 + pantry-tree: + sha256: c840f1193718b7af6c004fc62a67919e223b56cc1658a168c8e490e53a632aa0 + size: 779 + original: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 +- completed: + hackage: tagged-0.8.10@sha256:e9b97c98e9827981d62f37c5febf9e6bbb67acec92b8bd41fd9f7ace5eb31d32,2201 + pantry-tree: + sha256: 5ba1ff7ad9a676b89a2a6ab00ac2100f30a21440ef8e04094614ab5b5f494b3f + size: 438 + original: + hackage: tagged-0.8.10 +- completed: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 + pantry-tree: + sha256: 6ddac1e644efe75dbf62bbd35fa38897caca307d62bac538ae29b0c54bf6ff00 + size: 7056 + original: + hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 snapshots: - completed: - sha256: 8dd2b298abf5214ce1cc339f1282b9d424d66c511d433f874c12a92989dc3007 - size: 715169 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/12/20.yaml - original: nightly-2025-12-20 + sha256: f4d90db84aefb7c9590dd224ebdabfd8304f81bbad4652a715ee8350c4b9d396 + size: 738802 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2026/4/17.yaml + original: nightly-2026-04-17 diff --git a/stack.yaml b/stack.yaml index 78aef21612..14204616b7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -21,11 +21,13 @@ extra-deps: # lts-24.24 specifies crypton-x509-validation-1.6.14 - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 # lts-24.24 specifies hpack-0.38.3 -- hpack-0.39.1@sha256:d7378debd96e805760540e3640aeda3a1ebee1d000dac99726ed55c827c81a94,5229 +- hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 # lts-24.24 specifies pantry-0.10.1 - pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 # lts-24.24 specifies persistent-2.17.1.0 - persistent-2.18.0.0@sha256:baa3e0959cf10bbd1da462efeb61d4f073d0cc924a149325494ba5ce29bc17a4,7096 +# lts-24.24 specifies rio-prettyprint-0.1.8.0 +- rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 # lts-24.24 does not include time-hourglass - time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 # lts-24.24 specifies tls-2.1.8 diff --git a/stack.yaml.lock b/stack.yaml.lock index a28e915ece..5816a82a2b 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -82,12 +82,12 @@ packages: original: hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 - completed: - hackage: hpack-0.39.1@sha256:d7378debd96e805760540e3640aeda3a1ebee1d000dac99726ed55c827c81a94,5229 + hackage: hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 pantry-tree: - sha256: 5f7ca06ce0556a87c8a38813bc7caf9725ba6ad6c0c05ab2c3dd002373973b2f + sha256: a6b33bf86bd2d4b453fdb6ba73c3fd5eb77d069a612f546f52baa7f62c321bdf size: 3799 original: - hackage: hpack-0.39.1@sha256:d7378debd96e805760540e3640aeda3a1ebee1d000dac99726ed55c827c81a94,5229 + hackage: hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 - completed: hackage: pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 pantry-tree: @@ -102,6 +102,13 @@ packages: size: 7184 original: hackage: persistent-2.18.0.0@sha256:baa3e0959cf10bbd1da462efeb61d4f073d0cc924a149325494ba5ce29bc17a4,7096 +- completed: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 + pantry-tree: + sha256: c840f1193718b7af6c004fc62a67919e223b56cc1658a168c8e490e53a632aa0 + size: 779 + original: + hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 - completed: hackage: time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 pantry-tree: From e1c863afc7f74ab2cac3ff01d05ea32f5448f836 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 18 Apr 2026 21:25:38 +0100 Subject: [PATCH 31/75] Bump to Stackage LTS 24.37 --- CONTRIBUTING.md | 2 +- ChangeLog.md | 1 + cabal.config | 4 +-- cabal.project | 2 +- doc/commands/list_command.md | 6 ++-- doc/commands/script_command.md | 8 ++--- doc/configure/yaml/non-project.md | 2 +- doc/configure/yaml/project.md | 4 +-- doc/topics/Stack_and_VS_Code.md | 2 +- doc/topics/custom_snapshot.md | 22 +++++++------- doc/topics/haskell_and_c_code.md | 4 +-- doc/topics/scripts.md | 24 +++++++-------- doc/topics/snapshot_location.md | 4 +-- .../stack_yaml_vs_cabal_package_file.md | 4 +-- doc/tutorial/building_your_project.md | 2 +- doc/tutorial/executing_commands.md | 2 +- doc/tutorial/hello_world_example.md | 2 +- doc/tutorial/project_configuration.md | 2 +- etc/scripts/build-stack-installer.hs | 2 +- etc/scripts/release-linux-aarch64.hs | 4 +-- etc/scripts/release.hs | 4 +-- etc/scripts/stack.yaml | 2 +- src/Stack/Init.hs | 4 +-- src/Stack/Options/ConfigSetParser.hs | 4 +-- stack.yaml | 30 ++++++++----------- stack.yaml.lock | 29 +++--------------- tests/integration/lib/StackTest.hs | 2 +- .../files/snapshot-modify-lts.yaml | 2 +- .../files/snapshots/local-snapshot.yaml | 2 +- .../files/snapshots/remote-snapshot.yaml | 2 +- .../1337-unicode-everywhere/files/stack.yaml | 2 +- .../1659-skip-component/files/stack.yaml | 2 +- .../1884-url-to-tarball/files/stack.yaml | 2 +- .../tests/2195-depend-on-exe/files/stack.yaml | 2 +- .../tests/32-unlisted-module/files/stack.yaml | 2 +- .../3315-multi-ghc-options/files/stack.yaml | 2 +- .../335-multi-package-flags/files/stack.yaml | 2 +- .../345-override-bytestring/files/stack.yaml | 2 +- .../files/orig-stack.yaml | 2 +- .../3591-cabal-warnings-once/files/stack.yaml | 2 +- .../365-invalid-success/files/stack.yaml | 2 +- .../tests/366-non-root-dir/files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../tests/3863-purge-command/files/stack.yaml | 2 +- .../files/no-base-upgrade.yaml | 2 +- .../files/unattainable-base.yaml | 2 +- .../files/test-stack.yml | 2 +- .../3959-order-of-flags/files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../4101-dependency-tree/files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../tests/4270-files-order/files/stack.yaml | 2 +- .../tests/4453-detailed/files/stack.yaml | 2 +- .../4783-doctest-deps/files/snapshot.yaml | 2 +- .../4897-boot-package-pruned/files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../tests/5180-ghc-rts-flags/files/stack.yaml | 2 +- .../files/package-a/stack.yaml | 2 +- .../files/package-b/stack.yaml | 2 +- .../files/package-c/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../tests/620-env-command/files/run.sh | 4 +-- .../6372-sdist-unicode-test/files/stack.yaml | 2 +- .../6465-msys-environment/files/stack.yaml | 2 +- .../tests/6867-timeout-grace/files/stack.yaml | 2 +- .../tests/717-sdist-test/files/stack.yaml | 2 +- .../763-buildable-false/files/stack.yaml | 2 +- .../files/stack.yaml | 2 +- .../tests/cabal-non-buildable-bug/Main.hs | 2 +- .../files/stack.yaml | 2 +- .../tests/drop-packages/files/stack.yaml | 2 +- .../duplicate-package-ids/files/stack1.yaml | 2 +- .../duplicate-package-ids/files/stack2.yaml | 2 +- .../tests/haddock-options/files/stack.yaml | 2 +- .../tests/hpack-repo/files/stack.yaml | 2 +- .../tests/init-omit-packages/Main.hs | 4 +-- .../tests/lock-files/files/stack-1-extra | 2 +- .../tests/lock-files/files/stack-2-extras | 2 +- .../files/stack.yaml | 2 +- .../tests/multi-test/files/stack.yaml | 2 +- .../tests/mutable-deps/files/stack.yaml | 2 +- .../tests/nice-resolver-names/Main.hs | 2 +- .../integration/tests/upload/files/stack.yaml | 2 +- .../tests/watched-files/files/stack.yaml | 2 +- tests/unit/Stack/ConfigSpec.hs | 20 ++++++------- 87 files changed, 147 insertions(+), 173 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cc43e2e90..bc4af1a287 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -352,7 +352,7 @@ Stack aims to depend on well-known packages. The specific versions on which it depends at any time are specified by `package.yaml` and `stack.yaml`. It does not aim to be compatible with more than one version of the `Cabal` package at any time. At the time of writing (January 2026) the package versions are -primarily ones in Stackage snapshot LTS Haskell 24.24 (for GHC 9.10.3), the +primarily ones in Stackage snapshot LTS Haskell 24.37 (for GHC 9.10.3), the latest version of `Cabal` released on Hackage (`Cabal-3.16.0.0`), `pantry-0.11.2`, `persistent-2.18.0.0` and the latest version of packages in the `tls` family (which reduce dependencies on unmaintained packages). diff --git a/ChangeLog.md b/ChangeLog.md index 0b212a6dbc..8347d90786 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -18,6 +18,7 @@ Behavior changes: Other enhancements: +* Bump to Hpack 0.39.3. * Experimental: Add flag `--[no-]semaphore` (default: disabled) to Stack's `build` command, to allow GHC to use a system semaphore to perform compilation in parallel when possible. Supported, by default, by GHC 9.10.1 or later. The diff --git a/cabal.config b/cabal.config index ac763c0758..f965ed41a0 100644 --- a/cabal.config +++ b/cabal.config @@ -103,7 +103,7 @@ constraints: , haskell-src-exts ==1.23.1 , haskell-src-meta ==0.8.15 , hi-file-parser ==0.1.8.0 - , hpack ==0.39.1 + , hpack ==0.38.3 , hpc ==0.7.0.2 , hpke ==0.0.0 , http-api-data ==0.6.2 @@ -169,7 +169,7 @@ constraints: , retry ==0.9.3.1 , rio ==0.1.24.0 , rio-orphans ==0.1.2.0 - , rio-prettyprint ==0.1.8.0 + , rio-prettyprint ==0.1.9.0 , rts ==1.0.2 , safe ==0.3.21 , safe-exceptions ==0.1.7.4 diff --git a/cabal.project b/cabal.project index 6b8e022627..91b417ea97 100644 --- a/cabal.project +++ b/cabal.project @@ -33,7 +33,7 @@ -- specified by the snapshot specifed in Stack's project-level YAML -- configuration file (`stack.yaml`). The relevant version of GHC can be -- confirmed by reviewing the snapshot on Stackage. For example, at: --- https://www.stackage.org/lts-24.24/cabal.config. +-- https://www.stackage.org/lts-24.37/cabal.config. -- with-compiler: ghc-9.10.3 import: cabal.config diff --git a/doc/commands/list_command.md b/doc/commands/list_command.md index 627678987a..dad5cabee5 100644 --- a/doc/commands/list_command.md +++ b/doc/commands/list_command.md @@ -45,17 +45,17 @@ Error: [S-4926] tasty, retry, path, pretty, pasty, xattr, alloy, para, pappy and alure. -stack --snapshot lts-24.24 list base unix Win32 acme-missiles pantry +stack --snapshot lts-24.37 list base unix Win32 acme-missiles pantry Error: [S-4926] * Package does not appear in snapshot (directly or indirectly): acme-missiles. -stack --snapshot lts-24.24 list base unix Win32 pantry +stack --snapshot lts-24.37 list base unix Win32 pantry base-4.20.2.0 unix-2.8.7.0 Win32-2.14.1.0 pantry-0.10.1 -stack --snapshot lts-24.24 list +stack --snapshot lts-24.37 list AC-Angle-1.0 ALUT-2.4.0.3 ... diff --git a/doc/commands/script_command.md b/doc/commands/script_command.md index 98092ff472..92eb1c4027 100644 --- a/doc/commands/script_command.md +++ b/doc/commands/script_command.md @@ -49,7 +49,7 @@ A snapshot must be specified on the command line, using the `--snapshot` option. For example: ~~~text -stack script --snapshot lts-24.24 MyScript.hs +stack script --snapshot lts-24.37 MyScript.hs ~~~ An immutable extra-dep can be added to the snapshot on the command line with the @@ -211,7 +211,7 @@ main = do can be compiled and run, with arguments, with: ~~~text -stack --snapshot lts-24.24 script --package acme-missiles --compile MyScript.hs -- "Don't panic!" "Duck and cover!" +stack --snapshot lts-24.37 script --package acme-missiles --compile MyScript.hs -- "Don't panic!" "Duck and cover!" ~~~ `acme-missiles-0.3` (the most recent version in the package index) will be used. @@ -231,7 +231,7 @@ snapshot as an extra-dep. The `stack script` command is specified using Stack's ~~~haskell {- stack script - -- snapshot lts-24.24 + -- snapshot lts-24.37 -- extra-dep acme-missiles-0.2 -- package acme-missiles -} @@ -333,7 +333,7 @@ A Haskell source file `MyScript.hs`, as follows: ~~~haskell {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 -} {-# LANGUAGE OverloadedStrings #-} diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index a2b441956e..0a45b26f96 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -309,7 +309,7 @@ can be used to override the compiler (and, implicitly, its boot packages) for a Stackage snapshot, like this: ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 compiler: ghc-9.10.2 compiler-check: match-exact ~~~ diff --git a/doc/configure/yaml/project.md b/doc/configure/yaml/project.md index 82dc880970..7eea35ce90 100644 --- a/doc/configure/yaml/project.md +++ b/doc/configure/yaml/project.md @@ -39,13 +39,13 @@ snapshot defines a GHC version, the package version of packages available for installation, and various settings like build flags. For example: ~~~yaml -snapshot: lts-24-30 # A Stackage LTS Haskell snapshot +snapshot: lts-24.37 # A Stackage LTS Haskell snapshot ~~~ or ~~~yaml -snapshot: nightly-2026-02-09 # A Stackage Nightly snapshot +snapshot: nightly-2026-04-18 # A Stackage Nightly snapshot ~~~ For further information about how to specify the location of a snapshot, see the diff --git a/doc/topics/Stack_and_VS_Code.md b/doc/topics/Stack_and_VS_Code.md index 8a18445914..259138b0e6 100644 --- a/doc/topics/Stack_and_VS_Code.md +++ b/doc/topics/Stack_and_VS_Code.md @@ -150,7 +150,7 @@ VS Code with the 'Haskell' extension can be configured in a number of ways: Each time that a snapshot is used that references a different version of GHC, then GHCup must be used to install it (if GHCup has not already - installed that version). For example, to use `snapshot: lts-24.24` + installed that version). For example, to use `snapshot: lts-24.37` (GHC 9.10.3), the command `ghcup install ghc 9.10.3` must have been used to install GHC 9.10.3. That may be a minor inconvenience for some people, as one the primary benefits of Stack over other tools for building diff --git a/doc/topics/custom_snapshot.md b/doc/topics/custom_snapshot.md index 03dd173944..225b7a5446 100644 --- a/doc/topics/custom_snapshot.md +++ b/doc/topics/custom_snapshot.md @@ -29,7 +29,7 @@ available in snapshots to ensure reproducibility. ~~~yaml # Inherits a specific GHC version and, implicitly, its boot packages and # specific versions of a set of other packages: -snapshot: lts-24.24 +snapshot: lts-24.37 # Overwrites the version of GHC (and, implicitly, its boot packages) specified # in the snapshot (optional): compiler: ghc-9.10.2 @@ -75,36 +75,36 @@ custom snapshot, due to Stack sharing snapshot packages whenever possible. ### Overriding the compiler -The following snapshot specification will be identical to `lts-24.24`, but +The following snapshot specification will be identical to `lts-24.37`, but instead use `ghc-9.10.2` and its boot packages instead of `ghc-9.10.3` and its boot packages: ~~~yaml -snapshot: lts-24.24 # GHC 9.10.3 +snapshot: lts-24.37 # GHC 9.10.3 compiler: ghc-9.10.2 ~~~ ### Dropping packages -The following snapshot specification will be identical to `lts-24.24`, but +The following snapshot specification will be identical to `lts-24.37`, but without the `text` package in our snapshot. Removing this package will cause all the packages that depend on `text` to be unbuildable, but they will still be present in the snapshot. ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 drop-packages: - text ~~~ ### Hiding packages -The following snapshot specification will be identical to `lts-24.24`, but the +The following snapshot specification will be identical to `lts-24.37`, but the `text` package will be hidden when registering. This will affect, for example, the import parser in the script command. ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 hidden: - text ~~~ @@ -115,11 +115,11 @@ In order to specify GHC options for a package, you use the same syntax as the [ghc-options](../configure/yaml/non-project.md#ghc-options) key for build configuration. -The following snapshot specification will be identical to `lts-24.24`, but +The following snapshot specification will be identical to `lts-24.37`, but provides `-O1` as a ghc-option for `text`: ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - text-2.1.2 ghc-options: @@ -138,11 +138,11 @@ packages in the `packages` list, rather than all packages in the snapshot. In order to specify Cabal flags for a package, you use the same syntax as the [flags](../configure/yaml/project.md#flags) key for build configuration. The -following snapshot specification will be identical to `lts-24.24`, but +following snapshot specification will be identical to `lts-24.37`, but it enables the `developer` Cabal flag: ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - text-2.1.2 flags: diff --git a/doc/topics/haskell_and_c_code.md b/doc/topics/haskell_and_c_code.md index 7c1d55dc0f..217391ad41 100644 --- a/doc/topics/haskell_and_c_code.md +++ b/doc/topics/haskell_and_c_code.md @@ -83,7 +83,7 @@ executables: The project's `stack.yaml` file only needs to identify a snapshot: ~~~yaml -snapshot: lts-24.24 # GHC 9.10.3 +snapshot: lts-24.37 # GHC 9.10.3 ~~~ This example project can be built with Stack in the normal way (`stack build`), @@ -220,7 +220,7 @@ The `include-dirs` key will cause the specified directory (again, The project's `stack.yaml` file only needs to identify a snapshot: ~~~yaml -snapshot: lts-24.24 # GHC 9.10.3 +snapshot: lts-24.37 # GHC 9.10.3 ~~~ This example project can be built with Stack in the normal way (`stack build`), diff --git a/doc/topics/scripts.md b/doc/topics/scripts.md index 5b7ef645b0..7c88e61dd2 100644 --- a/doc/topics/scripts.md +++ b/doc/topics/scripts.md @@ -19,7 +19,7 @@ An example will be easiest to understand. Consider the Haskell source file ~~~haskell #!/usr/bin/env stack --- stack script --snapshot lts-24.24 --package turtle +-- stack script --snapshot lts-24.37 --package turtle {-# LANGUAGE OverloadedStrings #-} import Turtle (echo) main = echo "Hello World!" @@ -78,11 +78,11 @@ able to reuse everything already built). The second line of the source code is the Stack interpreter options comment. In this example, it specifies the [`stack script`](../commands/script_command.md) -command with the options of a LTS Haskell 24.24 snapshot -(`--snapshot lts-24.24`) and ensuring the +command with the options of a LTS Haskell 24.37 snapshot +(`--snapshot lts-24.37`) and ensuring the [`turtle`](https://hackage.haskell.org/package/turtle) package is available (`--package turtle`). The version of the package will be that in the specified -snapshot (`lts-24.24` provides `turtle-1.6.2`). +snapshot (`lts-24.37` provides `turtle-1.6.2`). ## Arguments and interpreter options and arguments @@ -117,7 +117,7 @@ For example, the command `stack MyScript.hs arg1 arg2` with `MyScript.hs`: ~~~haskell #!/usr/bin/env stack {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 -- +RTS -s -RTS -} @@ -133,7 +133,7 @@ main = do is equivalent to the following command at the command line: ~~~text -stack script --snapshot lts-24.24 -- MyScript.hs arg1 arg2 +RTS -s -RTS +stack script --snapshot lts-24.37 -- MyScript.hs arg1 arg2 +RTS -s -RTS ~~~ where `+RTS -s -RTS` are some of GHC's @@ -164,7 +164,7 @@ options, or by providing a comma or space separated list. For example: ~~~haskell #!/usr/bin/env stack {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --package turtle --package "stm async" --package http-client,http-conduit @@ -180,7 +180,7 @@ each. For example: ~~~haskell #!/usr/bin/env stack {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --extra-dep acme-missiles-0.3@rev:0 --extra-dep "{git: git@github.com:yesodweb/wai, commit: '2f8a8e1b771829f4a8a77c0111352ce45a14c30f', subdirs: [auto-update, wai]}" -} @@ -227,7 +227,7 @@ which makes use of the joke package ~~~haskell {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --package acme-missiles -} import Acme.Missiles (launchMissiles) @@ -238,7 +238,7 @@ main = launchMissiles The command `stack --script-no-run-compile Script.hs` then behaves as if the command -`stack script --snapshot lts-24.24 --package acme-missiles --no-run --compile -- Script.hs` +`stack script --snapshot lts-24.37 --package acme-missiles --no-run --compile -- Script.hs` had been given. `Script.hs` is compiled (without optimisation) and the resulting executable is not run: no missiles are launched in the process! @@ -280,7 +280,7 @@ those curious, here is an example with {- stack runghc --install-ghc - --snapshot lts-24.24 + --snapshot lts-24.37 --package base --package turtle -- @@ -304,7 +304,7 @@ it. Here is an example: {- stack exec ghci --install-ghc - --snapshot lts-24.24 + --snapshot lts-24.37 --package turtle -} ~~~ diff --git a/doc/topics/snapshot_location.md b/doc/topics/snapshot_location.md index f2b337d935..4022cfb4e0 100644 --- a/doc/topics/snapshot_location.md +++ b/doc/topics/snapshot_location.md @@ -32,7 +32,7 @@ There are four ways to specify a snapshot location: * **Stackage LTS Haskell snapshots**, for example: ~~~yaml - snapshot: lts-24.30 + snapshot: lts-24.37 ~~~ ??? info "Expansion of `lts-X.Y`" @@ -52,7 +52,7 @@ There are four ways to specify a snapshot location: * **Stackage Nightly snapshots**, for example: ~~~yaml - snapshot: nightly-2026-02-09 + snapshot: nightly-2026-04-18 ~~~ ??? info "Expansion of `nightly-YYYY-MM-DD`" diff --git a/doc/topics/stack_yaml_vs_cabal_package_file.md b/doc/topics/stack_yaml_vs_cabal_package_file.md index cc83764349..070cae979a 100644 --- a/doc/topics/stack_yaml_vs_cabal_package_file.md +++ b/doc/topics/stack_yaml_vs_cabal_package_file.md @@ -64,8 +64,8 @@ requires that you have chosen a specific version for each package available. The most common means by which this set of packages is defined is via a snapshot provided by Stackage. For example, if you go to the page -, you will see a list of 3,415 packages at -specific version numbers. When you then specify `snapshot: lts-24.24` you are +, you will see a list of 3,427 packages at +specific version numbers. When you then specify `snapshot: lts-24.37` you are telling Stack to use those package versions in resolving dependencies down to specific versions of packages. diff --git a/doc/tutorial/building_your_project.md b/doc/tutorial/building_your_project.md index 0d8ddc23aa..a09942bb10 100644 --- a/doc/tutorial/building_your_project.md +++ b/doc/tutorial/building_your_project.md @@ -249,7 +249,7 @@ With that out of the way, let us dig a little bit more into these snapshots. We mentioned the LTS snapshots, and you can get information about it at [https://www.stackage.org/lts](https://www.stackage.org/lts), including: -* The appropriate value (`lts-24.24`, as is currently the latest LTS) +* The appropriate value (`lts-24.37`, as is currently the latest LTS) * The GHC version used * A full list of all packages versions available in this snapshot * The ability to perform a Hoogle search on the packages in this snapshot diff --git a/doc/tutorial/executing_commands.md b/doc/tutorial/executing_commands.md index a0a9553ee4..e363e13227 100644 --- a/doc/tutorial/executing_commands.md +++ b/doc/tutorial/executing_commands.md @@ -34,7 +34,7 @@ yields output like: Writing the configuration file for the implicit global project to: .../global-project/stack.yaml. Note: You can change the snapshot via the snapshot key there. -Using the latest snapshot lts-24.24. +Using the latest snapshot lts-24.37. I installed the stm package via --package stm ~~~ diff --git a/doc/tutorial/hello_world_example.md b/doc/tutorial/hello_world_example.md index 83b4e1cb01..32bc06be33 100644 --- a/doc/tutorial/hello_world_example.md +++ b/doc/tutorial/hello_world_example.md @@ -59,7 +59,7 @@ creating manually a Stack project-level configuration file named `stack.yaml` in `my-project`, with the contents: ~~~yaml -snapshot: lts-24.24 +snapshot: lts-24.37 ~~~ By adding those two files (one to describe a package, the other to configure the diff --git a/doc/tutorial/project_configuration.md b/doc/tutorial/project_configuration.md index 5b6e5bb598..23a7ba6589 100644 --- a/doc/tutorial/project_configuration.md +++ b/doc/tutorial/project_configuration.md @@ -44,7 +44,7 @@ The key [`snapshot`](../configure/yaml/project.md#snapshot) is a project-specific configuration option. Its value tells Stack *how* to build your package: which version of GHC (and, implicitly, its boot packages) to use; which versions of other package dependencies to use, and so on. Our value here says to -use [LTS Haskell 24.24](https://www.stackage.org/lts-24.24), which implies +use [LTS Haskell 24.37](https://www.stackage.org/lts-24.37), which implies GHC 9.10.3 (which is why `stack build` installs that version of GHC if it is not already available to Stack). There are a number of values you can use for `snapshot`, which we will cover later. diff --git a/etc/scripts/build-stack-installer.hs b/etc/scripts/build-stack-installer.hs index 97dac34b82..6e601cf01e 100644 --- a/etc/scripts/build-stack-installer.hs +++ b/etc/scripts/build-stack-installer.hs @@ -1,5 +1,5 @@ {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --package nsis -} {-# LANGUAGE OverloadedStrings #-} diff --git a/etc/scripts/release-linux-aarch64.hs b/etc/scripts/release-linux-aarch64.hs index fa12f28656..750d2dad1f 100644 --- a/etc/scripts/release-linux-aarch64.hs +++ b/etc/scripts/release-linux-aarch64.hs @@ -1,5 +1,5 @@ {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --ghc-options -Wall -} @@ -7,7 +7,7 @@ -- interpreter options comment, Stack deduces the required packages from the -- module imports, being: Cabal, base, bytestring, directory, extra, process, -- shake, tar, zip-archive and zlib. These are either GHC boot packages or in --- the snapshot. Stackage LTS Haskell 24.24 does not include boot packages +-- the snapshot. Stackage LTS Haskell 24.37 does not include boot packages -- directly. As GHC 9.10.3 boot packages Cabal and Cabal-syntax expose modules -- with the same names, the language extension PackageImports is required. diff --git a/etc/scripts/release.hs b/etc/scripts/release.hs index 081e960497..a0ace5f5a9 100644 --- a/etc/scripts/release.hs +++ b/etc/scripts/release.hs @@ -1,5 +1,5 @@ {- stack script - --snapshot lts-24.24 + --snapshot lts-24.37 --ghc-options -Wall -} @@ -7,7 +7,7 @@ -- interpreter options comment, Stack deduces the required packages from the -- module imports, being: Cabal, base, bytestring, directory, extra, process, -- shake, tar, zip-archive and zlib. These are either GHC boot packages or in --- the snapshot. Stackage LTS Haskell 24.24 does not include boot packages +-- the snapshot. Stackage LTS Haskell 24.37 does not include boot packages -- directly. As GHC 9.10.3 boot packages Cabal and Cabal-syntax expose modules -- with the same names, the language extension PackageImports is required. diff --git a/etc/scripts/stack.yaml b/etc/scripts/stack.yaml index c5f61065a2..590b0311bc 100644 --- a/etc/scripts/stack.yaml +++ b/etc/scripts/stack.yaml @@ -6,4 +6,4 @@ # build-stack-installer.hs. The work around is to build the package required for # that script using the same Stack configuration as used by the script. -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/src/Stack/Init.hs b/src/Stack/Init.hs index 7b84d64b23..40b26659a6 100644 --- a/src/Stack/Init.hs +++ b/src/Stack/Init.hs @@ -437,8 +437,8 @@ renderStackYaml p ignoredPackages dupPackages = , "A snapshot dictates the compiler version and the set of packages" , "to be used for project dependencies. For example:" , "" - , "snapshot: lts-24.24" - , "snapshot: nightly-2025-12-20" + , "snapshot: lts-24.37" + , "snapshot: nightly-2026-04-18" , "snapshot: ghc-9.10.3" , "" , "The location of a snapshot can be provided as a file or url. Stack assumes" diff --git a/src/Stack/Options/ConfigSetParser.hs b/src/Stack/Options/ConfigSetParser.hs index efe64f3929..6c730b862d 100644 --- a/src/Stack/Options/ConfigSetParser.hs +++ b/src/Stack/Options/ConfigSetParser.hs @@ -36,7 +36,7 @@ configCmdSetParser = <$> OA.argument readAbstractSnapshot ( OA.metavar "SNAPSHOT" - <> OA.help "E.g. \"nightly\" or \"lts-24.24\"" )) + <> OA.help "E.g. \"nightly\" or \"lts-24.37\"" )) ( OA.progDesc "Change the snapshot of the current project." )) , OA.command "resolver" @@ -45,7 +45,7 @@ configCmdSetParser = <$> OA.argument readAbstractSnapshot ( OA.metavar "SNAPSHOT" - <> OA.help "E.g. \"nightly\" or \"lts-24.24\"" )) + <> OA.help "E.g. \"nightly\" or \"lts-24.37\"" )) ( OA.progDesc "Change the snapshot of the current project, using the \ \(deprecated) resolver key." )) diff --git a/stack.yaml b/stack.yaml index 14204616b7..5797518708 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,36 +1,30 @@ -snapshot: lts-24.24 # GHC 9.10.3 +snapshot: lts-24.37 # GHC 9.10.3 extra-deps: -# lts-24.24 specifies Cabal-3.12.1.0 +# lts-24.37 specifies Cabal-3.12.1.0 - Cabal-3.16.0.0@sha256:9972c2bd263168a20bd990962a68d4fd024f50c30a00519a6b942e8871d1bd67,14455 - Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 -# lts-24.24 specifies casa-client-0.0.3 -- casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 -# lts-24.24 does not include crypton-asn1-* +# lts-24.37 does not include crypton-asn1-* - crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 - crypton-asn1-parse-0.10.0@sha256:4a2cfc4980957d1a279ef69137ee5f665c247ccd8bb962812d5b071d543893fb,1359 - crypton-asn1-types-0.4.1@sha256:02f3ec473011b3da92f7bf738bea19cadf88a6470b25a6cb5042216c7549c912,1326 -# lts-24.24 specifies crypton-connection-0.4.5 (before revision) -- crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 -# lts-24.24 specifies crypton-x509-1.7.7 +# lts-24.37 specifies crypton-x509-1.7.7 - crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 -# lts-24.24 specifies crypton-x509-store-1.6.12 +# lts-24.37 specifies crypton-x509-store-1.6.14 - crypton-x509-store-1.8.0@sha256:075ba50a3daa0fdbb493481a665926e1ced2135c6b4ed56f97398aa855f0aecb,1674 -# lts-24.24 specifies crypton-x509-system-1.6.7 +# lts-24.37 specifies crypton-x509-system-1.6.8 - crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 -# lts-24.24 specifies crypton-x509-validation-1.6.14 +# lts-24.37 specifies crypton-x509-validation-1.6.14 - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 -# lts-24.24 specifies hpack-0.38.3 -- hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 -# lts-24.24 specifies pantry-0.10.1 +# lts-24.37 specifies pantry-0.10.1 - pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 -# lts-24.24 specifies persistent-2.17.1.0 +# lts-24.37 specifies persistent-2.17.1.0 - persistent-2.18.0.0@sha256:baa3e0959cf10bbd1da462efeb61d4f073d0cc924a149325494ba5ce29bc17a4,7096 -# lts-24.24 specifies rio-prettyprint-0.1.8.0 +# lts-24.37 specifies rio-prettyprint-0.1.8.0 - rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 -# lts-24.24 does not include time-hourglass +# lts-24.37 does not include time-hourglass - time-hourglass-0.3.0@sha256:ee02356fe24919ec43ae17fc0007398c2fd0bbe822833b2d7a9c849537b90580,3114 -# lts-24.24 specifies tls-2.1.8 +# lts-24.37 specifies tls-2.1.8 - tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 docker: diff --git a/stack.yaml.lock b/stack.yaml.lock index 5816a82a2b..da3ce742eb 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -18,13 +18,6 @@ packages: size: 11238 original: hackage: Cabal-syntax-3.16.0.0@sha256:6a35036763557301876c5b7a448de4f1cb54fe1e223ff6c4c0c1fdd6df635a65,7509 -- completed: - hackage: casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 - pantry-tree: - sha256: 7297f4d57587a66e63dbc8c192a9424cf0fc694891d5cf17bacd3dc7c6d89ff3 - size: 220 - original: - hackage: casa-client-0.0.4@sha256:2bcff165c0b73c16b9e7d0a916559f26fc6e18fa43c3d173d8aebd7027dae59c,1597 - completed: hackage: crypton-asn1-encoding-0.10.0@sha256:45494a1723a047a815d0d620481c1028dca28a4ea5cf2554868687da90753961,2497 pantry-tree: @@ -46,13 +39,6 @@ packages: size: 722 original: hackage: crypton-asn1-types-0.4.1@sha256:02f3ec473011b3da92f7bf738bea19cadf88a6470b25a6cb5042216c7549c912,1326 -- completed: - hackage: crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 - pantry-tree: - sha256: f15579ede43437fc33a1425115e7001a95a5706f71e07525d88211e9e1a42d13 - size: 464 - original: - hackage: crypton-connection-0.4.5@sha256:521d61fd6b0e528fd1c534475700ca3a60618b6d4b5bc798c7ab3d161b0aae11,1575 - completed: hackage: crypton-x509-1.8.0@sha256:d4822ba8dcb19ee3233fc98152f5afda383ac952770a1d07f1d01168e9fcdbc2,2006 pantry-tree: @@ -81,13 +67,6 @@ packages: size: 691 original: hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 -- completed: - hackage: hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 - pantry-tree: - sha256: a6b33bf86bd2d4b453fdb6ba73c3fd5eb77d069a612f546f52baa7f62c321bdf - size: 3799 - original: - hackage: hpack-0.39.3@sha256:8ce7ae9ec944a3181eeff971402102b5ec05946c8a484d460799a8e0bf23f8ee,5316 - completed: hackage: pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 pantry-tree: @@ -125,7 +104,7 @@ packages: hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 snapshots: - completed: - sha256: 4bc8e0388916c4000645c068dff642482d6ed1b68b747c2d4d444857979963e0 - size: 726334 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/24.yaml - original: lts-24.24 + sha256: 655e468f774beee1badf07dc4c45fb50288d5c66ce7bef6f487b7f92891a90b0 + size: 728965 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/37.yaml + original: lts-24.37 diff --git a/tests/integration/lib/StackTest.hs b/tests/integration/lib/StackTest.hs index d6987c5d2c..744d6f5c76 100644 --- a/tests/integration/lib/StackTest.hs +++ b/tests/integration/lib/StackTest.hs @@ -278,7 +278,7 @@ isMacOSX = os == "darwin" -- the main @stack.yaml@. -- defaultSnapshotArg :: String -defaultSnapshotArg = "--snapshot=lts-24.24" +defaultSnapshotArg = "--snapshot=lts-24.37" -- | Remove a file and ignore any warnings about missing files. removeFileIgnore :: HasCallStack => FilePath -> IO () diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml index d2ecc1f55b..042eaee94c 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 name: snapshot-modify-lts drop-packages: - zlib diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml index b51fac3cde..4345d24e23 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 name: local-snapshot packages: - archive: package-0.1.2.3.tar.gz diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml index 1eae88d171..cac0c643a4 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 name: remote-snapshot packages: - archive: https://s3.amazonaws.com/hackage.fpcomplete.com/package/acme-missiles-0.3.tar.gz diff --git a/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml b/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml +++ b/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/1659-skip-component/files/stack.yaml b/tests/integration/tests/1659-skip-component/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/1659-skip-component/files/stack.yaml +++ b/tests/integration/tests/1659-skip-component/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/1884-url-to-tarball/files/stack.yaml b/tests/integration/tests/1884-url-to-tarball/files/stack.yaml index 73ddc159cd..8247641fbb 100644 --- a/tests/integration/tests/1884-url-to-tarball/files/stack.yaml +++ b/tests/integration/tests/1884-url-to-tarball/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - location: https://hackage.haskell.org/package/half-0.2.2.3/half-0.2.2.3.tar.gz sha256: 85c244c80d1c889a3d79073a6f5a99d9e769dbe3c574ca11d992b2b4f7599a5c diff --git a/tests/integration/tests/2195-depend-on-exe/files/stack.yaml b/tests/integration/tests/2195-depend-on-exe/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/2195-depend-on-exe/files/stack.yaml +++ b/tests/integration/tests/2195-depend-on-exe/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/32-unlisted-module/files/stack.yaml b/tests/integration/tests/32-unlisted-module/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/32-unlisted-module/files/stack.yaml +++ b/tests/integration/tests/32-unlisted-module/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml b/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml +++ b/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/335-multi-package-flags/files/stack.yaml b/tests/integration/tests/335-multi-package-flags/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/335-multi-package-flags/files/stack.yaml +++ b/tests/integration/tests/335-multi-package-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/345-override-bytestring/files/stack.yaml b/tests/integration/tests/345-override-bytestring/files/stack.yaml index a5b500081d..d3f612f00e 100644 --- a/tests/integration/tests/345-override-bytestring/files/stack.yaml +++ b/tests/integration/tests/345-override-bytestring/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - bytestring-0.11.5.4 - binary-0.8.9.0 diff --git a/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml b/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml index 3557343998..4941659b7d 100644 --- a/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml +++ b/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - ./local-mmorph diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml b/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml +++ b/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/365-invalid-success/files/stack.yaml b/tests/integration/tests/365-invalid-success/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/365-invalid-success/files/stack.yaml +++ b/tests/integration/tests/365-invalid-success/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/366-non-root-dir/files/stack.yaml b/tests/integration/tests/366-non-root-dir/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/366-non-root-dir/files/stack.yaml +++ b/tests/integration/tests/366-non-root-dir/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3863-purge-command/files/stack.yaml b/tests/integration/tests/3863-purge-command/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3863-purge-command/files/stack.yaml +++ b/tests/integration/tests/3863-purge-command/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml index 49177786b8..7ecb56c46d 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml +++ b/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - base-4.10.1.0 diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml +++ b/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3942-solver-error-output/files/test-stack.yml b/tests/integration/tests/3942-solver-error-output/files/test-stack.yml index 8d15631053..7805f88107 100644 --- a/tests/integration/tests/3942-solver-error-output/files/test-stack.yml +++ b/tests/integration/tests/3942-solver-error-output/files/test-stack.yml @@ -1,4 +1,4 @@ -resolver: lts-24.24 +resolver: lts-24.37 packages: [] diff --git a/tests/integration/tests/3959-order-of-flags/files/stack.yaml b/tests/integration/tests/3959-order-of-flags/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3959-order-of-flags/files/stack.yaml +++ b/tests/integration/tests/3959-order-of-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml b/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml +++ b/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml b/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml +++ b/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/4101-dependency-tree/files/stack.yaml b/tests/integration/tests/4101-dependency-tree/files/stack.yaml index a9b178dba9..530954a8b4 100644 --- a/tests/integration/tests/4101-dependency-tree/files/stack.yaml +++ b/tests/integration/tests/4101-dependency-tree/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . - subproject diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/stack.yaml b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/stack.yaml +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/4270-files-order/files/stack.yaml b/tests/integration/tests/4270-files-order/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/4270-files-order/files/stack.yaml +++ b/tests/integration/tests/4270-files-order/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/4453-detailed/files/stack.yaml b/tests/integration/tests/4453-detailed/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/4453-detailed/files/stack.yaml +++ b/tests/integration/tests/4453-detailed/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml b/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml index 133d9e0f6a..fbeae1e6ce 100644 --- a/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml +++ b/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 name: foo packages: - acme-dont-1.1@sha256:8264ad3e5113d3e0417b46e71d5a9c0914a1f03b5b81319cc329f1dc0f49b96c,602 diff --git a/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml b/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml index 78379bbba6..a0b8b9c232 100644 --- a/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml +++ b/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - ./directory diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml b/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml +++ b/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml b/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml index 063c7659dc..7a45b56d0e 100644 --- a/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml +++ b/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 ghc-options: "$locals": -j8 +RTS -s -A128M diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml index 94af074400..a6ceecc2ed 100644 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml +++ b/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . - ../package-c diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml index 94af074400..a6ceecc2ed 100644 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml +++ b/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . - ../package-c diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml +++ b/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml b/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/606-local-version-not-exist/files/stack.yaml b/tests/integration/tests/606-local-version-not-exist/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/606-local-version-not-exist/files/stack.yaml +++ b/tests/integration/tests/606-local-version-not-exist/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/620-env-command/files/run.sh b/tests/integration/tests/620-env-command/files/run.sh index c9931d262d..6ba2545228 100644 --- a/tests/integration/tests/620-env-command/files/run.sh +++ b/tests/integration/tests/620-env-command/files/run.sh @@ -2,6 +2,6 @@ set -euxo pipefail -stack build --resolver lts-24.24 async -eval `stack config env --resolver lts-24.24` +stack build --resolver lts-24.37 async +eval `stack config env --resolver lts-24.37` ghc Main.hs diff --git a/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml b/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml +++ b/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/6465-msys-environment/files/stack.yaml b/tests/integration/tests/6465-msys-environment/files/stack.yaml index 159184fbd1..594bdd467c 100644 --- a/tests/integration/tests/6465-msys-environment/files/stack.yaml +++ b/tests/integration/tests/6465-msys-environment/files/stack.yaml @@ -1,2 +1,2 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 msys-environment: UCRT64 diff --git a/tests/integration/tests/6867-timeout-grace/files/stack.yaml b/tests/integration/tests/6867-timeout-grace/files/stack.yaml index da98263e48..53317c86d3 100644 --- a/tests/integration/tests/6867-timeout-grace/files/stack.yaml +++ b/tests/integration/tests/6867-timeout-grace/files/stack.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . diff --git a/tests/integration/tests/717-sdist-test/files/stack.yaml b/tests/integration/tests/717-sdist-test/files/stack.yaml index 1f8de3e558..cb4156ca85 100644 --- a/tests/integration/tests/717-sdist-test/files/stack.yaml +++ b/tests/integration/tests/717-sdist-test/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - package-with-th - package-with-working-th diff --git a/tests/integration/tests/763-buildable-false/files/stack.yaml b/tests/integration/tests/763-buildable-false/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/763-buildable-false/files/stack.yaml +++ b/tests/integration/tests/763-buildable-false/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml b/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml index 4126c4cd28..ba5ad2fa3c 100644 --- a/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml +++ b/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 allow-newer: true allow-newer-deps: diff --git a/tests/integration/tests/cabal-non-buildable-bug/Main.hs b/tests/integration/tests/cabal-non-buildable-bug/Main.hs index a1cd064333..7bd8831090 100644 --- a/tests/integration/tests/cabal-non-buildable-bug/Main.hs +++ b/tests/integration/tests/cabal-non-buildable-bug/Main.hs @@ -4,7 +4,7 @@ main :: IO () main = do -- Newer Cabal: dry run and building should succeed, because they'll -- both ignore the do-not-build - writeFile "stack.yaml" "snapshot: lts-24.24" + writeFile "stack.yaml" "snapshot: lts-24.37" stack ["build", "--dry-run"] stack ["build"] diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml b/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml index 6282bfb76f..b2901db007 100644 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . - subproject diff --git a/tests/integration/tests/drop-packages/files/stack.yaml b/tests/integration/tests/drop-packages/files/stack.yaml index 5d6ab2f533..f9d03af4eb 100644 --- a/tests/integration/tests/drop-packages/files/stack.yaml +++ b/tests/integration/tests/drop-packages/files/stack.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 drop-packages: - unliftio-core diff --git a/tests/integration/tests/duplicate-package-ids/files/stack1.yaml b/tests/integration/tests/duplicate-package-ids/files/stack1.yaml index bee6b8de03..97ad369c4f 100644 --- a/tests/integration/tests/duplicate-package-ids/files/stack1.yaml +++ b/tests/integration/tests/duplicate-package-ids/files/stack1.yaml @@ -1,2 +1,2 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: [] diff --git a/tests/integration/tests/duplicate-package-ids/files/stack2.yaml b/tests/integration/tests/duplicate-package-ids/files/stack2.yaml index 2cefc6a490..ee6bc144a2 100644 --- a/tests/integration/tests/duplicate-package-ids/files/stack2.yaml +++ b/tests/integration/tests/duplicate-package-ids/files/stack2.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - auto-update-0.1.2.1 diff --git a/tests/integration/tests/haddock-options/files/stack.yaml b/tests/integration/tests/haddock-options/files/stack.yaml index 7461e4e285..9cec735579 100644 --- a/tests/integration/tests/haddock-options/files/stack.yaml +++ b/tests/integration/tests/haddock-options/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 build: haddock-arguments: diff --git a/tests/integration/tests/hpack-repo/files/stack.yaml b/tests/integration/tests/hpack-repo/files/stack.yaml index c566c6c997..86ef409b6a 100644 --- a/tests/integration/tests/hpack-repo/files/stack.yaml +++ b/tests/integration/tests/hpack-repo/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - git: https://github.com/NorfairKing/validity.git commit: d128cc30bc886e31ea7f8161fb7708c08b162937 diff --git a/tests/integration/tests/init-omit-packages/Main.hs b/tests/integration/tests/init-omit-packages/Main.hs index 41772717d1..b7005be29e 100644 --- a/tests/integration/tests/init-omit-packages/Main.hs +++ b/tests/integration/tests/init-omit-packages/Main.hs @@ -5,8 +5,8 @@ import System.IO (readFile) main :: IO () main = do removeFileIgnore "stack.yaml" - stackErr ["init", "--snapshot", "lts-24.24"] - stack ["init", "--snapshot", "lts-24.24", "--omit-packages"] + stackErr ["init", "--snapshot", "lts-24.37"] + stack ["init", "--snapshot", "lts-24.37", "--omit-packages"] contents <- lines <$> readFile "stack.yaml" unless ("#- bad" `elem` contents) $ error "commented out 'bad' package was expected" diff --git a/tests/integration/tests/lock-files/files/stack-1-extra b/tests/integration/tests/lock-files/files/stack-1-extra index f2c7953baf..ae06c97f29 100644 --- a/tests/integration/tests/lock-files/files/stack-1-extra +++ b/tests/integration/tests/lock-files/files/stack-1-extra @@ -1,3 +1,3 @@ -resolver: lts-24.24 +resolver: lts-24.37 extra-deps: - acme-cuteboy-0.1.0.0 diff --git a/tests/integration/tests/lock-files/files/stack-2-extras b/tests/integration/tests/lock-files/files/stack-2-extras index 4d71871e66..b397fcf570 100644 --- a/tests/integration/tests/lock-files/files/stack-2-extras +++ b/tests/integration/tests/lock-files/files/stack-2-extras @@ -1,4 +1,4 @@ -resolver: lts-24.24 +resolver: lts-24.37 extra-deps: - acme-cuteboy-0.1.0.0 - acme-dont-1.1 diff --git a/tests/integration/tests/module-added-multiple-times/files/stack.yaml b/tests/integration/tests/module-added-multiple-times/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/module-added-multiple-times/files/stack.yaml +++ b/tests/integration/tests/module-added-multiple-times/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/integration/tests/multi-test/files/stack.yaml b/tests/integration/tests/multi-test/files/stack.yaml index 4628a20c03..002c22aefd 100644 --- a/tests/integration/tests/multi-test/files/stack.yaml +++ b/tests/integration/tests/multi-test/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 packages: - . - sub-package diff --git a/tests/integration/tests/mutable-deps/files/stack.yaml b/tests/integration/tests/mutable-deps/files/stack.yaml index 96615000ff..e038f59be3 100644 --- a/tests/integration/tests/mutable-deps/files/stack.yaml +++ b/tests/integration/tests/mutable-deps/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 extra-deps: - ./filepath-1.5.4.0 # Required, otherwise Stack reports that GHC boot library has been pruned. diff --git a/tests/integration/tests/nice-resolver-names/Main.hs b/tests/integration/tests/nice-resolver-names/Main.hs index 3e472300a1..4dd15d734f 100644 --- a/tests/integration/tests/nice-resolver-names/Main.hs +++ b/tests/integration/tests/nice-resolver-names/Main.hs @@ -8,7 +8,7 @@ import Data.List (stripPrefix) main :: IO () main = do - for_ ["lts-20.26", "lts-24.24"] $ \snapshot -> do + for_ ["lts-20.26", "lts-24.37"] $ \snapshot -> do stack ["init", "--force", "--snapshot", snapshot] str <- readFile "stack.yaml" case mapMaybe (stripPrefix "snapshot: ") $ lines str of diff --git a/tests/integration/tests/upload/files/stack.yaml b/tests/integration/tests/upload/files/stack.yaml index a857811614..8fe9f02394 100644 --- a/tests/integration/tests/upload/files/stack.yaml +++ b/tests/integration/tests/upload/files/stack.yaml @@ -1,2 +1,2 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 hackage-base-url: http://localhost:12415/ diff --git a/tests/integration/tests/watched-files/files/stack.yaml b/tests/integration/tests/watched-files/files/stack.yaml index b54fd809bf..c292f63385 100644 --- a/tests/integration/tests/watched-files/files/stack.yaml +++ b/tests/integration/tests/watched-files/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.24 +snapshot: lts-24.37 diff --git a/tests/unit/Stack/ConfigSpec.hs b/tests/unit/Stack/ConfigSpec.hs index b64dce1df1..9bfe980c9b 100644 --- a/tests/unit/Stack/ConfigSpec.hs +++ b/tests/unit/Stack/ConfigSpec.hs @@ -53,12 +53,12 @@ import Test.Hspec sampleConfig :: String sampleConfig = - "snapshot: lts-24.24\n" ++ + "snapshot: lts-24.37\n" ++ "packages: ['.']\n" buildOptsConfig :: String buildOptsConfig = - "snapshot: lts-24.24\n" ++ + "snapshot: lts-24.37\n" ++ "packages: ['.']\n" ++ "build:\n" ++ " semaphore: true\n" ++ @@ -106,7 +106,7 @@ buildOptsConfig = buildOptsHaddockForHackageConfig :: String buildOptsHaddockForHackageConfig = - "snapshot: lts-24.24\n" ++ + "snapshot: lts-24.37\n" ++ "packages: ['.']\n" ++ "build:\n" ++ " haddock: true\n" ++ @@ -122,24 +122,24 @@ buildOptsHaddockForHackageConfig = hpackConfig :: String hpackConfig = - "snapshot: lts-24.24\n" ++ + "snapshot: lts-24.37\n" ++ "with-hpack: /usr/local/bin/hpack\n" ++ "packages: ['.']\n" resolverConfig :: String resolverConfig = - "resolver: lts-24.24\n" ++ + "resolver: lts-24.37\n" ++ "packages: ['.']\n" snapshotConfig :: String snapshotConfig = - "snapshot: lts-24.24\n" ++ + "snapshot: lts-24.37\n" ++ "packages: ['.']\n" resolverSnapshotConfig :: String resolverSnapshotConfig = - "resolver: lts-24.24\n" ++ - "snapshot: lts-24.24\n" ++ + "resolver: lts-24.37\n" ++ + "snapshot: lts-24.37\n" ++ "packages: ['.']\n" stackDotYaml :: Path Rel File @@ -189,11 +189,11 @@ spec = beforeAll setup $ do it "parses snapshot using 'resolver'" $ inTempDir $ do loadProject resolverConfig $ \project -> - project.snapshot `shouldBe` RSLSynonym (LTS 24 24) + project.snapshot `shouldBe` RSLSynonym (LTS 24 37) it "parses snapshot using 'snapshot'" $ inTempDir $ do loadProject snapshotConfig $ \project -> - project.snapshot `shouldBe` RSLSynonym (LTS 24 24) + project.snapshot `shouldBe` RSLSynonym (LTS 24 37) it "throws if both 'resolver' and 'snapshot' are present" $ inTempDir $ do loadProject resolverSnapshotConfig (const (pure ())) From 4ef034e879dcdde10c43f18deba351036c3252fd Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 19 Apr 2026 21:21:24 +0100 Subject: [PATCH 32/75] Re #6872 Prettier Stack.Build.ExecutePackage exceptions --- doc/maintainers/stack_errors.md | 4 +- src/Stack/Build/ExecutePackage.hs | 14 ++--- src/Stack/Types/Build/Exception.hs | 94 +++++++++++++++++++----------- 3 files changed, 69 insertions(+), 43 deletions(-) diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index 4c5ecbbb6f..46d162f6d4 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -350,8 +350,6 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-5797] | LocalPackageDoesn'tMatchTarget PackageName Version Version [S-3118] | NoSetupHsFound (Path Abs Dir) [S-4925] | InvalidGhcOptionsSpecification [PackageName] - [S-7987] | TestSuiteExeMissing Bool String String String - [S-8027] | CabalCopyFailed Bool String [S-5510] | LocalPackagesPresent [PackageIdentifier] [S-7168] | CouldNotLockDistDir (Path Abs File) [S-7868] | TaskCycleBug PackageIdentifier @@ -378,6 +376,8 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-1727] | NotOnlyLocal [PackageName] [Text] [S-6362] | CompilerVersionMismatch (Maybe (ActualCompiler, Arch)) (WantedCompiler, Arch) GHCVariant CompilerBuild VersionCheck WantedCompilerSetter Text [S-4660] | ActionNotFilteredBug StyleDoc + [S-7987] | TestSuiteExeMissing Bool String PackageName StackUnqualCompName + [S-8027] | CabalCopyFailed Bool BuildPrettyException ~~~ - `Stack.Types.Compiler.CompilerException` diff --git a/src/Stack/Build/ExecutePackage.hs b/src/Stack/Build/ExecutePackage.hs index 9ef4fc1a8a..903a647b77 100644 --- a/src/Stack/Build/ExecutePackage.hs +++ b/src/Stack/Build/ExecutePackage.hs @@ -644,9 +644,9 @@ realConfigAndBuild announce "copy/register" try (cabal KeepTHLoading $ "copy" : copyOpts) >>= \case Left err@CabalExitedUnsuccessfully{} -> - throwM $ CabalCopyFailed - (package.buildType == C.Simple) - (displayException err) + prettyThrowM $ CabalCopyFailed + (package.buildType == C.Simple) + err _ -> pure () when (hasLibrary || hasSubLibraries) $ cabal KeepTHLoading ["register"] @@ -1254,12 +1254,12 @@ singleTest topts testsToRun ac ee task installedMap = do else pure $ Map.singleton testName (Just ec) else do unless expectFailure $ - logError $ - fromString $ displayException $ TestSuiteExeMissing + prettyError $ + pretty $ TestSuiteExeMissing (package.buildType == C.Simple) exeName - (packageNameString package.name) - (unqualCompToString testName) + package.name + testName pure emptyResult when needHpc $ do diff --git a/src/Stack/Types/Build/Exception.hs b/src/Stack/Types/Build/Exception.hs index 77ef8d012b..86414bc52f 100644 --- a/src/Stack/Types/Build/Exception.hs +++ b/src/Stack/Types/Build/Exception.hs @@ -70,8 +70,6 @@ data BuildException Version -- version specified on command line | NoSetupHsFound (Path Abs Dir) | InvalidGhcOptionsSpecification [PackageName] - | TestSuiteExeMissing Bool String String String - | CabalCopyFailed Bool String | LocalPackagesPresent [PackageIdentifier] | CouldNotLockDistDir !(Path Abs File) | TaskCycleBug PackageIdentifier @@ -178,23 +176,6 @@ instance Exception BuildException where , packageNameString name , "' not found" ] - displayException (TestSuiteExeMissing isSimpleBuildType exeName pkgName' testName) = - missingExeError "[S-7987]" - isSimpleBuildType $ concat - [ "Test suite executable \"" - , exeName - , "\" not found for " - , pkgName' - , ":test:" - , testName - ] - displayException (CabalCopyFailed isSimpleBuildType innerMsg) = - missingExeError "[S-8027]" - isSimpleBuildType $ concat - [ "'cabal copy' failed. Error message:\n" - , innerMsg - , "\n" - ] displayException (LocalPackagesPresent locals) = unlines $ "Error: [S-5510]" : "Local packages are not allowed when using the 'script' command. \ @@ -266,6 +247,8 @@ data BuildPrettyException WantedCompilerSetter -- Way that the wanted compiler is set StyleDoc -- recommended resolution | ActionNotFilteredBug StyleDoc + | TestSuiteExeMissing !Bool !String !PackageName !StackUnqualCompName + | CabalCopyFailed !Bool !BuildPrettyException deriving Show instance Pretty BuildPrettyException where @@ -461,6 +444,29 @@ instance Pretty BuildPrettyException where , flow "is seeking to run an action that should have been filtered from \ \the list of actions." ] + pretty (TestSuiteExeMissing isSimpleBuildType exeName pkgName testName) = + missingExeError "[S-7987]" isSimpleBuildType $ + fillSep + [ flow "Test suite executable" + , style Shell (fromString exeName) + , flow "not found for" + , style PkgComponent pkgComponent <> "." + ] + <> line + where + pkgComponent = + fromString (packageNameString pkgName) + <> ":test:" + <> fromString (unqualCompToString testName) + pretty (CabalCopyFailed isSimpleBuildType err) = + missingExeError "[S-8027]" isSimpleBuildType $ + fillSep + [ style Shell "cabal copy" + , flow "failed. Error message:" + ] + <> line + <> pretty err + <> line instance Exception BuildPrettyException @@ -834,22 +840,42 @@ data BadDependency | BDDependencyCycleDetected ![PackageName] deriving (Eq, Ord, Show) -missingExeError :: String -> Bool -> String -> String -missingExeError errorCode isSimpleBuildType msg = unlines - $ "Error: " <> errorCode - : msg - : "Possible causes of this issue:" - : map ("* " <>) possibleCauses +missingExeError :: StyleDoc -> Bool -> StyleDoc -> StyleDoc +missingExeError errorCode isSimpleBuildType msg = + errorCode + <> line + <> msg + <> line + <> flow "Possible causes of this issue:" + <> line + <> bulletedList possibleCauses where - possibleCauses - = "No module named \"Main\". The 'main-is' source file should usually \ - \have a header indicating that it's a 'Main' module." - : "A Cabal file that refers to nonexistent other files (e.g. a \ - \license-file that doesn't exist). Running 'cabal check' may point \ - \out these issues." - : [ "The Setup.hs file is changing the installation target dir." - | not isSimpleBuildType - ] + possibleCauses = + [ fillSep + [ flow "No module named" + , style Shell "Main" <> "." + , "The" + , style Shell "main-is" + , flow "source file should usually have a header indicating that \ + \it's a" + , style Shell "Main" + , "module." + ] + , fillSep + [ flow "A Cabal file that refers to nonexistent other files (e.g. a" + , style Shell "license-file" + , flow "that doesn't exist). Running" + , style Shell "cabal check" + , flow "may point out these issues." + ] + ] + <> [ fillSep + [ "The" + , style File "Setup.hs" + , flow "file is changing the installation target directory." + ] + | not isSimpleBuildType + ] showBuildError :: String From 22d2793c2f3f3bc80864e05191206a0c4def3d00 Mon Sep 17 00:00:00 2001 From: David Vollbracht Date: Mon, 20 Apr 2026 16:53:41 -0500 Subject: [PATCH 33/75] Allows stack.yaml files to use !include directives This allows projects that maintain multiple `stack.yaml` files (e.g. for testing against multiple LTS versions) to reduce the duplication between them by using includes to share common parts. `!include` may also be used in `config.yaml` files. The use of `!include` interferes with the ability of the `config set` command to determine where to change a setting that has been read while parsing JSON, so thes makes `config set` raise error if `!include` appears in the file being updated. Fixes #6879 --- ChangeLog.md | 8 ++ doc/commands/config_command.md | 6 + doc/configure/yaml/include.md | 131 ++++++++++++++++++ doc/configure/yaml/index.md | 3 +- doc/maintainers/stack_errors.md | 1 + mkdocs.yml | 1 + src/Stack/Config.hs | 3 +- src/Stack/ConfigCmd.hs | 29 ++++ stack.cabal | 1 + .../tests/6879-stack-yaml-includes/Main.hs | 51 +++++++ .../files/app/Main.hs | 14 ++ .../files/config-flags.yaml | 2 + .../files/config-including-flags.yaml | 1 + .../files/files.cabal | 17 +++ .../files/stack-flags.yaml | 3 + .../stack-including-flags-with-newline.yaml | 3 + .../files/stack-including-flags.yaml | 2 + .../files/stack-not-including-flags.yaml | 1 + 18 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 doc/configure/yaml/include.md create mode 100644 tests/integration/tests/6879-stack-yaml-includes/Main.hs create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/config-flags.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/config-including-flags.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/files.cabal create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml diff --git a/ChangeLog.md b/ChangeLog.md index 8347d90786..1ad773a262 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -34,6 +34,14 @@ Other enhancements: * In YAML configuration files, the `recent-snapshots` key is introduced (under the `urls` key), to specify the URL used by Stack's `ls snapshots remote` command. +* In YAML configuration files (`stack.yaml` and `config.yaml`), the `!include` + YAML directive is now supported, allowing common configuration to be shared + across multiple files. For example, projects that maintain multiple + `stack.yaml` files for testing against different snapshots can use `!include` + to avoid duplicating shared settings. +* Stack's `config set` command now raises an error (message S-6088) if the + target configuration file contains `!include` directives, as the command + cannot safely modify such files. Bug fixes: diff --git a/doc/commands/config_command.md b/doc/commands/config_command.md index 1f676a1861..89a78a4a8b 100644 --- a/doc/commands/config_command.md +++ b/doc/commands/config_command.md @@ -87,6 +87,12 @@ to be set. See `stack config set` for the available keys. The `config set` commands support an existing key only in the form `key: value` on a single line. +!!! warning + + The `config set` commands cannot modify a configuration file that uses + [`!include`](../configure/yaml/include.md) directives. Stack will report an + error if it detects `!include` directives in the target configuration file. + ## The `stack config set install-ghc` command ~~~text diff --git a/doc/configure/yaml/include.md b/doc/configure/yaml/include.md new file mode 100644 index 0000000000..73ebd99f83 --- /dev/null +++ b/doc/configure/yaml/include.md @@ -0,0 +1,131 @@ +
+ +# The `!include` directive + +Stack's configuration files are in the [YAML](https://yaml.org/) format. Stack +supports a non-standard `!include` YAML directive that allows the content of +one YAML file to be included in another. The directive can be used in both +[project-level and global](index.md#project-level-and-global-configuration-files) +configuration files. + +The included file path is relative to the directory containing the file with the +`!include` directive. + +!!! warning + + The [`stack config set`](../../commands/config_command.md#the-stack-config-set-commands) + commands cannot modify a configuration file that uses `!include` directives. + +## Including a value + +A value for a key can be provided by an included file. For example, given a file +`snapshot.yaml` with the content: + +~~~yaml +lts-23.24 +~~~ + +the following project-level configuration file would use `lts-23.24` as the +snapshot: + +~~~yaml +snapshot: !include snapshot.yaml +packages: +- . +~~~ + +The included file replaces the `!include` directive with its content, so this is +equivalent to: + +~~~yaml +snapshot: lts-23.24 +packages: +- . +~~~ + +## Merging mappings + +YAML's merge key (`<<`) can be combined with `!include` to merge the content of +an included file into the current mapping. For example, given a file +`shared-config.yaml` with the content: + +~~~yaml +ghc-options: + "$everything": -Wall +flags: + my-package: + dev: true +~~~ + +the following project-level configuration file would merge those options: + +~~~yaml +snapshot: lts-23.24 +<<: !include shared-config.yaml +packages: +- . +~~~ + +This is equivalent to: + +~~~yaml +snapshot: lts-23.24 +ghc-options: + "$everything": -Wall +flags: + my-package: + dev: true +packages: +- . +~~~ + +The `!include` directive can also be placed on the line after the merge key: + +~~~yaml +snapshot: lts-23.24 +<<: + !include shared-config.yaml +packages: +- . +~~~ + +## Including list items + +The `!include` directive can also be used to include the contents of a file as a +list item. For example, given a file `extra-deps.yaml` with the content: + +~~~yaml +- acme-missiles-0.3 +- text-short-0.1.6 +~~~ + +the following would use those as extra dependencies: + +~~~yaml +snapshot: lts-23.24 +extra-deps: !include extra-deps.yaml +~~~ + +## Nested includes + +Included files can themselves contain `!include` directives, allowing for nested +composition of configuration. Stack detects and raises an error for cyclic +includes. + +## Use with global configuration + +The `!include` directive can also be used in the global configuration file +(`config.yaml`). For example, given a file `ghc-options.yaml` with the content: + +~~~yaml +ghc-options: + "$everything": -j4 +~~~ + +the global configuration file could include it: + +~~~yaml +<<: !include ghc-options.yaml +install-ghc: true +system-ghc: false +~~~ diff --git a/doc/configure/yaml/index.md b/doc/configure/yaml/index.md index 293bbd9492..c3fa48dd90 100644 --- a/doc/configure/yaml/index.md +++ b/doc/configure/yaml/index.md @@ -6,7 +6,8 @@ title: Configuration files # Configuration files Stack is configured by the content of files in the [YAML](https://yaml.org/) -format. +format. Stack also supports a non-standard [`!include` directive](include.md) +for composing configuration from multiple YAML files. ## Project-specific and non-project specific options diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index 46d162f6d4..96d38cb3a0 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -90,6 +90,7 @@ to take stock of the errors that Stack itself can raise, by reference to the ~~~haskell [S-3136] = NoProjectConfigAvailable + [S-6088] | ConfigFileContainsIncludes (Path Abs File) ~~~ - `Stack.Constants.ConstantsException` diff --git a/mkdocs.yml b/mkdocs.yml index aa4c274cb6..d1d726a342 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -100,6 +100,7 @@ nav: - configure/yaml/index.md - Project-specific configuration: configure/yaml/project.md - Non-project specific configuration: configure/yaml/non-project.md + - The !include directive: configure/yaml/include.md - Global flags and options: configure/global_flags.md - Customisation scripts: configure/customisation_scripts.md - Topics: diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 3da44541d7..151ec82e6a 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -55,6 +55,7 @@ import Data.Monoid.Map ( MonoidMap (..) ) import qualified Data.Set as Set import qualified Data.Text as T import qualified Data.Yaml as Yaml +import qualified Data.Yaml.Include as YamlInclude import qualified Distribution.PackageDescription as PD import Distribution.System ( Arch (..), OS (..), Platform (..), buildPlatform ) @@ -1216,7 +1217,7 @@ loadYaml :: -> Path Abs File -> RIO env (Either Yaml.ParseException a) loadYaml parser path = - liftIO (Yaml.decodeFileEither (toFilePath path)) >>= \case + liftIO (YamlInclude.decodeFileEither (toFilePath path)) >>= \case Left err -> pure (Left err) Right val -> case Yaml.parseEither parser val of diff --git a/src/Stack/ConfigCmd.hs b/src/Stack/ConfigCmd.hs index 1861d482da..4d3b1acfb9 100644 --- a/src/Stack/ConfigCmd.hs +++ b/src/Stack/ConfigCmd.hs @@ -19,6 +19,7 @@ module Stack.ConfigCmd , cfgCmdBuildFiles , cfgCmdBuildFilesName , cfgCmdName + , yamlContainsInclude ) where import qualified Data.Aeson.Key as Key @@ -65,12 +66,18 @@ import System.Environment ( getEnvironment ) -- "Stack.ConfigCmd" module. data ConfigCmdException = NoProjectConfigAvailable + | ConfigFileContainsIncludes !(Path Abs File) deriving Show instance Exception ConfigCmdException where displayException NoProjectConfigAvailable = "Error: [S-3136]\n" ++ "'config' command used when no project configuration available." + displayException (ConfigFileContainsIncludes configFile) = + "Error: [S-6088]\n" + ++ "The 'config set' command cannot modify a configuration file that \ + \uses !include directives: " + ++ toFilePath configFile -- | Function underlying Stack's @config set@ command. cfgCmdSet :: @@ -90,6 +97,8 @@ cfgCmdSet cmd = do -- maybe modify the ~/.stack/config.yaml file instead? CommandScopeGlobal -> pure conf.userGlobalConfigFile rawConfig <- liftIO (readFileUtf8 (toFilePath configFilePath)) + when (yamlContainsInclude rawConfig) $ + throwIO (ConfigFileContainsIncludes configFilePath) config <- either throwM pure (Yaml.decodeEither' $ encodeUtf8 rawConfig) newValue <- cfgCmdSetValue (parent configFilePath) cmd let yamlLines = T.lines rawConfig @@ -280,6 +289,26 @@ cfgCmdSetKeys (ConfigCmdSetRecommendStackUpgrade _ _) = cfgCmdSetKeys (ConfigCmdSetDownloadPrefix _ _) = [["package-index", "download-prefix"]] +-- | Check if YAML content contains a @!include@ directive in value position. +-- This covers both inline values (e.g. @key: !include path@) and values on +-- the next line after indentation. Stack config keys do not contain spaces or +-- colons, so the first @:@ is always the value separator. +yamlContainsInclude :: Text -> Bool +yamlContainsInclude = + let + lineContainsInclude yamlLine = + let stripped = T.stripStart yamlLine + in includeAsValue stripped || includeOnOwnLine stripped + + includeAsValue strippedLine = + let (_key, rest) = T.breakOn ":" strippedLine + in "!include" `T.isPrefixOf` (T.stripStart (T.drop 1 rest)) + + includeOnOwnLine strippedLine = + "!include" `T.isPrefixOf` strippedLine + in + any lineContainsInclude . T.lines + -- | The name of Stack's @config@ command. cfgCmdName :: String cfgCmdName = "config" diff --git a/stack.cabal b/stack.cabal index 4cfdc9f0b1..e32080aef3 100644 --- a/stack.cabal +++ b/stack.cabal @@ -82,6 +82,7 @@ extra-source-files: doc/configure/environment_variables.md doc/configure/global_flags.md doc/configure/index.md + doc/configure/yaml/include.md doc/configure/yaml/index.md doc/configure/yaml/non-project.md doc/configure/yaml/project.md diff --git a/tests/integration/tests/6879-stack-yaml-includes/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/Main.hs new file mode 100644 index 0000000000..28825edba2 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/Main.hs @@ -0,0 +1,51 @@ +import StackTest + +import Control.Monad (unless) +import Data.List (isInfixOf) +import System.Directory (getCurrentDirectory) +import System.Environment (setEnv) +import System.FilePath ( () ) + +main :: IO () +main = do + let + checkFor expected actual = + unless (expected == actual) $ + error ("expected " <> show expected <> "but got: " <> show actual) + + -- Check that includes in stack.yaml files are included + stackCheckStdout + ["--stack-yaml","stack-including-flags.yaml","run"] + (checkFor "TEST_FLAG was set\n") + + stackCheckStdout + ["--stack-yaml","stack-including-flags-with-newline.yaml","run"] + (checkFor "TEST_FLAG was set\n") + + stackCheckStdout + ["--stack-yaml","stack-not-including-flags.yaml","run"] + (checkFor "TEST_FLAG was not set\n") + + -- Check that includes in config.yaml files are included + currentDir <- getCurrentDirectory + setEnv "STACK_CONFIG" (currentDir "config-including-flags.yaml") + stackCheckStdout + ["--stack-yaml","stack-not-including-flags.yaml","run"] + (checkFor "TEST_FLAG was set\n") + + -- Check that 'config set' raises an error when applied to a stack.yaml file + -- that uses !include directives + stackErrStderr + ["--stack-yaml","stack-including-flags.yaml","config","set","snapshot","ghc-9.8.4"] + (expectMessage "!include") + + -- Check that 'config set' raises an error when applied to a stack.yaml file + -- that uses !include directives + stackErrStderr + ["--stack-yaml","stack-including-flags-with-newline.yaml","config","set","snapshot","ghc-9.8.4"] + (expectMessage "!include") + +expectMessage :: String -> String -> IO () +expectMessage msg stderr' = do + unless (msg `isInfixOf` stderr') + (error $ "Expected stderr to contain " ++ show msg ++ " but got:\n" ++ stderr') diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs new file mode 100644 index 0000000000..ad0614bb43 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE CPP #-} + +module Main + ( main + ) where + +main :: IO () +main = +#if TEST_FLAG + putStrLn "TEST_FLAG was set" +#else + putStrLn "TEST_FLAG was not set" +#endif + diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/config-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/config-flags.yaml new file mode 100644 index 0000000000..222ce796b8 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/config-flags.yaml @@ -0,0 +1,2 @@ +ghc-options: + "$everything": -DTEST_FLAG diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/config-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/config-including-flags.yaml new file mode 100644 index 0000000000..290a0eee8a --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/config-including-flags.yaml @@ -0,0 +1 @@ +<<: !include config-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal b/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal new file mode 100644 index 0000000000..6d61223142 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal @@ -0,0 +1,17 @@ +name: files +version: 0.1.0.0 +build-type: Simple +cabal-version: >=1.10 + +flag test-flag + description: Generate a compiler error for test purposes + default: False + manual: True + +executable test-exe + hs-source-dirs: app + main-is: Main.hs + build-depends: base >= 4.7 && < 5 + default-language: Haskell2010 + if flag(test-flag) + cpp-options: -DTEST_FLAG diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml new file mode 100644 index 0000000000..37b83239fd --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml @@ -0,0 +1,3 @@ +flags: + files: + test-flag: true diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml new file mode 100644 index 0000000000..897f5b3691 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml @@ -0,0 +1,3 @@ +snapshot: ghc-9.8.4 +<<: + !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml new file mode 100644 index 0000000000..96a0389d3b --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml @@ -0,0 +1,2 @@ +snapshot: ghc-9.8.4 +<<: !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml new file mode 100644 index 0000000000..f981bdbf6c --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.8.4 From bfba3168570cfd3910353c05e261550dac805ad4 Mon Sep 17 00:00:00 2001 From: David Vollbracht Date: Wed, 22 Apr 2026 09:32:20 -0500 Subject: [PATCH 34/75] Allows `config set` to update existing keys when `!include` is present This moves the check for `!include` when executing `config set` to after the detection of keys in the config so that values directly present in the file can be set even when `!include` is present. --- ChangeLog.md | 6 +++-- doc/commands/config_command.md | 8 ++++--- src/Stack/ConfigCmd.hs | 10 ++++---- .../tests/6879-stack-yaml-includes/Main.hs | 24 ++++++++++++------- .../files/install-ghc.yaml | 1 + ...stack-including-file-with-install-ghc.yaml | 2 ++ .../stack-including-flags-with-newline.yaml | 2 +- .../files/stack-including-flags.yaml | 2 +- .../files/stack-not-including-flags.yaml | 2 +- 9 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/install-ghc.yaml create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml diff --git a/ChangeLog.md b/ChangeLog.md index 1ad773a262..13c0cd660b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -40,8 +40,10 @@ Other enhancements: `stack.yaml` files for testing against different snapshots can use `!include` to avoid duplicating shared settings. * Stack's `config set` command now raises an error (message S-6088) if the - target configuration file contains `!include` directives, as the command - cannot safely modify such files. + target configuration file contains `!include` directives and the key being + set is not already present in the file, as appending a new key to such files + cannot be done safely. Existing keys can be modified even in files that use + `!include`. Bug fixes: diff --git a/doc/commands/config_command.md b/doc/commands/config_command.md index 89a78a4a8b..931f693c73 100644 --- a/doc/commands/config_command.md +++ b/doc/commands/config_command.md @@ -89,9 +89,11 @@ to be set. See `stack config set` for the available keys. !!! warning - The `config set` commands cannot modify a configuration file that uses - [`!include`](../configure/yaml/include.md) directives. Stack will report an - error if it detects `!include` directives in the target configuration file. + The `config set` commands cannot add a new key to a configuration file that + uses [`!include`](../configure/yaml/include.md) directives. Stack will report + an error if it detects `!include` directives in the target configuration file + and the key being set is not already present. Existing keys can be modified + even in files that use `!include`. ## The `stack config set install-ghc` command diff --git a/src/Stack/ConfigCmd.hs b/src/Stack/ConfigCmd.hs index 4d3b1acfb9..aa9809609c 100644 --- a/src/Stack/ConfigCmd.hs +++ b/src/Stack/ConfigCmd.hs @@ -75,8 +75,8 @@ instance Exception ConfigCmdException where ++ "'config' command used when no project configuration available." displayException (ConfigFileContainsIncludes configFile) = "Error: [S-6088]\n" - ++ "The 'config set' command cannot modify a configuration file that \ - \uses !include directives: " + ++ "The 'config set' command cannot add a new key to a configuration file \ + \that uses !include directives: " ++ toFilePath configFile -- | Function underlying Stack's @config set@ command. @@ -97,8 +97,6 @@ cfgCmdSet cmd = do -- maybe modify the ~/.stack/config.yaml file instead? CommandScopeGlobal -> pure conf.userGlobalConfigFile rawConfig <- liftIO (readFileUtf8 (toFilePath configFilePath)) - when (yamlContainsInclude rawConfig) $ - throwIO (ConfigFileContainsIncludes configFilePath) config <- either throwM pure (Yaml.decodeEither' $ encodeUtf8 rawConfig) newValue <- cfgCmdSetValue (parent configFilePath) cmd let yamlLines = T.lines rawConfig @@ -110,6 +108,8 @@ cfgCmdSet cmd = do primaryCmdKey = NE.last $ NE.head cmdKeys newYamlLines <- case hits of [] -> do + when (yamlContainsInclude rawConfig) $ + throwIO (ConfigFileContainsIncludes configFilePath) prettyInfoL [ pretty configFilePath , flow "has been extended." @@ -302,7 +302,7 @@ yamlContainsInclude = includeAsValue strippedLine = let (_key, rest) = T.breakOn ":" strippedLine - in "!include" `T.isPrefixOf` (T.stripStart (T.drop 1 rest)) + in "!include" `T.isPrefixOf` T.stripStart (T.drop 1 rest) includeOnOwnLine strippedLine = "!include" `T.isPrefixOf` strippedLine diff --git a/tests/integration/tests/6879-stack-yaml-includes/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/Main.hs index 28825edba2..a3fd361df7 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/Main.hs +++ b/tests/integration/tests/6879-stack-yaml-includes/Main.hs @@ -33,16 +33,22 @@ main = do ["--stack-yaml","stack-not-including-flags.yaml","run"] (checkFor "TEST_FLAG was set\n") - -- Check that 'config set' raises an error when applied to a stack.yaml file - -- that uses !include directives + -- Check that 'config set' succeeds when the key already exists in a + -- stack.yaml file that uses !include directives + stackCheckStderr + ["--stack-yaml","stack-including-flags.yaml","config","set","snapshot","lts-24.37"] + (expectMessage "already contained the intended configuration") + + -- Check that 'config set' succeeds when the key already exists in a + -- stack.yaml file that uses !include directives (with newline variant) + stackCheckStderr + ["--stack-yaml","stack-including-flags-with-newline.yaml","config","set","snapshot","lts-24.37"] + (expectMessage "already contained the intended configuration") + + -- Check that 'config set' raises an error when the key does not exist in a + -- stack.yaml file that uses !include directives stackErrStderr - ["--stack-yaml","stack-including-flags.yaml","config","set","snapshot","ghc-9.8.4"] - (expectMessage "!include") - - -- Check that 'config set' raises an error when applied to a stack.yaml file - -- that uses !include directives - stackErrStderr - ["--stack-yaml","stack-including-flags-with-newline.yaml","config","set","snapshot","ghc-9.8.4"] + ["--stack-yaml","stack-including-file-with-install-ghc.yaml","config","set","install-ghc","true"] (expectMessage "!include") expectMessage :: String -> String -> IO () diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/install-ghc.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/install-ghc.yaml new file mode 100644 index 0000000000..fd3953b239 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/install-ghc.yaml @@ -0,0 +1 @@ +install-ghc: true diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml new file mode 100644 index 0000000000..31d6e2f246 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml @@ -0,0 +1,2 @@ +snapshot: lts-24.37 +<<: !include install-ghc.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml index 897f5b3691..065a854323 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml @@ -1,3 +1,3 @@ -snapshot: ghc-9.8.4 +snapshot: lts-24.37 <<: !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml index 96a0389d3b..fecebb23af 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml @@ -1,2 +1,2 @@ -snapshot: ghc-9.8.4 +snapshot: lts-24.37 <<: !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml index f981bdbf6c..c292f63385 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml @@ -1 +1 @@ -snapshot: ghc-9.8.4 +snapshot: lts-24.37 From 59c37b67074e106bd91a9709048e52927e33c11c Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Wed, 22 Apr 2026 22:49:44 +0100 Subject: [PATCH 35/75] Fix 6879 integration test --- tests/integration/tests/6879-stack-yaml-includes/Main.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/tests/6879-stack-yaml-includes/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/Main.hs index a3fd361df7..2c692de132 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/Main.hs +++ b/tests/integration/tests/6879-stack-yaml-includes/Main.hs @@ -37,13 +37,13 @@ main = do -- stack.yaml file that uses !include directives stackCheckStderr ["--stack-yaml","stack-including-flags.yaml","config","set","snapshot","lts-24.37"] - (expectMessage "already contained the intended configuration") + (expectMessage "already") -- Check that 'config set' succeeds when the key already exists in a -- stack.yaml file that uses !include directives (with newline variant) stackCheckStderr ["--stack-yaml","stack-including-flags-with-newline.yaml","config","set","snapshot","lts-24.37"] - (expectMessage "already contained the intended configuration") + (expectMessage "already") -- Check that 'config set' raises an error when the key does not exist in a -- stack.yaml file that uses !include directives From 1f2944b46b27c614241fb88db03c309318e4122a Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 24 Apr 2026 00:23:58 +0100 Subject: [PATCH 36/75] Re #6879 Prettier Stack.ConfigCmd exceptions Also simplfies and conforms some online documentation. --- ChangeLog.md | 17 ++--- doc/configure/yaml/include.md | 110 ++++++++++++++------------------ doc/configure/yaml/index.md | 4 +- doc/maintainers/stack_errors.md | 4 +- src/Stack/ConfigCmd.hs | 58 ++++++++++------- 5 files changed, 93 insertions(+), 100 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 13c0cd660b..b516fa5fed 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -34,16 +34,13 @@ Other enhancements: * In YAML configuration files, the `recent-snapshots` key is introduced (under the `urls` key), to specify the URL used by Stack's `ls snapshots remote` command. -* In YAML configuration files (`stack.yaml` and `config.yaml`), the `!include` - YAML directive is now supported, allowing common configuration to be shared - across multiple files. For example, projects that maintain multiple - `stack.yaml` files for testing against different snapshots can use `!include` - to avoid duplicating shared settings. -* Stack's `config set` command now raises an error (message S-6088) if the - target configuration file contains `!include` directives and the key being - set is not already present in the file, as appending a new key to such files - cannot be done safely. Existing keys can be modified even in files that use - `!include`. +* In YAML configuration files (`stack.yaml` and `config.yaml`), an + `!include ` directive is now supported. This allows common + configuration to be shared across multiple files. For example, a project that + maintains multiple project-level configuration files for testing against + different snapshots can use `!include` to avoid duplicating shared settings. +* Stack's `config set` command raises an error if the target configuration file + excludes the key being set and includes an `!include` directive. Bug fixes: diff --git a/doc/configure/yaml/include.md b/doc/configure/yaml/include.md index 73ebd99f83..2e56c60f26 100644 --- a/doc/configure/yaml/include.md +++ b/doc/configure/yaml/include.md @@ -3,129 +3,115 @@ # The `!include` directive Stack's configuration files are in the [YAML](https://yaml.org/) format. Stack -supports a non-standard `!include` YAML directive that allows the content of -one YAML file to be included in another. The directive can be used in both +also supports the use of an `!include` local tag together with scalar content +that represents an absolute or relative path to another file. This provides a +directive that allows the content of one YAML file to be included in another. + +The directive can be used in both [project-level and global](index.md#project-level-and-global-configuration-files) configuration files. -The included file path is relative to the directory containing the file with the -`!include` directive. +!!! note + + An included relative file path is relative to the directory containing the + file with the `!include` directive. !!! warning The [`stack config set`](../../commands/config_command.md#the-stack-config-set-commands) - commands cannot modify a configuration file that uses `!include` directives. + commands cannot modify a configuration file that excludes the relevant key + and uses `!include` directives. ## Including a value A value for a key can be provided by an included file. For example, given a file -`snapshot.yaml` with the content: +`snapshot.yaml` in the project directory with the content: ~~~yaml -lts-23.24 +lts-24.37 ~~~ -the following project-level configuration file would use `lts-23.24` as the +the following project-level configuration file would use `lts-24.37` as the snapshot: ~~~yaml snapshot: !include snapshot.yaml -packages: -- . ~~~ The included file replaces the `!include` directive with its content, so this is equivalent to: ~~~yaml -snapshot: lts-23.24 -packages: -- . +snapshot: lts-24.37 +~~~ + +## Including a sequence + +The value provided by an included file is not limited to scalar content. It can +be a YAML sequence. For example, given a file `extra-deps.yaml` in the project +directory with the content: + +~~~yaml +- acme-missiles-0.3 +- text-short-0.1.6 +~~~ + +the following project-level configuration file would use those as extra-deps: + +~~~yaml +snapshot: lts-24.37 +extra-deps: !include extra-deps.yaml ~~~ ## Merging mappings -YAML's merge key (`<<`) can be combined with `!include` to merge the content of -an included file into the current mapping. For example, given a file -`shared-config.yaml` with the content: +YAML's merge key (`<<`) is used to indicate that all of the keys of one or more +specified mappings should be inserted into the current mapping. + +YAML's merge key can be combined with an `!include` directive to merge the +content of an included file into the current mapping. For example, given a file +`shared-config.yaml` in the project directory with the content: ~~~yaml ghc-options: "$everything": -Wall flags: my-package: - dev: true + my-flag: true ~~~ the following project-level configuration file would merge those options: ~~~yaml -snapshot: lts-23.24 +snapshot: lts-24.37 <<: !include shared-config.yaml -packages: -- . ~~~ This is equivalent to: ~~~yaml -snapshot: lts-23.24 +snapshot: lts-24.37 ghc-options: "$everything": -Wall flags: my-package: - dev: true -packages: -- . + my-flag: true ~~~ The `!include` directive can also be placed on the line after the merge key: ~~~yaml -snapshot: lts-23.24 +snapshot: lts-24.37 <<: !include shared-config.yaml -packages: -- . -~~~ - -## Including list items - -The `!include` directive can also be used to include the contents of a file as a -list item. For example, given a file `extra-deps.yaml` with the content: - -~~~yaml -- acme-missiles-0.3 -- text-short-0.1.6 -~~~ - -the following would use those as extra dependencies: - -~~~yaml -snapshot: lts-23.24 -extra-deps: !include extra-deps.yaml ~~~ ## Nested includes Included files can themselves contain `!include` directives, allowing for nested -composition of configuration. Stack detects and raises an error for cyclic -includes. +composition of configuration. -## Use with global configuration +!!! note -The `!include` directive can also be used in the global configuration file -(`config.yaml`). For example, given a file `ghc-options.yaml` with the content: - -~~~yaml -ghc-options: - "$everything": -j4 -~~~ - -the global configuration file could include it: - -~~~yaml -<<: !include ghc-options.yaml -install-ghc: true -system-ghc: false -~~~ + A file cannot include itself or a file that has already included the file. + Stack detects and raises an error for cyclic includes. diff --git a/doc/configure/yaml/index.md b/doc/configure/yaml/index.md index c3fa48dd90..0f9fae07b0 100644 --- a/doc/configure/yaml/index.md +++ b/doc/configure/yaml/index.md @@ -6,8 +6,8 @@ title: Configuration files # Configuration files Stack is configured by the content of files in the [YAML](https://yaml.org/) -format. Stack also supports a non-standard [`!include` directive](include.md) -for composing configuration from multiple YAML files. +format. Stack also supports an [`!include` directive](include.md) that allows a +configuration file to include the contents of another file. ## Project-specific and non-project specific options diff --git a/doc/maintainers/stack_errors.md b/doc/maintainers/stack_errors.md index 96d38cb3a0..ac3086639c 100644 --- a/doc/maintainers/stack_errors.md +++ b/doc/maintainers/stack_errors.md @@ -5,7 +5,7 @@ In connection with considering Stack's support of the [Haskell Error Index](https://errors.haskell.org/) initiative, this page seeks to take stock of the errors that Stack itself can raise, by reference to the -`master` branch of the Stack repository. Last updated: 2026-03-15. +`master` branch of the Stack repository. Last updated: 2026-04-24. * `Stack.main`: catches exceptions from action `commandLineHandler`. @@ -86,7 +86,7 @@ to take stock of the errors that Stack itself can raise, by reference to the [S-8605] | OnlyGHCSupported ~~~ - - `Stack.ConfigCmd.ConfigCmdException` + - `Stack.ConfigCmd.ConfigCmdPrettyException` ~~~haskell [S-3136] = NoProjectConfigAvailable diff --git a/src/Stack/ConfigCmd.hs b/src/Stack/ConfigCmd.hs index aa9809609c..b3f3fae468 100644 --- a/src/Stack/ConfigCmd.hs +++ b/src/Stack/ConfigCmd.hs @@ -62,22 +62,34 @@ import Stack.Types.Runner ( globalOptsL ) import Stack.Types.Snapshot ( AbstractSnapshot ) import System.Environment ( getEnvironment ) --- | Type repesenting exceptions thrown by functions exported by the +-- | Type repesenting \'pretty\' exceptions thrown by functions exported by the -- "Stack.ConfigCmd" module. -data ConfigCmdException +data ConfigCmdPrettyException = NoProjectConfigAvailable | ConfigFileContainsIncludes !(Path Abs File) deriving Show -instance Exception ConfigCmdException where - displayException NoProjectConfigAvailable = - "Error: [S-3136]\n" - ++ "'config' command used when no project configuration available." - displayException (ConfigFileContainsIncludes configFile) = - "Error: [S-6088]\n" - ++ "The 'config set' command cannot add a new key to a configuration file \ - \that uses !include directives: " - ++ toFilePath configFile +instance Pretty ConfigCmdPrettyException where + pretty NoProjectConfigAvailable = + "[S-3136]" + <> line + <> fillSep + [ style Shell "config" + , flow "command used when no project configuration available." + ] + pretty (ConfigFileContainsIncludes configFile) = + "[S-6088]" + <> line + <> fillSep + [ "The" + , style Shell "config set" + , flow "command cannot add a new key to a configuration file that uses" + , style Shell "!include" + , "directives:" + , pretty configFile + ] + +instance Exception ConfigCmdPrettyException -- | Function underlying Stack's @config set@ command. cfgCmdSet :: @@ -93,7 +105,7 @@ cfgCmdSet cmd = do case mstackYaml of PCProject stackYaml -> pure stackYaml PCGlobalProject -> getImplicitGlobalProjectDir <&> ( stackDotYaml) - PCNoProject _extraDeps -> throwIO NoProjectConfigAvailable + PCNoProject _extraDeps -> prettyThrowIO NoProjectConfigAvailable -- maybe modify the ~/.stack/config.yaml file instead? CommandScopeGlobal -> pure conf.userGlobalConfigFile rawConfig <- liftIO (readFileUtf8 (toFilePath configFilePath)) @@ -109,7 +121,7 @@ cfgCmdSet cmd = do newYamlLines <- case hits of [] -> do when (yamlContainsInclude rawConfig) $ - throwIO (ConfigFileContainsIncludes configFilePath) + prettyThrowIO (ConfigFileContainsIncludes configFilePath) prettyInfoL [ pretty configFilePath , flow "has been extended." @@ -295,19 +307,17 @@ cfgCmdSetKeys (ConfigCmdSetDownloadPrefix _ _) = -- colons, so the first @:@ is always the value separator. yamlContainsInclude :: Text -> Bool yamlContainsInclude = - let - lineContainsInclude yamlLine = - let stripped = T.stripStart yamlLine - in includeAsValue stripped || includeOnOwnLine stripped + let lineContainsInclude yamlLine = + let stripped = T.stripStart yamlLine + in includeAsValue stripped || includeOnOwnLine stripped - includeAsValue strippedLine = - let (_key, rest) = T.breakOn ":" strippedLine - in "!include" `T.isPrefixOf` T.stripStart (T.drop 1 rest) + includeAsValue strippedLine = + let (_key, rest) = T.breakOn ":" strippedLine + in "!include" `T.isPrefixOf` T.stripStart (T.drop 1 rest) - includeOnOwnLine strippedLine = - "!include" `T.isPrefixOf` strippedLine - in - any lineContainsInclude . T.lines + includeOnOwnLine strippedLine = + "!include" `T.isPrefixOf` strippedLine + in any lineContainsInclude . T.lines -- | The name of Stack's @config@ command. cfgCmdName :: String From b882989a2c6449a8dc56a84d41db45ae10bb4d8c Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 25 Apr 2026 22:07:55 +0100 Subject: [PATCH 37/75] Fix #6882 Update 3229-exe-targets integration test --- .../tests/3229-exe-targets/Main.hs | 42 ------------------- .../tests/3229-exe-targets/files/.gitignore | 1 - .../tests/3229-exe-targets/files/foo.cabal | 22 ---------- .../tests/6451-exe-targets/Main.hs | 22 ++++++++++ .../files/app/Alpha.hs | 0 .../files/app/Beta.hs | 0 .../tests/6451-exe-targets/files/package.yaml | 24 +++++++++++ .../files/src/Foo.hs | 0 .../tests/6451-exe-targets/files/stack.yaml | 1 + 9 files changed, 47 insertions(+), 65 deletions(-) delete mode 100644 tests/integration/tests/3229-exe-targets/Main.hs delete mode 100644 tests/integration/tests/3229-exe-targets/files/.gitignore delete mode 100644 tests/integration/tests/3229-exe-targets/files/foo.cabal create mode 100644 tests/integration/tests/6451-exe-targets/Main.hs rename tests/integration/tests/{3229-exe-targets => 6451-exe-targets}/files/app/Alpha.hs (100%) rename tests/integration/tests/{3229-exe-targets => 6451-exe-targets}/files/app/Beta.hs (100%) create mode 100644 tests/integration/tests/6451-exe-targets/files/package.yaml rename tests/integration/tests/{3229-exe-targets => 6451-exe-targets}/files/src/Foo.hs (100%) create mode 100644 tests/integration/tests/6451-exe-targets/files/stack.yaml diff --git a/tests/integration/tests/3229-exe-targets/Main.hs b/tests/integration/tests/3229-exe-targets/Main.hs deleted file mode 100644 index 0cc4674561..0000000000 --- a/tests/integration/tests/3229-exe-targets/Main.hs +++ /dev/null @@ -1,42 +0,0 @@ --- | Stack should build all executables once, and in subsequent --- invocations only build those executables requested by the program --- arguments. --- --- Issue: https://github.com/commercialhaskell/stack/issues/3229 - -module Main where - -import Control.Exception -import Control.Monad (unless, when) -import qualified Data.ByteString as S -import Data.List (isInfixOf) -import StackTest - -main :: IO () -main = do - removeDirIgnore ".stack-work" - removeFileIgnore "stack.yaml" - stack [defaultSnapshotArg, "init"] - stack ["build", ":alpha"] - bracket - (S.readFile alphaFile) - (S.writeFile alphaFile) - (const - (do appendFile alphaFile "\n--" - stackCheckStderr - ["build", ":alpha"] - (rejectMessage - (unlines - ["Preprocessing executable 'beta' for foo-0..."])))) - where - alphaFile = "app/Alpha.hs" - -expectMessage :: String -> String -> IO () -expectMessage msg stderr = - unless (msg `isInfixOf` stderr) - (error $ "Expected in output: \n" ++ show msg) - -rejectMessage :: String -> String -> IO () -rejectMessage msg stderr = - when (msg `isInfixOf` stderr) - (error $ "Did not expect message here: \n" ++ show msg) diff --git a/tests/integration/tests/3229-exe-targets/files/.gitignore b/tests/integration/tests/3229-exe-targets/files/.gitignore deleted file mode 100644 index 684dbffa96..0000000000 --- a/tests/integration/tests/3229-exe-targets/files/.gitignore +++ /dev/null @@ -1 +0,0 @@ -stack.yaml diff --git a/tests/integration/tests/3229-exe-targets/files/foo.cabal b/tests/integration/tests/3229-exe-targets/files/foo.cabal deleted file mode 100644 index 4a68648e6d..0000000000 --- a/tests/integration/tests/3229-exe-targets/files/foo.cabal +++ /dev/null @@ -1,22 +0,0 @@ -name: foo -version: 0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Foo - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -executable alpha - hs-source-dirs: app - main-is: Alpha.hs - build-depends: base, foo - default-language: Haskell2010 - -executable beta - hs-source-dirs: app - main-is: Beta.hs - build-depends: base, foo - default-language: Haskell2010 diff --git a/tests/integration/tests/6451-exe-targets/Main.hs b/tests/integration/tests/6451-exe-targets/Main.hs new file mode 100644 index 0000000000..b2c88b1b04 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/Main.hs @@ -0,0 +1,22 @@ +-- | Stack should build only those executables requested by the program +-- arguments. +-- +-- Issue: https://github.com/commercialhaskell/stack/issues/3229 is no longer +-- applicable. + +module Main where + +import Control.Monad ( when ) +import Data.List ( isInfixOf ) +import StackTest + +main :: IO () +main = do + stackCheckStderr + ["build", ":alpha"] + (rejectMessage (unlines ["Installing executable beta in"])) + +rejectMessage :: String -> String -> IO () +rejectMessage msg stderr = + when (msg `isInfixOf` stderr) + (error $ "Did not expect message here: \n" ++ show msg) diff --git a/tests/integration/tests/3229-exe-targets/files/app/Alpha.hs b/tests/integration/tests/6451-exe-targets/files/app/Alpha.hs similarity index 100% rename from tests/integration/tests/3229-exe-targets/files/app/Alpha.hs rename to tests/integration/tests/6451-exe-targets/files/app/Alpha.hs diff --git a/tests/integration/tests/3229-exe-targets/files/app/Beta.hs b/tests/integration/tests/6451-exe-targets/files/app/Beta.hs similarity index 100% rename from tests/integration/tests/3229-exe-targets/files/app/Beta.hs rename to tests/integration/tests/6451-exe-targets/files/app/Beta.hs diff --git a/tests/integration/tests/6451-exe-targets/files/package.yaml b/tests/integration/tests/6451-exe-targets/files/package.yaml new file mode 100644 index 0000000000..045c846203 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/package.yaml @@ -0,0 +1,24 @@ +spec-version: 0.36.0 + +name: foo +version: 0 + +dependencies: +- base >= 4.7 && < 5 + +library: + source-dirs: src + +executables: + alpha: + source-dirs: app + main: Alpha.hs + other-modules: [] + dependencies: + - foo + beta: + source-dirs: app + main: Beta.hs + other-modules: [] + dependencies: + - foo diff --git a/tests/integration/tests/3229-exe-targets/files/src/Foo.hs b/tests/integration/tests/6451-exe-targets/files/src/Foo.hs similarity index 100% rename from tests/integration/tests/3229-exe-targets/files/src/Foo.hs rename to tests/integration/tests/6451-exe-targets/files/src/Foo.hs diff --git a/tests/integration/tests/6451-exe-targets/files/stack.yaml b/tests/integration/tests/6451-exe-targets/files/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3 From e46a7ea57defb35c06072c71fbbdb2727a7b7b54 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 26 Apr 2026 00:48:06 +0100 Subject: [PATCH 38/75] Fix integration test 6451-exe-targets --- tests/integration/tests/6451-exe-targets/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/tests/6451-exe-targets/Main.hs b/tests/integration/tests/6451-exe-targets/Main.hs index b2c88b1b04..d57296fcf2 100644 --- a/tests/integration/tests/6451-exe-targets/Main.hs +++ b/tests/integration/tests/6451-exe-targets/Main.hs @@ -14,7 +14,7 @@ main :: IO () main = do stackCheckStderr ["build", ":alpha"] - (rejectMessage (unlines ["Installing executable beta in"])) + (rejectMessage "Installing executable beta in") rejectMessage :: String -> String -> IO () rejectMessage msg stderr = From cf0984a7fc4eb1e2ad63bb01a53c739e5c2875cc Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 26 Apr 2026 11:00:26 +0100 Subject: [PATCH 39/75] Update integration test 3996-sublib-not-depended-upon --- .../3996-sublib-not-depended-upon/.gitignore | 1 + .../tests/3996-sublib-not-depended-upon/Main.hs | 14 ++++++++------ .../files/files.cabal | 16 ---------------- .../files/package.yaml | 14 ++++++++++++++ .../files/src-internal/Internal.hs | 4 ++-- .../files/src-myPackage/MyPackage.hs | 4 ++++ .../files/src/Lib.hs | 4 ---- .../files/stack.yaml | 3 --- 8 files changed, 29 insertions(+), 31 deletions(-) create mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/.gitignore delete mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/files.cabal create mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml create mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs delete mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/.gitignore b/tests/integration/tests/3996-sublib-not-depended-upon/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3996-sublib-not-depended-upon/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/Main.hs b/tests/integration/tests/3996-sublib-not-depended-upon/Main.hs index d2479bd056..0ba51d1aea 100644 --- a/tests/integration/tests/3996-sublib-not-depended-upon/Main.hs +++ b/tests/integration/tests/3996-sublib-not-depended-upon/Main.hs @@ -1,8 +1,10 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack should build a package with a main library and an internal library (a +-- private named sublibrary) even if the main library does not depend on the +-- sublibrary. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3996 + +import StackTest main :: IO () -main = do - stack ["clean"] - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/files.cabal b/tests/integration/tests/3996-sublib-not-depended-upon/files/files.cabal deleted file mode 100644 index bf9a55bd17..0000000000 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/files.cabal +++ /dev/null @@ -1,16 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 2.0 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 - -library lib - hs-source-dirs: src-internal - exposed-modules: Internal - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml new file mode 100644 index 0000000000..346994bde2 --- /dev/null +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml @@ -0,0 +1,14 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src-myPackage + +internal-libraries: + internal: + source-dirs: src-internal diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs index 462baca786..cc2b013844 100644 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs @@ -1,4 +1,4 @@ module Internal where -test :: Int -test = 42 +internalFunc :: IO () +internalFunc = pure () diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs new file mode 100644 index 0000000000..986e664586 --- /dev/null +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs @@ -0,0 +1,4 @@ +module MyPackage where + +myPackageFunc :: IO () +myPackageFunc = pure () diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs deleted file mode 100644 index a35e444b85..0000000000 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Lib where - -testLib :: Int -testLib = 42 diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/stack.yaml b/tests/integration/tests/3996-sublib-not-depended-upon/files/stack.yaml index 01c7b866fc..e674eab75a 100644 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/stack.yaml +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/stack.yaml @@ -1,4 +1 @@ snapshot: ghc-9.10.3 -extra-deps: -- stm-2.4.4.1 -- mtl-2.2.1 From 9b83d044a355af7adb248d9fe33037a44de20de1 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 26 Apr 2026 21:26:33 +0100 Subject: [PATCH 40/75] Fix #6866 Add Stack's user agent to applyDigestAuth --- ChangeLog.md | 3 +++ doc/commands/upload_command.md | 9 --------- src/Network/HTTP/StackClient.hs | 24 ++++++++++++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index b516fa5fed..a27d78688b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -46,6 +46,9 @@ Bug fixes: * Stack's `dot` and `ls dependencies` commands no longer prune a package with dependencies only because all its direct dependencies are to be pruned. +* After March 2026, Hackage requires Stack's user agent to be set when applying + digest authentication to a request. Stack's `upload` command now does that, + re-establishing authentication by Hackage username and password. ## v3.9.3 - 2026-02-19 diff --git a/doc/commands/upload_command.md b/doc/commands/upload_command.md index fe3ff5ab0b..f9ab6d2a40 100644 --- a/doc/commands/upload_command.md +++ b/doc/commands/upload_command.md @@ -89,15 +89,6 @@ are ignored. [:octicons-tag-24: 2.3.1](https://github.com/commercialhaskell/stack/releases/tag/v2.3.1) -!!! warning - - After March 2026, Hackage requires Stack to add its user agent when applying - digest authentication to a request. Stack 3.9.3 and earlier do not do this. - Consequently, Stack's `upload` command is unable to submit digest - credentials and encounters an authentication failure when uploading to the - server. A work around is to use the - [`HACKAGE_KEY` environment variable](#the-hackage_key-environment-variable). - `stack upload` will request a Hackage username and password to authenticate. This can be avoided by setting the `HACKAGE_USERNAME` and `HACKAGE_PASSWORD` environment variables. For diff --git a/src/Network/HTTP/StackClient.hs b/src/Network/HTTP/StackClient.hs index fb894d2e96..2a6bc48b90 100644 --- a/src/Network/HTTP/StackClient.hs +++ b/src/Network/HTTP/StackClient.hs @@ -80,16 +80,16 @@ import qualified Data.Text as T import Data.Time.Clock ( NominalDiffTime, diffUTCTime, getCurrentTime ) import Network.HTTP.Client - ( HttpException (..), HttpExceptionContent (..), Request - , RequestBody (..), Response (..), checkResponse, getUri - , method, parseRequest, parseUrlThrow, path, requestBody + ( HttpException (..), HttpExceptionContent (..), Manager + , Request, RequestBody (..), Response (..), checkResponse + , getUri, method, parseRequest, parseUrlThrow, path + , requestBody ) import Network.HTTP.Client.MultipartFormData ( formDataBody, partBS, partFileRequestBody, partLBS ) import Network.HTTP.Client.TLS - ( applyDigestAuth, displayDigestAuthException - , getGlobalManager - ) + ( displayDigestAuthException, getGlobalManager ) +import qualified Network.HTTP.Client.TLS ( applyDigestAuth ) import Network.HTTP.Conduit ( requestHeaders ) import Network.HTTP.Download ( CheckHexDigest (..), DownloadRequest, HashCheck (..) @@ -306,3 +306,15 @@ chunksOverTime diff = do then put (currentTime, mempty) >> yield acc' else put (lastTime, acc') go + +-- | Like 'Network.HTTP.Client.TLS.applyDigestAuth' but sets the User-Agent +-- request header. +applyDigestAuth :: + (MonadIO m, MonadThrow n) + => Strict.ByteString + -> Strict.ByteString + -> Request + -> Manager + -> m (n Request) +applyDigestAuth user pass = + Network.HTTP.Client.TLS.applyDigestAuth user pass . setUserAgent From 4a2c00de586e45d226bf176acf2682842d761266 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 27 Apr 2026 22:38:33 +0100 Subject: [PATCH 41/75] Begin to review, document and conform integration tests --- .../tests/111-custom-snapshot/Main.hs | 5 ++ .../111-custom-snapshot/files/.gitignore | 1 + .../111-custom-snapshot/files/files.cabal | 10 ---- .../files/my-snapshot.yaml | 5 +- .../111-custom-snapshot/files/package.yaml | 11 +++++ .../111-custom-snapshot/files/src/Lib.hs | 9 ++-- .../tests/32-unlisted-module/Main.hs | 49 ++++++++++--------- .../tests/32-unlisted-module/files/.gitignore | 3 +- .../32-unlisted-module/files/app/Main.hs | 16 ++++++ .../files/app/Unlisted_FAIL.hs | 3 ++ .../files/app/Unlisted_OK.hs | 5 ++ .../32-unlisted-module/files/files.cabal | 17 ------- .../32-unlisted-module/files/package.yaml | 15 ++++++ .../32-unlisted-module/files/src/Main.hs | 16 ------ .../files/src/Unlisted_FAIL.hs | 5 -- .../files/src/Unlisted_OK.hs | 4 -- .../32-unlisted-module/files/src/main/Main.hs | 3 -- .../tests/335-multi-package-flags/Main.hs | 15 ++++-- .../335-multi-package-flags/files/.gitignore | 1 + .../files/new-template.cabal | 17 ------- .../files/package.yaml | 19 +++++++ .../335-multi-package-flags/files/src/Lib.hs | 6 +-- .../335-multi-package-flags/files/stack.yaml | 2 +- .../tests/345-override-bytestring/Main.hs | 11 +++-- .../345-override-bytestring/files/.gitignore | 1 + .../345-override-bytestring/files/Foo.hs | 4 -- .../345-override-bytestring/files/foo.cabal | 10 ---- .../files/package.yaml | 11 +++++ .../345-override-bytestring/files/src/Lib.hs | 3 ++ .../345-override-bytestring/files/stack.yaml | 7 +-- .../tests/365-invalid-success/Main.hs | 22 ++++++--- .../365-invalid-success/files/.gitignore | 3 +- .../files/new-template.cabal | 12 ----- .../365-invalid-success/files/package.yaml | 13 +++++ .../365-invalid-success/files/src/Lib_FAIL.hs | 11 +++++ .../365-invalid-success/files/src/Lib_OK.hs | 2 + .../365-invalid-success/files/stack.yaml | 2 +- .../tests/366-non-root-dir/Main.hs | 16 +++--- .../tests/366-non-root-dir/files/.gitignore | 1 + .../tests/366-non-root-dir/files/app/Main.hs | 2 + .../366-non-root-dir/files/new-template.cabal | 11 ----- .../tests/366-non-root-dir/files/package.yaml | 12 +++++ .../tests/366-non-root-dir/files/stack.yaml | 2 +- .../tests/370-invalid-setup-hs/Main.hs | 6 ++- .../370-invalid-setup-hs/files/.gitignore | 1 + .../tests/370-invalid-setup-hs/files/LICENSE | 30 ------------ .../tests/370-invalid-setup-hs/files/Setup.hs | 12 ++++- .../files/new-template.cabal | 18 ------- .../370-invalid-setup-hs/files/package.yaml | 10 ++++ .../370-invalid-setup-hs/files/src/Lib.hs | 7 +-- .../integration/tests/384-local-deps/Main.hs | 10 ++-- .../tests/384-local-deps/files/.gitignore | 2 + .../384-local-deps/files/dir1/dir1.cabal | 10 ---- .../384-local-deps/files/dir1/src/Lib.hs | 6 --- .../384-local-deps/files/dir2/dir2.cabal | 10 ---- .../384-local-deps/files/dir2/src/Lib.hs | 6 --- .../files/myPackageA/package.yaml | 10 ++++ .../files/myPackageA/src/Lib.hs | 1 + .../files/myPackageB/package.yaml | 11 +++++ .../files/myPackageB/src/Lib.hs | 1 + .../tests/397-case-insensitive-flags/Main.hs | 13 ++--- .../files/.gitignore | 1 + .../files/new-template.cabal | 18 ------- .../files/package.yaml | 19 +++++++ .../files/src/Lib.hs | 16 ++++-- .../files/stack.yaml | 2 +- .../tests/443-specify-path/.gitignore | 1 - .../tests/443-specify-path/Main.hs | 44 ++++++++--------- .../tests/443-specify-path/files/.gitignore | 5 ++ .../files/app/Main.hs | 2 +- .../tests/443-specify-path/files/package.yaml | 12 +++++ .../tests/443-specify-path/files/stack.yaml | 1 + 72 files changed, 356 insertions(+), 322 deletions(-) create mode 100644 tests/integration/tests/111-custom-snapshot/files/.gitignore delete mode 100644 tests/integration/tests/111-custom-snapshot/files/files.cabal create mode 100644 tests/integration/tests/111-custom-snapshot/files/package.yaml create mode 100644 tests/integration/tests/32-unlisted-module/files/app/Main.hs create mode 100644 tests/integration/tests/32-unlisted-module/files/app/Unlisted_FAIL.hs create mode 100644 tests/integration/tests/32-unlisted-module/files/app/Unlisted_OK.hs delete mode 100644 tests/integration/tests/32-unlisted-module/files/files.cabal create mode 100644 tests/integration/tests/32-unlisted-module/files/package.yaml delete mode 100644 tests/integration/tests/32-unlisted-module/files/src/Main.hs delete mode 100644 tests/integration/tests/32-unlisted-module/files/src/Unlisted_FAIL.hs delete mode 100644 tests/integration/tests/32-unlisted-module/files/src/Unlisted_OK.hs delete mode 100644 tests/integration/tests/32-unlisted-module/files/src/main/Main.hs create mode 100644 tests/integration/tests/335-multi-package-flags/files/.gitignore delete mode 100644 tests/integration/tests/335-multi-package-flags/files/new-template.cabal create mode 100644 tests/integration/tests/335-multi-package-flags/files/package.yaml create mode 100644 tests/integration/tests/345-override-bytestring/files/.gitignore delete mode 100644 tests/integration/tests/345-override-bytestring/files/Foo.hs delete mode 100644 tests/integration/tests/345-override-bytestring/files/foo.cabal create mode 100644 tests/integration/tests/345-override-bytestring/files/package.yaml create mode 100644 tests/integration/tests/345-override-bytestring/files/src/Lib.hs delete mode 100644 tests/integration/tests/365-invalid-success/files/new-template.cabal create mode 100644 tests/integration/tests/365-invalid-success/files/package.yaml create mode 100644 tests/integration/tests/365-invalid-success/files/src/Lib_FAIL.hs create mode 100644 tests/integration/tests/365-invalid-success/files/src/Lib_OK.hs create mode 100644 tests/integration/tests/366-non-root-dir/files/.gitignore delete mode 100644 tests/integration/tests/366-non-root-dir/files/new-template.cabal create mode 100644 tests/integration/tests/366-non-root-dir/files/package.yaml create mode 100644 tests/integration/tests/370-invalid-setup-hs/files/.gitignore delete mode 100644 tests/integration/tests/370-invalid-setup-hs/files/LICENSE delete mode 100644 tests/integration/tests/370-invalid-setup-hs/files/new-template.cabal create mode 100644 tests/integration/tests/370-invalid-setup-hs/files/package.yaml delete mode 100644 tests/integration/tests/384-local-deps/files/dir1/dir1.cabal delete mode 100644 tests/integration/tests/384-local-deps/files/dir1/src/Lib.hs delete mode 100644 tests/integration/tests/384-local-deps/files/dir2/dir2.cabal delete mode 100644 tests/integration/tests/384-local-deps/files/dir2/src/Lib.hs create mode 100644 tests/integration/tests/384-local-deps/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/384-local-deps/files/myPackageA/src/Lib.hs create mode 100644 tests/integration/tests/384-local-deps/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/384-local-deps/files/myPackageB/src/Lib.hs create mode 100644 tests/integration/tests/397-case-insensitive-flags/files/.gitignore delete mode 100644 tests/integration/tests/397-case-insensitive-flags/files/new-template.cabal create mode 100644 tests/integration/tests/397-case-insensitive-flags/files/package.yaml delete mode 100644 tests/integration/tests/443-specify-path/.gitignore create mode 100644 tests/integration/tests/443-specify-path/files/.gitignore rename tests/integration/tests/{365-invalid-success => 443-specify-path}/files/app/Main.hs (62%) create mode 100644 tests/integration/tests/443-specify-path/files/package.yaml create mode 100644 tests/integration/tests/443-specify-path/files/stack.yaml diff --git a/tests/integration/tests/111-custom-snapshot/Main.hs b/tests/integration/tests/111-custom-snapshot/Main.hs index e61b083aa4..9c6bfb055b 100644 --- a/tests/integration/tests/111-custom-snapshot/Main.hs +++ b/tests/integration/tests/111-custom-snapshot/Main.hs @@ -1,3 +1,8 @@ +-- Stack should build a package when a custom snapshot is specified in the +-- project-level configuration file. +-- +-- See: https://github.com/commercialhaskell/stack/issues/111 + import StackTest main :: IO () diff --git a/tests/integration/tests/111-custom-snapshot/files/.gitignore b/tests/integration/tests/111-custom-snapshot/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/111-custom-snapshot/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/111-custom-snapshot/files/files.cabal b/tests/integration/tests/111-custom-snapshot/files/files.cabal deleted file mode 100644 index 66525ce056..0000000000 --- a/tests/integration/tests/111-custom-snapshot/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, mtl - default-language: Haskell2010 diff --git a/tests/integration/tests/111-custom-snapshot/files/my-snapshot.yaml b/tests/integration/tests/111-custom-snapshot/files/my-snapshot.yaml index 8d13ffd0dc..9f6da9150c 100644 --- a/tests/integration/tests/111-custom-snapshot/files/my-snapshot.yaml +++ b/tests/integration/tests/111-custom-snapshot/files/my-snapshot.yaml @@ -1,4 +1,5 @@ -compiler: ghc-9.10.3 name: my-snapshot + +compiler: ghc-9.10.3 packages: -- mtl-2.3.1 +- acme-missiles-0.3 diff --git a/tests/integration/tests/111-custom-snapshot/files/package.yaml b/tests/integration/tests/111-custom-snapshot/files/package.yaml new file mode 100644 index 0000000000..cfbb4ddee5 --- /dev/null +++ b/tests/integration/tests/111-custom-snapshot/files/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base +- acme-missiles + +library: + source-dirs: src diff --git a/tests/integration/tests/111-custom-snapshot/files/src/Lib.hs b/tests/integration/tests/111-custom-snapshot/files/src/Lib.hs index 4844564d1b..3635ec4a52 100644 --- a/tests/integration/tests/111-custom-snapshot/files/src/Lib.hs +++ b/tests/integration/tests/111-custom-snapshot/files/src/Lib.hs @@ -1,8 +1,5 @@ module Lib - ( someFunc - ) where + ( launchMissiles + ) where -import Control.Monad.Reader () - -someFunc :: IO () -someFunc = putStrLn "someFunc" +import Acme.Missiles ( launchMissiles ) diff --git a/tests/integration/tests/32-unlisted-module/Main.hs b/tests/integration/tests/32-unlisted-module/Main.hs index 1559b530c7..bc0feae92f 100644 --- a/tests/integration/tests/32-unlisted-module/Main.hs +++ b/tests/integration/tests/32-unlisted-module/Main.hs @@ -1,25 +1,30 @@ -import Control.Concurrent -import StackTest +-- Stack should rebuild a package when files required for building are dirty, +-- even if the files are not listed in the package's Cabal file. +-- +-- See: https://github.com/commercialhaskell/stack/issues/32 + +import Control.Concurrent ( threadDelay ) +import StackTest main :: IO () main = do - copy "src/Unlisted_OK.hs" "src/Unlisted.hs" - copy "embed_OK.txt" "embed.txt" - stack ["build"] - pause - copy "src/Unlisted_FAIL.hs" "src/Unlisted.hs" - stackErr ["build"] - pause - copy "src/Unlisted_OK.hs" "src/Unlisted.hs" - stack ["build"] - stack ["exec", "files-exe"] - pause - copy "embed_FAIL.txt" "embed.txt" - stack ["build"] - stackErr ["exec", "files-exe"] - pause - copy "embed_OK.txt" "embed.txt" - stack ["build"] - stack ["exec", "files-exe"] - -pause = threadDelay 1000000 + copy "app/Unlisted_OK.hs" "app/Unlisted.hs" + copy "embed_OK.txt" "embed.txt" + stack ["build"] + pause + copy "app/Unlisted_FAIL.hs" "app/Unlisted.hs" + stackErr ["build"] + pause + copy "app/Unlisted_OK.hs" "app/Unlisted.hs" + stack ["build"] + stack ["exec", "fail-if-fail"] + pause + copy "embed_FAIL.txt" "embed.txt" + stack ["build"] + stackErr ["exec", "fail-if-fail"] + pause + copy "embed_OK.txt" "embed.txt" + stack ["build"] + stack ["exec", "fail-if-fail"] + where + pause = threadDelay 1000000 diff --git a/tests/integration/tests/32-unlisted-module/files/.gitignore b/tests/integration/tests/32-unlisted-module/files/.gitignore index 6c87a5ea83..5983ce17cb 100644 --- a/tests/integration/tests/32-unlisted-module/files/.gitignore +++ b/tests/integration/tests/32-unlisted-module/files/.gitignore @@ -1,2 +1,3 @@ embed.txt -src/Unlisted.hs +app/Unlisted.hs +myPackage.cabal diff --git a/tests/integration/tests/32-unlisted-module/files/app/Main.hs b/tests/integration/tests/32-unlisted-module/files/app/Main.hs new file mode 100644 index 0000000000..6328508c11 --- /dev/null +++ b/tests/integration/tests/32-unlisted-module/files/app/Main.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import Control.Monad ( when ) +import qualified Data.ByteString.Char8 as C8 +import Data.FileEmbed ( embedFile ) +import Unlisted ( unlistedFunc ) + +main :: IO () +main = do + unlistedFunc + when ("FAIL" `C8.isPrefixOf` embedded) $ error "embedded contains FAIL" + +embedded = $(embedFile "embed.txt") diff --git a/tests/integration/tests/32-unlisted-module/files/app/Unlisted_FAIL.hs b/tests/integration/tests/32-unlisted-module/files/app/Unlisted_FAIL.hs new file mode 100644 index 0000000000..35b46d7b50 --- /dev/null +++ b/tests/integration/tests/32-unlisted-module/files/app/Unlisted_FAIL.hs @@ -0,0 +1,3 @@ +-- | Version of Unlisted with a different export that causes Main to fail to +-- compile. +module Unlisted where diff --git a/tests/integration/tests/32-unlisted-module/files/app/Unlisted_OK.hs b/tests/integration/tests/32-unlisted-module/files/app/Unlisted_OK.hs new file mode 100644 index 0000000000..000f75684c --- /dev/null +++ b/tests/integration/tests/32-unlisted-module/files/app/Unlisted_OK.hs @@ -0,0 +1,5 @@ +-- | Version of Unlisted that does not cause Main to fail to compile. +module Unlisted where + +unlistedFunc :: IO () +unlistedFunc = pure () diff --git a/tests/integration/tests/32-unlisted-module/files/files.cabal b/tests/integration/tests/32-unlisted-module/files/files.cabal deleted file mode 100644 index b789af591e..0000000000 --- a/tests/integration/tests/32-unlisted-module/files/files.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: files -version: 0.1.0.0 -synopsis: Initial project template from stack -description: Please see README.md -homepage: http://github.com/githubuser/files#readme -license: BSD3 -build-type: Simple --- extra-source-files: -cabal-version: >=1.10 - -executable files-exe - hs-source-dirs: src/../src - main-is: Main.hs - build-depends: base >= 4.7 && < 5 - , bytestring - , file-embed - default-language: Haskell2010 diff --git a/tests/integration/tests/32-unlisted-module/files/package.yaml b/tests/integration/tests/32-unlisted-module/files/package.yaml new file mode 100644 index 0000000000..52873f9fd5 --- /dev/null +++ b/tests/integration/tests/32-unlisted-module/files/package.yaml @@ -0,0 +1,15 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base +- bytestring +- file-embed + +executables: + fail-if-fail: + source-dirs: app + main: Main.hs + other-modules: [] diff --git a/tests/integration/tests/32-unlisted-module/files/src/Main.hs b/tests/integration/tests/32-unlisted-module/files/src/Main.hs deleted file mode 100644 index dde0892cc5..0000000000 --- a/tests/integration/tests/32-unlisted-module/files/src/Main.hs +++ /dev/null @@ -1,16 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE OverloadedStrings #-} -module Main where - -import Control.Monad -import qualified Data.ByteString.Char8 as C8 -import Data.FileEmbed -import Data.List -import Unlisted - -main :: IO () -main = do - putStrLn ("main " ++ show foo ++ " " ++ show embedded) - when ("FAIL" `C8.isPrefixOf` embedded) $ error "embedded contains FAIL" - -embedded = $(embedFile "embed.txt") diff --git a/tests/integration/tests/32-unlisted-module/files/src/Unlisted_FAIL.hs b/tests/integration/tests/32-unlisted-module/files/src/Unlisted_FAIL.hs deleted file mode 100644 index b15130820b..0000000000 --- a/tests/integration/tests/32-unlisted-module/files/src/Unlisted_FAIL.hs +++ /dev/null @@ -1,5 +0,0 @@ --- | Version of Unlisted with different export that causes failure to compile. -module Unlisted where - -fooRenamed :: String -fooRenamed = "foo" diff --git a/tests/integration/tests/32-unlisted-module/files/src/Unlisted_OK.hs b/tests/integration/tests/32-unlisted-module/files/src/Unlisted_OK.hs deleted file mode 100644 index 73caa00bcc..0000000000 --- a/tests/integration/tests/32-unlisted-module/files/src/Unlisted_OK.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Unlisted where - -foo :: String -foo = "foo" diff --git a/tests/integration/tests/32-unlisted-module/files/src/main/Main.hs b/tests/integration/tests/32-unlisted-module/files/src/main/Main.hs deleted file mode 100644 index b768742deb..0000000000 --- a/tests/integration/tests/32-unlisted-module/files/src/main/Main.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Main where - -main = do putStrLn "Hello, world." diff --git a/tests/integration/tests/335-multi-package-flags/Main.hs b/tests/integration/tests/335-multi-package-flags/Main.hs index e9ff7fa6ac..4e6aa05311 100644 --- a/tests/integration/tests/335-multi-package-flags/Main.hs +++ b/tests/integration/tests/335-multi-package-flags/Main.hs @@ -1,8 +1,13 @@ -import StackTest +-- Stack should be able to specify Cabal flags for all packages that have a +-- Cabal flag of the same name. +-- +-- See: https://github.com/commercialhaskell/stack/issues/335 + +import StackTest main :: IO () main = do - stackErr ["build"] - stack ["build", "--flag", "new-template:necessary"] - stackErr ["build"] - stack ["build", "--flag", "*:necessary"] + stackErr ["build"] + stack ["build", "--flag", "myPackage:necessary"] + stackErr ["build"] + stack ["build", "--flag", "*:necessary"] diff --git a/tests/integration/tests/335-multi-package-flags/files/.gitignore b/tests/integration/tests/335-multi-package-flags/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/335-multi-package-flags/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/335-multi-package-flags/files/new-template.cabal b/tests/integration/tests/335-multi-package-flags/files/new-template.cabal deleted file mode 100644 index 50876be0ce..0000000000 --- a/tests/integration/tests/335-multi-package-flags/files/new-template.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: new-template -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -flag necessary - manual: True - default: False - description: Won't build without this flag on - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 - if flag(necessary) - cpp-options: -DWORK diff --git a/tests/integration/tests/335-multi-package-flags/files/package.yaml b/tests/integration/tests/335-multi-package-flags/files/package.yaml new file mode 100644 index 0000000000..273e2086bd --- /dev/null +++ b/tests/integration/tests/335-multi-package-flags/files/package.yaml @@ -0,0 +1,19 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +flags: + necessary: + description: The package will not build unless this flag is true. + manual: true + default: false + +dependencies: +- base + +library: + source-dirs: src + when: + - condition: flag(necessary) + cpp-options: -DWORK diff --git a/tests/integration/tests/335-multi-package-flags/files/src/Lib.hs b/tests/integration/tests/335-multi-package-flags/files/src/Lib.hs index 12a75ea899..eccdf60245 100644 --- a/tests/integration/tests/335-multi-package-flags/files/src/Lib.hs +++ b/tests/integration/tests/335-multi-package-flags/files/src/Lib.hs @@ -1,10 +1,6 @@ {-# LANGUAGE CPP #-} -module Lib - ( someFunc - ) where -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where -- Avoid problems with CPP and HLint #ifndef __HLINT__ diff --git a/tests/integration/tests/335-multi-package-flags/files/stack.yaml b/tests/integration/tests/335-multi-package-flags/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/335-multi-package-flags/files/stack.yaml +++ b/tests/integration/tests/335-multi-package-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/345-override-bytestring/Main.hs b/tests/integration/tests/345-override-bytestring/Main.hs index 248a59a3df..1e1d847024 100644 --- a/tests/integration/tests/345-override-bytestring/Main.hs +++ b/tests/integration/tests/345-override-bytestring/Main.hs @@ -1,6 +1,9 @@ -import StackTest +-- An extra-dep in a project-level configuration file should be able to shadow a +-- GHC boot package such as bytestring. +-- +-- See: https://github.com/commercialhaskell/stack/issues/345 + +import StackTest main :: IO () -main = do - stack ["build", "--dry-run"] -- for useful error output - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/345-override-bytestring/files/.gitignore b/tests/integration/tests/345-override-bytestring/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/345-override-bytestring/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/345-override-bytestring/files/Foo.hs b/tests/integration/tests/345-override-bytestring/files/Foo.hs deleted file mode 100644 index d282cc6fb6..0000000000 --- a/tests/integration/tests/345-override-bytestring/files/Foo.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Foo where - -import Data.Binary () -import Data.ByteString () diff --git a/tests/integration/tests/345-override-bytestring/files/foo.cabal b/tests/integration/tests/345-override-bytestring/files/foo.cabal deleted file mode 100644 index 4c23cac18d..0000000000 --- a/tests/integration/tests/345-override-bytestring/files/foo.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: foo -version: 0.0.0 -synopsis: foo -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Foo - build-depends: base, bytestring, binary - default-language: Haskell2010 diff --git a/tests/integration/tests/345-override-bytestring/files/package.yaml b/tests/integration/tests/345-override-bytestring/files/package.yaml new file mode 100644 index 0000000000..a68b5080c9 --- /dev/null +++ b/tests/integration/tests/345-override-bytestring/files/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base +- bytestring + +library: + source-dirs: src diff --git a/tests/integration/tests/345-override-bytestring/files/src/Lib.hs b/tests/integration/tests/345-override-bytestring/files/src/Lib.hs new file mode 100644 index 0000000000..c06ea6cd1f --- /dev/null +++ b/tests/integration/tests/345-override-bytestring/files/src/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +import Data.ByteString () diff --git a/tests/integration/tests/345-override-bytestring/files/stack.yaml b/tests/integration/tests/345-override-bytestring/files/stack.yaml index d3f612f00e..8d391e6d16 100644 --- a/tests/integration/tests/345-override-bytestring/files/stack.yaml +++ b/tests/integration/tests/345-override-bytestring/files/stack.yaml @@ -1,4 +1,5 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + extra-deps: -- bytestring-0.11.5.4 -- binary-0.8.9.0 +# GHC 9.10.3 comes with bytestring-0.12.2.0 +- bytestring-0.12.1.0 diff --git a/tests/integration/tests/365-invalid-success/Main.hs b/tests/integration/tests/365-invalid-success/Main.hs index b978282dd4..64a1e640a0 100644 --- a/tests/integration/tests/365-invalid-success/Main.hs +++ b/tests/integration/tests/365-invalid-success/Main.hs @@ -1,11 +1,17 @@ -import StackTest +-- If Stack fails to build a package once, it should fail to build it +-- (unchanged) a second time. +-- +-- See: https://github.com/commercialhaskell/stack/issues/365 + +import StackTest main :: IO () main = do - stackErr ["build"] - stackErr ["build"] - writeFile "app/Foo.hs" "module Foo where" - stack ["build"] - writeFile "app/Foo.hs" "module Foo wher e" - stackErr ["build"] - stackErr ["build"] + copy "src/Lib_FAIL.hs" "src/Lib.hs" + stackErr ["build"] + stackErr ["build"] + copy "src/Lib_OK.hs" "src/Lib.hs" + stack ["build"] + copy "src/Lib_FAIL.hs" "src/Lib.hs" + stackErr ["build"] + stackErr ["build"] diff --git a/tests/integration/tests/365-invalid-success/files/.gitignore b/tests/integration/tests/365-invalid-success/files/.gitignore index 8fec4903f5..bf0c94dd4e 100644 --- a/tests/integration/tests/365-invalid-success/files/.gitignore +++ b/tests/integration/tests/365-invalid-success/files/.gitignore @@ -1 +1,2 @@ -app/Foo.hs +src/Lib.hs +myPackage.cabal diff --git a/tests/integration/tests/365-invalid-success/files/new-template.cabal b/tests/integration/tests/365-invalid-success/files/new-template.cabal deleted file mode 100644 index 6ab719dc58..0000000000 --- a/tests/integration/tests/365-invalid-success/files/new-template.cabal +++ /dev/null @@ -1,12 +0,0 @@ -name: new-template -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable new-template-exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 - other-modules: Foo diff --git a/tests/integration/tests/365-invalid-success/files/package.yaml b/tests/integration/tests/365-invalid-success/files/package.yaml new file mode 100644 index 0000000000..2760d9419f --- /dev/null +++ b/tests/integration/tests/365-invalid-success/files/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + exposed-modules: + - Lib + other-modules: [] diff --git a/tests/integration/tests/365-invalid-success/files/src/Lib_FAIL.hs b/tests/integration/tests/365-invalid-success/files/src/Lib_FAIL.hs new file mode 100644 index 0000000000..764550ce44 --- /dev/null +++ b/tests/integration/tests/365-invalid-success/files/src/Lib_FAIL.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE CPP #-} + +-- | Version of Lib that does not compile. +module Lib where + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#error Not going to compile, sorry + +#endif diff --git a/tests/integration/tests/365-invalid-success/files/src/Lib_OK.hs b/tests/integration/tests/365-invalid-success/files/src/Lib_OK.hs new file mode 100644 index 0000000000..8745d54bd6 --- /dev/null +++ b/tests/integration/tests/365-invalid-success/files/src/Lib_OK.hs @@ -0,0 +1,2 @@ +-- | Version of Lib that does compile. +module Lib where diff --git a/tests/integration/tests/365-invalid-success/files/stack.yaml b/tests/integration/tests/365-invalid-success/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/365-invalid-success/files/stack.yaml +++ b/tests/integration/tests/365-invalid-success/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/366-non-root-dir/Main.hs b/tests/integration/tests/366-non-root-dir/Main.hs index f1dd62cefb..a09cf86b64 100644 --- a/tests/integration/tests/366-non-root-dir/Main.hs +++ b/tests/integration/tests/366-non-root-dir/Main.hs @@ -1,10 +1,12 @@ -import StackTest -import System.Directory +-- Stack builds when commanded from a subdirectory of the project directory. +-- +-- See: https://github.com/commercialhaskell/stack/issues/366 + +import StackTest +import System.Directory ( setCurrentDirectory ) main :: IO () main = do - removeDirIgnore ".stack-work" - stackErr ["exec", "hello-world"] - setCurrentDirectory "app" - stack ["build"] - stack ["exec", "hello-world"] + setCurrentDirectory "app" + stack ["build"] + stack ["exec", "myPackage"] diff --git a/tests/integration/tests/366-non-root-dir/files/.gitignore b/tests/integration/tests/366-non-root-dir/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/366-non-root-dir/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/366-non-root-dir/files/app/Main.hs b/tests/integration/tests/366-non-root-dir/files/app/Main.hs index d582e1e36a..89ad4b3e08 100644 --- a/tests/integration/tests/366-non-root-dir/files/app/Main.hs +++ b/tests/integration/tests/366-non-root-dir/files/app/Main.hs @@ -1,2 +1,4 @@ +module Main where + main :: IO () main = pure () diff --git a/tests/integration/tests/366-non-root-dir/files/new-template.cabal b/tests/integration/tests/366-non-root-dir/files/new-template.cabal deleted file mode 100644 index 1ce3458647..0000000000 --- a/tests/integration/tests/366-non-root-dir/files/new-template.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: new-template -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable hello-world - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/366-non-root-dir/files/package.yaml b/tests/integration/tests/366-non-root-dir/files/package.yaml new file mode 100644 index 0000000000..113821465d --- /dev/null +++ b/tests/integration/tests/366-non-root-dir/files/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/366-non-root-dir/files/stack.yaml b/tests/integration/tests/366-non-root-dir/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/366-non-root-dir/files/stack.yaml +++ b/tests/integration/tests/366-non-root-dir/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/370-invalid-setup-hs/Main.hs b/tests/integration/tests/370-invalid-setup-hs/Main.hs index e61b083aa4..08d1440472 100644 --- a/tests/integration/tests/370-invalid-setup-hs/Main.hs +++ b/tests/integration/tests/370-invalid-setup-hs/Main.hs @@ -1,4 +1,8 @@ -import StackTest +-- Stack ignores a package's Setup.hs file when the Cabal build type is Simple. +-- +-- See: https://github.com/commercialhaskell/stack/issues/370 + +import StackTest main :: IO () main = stack ["build"] diff --git a/tests/integration/tests/370-invalid-setup-hs/files/.gitignore b/tests/integration/tests/370-invalid-setup-hs/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/370-invalid-setup-hs/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/370-invalid-setup-hs/files/LICENSE b/tests/integration/tests/370-invalid-setup-hs/files/LICENSE deleted file mode 100644 index d05408d876..0000000000 --- a/tests/integration/tests/370-invalid-setup-hs/files/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2000 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Your name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/integration/tests/370-invalid-setup-hs/files/Setup.hs b/tests/integration/tests/370-invalid-setup-hs/files/Setup.hs index 4b147db695..58838f89a6 100644 --- a/tests/integration/tests/370-invalid-setup-hs/files/Setup.hs +++ b/tests/integration/tests/370-invalid-setup-hs/files/Setup.hs @@ -1,2 +1,10 @@ -import Distribution.Make (defaultMain) -main = defaultMain +{-# LANGUAGE CPP #-} + +-- A bogus Setup.hs file that does not compile + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#error Not going to compile, sorry + +#endif diff --git a/tests/integration/tests/370-invalid-setup-hs/files/new-template.cabal b/tests/integration/tests/370-invalid-setup-hs/files/new-template.cabal deleted file mode 100644 index 7306959dcc..0000000000 --- a/tests/integration/tests/370-invalid-setup-hs/files/new-template.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: new-template -version: 0.1.0.0 -synopsis: Initial project template from stack -description: Please see README.md -homepage: http://github.com/name/project -license: BSD3 -license-file: LICENSE -author: Your name here -maintainer: your.address@example.com -category: Web -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/370-invalid-setup-hs/files/package.yaml b/tests/integration/tests/370-invalid-setup-hs/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/370-invalid-setup-hs/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/370-invalid-setup-hs/files/src/Lib.hs b/tests/integration/tests/370-invalid-setup-hs/files/src/Lib.hs index d36ff2714d..6d85a26fe1 100644 --- a/tests/integration/tests/370-invalid-setup-hs/files/src/Lib.hs +++ b/tests/integration/tests/370-invalid-setup-hs/files/src/Lib.hs @@ -1,6 +1 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where diff --git a/tests/integration/tests/384-local-deps/Main.hs b/tests/integration/tests/384-local-deps/Main.hs index f226e5f577..bf08823e28 100644 --- a/tests/integration/tests/384-local-deps/Main.hs +++ b/tests/integration/tests/384-local-deps/Main.hs @@ -1,7 +1,11 @@ +-- Stack can initialise a multi-project package where one project package +-- depends on another project package. +-- +-- See: https://github.com/commercialhaskell/stack/issues/384 + import StackTest main :: IO () main = do - removeFileIgnore "stack.yaml" - stack ["init", defaultSnapshotArg] - stack ["test"] + stack ["init"] + stack ["build"] diff --git a/tests/integration/tests/384-local-deps/files/.gitignore b/tests/integration/tests/384-local-deps/files/.gitignore index 684dbffa96..11a5409872 100644 --- a/tests/integration/tests/384-local-deps/files/.gitignore +++ b/tests/integration/tests/384-local-deps/files/.gitignore @@ -1 +1,3 @@ stack.yaml +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/384-local-deps/files/dir1/dir1.cabal b/tests/integration/tests/384-local-deps/files/dir1/dir1.cabal deleted file mode 100644 index 87ea412999..0000000000 --- a/tests/integration/tests/384-local-deps/files/dir1/dir1.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: dir1 -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/384-local-deps/files/dir1/src/Lib.hs b/tests/integration/tests/384-local-deps/files/dir1/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/384-local-deps/files/dir1/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/384-local-deps/files/dir2/dir2.cabal b/tests/integration/tests/384-local-deps/files/dir2/dir2.cabal deleted file mode 100644 index 40d8a85084..0000000000 --- a/tests/integration/tests/384-local-deps/files/dir2/dir2.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: dir2 -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, dir1 - default-language: Haskell2010 diff --git a/tests/integration/tests/384-local-deps/files/dir2/src/Lib.hs b/tests/integration/tests/384-local-deps/files/dir2/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/384-local-deps/files/dir2/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml b/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml new file mode 100644 index 0000000000..c9c1bf8cff --- /dev/null +++ b/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/384-local-deps/files/myPackageA/src/Lib.hs b/tests/integration/tests/384-local-deps/files/myPackageA/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/384-local-deps/files/myPackageA/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml b/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml new file mode 100644 index 0000000000..62ff96d1e9 --- /dev/null +++ b/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base +- myPackageA + +library: + source-dirs: src diff --git a/tests/integration/tests/384-local-deps/files/myPackageB/src/Lib.hs b/tests/integration/tests/384-local-deps/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/384-local-deps/files/myPackageB/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/397-case-insensitive-flags/Main.hs b/tests/integration/tests/397-case-insensitive-flags/Main.hs index 65bbe49cc7..38eb51ed26 100644 --- a/tests/integration/tests/397-case-insensitive-flags/Main.hs +++ b/tests/integration/tests/397-case-insensitive-flags/Main.hs @@ -1,10 +1,11 @@ +-- Cabal flags are case-insensitive and Stack treats them as such. +-- +-- See: https://github.com/commercialhaskell/stack/issues/397 + import StackTest main :: IO () main = do - stackErr ["build"] - stack ["build", "--flag", "new-template:fixIt"] - stack ["build", "--flag", "new-template:fixit"] - stack ["build", "--flag", "new-template:fiXit"] - stack ["build", "--flag", "*:fiXit"] - stackErr ["build", "--flag", "*:fiXit-else"] + stackErr ["build"] + stack ["build", "--flag", "myPackage:nEcEssAry"] + stack ["build", "--flag", "*:nEcEssAry"] diff --git a/tests/integration/tests/397-case-insensitive-flags/files/.gitignore b/tests/integration/tests/397-case-insensitive-flags/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/397-case-insensitive-flags/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/397-case-insensitive-flags/files/new-template.cabal b/tests/integration/tests/397-case-insensitive-flags/files/new-template.cabal deleted file mode 100644 index f9c9dd087a..0000000000 --- a/tests/integration/tests/397-case-insensitive-flags/files/new-template.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: new-template -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -flag fixIt - manual: True - default: False - description: Make the build work - -library - hs-source-dirs: src - exposed-modules: Lib - default-language: Haskell2010 - if flag(fixIt) - build-depends: base >= 4.7 - else - build-depends: base < 4.7 && > 4.7 diff --git a/tests/integration/tests/397-case-insensitive-flags/files/package.yaml b/tests/integration/tests/397-case-insensitive-flags/files/package.yaml new file mode 100644 index 0000000000..273e2086bd --- /dev/null +++ b/tests/integration/tests/397-case-insensitive-flags/files/package.yaml @@ -0,0 +1,19 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +flags: + necessary: + description: The package will not build unless this flag is true. + manual: true + default: false + +dependencies: +- base + +library: + source-dirs: src + when: + - condition: flag(necessary) + cpp-options: -DWORK diff --git a/tests/integration/tests/397-case-insensitive-flags/files/src/Lib.hs b/tests/integration/tests/397-case-insensitive-flags/files/src/Lib.hs index d36ff2714d..eccdf60245 100644 --- a/tests/integration/tests/397-case-insensitive-flags/files/src/Lib.hs +++ b/tests/integration/tests/397-case-insensitive-flags/files/src/Lib.hs @@ -1,6 +1,12 @@ -module Lib - ( someFunc - ) where +{-# LANGUAGE CPP #-} -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#if !WORK +#error Not going to work, sorry +#endif + +#endif diff --git a/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml b/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml +++ b/tests/integration/tests/397-case-insensitive-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/443-specify-path/.gitignore b/tests/integration/tests/443-specify-path/.gitignore deleted file mode 100644 index 027271b9b2..0000000000 --- a/tests/integration/tests/443-specify-path/.gitignore +++ /dev/null @@ -1 +0,0 @@ -files diff --git a/tests/integration/tests/443-specify-path/Main.hs b/tests/integration/tests/443-specify-path/Main.hs index 8dca6aa4e5..4c01c57e58 100644 --- a/tests/integration/tests/443-specify-path/Main.hs +++ b/tests/integration/tests/443-specify-path/Main.hs @@ -1,30 +1,30 @@ +-- Stack can specify the directory to which built executable binary files are +-- copied. +-- +-- See: https://github.com/commercialhaskell/stack/issues/443 + import StackTest -import System.Directory -import System.FilePath -import System.Info (os) +import System.Directory ( createDirectory, getCurrentDirectory ) +import System.FilePath ( () ) main :: IO () main = do - -- install in relative path - removeDirIgnore "bin" - createDirectory "bin" - stack [defaultSnapshotArg, "--local-bin-path", "./bin", "install" , "happy"] - doesExist ("./bin/happy" ++ exeExt) - -- Default install - -- This seems to fail due to directory being cleaned up, - -- a manual test of the default stack install is required - -- defaultDir <- getAppUserDataDirectory "local" - -- stack ["install", "happy"] - -- doesExist (defaultDir ++ "/bin/happy" ++ exeExt) + -- A manual test of the default stack install is required - -- install in current dir - stack [defaultSnapshotArg, "--local-bin-path", ".", "install", "happy" ] - doesExist ("happy" ++ exeExt) + -- Install in current dir + stack [ "--local-bin-path", ".", "install" ] + doesExist myPackageExe + + -- Install in relative path + createDirectory "bin" + stack [ "--local-bin-path", "./bin", "install" ] + doesExist ("./bin/" <> myPackageExe) - -- install in absolute path - tmpDirectory <- fmap ( "absolute-bin") getCurrentDirectory - removeDirIgnore tmpDirectory + -- Install in absolute path + tmpDirectory <- fmap ( "bin-absolute") getCurrentDirectory createDirectory tmpDirectory - stack [defaultSnapshotArg, "--local-bin-path", tmpDirectory, "install", "happy" ] - doesExist (tmpDirectory ("happy" ++ exeExt)) + stack [ "--local-bin-path", tmpDirectory, "install" ] + doesExist (tmpDirectory myPackageExe) + where + myPackageExe = "myPackage" <> exeExt diff --git a/tests/integration/tests/443-specify-path/files/.gitignore b/tests/integration/tests/443-specify-path/files/.gitignore new file mode 100644 index 0000000000..e28030a9e4 --- /dev/null +++ b/tests/integration/tests/443-specify-path/files/.gitignore @@ -0,0 +1,5 @@ +bin/ +bin-absolute/ +myPackage.cabal +myPackage.exe +myPackage diff --git a/tests/integration/tests/365-invalid-success/files/app/Main.hs b/tests/integration/tests/443-specify-path/files/app/Main.hs similarity index 62% rename from tests/integration/tests/365-invalid-success/files/app/Main.hs rename to tests/integration/tests/443-specify-path/files/app/Main.hs index 0d6c14399b..89ad4b3e08 100644 --- a/tests/integration/tests/365-invalid-success/files/app/Main.hs +++ b/tests/integration/tests/443-specify-path/files/app/Main.hs @@ -1,4 +1,4 @@ -import Foo +module Main where main :: IO () main = pure () diff --git a/tests/integration/tests/443-specify-path/files/package.yaml b/tests/integration/tests/443-specify-path/files/package.yaml new file mode 100644 index 0000000000..113821465d --- /dev/null +++ b/tests/integration/tests/443-specify-path/files/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/443-specify-path/files/stack.yaml b/tests/integration/tests/443-specify-path/files/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/443-specify-path/files/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3 From 181be82ed1a1e90f83ac7709ecac7c9c527d2c3d Mon Sep 17 00:00:00 2001 From: Olivier Benz Date: Tue, 28 Apr 2026 12:17:07 +0200 Subject: [PATCH 42/75] Dev Containers: Update HLS to v2.14.0.0 --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1596006990..f02a53e996 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "args": { "GHC_VERSION": "9.10.3", // "SUBTAG": "int-native", - "HLS_VERSION": "2.13.0.0", + "HLS_VERSION": "2.14.0.0", "USE_ZSH_FOR_ROOT": "unset-to-use-ash", "LANG": "C.UTF-8", "TZ": "" From f24a6f062a3ccf9b76600b5710fdd9e2aa7edcbb Mon Sep 17 00:00:00 2001 From: Olivier Benz Date: Tue, 28 Apr 2026 12:21:16 +0200 Subject: [PATCH 43/75] Dev Containers: Update experimental GHC version --- .devcontainer/{ghc-9.12.3 => ghc-9.12.4}/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .devcontainer/{ghc-9.12.3 => ghc-9.12.4}/devcontainer.json (94%) diff --git a/.devcontainer/ghc-9.12.3/devcontainer.json b/.devcontainer/ghc-9.12.4/devcontainer.json similarity index 94% rename from .devcontainer/ghc-9.12.3/devcontainer.json rename to .devcontainer/ghc-9.12.4/devcontainer.json index 4ba56636e9..67bbf5bc44 100644 --- a/.devcontainer/ghc-9.12.3/devcontainer.json +++ b/.devcontainer/ghc-9.12.4/devcontainer.json @@ -1,10 +1,10 @@ { - "name": "GHC 9.12.3 (experimental)", + "name": "GHC 9.12.4 (experimental)", "build": { "dockerfile": "../GHC.Dockerfile", "context": "..", "args": { - "GHC_VERSION": "9.12.3", + "GHC_VERSION": "9.12.4", // "SUBTAG": "int-native", "USE_ZSH_FOR_ROOT": "unset-to-use-ash", "LANG": "C.UTF-8", From 270f95d21695968b928ad3549b05d8e57806992d Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Tue, 28 Apr 2026 00:27:42 +0100 Subject: [PATCH 44/75] Review, document and conform further integration tests --- .../335-multi-package-flags/files/Setup.hs | 2 -- .../tests/606-local-version-not-exist/Main.hs | 12 ++++--- .../files/.gitignore | 1 + .../files/files.cabal | 10 ------ .../files/package.yaml | 10 ++++++ .../files/src/Lib.hs | 7 +---- .../files/stack.yaml | 2 +- .../tests/617-extra-dep-flag/Main.hs | 6 +++- .../tests/617-extra-dep-flag/files/stack.yaml | 9 ++++-- .../tests/617-unused-flag-cli/Main.hs | 13 +++++--- .../617-unused-flag-cli/files/.gitignore | 1 + .../617-unused-flag-cli/files/files.cabal | 10 ------ .../617-unused-flag-cli/files/package.yaml | 10 ++++++ .../617-unused-flag-cli/files/src/Lib.hs | 7 +---- .../tests/617-unused-flag-name-yaml/Main.hs | 5 +++ .../files/.gitignore | 1 + .../files/files.cabal | 10 ------ .../files/package.yaml | 10 ++++++ .../files/src/Lib.hs | 7 +---- .../files/stack.yaml | 5 +-- .../tests/617-unused-flag-yaml/Main.hs | 5 +++ .../617-unused-flag-yaml/files/.gitignore | 1 + .../617-unused-flag-yaml/files/files.cabal | 10 ------ .../617-unused-flag-yaml/files/package.yaml | 10 ++++++ .../617-unused-flag-yaml/files/stack.yaml | 5 +-- .../integration/tests/620-env-command/Main.hs | 13 +++++--- .../tests/620-env-command/files/Main.hs | 2 -- .../tests/620-env-command/files/run.sh | 3 +- .../integration/tests/717-sdist-test/Main.hs | 31 ++++++++++++------- .../tests/717-sdist-test/files/.gitignore | 5 +++ .../LICENSE | 0 .../files/failing-package-with-test/README.md | 1 + .../failing-package-with-test/files/file.txt | 1 + .../failing-package-with-test/package.yaml | 13 ++++++++ .../test/Test.hs | 0 .../LICENSE | 0 .../files/failing-package-with-th/README.md | 1 + .../failing-package-with-th/files/file.txt | 1 + .../failing-package-with-th/package.yaml | 15 +++++++++ .../src/Lib.hs | 4 +-- .../files/failing-package-with-th/src/TH.hs | 10 ++++++ .../files/package-with-failing-test/README.md | 1 - .../files/package-with-failing-test/Setup.hs | 2 -- .../package-with-failing-test/files/file.txt | 1 - .../package-with-failing-test.cabal | 27 ---------------- .../package-with-failing-test/src/Lib.hs | 8 ----- .../files/package-with-th/README.md | 1 - .../files/package-with-th/Setup.hs | 2 -- .../files/package-with-th/files/file.txt | 1 - .../package-with-th/package-with-th.cabal | 22 ------------- .../files/package-with-th/src/TH.hs | 8 ----- .../files/package-with-working-th/README.md | 1 - .../files/package-with-working-th/Setup.hs | 2 -- .../package-with-working-th/files/file.txt | 1 - .../package-with-working-th.cabal | 22 ------------- .../files/package-with-working-th/src/TH.hs | 7 ----- .../tests/717-sdist-test/files/stack.yaml | 9 +++--- .../dependent-on-failing-packages/README.md | 2 +- .../dependent-on-failing-packages/Setup.hs | 2 -- .../dependent-on-failing-packages.cabal | 23 -------------- .../files/file.txt | 2 +- .../package.yaml | 17 ++++++++++ .../dependent-on-failing-packages/src/LibD.hs | 8 ++--- .../files/subdirs/failing-in-subdir/README.md | 2 +- .../files/subdirs/failing-in-subdir/Setup.hs | 2 -- .../failing-in-subdir/failing-in-subdir.cabal | 22 ------------- .../subdirs/failing-in-subdir/files/file.txt | 2 +- .../subdirs/failing-in-subdir/package.yaml | 15 +++++++++ .../subdirs/failing-in-subdir/src/LibC.hs | 4 +-- .../failing-in-subdir/src/THInSubdir.hs | 6 ++-- .../LICENSE | 0 .../files/working-package-with-th/README.md | 1 + .../working-package-with-th/package.yaml | 15 +++++++++ .../src/Lib.hs | 8 ++--- .../files/working-package-with-th/src/TH.hs | 8 +++++ 75 files changed, 249 insertions(+), 274 deletions(-) delete mode 100644 tests/integration/tests/335-multi-package-flags/files/Setup.hs create mode 100644 tests/integration/tests/606-local-version-not-exist/files/.gitignore delete mode 100644 tests/integration/tests/606-local-version-not-exist/files/files.cabal create mode 100644 tests/integration/tests/606-local-version-not-exist/files/package.yaml create mode 100644 tests/integration/tests/617-unused-flag-cli/files/.gitignore delete mode 100644 tests/integration/tests/617-unused-flag-cli/files/files.cabal create mode 100644 tests/integration/tests/617-unused-flag-cli/files/package.yaml create mode 100644 tests/integration/tests/617-unused-flag-name-yaml/files/.gitignore delete mode 100644 tests/integration/tests/617-unused-flag-name-yaml/files/files.cabal create mode 100644 tests/integration/tests/617-unused-flag-name-yaml/files/package.yaml create mode 100644 tests/integration/tests/617-unused-flag-yaml/files/.gitignore delete mode 100644 tests/integration/tests/617-unused-flag-yaml/files/files.cabal create mode 100644 tests/integration/tests/617-unused-flag-yaml/files/package.yaml create mode 100644 tests/integration/tests/717-sdist-test/files/.gitignore rename tests/integration/tests/717-sdist-test/files/{package-with-failing-test => failing-package-with-test}/LICENSE (100%) create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-test/README.md create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-test/files/file.txt create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-test/package.yaml rename tests/integration/tests/717-sdist-test/files/{package-with-failing-test => failing-package-with-test}/test/Test.hs (100%) rename tests/integration/tests/717-sdist-test/files/{package-with-th => failing-package-with-th}/LICENSE (100%) create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-th/README.md create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-th/files/file.txt create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-th/package.yaml rename tests/integration/tests/717-sdist-test/files/{package-with-th => failing-package-with-th}/src/Lib.hs (62%) create mode 100644 tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/TH.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-failing-test/README.md delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-failing-test/Setup.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-failing-test/files/file.txt delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-failing-test/package-with-failing-test.cabal delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-failing-test/src/Lib.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-th/README.md delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-th/Setup.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-th/files/file.txt delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-th/package-with-th.cabal delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-th/src/TH.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-working-th/README.md delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-working-th/Setup.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-working-th/files/file.txt delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-working-th/package-with-working-th.cabal delete mode 100644 tests/integration/tests/717-sdist-test/files/package-with-working-th/src/TH.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/Setup.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/dependent-on-failing-packages.cabal create mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/package.yaml delete mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/Setup.hs delete mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/failing-in-subdir.cabal create mode 100644 tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/package.yaml rename tests/integration/tests/717-sdist-test/files/{package-with-working-th => working-package-with-th}/LICENSE (100%) create mode 100644 tests/integration/tests/717-sdist-test/files/working-package-with-th/README.md create mode 100644 tests/integration/tests/717-sdist-test/files/working-package-with-th/package.yaml rename tests/integration/tests/717-sdist-test/files/{package-with-working-th => working-package-with-th}/src/Lib.hs (58%) create mode 100644 tests/integration/tests/717-sdist-test/files/working-package-with-th/src/TH.hs diff --git a/tests/integration/tests/335-multi-package-flags/files/Setup.hs b/tests/integration/tests/335-multi-package-flags/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/335-multi-package-flags/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/606-local-version-not-exist/Main.hs b/tests/integration/tests/606-local-version-not-exist/Main.hs index 30d17c8729..02f4066f51 100644 --- a/tests/integration/tests/606-local-version-not-exist/Main.hs +++ b/tests/integration/tests/606-local-version-not-exist/Main.hs @@ -1,8 +1,12 @@ +-- Stack reports an error when the target is a project package version, +-- whether the version is correct or not. +-- +-- See: https://github.com/commercialhaskell/stack/issues/606 + import StackTest main :: IO () main = do - stackErr ["build", "files-3"] - stackErr ["build", "files-0.1.0.0"] - stack ["build", "files"] - stack ["build", "."] + stackErr ["build", "myPackage-1"] + stackErr ["build", "myPackage-0.1.0.0"] + stack ["build", "myPackage"] diff --git a/tests/integration/tests/606-local-version-not-exist/files/.gitignore b/tests/integration/tests/606-local-version-not-exist/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/606-local-version-not-exist/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/606-local-version-not-exist/files/files.cabal b/tests/integration/tests/606-local-version-not-exist/files/files.cabal deleted file mode 100644 index 6ec3b1e471..0000000000 --- a/tests/integration/tests/606-local-version-not-exist/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/606-local-version-not-exist/files/package.yaml b/tests/integration/tests/606-local-version-not-exist/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/606-local-version-not-exist/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/606-local-version-not-exist/files/src/Lib.hs b/tests/integration/tests/606-local-version-not-exist/files/src/Lib.hs index d36ff2714d..6d85a26fe1 100644 --- a/tests/integration/tests/606-local-version-not-exist/files/src/Lib.hs +++ b/tests/integration/tests/606-local-version-not-exist/files/src/Lib.hs @@ -1,6 +1 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where diff --git a/tests/integration/tests/606-local-version-not-exist/files/stack.yaml b/tests/integration/tests/606-local-version-not-exist/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/606-local-version-not-exist/files/stack.yaml +++ b/tests/integration/tests/606-local-version-not-exist/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/617-extra-dep-flag/Main.hs b/tests/integration/tests/617-extra-dep-flag/Main.hs index 50fcae4fa6..eefa091b4f 100644 --- a/tests/integration/tests/617-extra-dep-flag/Main.hs +++ b/tests/integration/tests/617-extra-dep-flag/Main.hs @@ -1,4 +1,8 @@ +-- Stack can specify a Cabal flag for an extra-dep. +-- +-- See: https://github.com/commercialhaskell/stack/issues/617 + import StackTest main :: IO () -main = stack ["build", "acme-dont-1.1"] +main = stack ["build", "acme-missiles-0.3"] diff --git a/tests/integration/tests/617-extra-dep-flag/files/stack.yaml b/tests/integration/tests/617-extra-dep-flag/files/stack.yaml index 33622a7c88..ae1b6d1fd9 100644 --- a/tests/integration/tests/617-extra-dep-flag/files/stack.yaml +++ b/tests/integration/tests/617-extra-dep-flag/files/stack.yaml @@ -1,7 +1,10 @@ snapshot: ghc-9.10.3 + +packages: [] + +extra-deps: +- text-1.2.0.3 + flags: text: integer-simple: false -extra-deps: -- text-1.2.0.3 -packages: [] diff --git a/tests/integration/tests/617-unused-flag-cli/Main.hs b/tests/integration/tests/617-unused-flag-cli/Main.hs index f9a2b093ea..0170e4148f 100644 --- a/tests/integration/tests/617-unused-flag-cli/Main.hs +++ b/tests/integration/tests/617-unused-flag-cli/Main.hs @@ -1,8 +1,13 @@ +-- Stack reports an error when a Cabal flag is specified on the command line for +-- a specific non-existent package or a non-existent Cabal flag is specified for +-- a specific project package. +-- +-- See: https://github.com/commercialhaskell/stack/issues/617 + import StackTest main :: IO () main = do - stack ["build"] - stackErr ["build", "--flag", "foo:bar"] - stackErr ["build", "--flag", "files:bar"] - stack ["build", "--flag", "*:bar"] + stackErr ["build", "--flag", "noSuchPackage:my-flag"] + stackErr ["build", "--flag", "myPackage:no-such-flag"] + stack ["build", "--flag", "*:no-such-flag"] diff --git a/tests/integration/tests/617-unused-flag-cli/files/.gitignore b/tests/integration/tests/617-unused-flag-cli/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/617-unused-flag-cli/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/617-unused-flag-cli/files/files.cabal b/tests/integration/tests/617-unused-flag-cli/files/files.cabal deleted file mode 100644 index 6ec3b1e471..0000000000 --- a/tests/integration/tests/617-unused-flag-cli/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/617-unused-flag-cli/files/package.yaml b/tests/integration/tests/617-unused-flag-cli/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/617-unused-flag-cli/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/617-unused-flag-cli/files/src/Lib.hs b/tests/integration/tests/617-unused-flag-cli/files/src/Lib.hs index d36ff2714d..6d85a26fe1 100644 --- a/tests/integration/tests/617-unused-flag-cli/files/src/Lib.hs +++ b/tests/integration/tests/617-unused-flag-cli/files/src/Lib.hs @@ -1,6 +1 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where diff --git a/tests/integration/tests/617-unused-flag-name-yaml/Main.hs b/tests/integration/tests/617-unused-flag-name-yaml/Main.hs index b16d43227b..5fabddaa78 100644 --- a/tests/integration/tests/617-unused-flag-name-yaml/Main.hs +++ b/tests/integration/tests/617-unused-flag-name-yaml/Main.hs @@ -1,3 +1,8 @@ +-- Stack reports an error when a non-existent Cabal flag is specified for +-- a project package. +-- +-- See: https://github.com/commercialhaskell/stack/issues/617 + import StackTest main :: IO () diff --git a/tests/integration/tests/617-unused-flag-name-yaml/files/.gitignore b/tests/integration/tests/617-unused-flag-name-yaml/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/617-unused-flag-name-yaml/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/617-unused-flag-name-yaml/files/files.cabal b/tests/integration/tests/617-unused-flag-name-yaml/files/files.cabal deleted file mode 100644 index 6ec3b1e471..0000000000 --- a/tests/integration/tests/617-unused-flag-name-yaml/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/617-unused-flag-name-yaml/files/package.yaml b/tests/integration/tests/617-unused-flag-name-yaml/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/617-unused-flag-name-yaml/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/617-unused-flag-name-yaml/files/src/Lib.hs b/tests/integration/tests/617-unused-flag-name-yaml/files/src/Lib.hs index d36ff2714d..6d85a26fe1 100644 --- a/tests/integration/tests/617-unused-flag-name-yaml/files/src/Lib.hs +++ b/tests/integration/tests/617-unused-flag-name-yaml/files/src/Lib.hs @@ -1,6 +1 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where diff --git a/tests/integration/tests/617-unused-flag-name-yaml/files/stack.yaml b/tests/integration/tests/617-unused-flag-name-yaml/files/stack.yaml index 39fe9b5749..d7173d4dd8 100644 --- a/tests/integration/tests/617-unused-flag-name-yaml/files/stack.yaml +++ b/tests/integration/tests/617-unused-flag-name-yaml/files/stack.yaml @@ -1,4 +1,5 @@ snapshot: ghc-9.10.3 + flags: - files: - does-not-exist: false + myPackage: + no-such-flag: false diff --git a/tests/integration/tests/617-unused-flag-yaml/Main.hs b/tests/integration/tests/617-unused-flag-yaml/Main.hs index b16d43227b..609efaadd3 100644 --- a/tests/integration/tests/617-unused-flag-yaml/Main.hs +++ b/tests/integration/tests/617-unused-flag-yaml/Main.hs @@ -1,3 +1,8 @@ +-- Stack reports an error when a Cabal flag is specified for a specific +-- non-existent package. +-- +-- See: https://github.com/commercialhaskell/stack/issues/617 + import StackTest main :: IO () diff --git a/tests/integration/tests/617-unused-flag-yaml/files/.gitignore b/tests/integration/tests/617-unused-flag-yaml/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/617-unused-flag-yaml/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/617-unused-flag-yaml/files/files.cabal b/tests/integration/tests/617-unused-flag-yaml/files/files.cabal deleted file mode 100644 index 6ec3b1e471..0000000000 --- a/tests/integration/tests/617-unused-flag-yaml/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/617-unused-flag-yaml/files/package.yaml b/tests/integration/tests/617-unused-flag-yaml/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/617-unused-flag-yaml/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/617-unused-flag-yaml/files/stack.yaml b/tests/integration/tests/617-unused-flag-yaml/files/stack.yaml index d17c443bee..ba4e5e5804 100644 --- a/tests/integration/tests/617-unused-flag-yaml/files/stack.yaml +++ b/tests/integration/tests/617-unused-flag-yaml/files/stack.yaml @@ -1,4 +1,5 @@ snapshot: ghc-9.10.3 + flags: - does-not-exist: - foo: false + no-such-package: + my-flag: false diff --git a/tests/integration/tests/620-env-command/Main.hs b/tests/integration/tests/620-env-command/Main.hs index 2a4e394673..94b2c35a5b 100644 --- a/tests/integration/tests/620-env-command/Main.hs +++ b/tests/integration/tests/620-env-command/Main.hs @@ -1,7 +1,12 @@ -import StackTest -import System.Process -import Control.Exception (throwIO) -import Control.Monad (unless) +-- Stack's config env command produces output that can be evaluated by bash's +-- built-in eval command. +-- +-- See: https://github.com/commercialhaskell/stack/issues/617 + +import Control.Exception ( throwIO ) +import Control.Monad ( unless ) +import StackTest +import System.Process ( rawSystem ) main :: IO () main = unless isWindows $ rawSystem "bash" ["run.sh"] >>= throwIO diff --git a/tests/integration/tests/620-env-command/files/Main.hs b/tests/integration/tests/620-env-command/files/Main.hs index bd555bc39d..d582e1e36a 100644 --- a/tests/integration/tests/620-env-command/files/Main.hs +++ b/tests/integration/tests/620-env-command/files/Main.hs @@ -1,4 +1,2 @@ -import Control.Concurrent.Async () - main :: IO () main = pure () diff --git a/tests/integration/tests/620-env-command/files/run.sh b/tests/integration/tests/620-env-command/files/run.sh index 6ba2545228..134e7e4c5a 100644 --- a/tests/integration/tests/620-env-command/files/run.sh +++ b/tests/integration/tests/620-env-command/files/run.sh @@ -2,6 +2,5 @@ set -euxo pipefail -stack build --resolver lts-24.37 async -eval `stack config env --resolver lts-24.37` +eval `stack --snapshot lts-24.37 config env` ghc Main.hs diff --git a/tests/integration/tests/717-sdist-test/Main.hs b/tests/integration/tests/717-sdist-test/Main.hs index cce419b2a5..fdd3691cee 100644 --- a/tests/integration/tests/717-sdist-test/Main.hs +++ b/tests/integration/tests/717-sdist-test/Main.hs @@ -1,19 +1,26 @@ -import StackTest +-- Stack's test of an archive file produced by sdist should fail if the package +-- description did not list all files used by the package itself. +-- +-- https://github.com/commercialhaskell/stack/issues/717 + +import StackTest main :: IO () main = do - -- verify building works + -- Verify building works: stack ["build"] - -- keep old behavior + -- Keep old behavior: stack ["sdist"] - -- successful sdist with --test-tarball - stack ["sdist", "package-with-working-th", "--test-tarball"] - -- fails because package contains TH which depends on files which are not put into sdist tarball - stackErr ["sdist", "package-with-th", "--test-tarball"] - -- same, but inside a subdir + -- Successful sdist with --test-tarball: + stack ["sdist", "working-package-with-th", "--test-tarball"] + -- Fails because package contains TH which depends on files which are not put + -- into sdist tarball: + stackErr ["sdist", "failing-package-with-th", "--test-tarball"] + -- Same, but inside a subdir: stackErr ["sdist", "subdirs/failing-in-subdir", "--test-tarball"] - -- depends on packagea and packagec - these would fail if they were the target of sdist, - -- but since they are just dependencies, the operation should succeed + -- Depends on failing-package-with-th and failing-in-subdir - these would fail + -- if they were the target of sdist, but since they are just dependencies, the + -- operation should succeed: stack ["sdist", "subdirs/dependent-on-failing-packages", "--test-tarball"] - -- fails because a test depends on files which are not put into sdist tarball - stackErr ["sdist", "package-with-failing-test", "--test-tarball"] + -- Fails because a test depends on files which are not put into sdist tarball: + stackErr ["sdist", "failing-package-with-test", "--test-tarball"] diff --git a/tests/integration/tests/717-sdist-test/files/.gitignore b/tests/integration/tests/717-sdist-test/files/.gitignore new file mode 100644 index 0000000000..1b68608ab5 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/.gitignore @@ -0,0 +1,5 @@ +dependent-on-failing-packages.cabal +failing-in-subdir.cabal +failing-package-with-th.cabal +failing-package-with-test.cabal +working-package-with-th.cabal diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/LICENSE b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/LICENSE similarity index 100% rename from tests/integration/tests/717-sdist-test/files/package-with-failing-test/LICENSE rename to tests/integration/tests/717-sdist-test/files/failing-package-with-test/LICENSE diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-test/README.md b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/README.md new file mode 100644 index 0000000000..d432cbeb7e --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/README.md @@ -0,0 +1 @@ +# failing-package-with-test diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-test/files/file.txt b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/files/file.txt new file mode 100644 index 0000000000..d95f3ad14d --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/files/file.txt @@ -0,0 +1 @@ +content diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-test/package.yaml b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/package.yaml new file mode 100644 index 0000000000..5d83a066f5 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: failing-package-with-test +version: 0.1.0.0 +description: A package with a test suite that is incomplete if sdist. + +dependencies: +- base < 5 + +tests: + my-test: + source-dirs: test + main: Test.hs diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/test/Test.hs b/tests/integration/tests/717-sdist-test/files/failing-package-with-test/test/Test.hs similarity index 100% rename from tests/integration/tests/717-sdist-test/files/package-with-failing-test/test/Test.hs rename to tests/integration/tests/717-sdist-test/files/failing-package-with-test/test/Test.hs diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/LICENSE b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/LICENSE similarity index 100% rename from tests/integration/tests/717-sdist-test/files/package-with-th/LICENSE rename to tests/integration/tests/717-sdist-test/files/failing-package-with-th/LICENSE diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-th/README.md b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/README.md new file mode 100644 index 0000000000..6c7f4896ea --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/README.md @@ -0,0 +1 @@ +# failing-package-with-th diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-th/files/file.txt b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/files/file.txt new file mode 100644 index 0000000000..d95f3ad14d --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/files/file.txt @@ -0,0 +1 @@ +content diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-th/package.yaml b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/package.yaml new file mode 100644 index 0000000000..f9a9959604 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/package.yaml @@ -0,0 +1,15 @@ +spec-version: 0.36.0 + +name: failing-package-with-th +version: 0.1.0.0 +description: A package with Template Haskell that is incomplete if sdist. + +extra-source-files: +- README.md + +dependencies: +- base < 5 +- template-haskell + +library: + source-dirs: src diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/src/Lib.hs b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/Lib.hs similarity index 62% rename from tests/integration/tests/717-sdist-test/files/package-with-th/src/Lib.hs rename to tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/Lib.hs index 26d2841b8f..0e37b70732 100644 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/src/Lib.hs +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/Lib.hs @@ -3,8 +3,8 @@ module Lib ( someFunc ) where -import TH -import Language.Haskell.TH +import TH ( thFunc ) +import Language.Haskell.TH () someFunc :: IO () someFunc = print $(thFunc) diff --git a/tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/TH.hs b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/TH.hs new file mode 100644 index 0000000000..a83a2014e7 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/failing-package-with-th/src/TH.hs @@ -0,0 +1,10 @@ +module TH + ( thFunc + ) where + +import Language.Haskell.TH ( Exp (..), Lit (..), Q, runIO ) + +thFunc :: Q Exp +thFunc = runIO $ do + readFile "files/file.txt" + pure $ LitE (IntegerL 5) diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/README.md b/tests/integration/tests/717-sdist-test/files/package-with-failing-test/README.md deleted file mode 100644 index 8831e9c09c..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/README.md +++ /dev/null @@ -1 +0,0 @@ -# thtest diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/Setup.hs b/tests/integration/tests/717-sdist-test/files/package-with-failing-test/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/files/file.txt b/tests/integration/tests/717-sdist-test/files/package-with-failing-test/files/file.txt deleted file mode 100644 index 72943a16fb..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/files/file.txt +++ /dev/null @@ -1 +0,0 @@ -aaa diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/package-with-failing-test.cabal b/tests/integration/tests/717-sdist-test/files/package-with-failing-test/package-with-failing-test.cabal deleted file mode 100644 index 75e8f7ae2e..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/package-with-failing-test.cabal +++ /dev/null @@ -1,27 +0,0 @@ -name: package-with-failing-test -version: 0.1.0.0 -synopsis: Some package -description: Some package -homepage: https://invalid -license: BSD3 -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2000 Author name here -category: Web -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, - template-haskell - default-language: Haskell2010 - -test-suite tests - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Test.hs - build-depends: base >= 4.7 && < 5 diff --git a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/src/Lib.hs b/tests/integration/tests/717-sdist-test/files/package-with-failing-test/src/Lib.hs deleted file mode 100644 index 0d8704c625..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-failing-test/src/Lib.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Lib - ( someFunc - ) where - -import Language.Haskell.TH - -someFunc :: IO () -someFunc = putStrLn "aaa" diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/README.md b/tests/integration/tests/717-sdist-test/files/package-with-th/README.md deleted file mode 100644 index 8831e9c09c..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/README.md +++ /dev/null @@ -1 +0,0 @@ -# thtest diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/Setup.hs b/tests/integration/tests/717-sdist-test/files/package-with-th/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/files/file.txt b/tests/integration/tests/717-sdist-test/files/package-with-th/files/file.txt deleted file mode 100644 index 72943a16fb..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/files/file.txt +++ /dev/null @@ -1 +0,0 @@ -aaa diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/package-with-th.cabal b/tests/integration/tests/717-sdist-test/files/package-with-th/package-with-th.cabal deleted file mode 100644 index 972934006d..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/package-with-th.cabal +++ /dev/null @@ -1,22 +0,0 @@ -name: package-with-th -version: 0.1.0.0 -synopsis: Some package -description: Some package -homepage: https://invalid -license: BSD3 -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2000 Author name here -category: Web -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib, - TH - build-depends: base >= 4.7 && < 5, - template-haskell - default-language: Haskell2010 diff --git a/tests/integration/tests/717-sdist-test/files/package-with-th/src/TH.hs b/tests/integration/tests/717-sdist-test/files/package-with-th/src/TH.hs deleted file mode 100644 index ba24a158bf..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-th/src/TH.hs +++ /dev/null @@ -1,8 +0,0 @@ -module TH (thFunc) where - -import Language.Haskell.TH - -thFunc :: Q Exp -thFunc = runIO $ do - readFile "files/file.txt" - pure $ LitE (IntegerL 5) diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/README.md b/tests/integration/tests/717-sdist-test/files/package-with-working-th/README.md deleted file mode 100644 index 8831e9c09c..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/README.md +++ /dev/null @@ -1 +0,0 @@ -# thtest diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/Setup.hs b/tests/integration/tests/717-sdist-test/files/package-with-working-th/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/files/file.txt b/tests/integration/tests/717-sdist-test/files/package-with-working-th/files/file.txt deleted file mode 100644 index 72943a16fb..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/files/file.txt +++ /dev/null @@ -1 +0,0 @@ -aaa diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/package-with-working-th.cabal b/tests/integration/tests/717-sdist-test/files/package-with-working-th/package-with-working-th.cabal deleted file mode 100644 index cbeb18c3ee..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/package-with-working-th.cabal +++ /dev/null @@ -1,22 +0,0 @@ -name: package-with-working-th -version: 0.1.0.0 -synopsis: Some package -description: Some package -homepage: https://invalid -license: BSD3 -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2000 Author name here -category: Web -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib, - TH - build-depends: base >= 4.7 && < 5, - template-haskell - default-language: Haskell2010 diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/src/TH.hs b/tests/integration/tests/717-sdist-test/files/package-with-working-th/src/TH.hs deleted file mode 100644 index e47d6eaab9..0000000000 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/src/TH.hs +++ /dev/null @@ -1,7 +0,0 @@ -module TH (thFunc) where - -import Language.Haskell.TH - -thFunc :: Q Exp -thFunc = - pure $ LitE (IntegerL 5) diff --git a/tests/integration/tests/717-sdist-test/files/stack.yaml b/tests/integration/tests/717-sdist-test/files/stack.yaml index cb4156ca85..196e557d7b 100644 --- a/tests/integration/tests/717-sdist-test/files/stack.yaml +++ b/tests/integration/tests/717-sdist-test/files/stack.yaml @@ -1,7 +1,8 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + packages: -- package-with-th -- package-with-working-th -- package-with-failing-test +- failing-package-with-test +- failing-package-with-th - subdirs/dependent-on-failing-packages - subdirs/failing-in-subdir +- working-package-with-th diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/README.md b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/README.md index 8831e9c09c..387b7303cf 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/README.md +++ b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/README.md @@ -1 +1 @@ -# thtest +# dependent-on-failing-packages diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/Setup.hs b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/dependent-on-failing-packages.cabal b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/dependent-on-failing-packages.cabal deleted file mode 100644 index cb1ddff94c..0000000000 --- a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/dependent-on-failing-packages.cabal +++ /dev/null @@ -1,23 +0,0 @@ -name: dependent-on-failing-packages -version: 0.1.0.0 -synopsis: Some package -description: Some package -homepage: https://invalid -license: BSD3 -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2000 Author name here -category: Web -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: LibD - build-depends: base >= 4.7 && < 5, - template-haskell, - package-with-th, - failing-in-subdir - default-language: Haskell2010 diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/files/file.txt b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/files/file.txt index 72943a16fb..d95f3ad14d 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/files/file.txt +++ b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/files/file.txt @@ -1 +1 @@ -aaa +content diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/package.yaml b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/package.yaml new file mode 100644 index 0000000000..62ab378b6e --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/package.yaml @@ -0,0 +1,17 @@ +spec-version: 0.36.0 + +name: dependent-on-failing-packages +version: 0.1.0.0 +description: A package that can be sdist that depends on packages that cannot + +extra-source-files: +- README.md + +dependencies: +- base < 5 +- template-haskell +- failing-package-with-th +- failing-in-subdir + +library: + source-dirs: src diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/src/LibD.hs b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/src/LibD.hs index a0c7ad615e..5967ffc1dc 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/src/LibD.hs +++ b/tests/integration/tests/717-sdist-test/files/subdirs/dependent-on-failing-packages/src/LibD.hs @@ -1,9 +1,9 @@ module LibD - ( someFunc - ) where + ( someFuncD + ) where -import Lib -import LibC +import Lib ( someFunc ) +import LibC ( someFuncC ) someFuncD :: IO () someFuncD = do diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/README.md b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/README.md index 8831e9c09c..0533304f7f 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/README.md +++ b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/README.md @@ -1 +1 @@ -# thtest +# failing-in-subdir diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/Setup.hs b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/failing-in-subdir.cabal b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/failing-in-subdir.cabal deleted file mode 100644 index 944a17a598..0000000000 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/failing-in-subdir.cabal +++ /dev/null @@ -1,22 +0,0 @@ -name: failing-in-subdir -version: 0.1.0.0 -synopsis: Some package -description: Some package -homepage: https://invalid -license: BSD3 -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2000 Author name here -category: Web -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: LibC, - THInSubdir - build-depends: base >= 4.7 && < 5, - template-haskell - default-language: Haskell2010 diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/files/file.txt b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/files/file.txt index 72943a16fb..d95f3ad14d 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/files/file.txt +++ b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/files/file.txt @@ -1 +1 @@ -aaa +content diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/package.yaml b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/package.yaml new file mode 100644 index 0000000000..0109b121c9 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/package.yaml @@ -0,0 +1,15 @@ +spec-version: 0.36.0 + +name: failing-in-subdir +version: 0.1.0.0 +description: A package with Template Haskell that is incomplete if sdist. + +extra-source-files: +- README.md + +dependencies: +- base < 5 +- template-haskell + +library: + source-dirs: src diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/LibC.hs b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/LibC.hs index f951ce4a28..bce50b4df4 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/LibC.hs +++ b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/LibC.hs @@ -1,10 +1,10 @@ {-# LANGUAGE TemplateHaskell #-} + module LibC ( someFuncC ) where -import THInSubdir -import Language.Haskell.TH +import THInSubdir ( thFuncC ) someFuncC :: IO () someFuncC = print $(thFuncC) diff --git a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/THInSubdir.hs b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/THInSubdir.hs index d9a3820d9d..803150f5ca 100644 --- a/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/THInSubdir.hs +++ b/tests/integration/tests/717-sdist-test/files/subdirs/failing-in-subdir/src/THInSubdir.hs @@ -1,6 +1,8 @@ -module THInSubdir (thFuncC) where +module THInSubdir + ( thFuncC + ) where -import Language.Haskell.TH +import Language.Haskell.TH ( Exp (..), Lit (..), Q, runIO ) thFuncC :: Q Exp thFuncC = runIO $ do diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/LICENSE b/tests/integration/tests/717-sdist-test/files/working-package-with-th/LICENSE similarity index 100% rename from tests/integration/tests/717-sdist-test/files/package-with-working-th/LICENSE rename to tests/integration/tests/717-sdist-test/files/working-package-with-th/LICENSE diff --git a/tests/integration/tests/717-sdist-test/files/working-package-with-th/README.md b/tests/integration/tests/717-sdist-test/files/working-package-with-th/README.md new file mode 100644 index 0000000000..c98b2279e2 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/working-package-with-th/README.md @@ -0,0 +1 @@ +# working-package-with-th diff --git a/tests/integration/tests/717-sdist-test/files/working-package-with-th/package.yaml b/tests/integration/tests/717-sdist-test/files/working-package-with-th/package.yaml new file mode 100644 index 0000000000..660aa8f803 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/working-package-with-th/package.yaml @@ -0,0 +1,15 @@ +spec-version: 0.36.0 + +name: working-package-with-th +version: 0.1.0.0 +description: A package with Template Haskell that can be sdist. + +extra-source-files: +- README.md + +dependencies: +- base < 5 +- template-haskell + +library: + source-dirs: src diff --git a/tests/integration/tests/717-sdist-test/files/package-with-working-th/src/Lib.hs b/tests/integration/tests/717-sdist-test/files/working-package-with-th/src/Lib.hs similarity index 58% rename from tests/integration/tests/717-sdist-test/files/package-with-working-th/src/Lib.hs rename to tests/integration/tests/717-sdist-test/files/working-package-with-th/src/Lib.hs index 26d2841b8f..dfdbfc9d08 100644 --- a/tests/integration/tests/717-sdist-test/files/package-with-working-th/src/Lib.hs +++ b/tests/integration/tests/717-sdist-test/files/working-package-with-th/src/Lib.hs @@ -1,10 +1,10 @@ {-# LANGUAGE TemplateHaskell #-} + module Lib - ( someFunc - ) where + ( someFunc + ) where -import TH -import Language.Haskell.TH +import TH ( thFunc ) someFunc :: IO () someFunc = print $(thFunc) diff --git a/tests/integration/tests/717-sdist-test/files/working-package-with-th/src/TH.hs b/tests/integration/tests/717-sdist-test/files/working-package-with-th/src/TH.hs new file mode 100644 index 0000000000..06925fbf18 --- /dev/null +++ b/tests/integration/tests/717-sdist-test/files/working-package-with-th/src/TH.hs @@ -0,0 +1,8 @@ +module TH + ( thFunc + ) where + +import Language.Haskell.TH ( Exp (..), Lit (..), Q ) + +thFunc :: Q Exp +thFunc = pure $ LitE (IntegerL 5) From dab67bf1725cd445cddc8648e042b641e48525c0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Wed, 29 Apr 2026 00:31:23 +0100 Subject: [PATCH 45/75] Review, document and conform further integration tests --- .../1198-multiple-exes-with-same-name/Main.hs | 35 ++++++------- .../files/.gitignore | 4 +- .../also-has-exe-foo/also-has-exe-foo.cabal | 11 ---- .../files/also-has-exe-foo/app/Main.hs | 4 -- .../files/app/Main.hs | 4 -- .../files/has-exe-foo-too/app/Main.hs | 4 -- .../has-exe-foo-too/has-exe-foo-too.cabal | 11 ---- .../files/has-exe-foo.cabal | 11 ---- .../files/myPackageA/app/Main.hs | 4 ++ .../files/myPackageA/package.yaml | 12 +++++ .../files/myPackageB/app/Main.hs | 4 ++ .../files/myPackageB/package.yaml | 12 +++++ .../files/myPackageC/app/Main.hs | 4 ++ .../files/myPackageC/package.yaml | 12 +++++ .../files/stack.yaml | 6 +++ .../tests/1265-extensible-snapshots/Main.hs | 30 ++++++++--- .../files/.gitignore | 4 ++ .../files/myPackageA/package.yaml | 11 ++++ .../files/myPackageA/src/Lib.hs | 5 ++ .../files/myPackageB/package.yaml | 11 ++++ .../files/myPackageB/src/Lib.hs | 5 ++ .../files/myPackageC/package.yaml | 11 ++++ .../files/myPackageC/src/Lib.hs | 1 + .../files/myPackageD/package.yaml | 11 ++++ .../files/myPackageD/src/Lib.hs | 1 + .../files/snapshot-2.yaml | 14 ++---- .../files/snapshot-modify-lts.yaml | 7 ++- .../files/snapshot.yaml | 8 +-- .../files/snapshots/local-snapshot.yaml | 6 ++- .../files/snapshots/myPackage-0.1.0.0.tar.gz | Bin 0 -> 392 bytes .../files/snapshots/package-0.1.2.3.tar.gz | Bin 205 -> 0 bytes .../files/snapshots/remote-snapshot.yaml | 2 +- .../files/stack-local-snapshot.yaml | 5 +- .../files/stack-modify-lts.yaml | 5 +- .../files/stack-remote-snapshot.yaml | 5 +- .../files/stack.yaml | 6 ++- .../1336-1337-new-package-names/.gitignore | 8 ++- .../tests/1336-1337-new-package-names/Main.hs | 47 +++++++++--------- .../tests/763-buildable-false/Main.hs | 13 +++-- .../763-buildable-false/files/.gitignore | 1 + .../763-buildable-false/files/files.cabal | 25 ---------- .../763-buildable-false/files/package.yaml | 24 +++++++++ .../763-buildable-false/files/stack.yaml | 2 +- .../integration/tests/796-ghc-options/Main.hs | 11 ++-- .../tests/796-ghc-options/files/.gitignore | 1 + .../796-ghc-options/files/ghc-options.cabal | 10 ---- .../tests/796-ghc-options/files/package.yaml | 10 ++++ .../tests/796-ghc-options/files/src/Lib.hs | 18 +++---- .../tests/796-ghc-options/files/stack.yaml | 6 ++- 49 files changed, 288 insertions(+), 174 deletions(-) delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/also-has-exe-foo.cabal delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/app/Main.hs delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/app/Main.hs delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/app/Main.hs delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/has-exe-foo-too.cabal delete mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo.cabal create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/app/Main.hs create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/app/Main.hs create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/app/Main.hs create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml create mode 100644 tests/integration/tests/1198-multiple-exes-with-same-name/files/stack.yaml create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/.gitignore create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageA/src/Lib.hs create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageB/src/Lib.hs create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageC/src/Lib.hs create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/myPackageD/src/Lib.hs create mode 100644 tests/integration/tests/1265-extensible-snapshots/files/snapshots/myPackage-0.1.0.0.tar.gz delete mode 100644 tests/integration/tests/1265-extensible-snapshots/files/snapshots/package-0.1.2.3.tar.gz create mode 100644 tests/integration/tests/763-buildable-false/files/.gitignore delete mode 100644 tests/integration/tests/763-buildable-false/files/files.cabal create mode 100644 tests/integration/tests/763-buildable-false/files/package.yaml create mode 100644 tests/integration/tests/796-ghc-options/files/.gitignore delete mode 100644 tests/integration/tests/796-ghc-options/files/ghc-options.cabal create mode 100644 tests/integration/tests/796-ghc-options/files/package.yaml diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/Main.hs index de8bfef1b9..1dcedba320 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/Main.hs +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/Main.hs @@ -1,27 +1,28 @@ -import Control.Monad (unless,when) -import Data.List (isInfixOf) -import StackTest +-- Stack warns when more than one project package has an executable component of +-- the same name. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1198 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - stack [defaultSnapshotArg, "clean"] - stack [defaultSnapshotArg, "init", "--force"] - stackCheckStderr - ["build", "also-has-exe-foo", "has-exe-foo"] - (expectMessage buildMessage1) - stackCheckStderr - ["build", "has-exe-foo-too"] - (expectMessage buildMessage2) + stackCheckStderr + ["build", "myPackageA", "myPackageB"] + (expectMessage buildMessage1) + stackCheckStderr + ["build", "myPackageC"] + (expectMessage buildMessage2) expectMessage :: String -> String -> IO () expectMessage msg stderr = - unless (msg `isInfixOf` stderr) - (error $ "Expected a warning: \n" ++ show msg) + unless (msg `isInfixOf` stderr) + (error $ "Expected a warning: \n" ++ show msg) -- Use short message fragment because prettyWarn formatting and colour -buildMessage1 = - "Building several executables with the same name:" +buildMessage1 = "Building several executables with the same name:" -- Use short message fragment because prettyWarn formatting and colour -buildMessage2 = - "Other executables with the same name" +buildMessage2 = "Other executables with the same name" diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/.gitignore b/tests/integration/tests/1198-multiple-exes-with-same-name/files/.gitignore index 684dbffa96..c4ea0f5ab0 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/.gitignore +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/.gitignore @@ -1 +1,3 @@ -stack.yaml +myPackageA.cabal +myPackageB.cabal +myPackageC.cabal diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/also-has-exe-foo.cabal b/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/also-has-exe-foo.cabal deleted file mode 100644 index 97d9c1fd90..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/also-has-exe-foo.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: also-has-exe-foo -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable foo - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/app/Main.hs deleted file mode 100644 index ed0f47faf7..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/also-has-exe-foo/app/Main.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = putStrLn "This is foo from also-has-exe-foo" diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/app/Main.hs deleted file mode 100644 index d62e2f2117..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/app/Main.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = putStrLn "This is foo from has-exe-foo" diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/app/Main.hs deleted file mode 100644 index 90ac2ae946..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/app/Main.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = putStrLn "This is foo from has-exe-foo-too" diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/has-exe-foo-too.cabal b/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/has-exe-foo-too.cabal deleted file mode 100644 index 05db41b4b7..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo-too/has-exe-foo-too.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: has-exe-foo-too -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable foo - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo.cabal b/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo.cabal deleted file mode 100644 index 19b222b3a1..0000000000 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/has-exe-foo.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: has-exe-foo -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable foo - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/app/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml new file mode 100644 index 0000000000..3caf99d15a --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/app/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml new file mode 100644 index 0000000000..9f1897c21a --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/app/Main.hs b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/app/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml new file mode 100644 index 0000000000..01f8a94348 --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageC +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/stack.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/stack.yaml new file mode 100644 index 0000000000..14a33de5df --- /dev/null +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/stack.yaml @@ -0,0 +1,6 @@ +snapshot: ghc-9.10.3 + +packages: +- myPackageA +- myPackageB +- myPackageC diff --git a/tests/integration/tests/1265-extensible-snapshots/Main.hs b/tests/integration/tests/1265-extensible-snapshots/Main.hs index 506ddbd941..a44bcc205b 100644 --- a/tests/integration/tests/1265-extensible-snapshots/Main.hs +++ b/tests/integration/tests/1265-extensible-snapshots/Main.hs @@ -1,10 +1,28 @@ +-- Stack supports extensible snapshots. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1198 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) import StackTest main :: IO () main = do - stack ["build", "async"] - stackErr ["build", "zlib-bindings"] - stack ["build", "--stack-yaml", "stack-modify-lts.yaml", "async"] - stack ["build", "--stack-yaml", "stack-local-snapshot.yaml", "async"] - stack ["build", "--stack-yaml", "stack-remote-snapshot.yaml", "acme-missiles"] - stackErr ["build", "--stack-yaml", "stack-modify-lts.yaml", "zlib-bindings"] + stack ["build", "myPackageA", "--dry-run"] + -- Should fail because myPackageB depends on acme-box, which has been dropped: + stackErrStderr ["build", "myPackageB", "--dry-run"] (expectMessage acmeBoxNeeded) + stack ["build", "--stack-yaml", "stack-modify-lts.yaml", "myPackageA", "--dry-run"] + stack ["build", "--stack-yaml", "stack-local-snapshot.yaml", "myPackageC", "--dry-run"] + stack ["build", "--stack-yaml", "stack-remote-snapshot.yaml", "myPackageA", "--dry-run"] + -- Should fail because myPackageD depends on zlib, which has been dropped: + stackErrStderr + ["build", "--stack-yaml", "stack-modify-lts.yaml", "myPackageD", "--dry-run"] + (expectMessage zlibNeeded) + where + acmeBoxNeeded = "acme-box needed, but no version" + zlibNeeded = "zlib needed, but no version" + +expectMessage :: String -> String -> IO () +expectMessage msg stderr = do + unless (words msg `isInfixOf` words stderr) + (error $ "Expected a warning: \n" ++ show msg) diff --git a/tests/integration/tests/1265-extensible-snapshots/files/.gitignore b/tests/integration/tests/1265-extensible-snapshots/files/.gitignore new file mode 100644 index 0000000000..5087095541 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/.gitignore @@ -0,0 +1,4 @@ +myPackageA.cabal +myPackageB.cabal +myPackageC.cabal +myPackageD.cabal diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml new file mode 100644 index 0000000000..b845717f8e --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base +- acme-missiles + +library: + source-dirs: src diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/src/Lib.hs b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/src/Lib.hs new file mode 100644 index 0000000000..889210c825 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/src/Lib.hs @@ -0,0 +1,5 @@ +module Lib + ( launchMissiles + ) where + +import Acme.Missiles ( launchMissiles ) diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml new file mode 100644 index 0000000000..55b65b2c1d --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base +- acme-box + +library: + source-dirs: src diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/src/Lib.hs b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..af8de0c696 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/src/Lib.hs @@ -0,0 +1,5 @@ +module Lib + ( box + ) where + +import Acme.Box ( box ) diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml new file mode 100644 index 0000000000..888fa6d0f4 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageC +version: 0.1.0.0 + +dependencies: +- base +- myPackage + +library: + source-dirs: src diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/src/Lib.hs b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml new file mode 100644 index 0000000000..ba13632e60 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageD +version: 0.1.0.0 + +dependencies: +- base +- zlib + +library: + source-dirs: src diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/src/Lib.hs b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-2.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-2.yaml index 58134d368e..67a1547355 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-2.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-2.yaml @@ -1,11 +1,7 @@ -snapshot: ghc-9.10.3 name: test-snapshot-2 + +snapshot: ghc-9.10.3 + packages: -- async-2.2.5 -- hashable-1.5.0.0 -- os-string-2.0.7 -- stm-2.5.3.1 -- zlib-0.7.1.0@rev:2 -# FIXME: test these here -flags: {} -ghc-options: {} +- acme-missiles-0.3 +- acme-box-0.0.0.0 diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml index 042eaee94c..6f217b4bac 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshot-modify-lts.yaml @@ -1,4 +1,9 @@ -snapshot: lts-24.37 name: snapshot-modify-lts + +snapshot: lts-24.37 + +packages: +- acme-missiles-0.3 + drop-packages: - zlib diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshot.yaml index a95f8e7b38..bd797eccb9 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshot.yaml @@ -1,6 +1,6 @@ -snapshot: snapshot-2.yaml name: test-snapshot -packages: -- microlens-0.4.14.0 + +snapshot: snapshot-2.yaml + drop-packages: -- zlib +- acme-box diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml index 4345d24e23..feb04c6e76 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/local-snapshot.yaml @@ -1,4 +1,6 @@ -snapshot: lts-24.37 name: local-snapshot + +snapshot: ghc-9.10.3 + packages: -- archive: package-0.1.2.3.tar.gz +- archive: myPackage-0.1.0.0.tar.gz diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/myPackage-0.1.0.0.tar.gz b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/myPackage-0.1.0.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ce1a9e2a00891e8da45a1925210abc693d3d1769 GIT binary patch literal 392 zcmV;30eAi%iwFp^T=HoI0Bw0tVPk7yXJsugE-@}JE-)^1VR8WNmEB6iFc^k&ThgaMKKI{tW4P96BEHLiO8Mx2nnc$BC?+odXJMbi$M{`f-PUkrnjvnN_<0R# mNbsYKvkc$d;l=Webcs8oz-lgI9S(=%|L_V}E~o7P5C8x^XuJsk literal 0 HcmV?d00001 diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/package-0.1.2.3.tar.gz b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/package-0.1.2.3.tar.gz deleted file mode 100644 index a28a03742b126a3f05e1a8f868ca6b2d5b54277a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmb2|=3ppS-WSEd{Pxmqt|kYO*2ML-U6oCR*6gkK(uBG-bgdlo?*~i@muwWf`2X%2 z?(I9$r&)QcsVgo0{%YD$+oLO*vtRgrzjthF<&Bpj! E0C}5Xvj6}9 diff --git a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml index cac0c643a4..d93db09f54 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/snapshots/remote-snapshot.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.37 name: remote-snapshot +snapshot: ghc-9.10.3 packages: - archive: https://s3.amazonaws.com/hackage.fpcomplete.com/package/acme-missiles-0.3.tar.gz diff --git a/tests/integration/tests/1265-extensible-snapshots/files/stack-local-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/stack-local-snapshot.yaml index 59e7c5b620..85d9a380b5 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/stack-local-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/stack-local-snapshot.yaml @@ -1,3 +1,4 @@ snapshot: snapshots/local-snapshot.yaml -packages: [] -allow-newer: true + +packages: +- myPackageC diff --git a/tests/integration/tests/1265-extensible-snapshots/files/stack-modify-lts.yaml b/tests/integration/tests/1265-extensible-snapshots/files/stack-modify-lts.yaml index 144a246a17..cc8cca4759 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/stack-modify-lts.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/stack-modify-lts.yaml @@ -1,2 +1,5 @@ snapshot: snapshot-modify-lts.yaml -packages: [] + +packages: +- myPackageA +- myPackageD diff --git a/tests/integration/tests/1265-extensible-snapshots/files/stack-remote-snapshot.yaml b/tests/integration/tests/1265-extensible-snapshots/files/stack-remote-snapshot.yaml index 0d4edfed64..faa16c1912 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/stack-remote-snapshot.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/stack-remote-snapshot.yaml @@ -1,3 +1,4 @@ snapshot: snapshots/remote-snapshot.yaml -packages: [] -allow-newer: true + +packages: +- myPackageA diff --git a/tests/integration/tests/1265-extensible-snapshots/files/stack.yaml b/tests/integration/tests/1265-extensible-snapshots/files/stack.yaml index da6ffb5007..105c1ae1d7 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/stack.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/stack.yaml @@ -1,3 +1,5 @@ snapshot: snapshot.yaml -packages: [] -allow-newer: true + +packages: +- myPackageA +- myPackageB diff --git a/tests/integration/tests/1336-1337-new-package-names/.gitignore b/tests/integration/tests/1336-1337-new-package-names/.gitignore index 027271b9b2..ed73754e8e 100644 --- a/tests/integration/tests/1336-1337-new-package-names/.gitignore +++ b/tests/integration/tests/1336-1337-new-package-names/.gitignore @@ -1 +1,7 @@ -files +1b3d-a2c4/ +1234-abcd/ +abcd-1234/ +1234-ば日本-4本/ +ば日本-4本/ +אבהץש/ +ΔΘΩϬ/ diff --git a/tests/integration/tests/1336-1337-new-package-names/Main.hs b/tests/integration/tests/1336-1337-new-package-names/Main.hs index 56722c43f6..83d15d9d0d 100644 --- a/tests/integration/tests/1336-1337-new-package-names/Main.hs +++ b/tests/integration/tests/1336-1337-new-package-names/Main.hs @@ -1,28 +1,29 @@ -import StackTest -import Control.Monad -import System.Directory -import System.FilePath +-- Stack's new command accepts project names that are valid Cabal package names +-- and rejects those that are not without creating a project directory. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1336 +-- https://github.com/commercialhaskell/stack/issues/1337 + +import Control.Monad ( unless, when ) +import StackTest +import System.Directory + ( doesDirectoryExist, removeDirectoryRecursive ) -{-# ANN module "HLint: ignore Use unless" #-} main :: IO () -main = - if isWindows - then logInfo "Disabled on Windows (see https://github.com/commercialhaskell/stack/issues/1337#issuecomment-166118678)" - else when isLinux $ do - safeNew "1234a-4b-b4-abc-12b34" - doesExist "./1234a-4b-b4-abc-12b34/stack.yaml" - stackErr ["new", "1234-abc"] - doesNotExist "./1234-abc/stack.yaml" - doesNotExist "./1234-abc" - stackErr ["new", "1-abc"] - stackErr ["new", "44444444444444"] - stackErr ["new", "abc-1"] - stackErr ["new", "444-ば日本-4本"] - unless isMacOSX $ safeNew "ば日本-4本" - safeNew "אבהץש" - safeNew "ΔΘΩϬ" - doesExist "./ΔΘΩϬ/stack.yaml" - doesExist "./ΔΘΩϬ/ΔΘΩϬ.cabal" +main = do + safeNew "1b3d-a2c4" + doesExist "./1b3d-a2c4/stack.yaml" + doesExist "./1b3d-a2c4/1b3d-a2c4.cabal" + stackErr ["new", "1234-abcd"] + doesNotExist "./1234-abcd" + stackErr ["new", "abcd-1234"] + -- The GitHub windows-latest (Microsoft Windows Server 2025) environment + -- appears to be unable to handle these Unicode code points. + unless isWindows $ do + stackErr ["new", "1234-ば日本-4本"] + safeNew "ば日本-4本" + safeNew "אבהץש" + safeNew "ΔΘΩϬ" safeNew :: String -> IO () safeNew name = do diff --git a/tests/integration/tests/763-buildable-false/Main.hs b/tests/integration/tests/763-buildable-false/Main.hs index 89d44c5eea..c8e7b28d40 100644 --- a/tests/integration/tests/763-buildable-false/Main.hs +++ b/tests/integration/tests/763-buildable-false/Main.hs @@ -1,9 +1,12 @@ +-- Stack reports an error if commanded to build a specific component of a +-- package that is not buildable. +-- +-- https://github.com/commercialhaskell/stack/issues/763 + import StackTest main :: IO () main = do - stack ["build"] - stack ["build", "--flag", "*:force-enable"] - stack ["build", ":enabled"] - stackErr ["build", ":disabled"] - stack ["build", ":disabled", "--flag", "files:force-enable"] + stack ["build"] + stack ["build", ":myPackage", "--flag", "myPackage:buildable"] + stackErr ["build", ":myPackage"] diff --git a/tests/integration/tests/763-buildable-false/files/.gitignore b/tests/integration/tests/763-buildable-false/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/763-buildable-false/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/763-buildable-false/files/files.cabal b/tests/integration/tests/763-buildable-false/files/files.cabal deleted file mode 100644 index a4c6069896..0000000000 --- a/tests/integration/tests/763-buildable-false/files/files.cabal +++ /dev/null @@ -1,25 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -flag force-enable - default: False - description: foo - -executable enabled - hs-source-dirs: app - main-is: Main.hs - build-depends: base - default-language: Haskell2010 - buildable: True - -executable disabled - hs-source-dirs: app - main-is: Main.hs - build-depends: base - default-language: Haskell2010 - if flag(force-enable) - buildable: True - else - buildable: False diff --git a/tests/integration/tests/763-buildable-false/files/package.yaml b/tests/integration/tests/763-buildable-false/files/package.yaml new file mode 100644 index 0000000000..ef84df9c46 --- /dev/null +++ b/tests/integration/tests/763-buildable-false/files/package.yaml @@ -0,0 +1,24 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +flags: + buildable: + description: Make component buildable. + default: false + manual: true + +dependencies: +- base + +executables: + myPackage: + source-dirs: app + main: Main.hs + when: + - condition: flag(buildable) + then: + buildable: true + else: + buildable: false diff --git a/tests/integration/tests/763-buildable-false/files/stack.yaml b/tests/integration/tests/763-buildable-false/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/763-buildable-false/files/stack.yaml +++ b/tests/integration/tests/763-buildable-false/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/796-ghc-options/Main.hs b/tests/integration/tests/796-ghc-options/Main.hs index 25ee1e2869..0b5bb1cfdb 100644 --- a/tests/integration/tests/796-ghc-options/Main.hs +++ b/tests/integration/tests/796-ghc-options/Main.hs @@ -1,7 +1,12 @@ +-- Stack can set environment variables in a project-level configuration file or +-- at the command line and cause the package to be rebuilt. +-- +-- See: https://github.com/commercialhaskell/stack/issues/796 + import StackTest main :: IO () main = do - stack ["build"] - stackErr ["build", "--ghc-options=-DBAZ"] - stack ["build", "--ghc-options=-DQUX"] + stack ["build"] + stackErr ["build", "--ghc-options=-DVARIABLE_C"] + stack ["build", "--ghc-options=-DVARIABLE_D"] diff --git a/tests/integration/tests/796-ghc-options/files/.gitignore b/tests/integration/tests/796-ghc-options/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/796-ghc-options/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/796-ghc-options/files/ghc-options.cabal b/tests/integration/tests/796-ghc-options/files/ghc-options.cabal deleted file mode 100644 index 642090489e..0000000000 --- a/tests/integration/tests/796-ghc-options/files/ghc-options.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: ghc-options -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/796-ghc-options/files/package.yaml b/tests/integration/tests/796-ghc-options/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/796-ghc-options/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/796-ghc-options/files/src/Lib.hs b/tests/integration/tests/796-ghc-options/files/src/Lib.hs index cbb5c96956..5a5e96c7f0 100644 --- a/tests/integration/tests/796-ghc-options/files/src/Lib.hs +++ b/tests/integration/tests/796-ghc-options/files/src/Lib.hs @@ -1,24 +1,20 @@ {-# LANGUAGE CPP #-} -module Lib - ( someFunc - ) where -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where -- Avoid problems with CPP and HLint #ifndef __HLINT__ -#ifndef FOO -#error FOO isn't defined +#ifndef VARIABLE_A +#error VARIABLE_A isn't defined #endif -#ifndef BAR -#error BAR isn't defined +#ifndef VARIABLE_B +#error VARIABLE_B isn't defined #endif -#ifdef BAZ -#error BAZ is defined +#ifdef VARIABLE_C +#error VARIABLE_C is defined #endif #endif diff --git a/tests/integration/tests/796-ghc-options/files/stack.yaml b/tests/integration/tests/796-ghc-options/files/stack.yaml index f98d2f0900..3c2c041e3d 100644 --- a/tests/integration/tests/796-ghc-options/files/stack.yaml +++ b/tests/integration/tests/796-ghc-options/files/stack.yaml @@ -1,5 +1,7 @@ snapshot: ghc-9.10.3 + ghc-options: - "*": -DFOO - ghc-options: -DBAR + "*": -DVARIABLE_A + myPackage: -DVARIABLE_B + rebuild-ghc-options: true From 407f8e05ebc962915d83304f4ca81fccd6b8ebf0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Wed, 29 Apr 2026 23:15:03 +0100 Subject: [PATCH 46/75] Review, document and conform further integration tests --- .../tests/1337-unicode-everywhere/Main.hs | 20 ++- .../1337-unicode-everywhere/files/.gitignore | 1 + .../1337-unicode-everywhere/files/Setup.hs | 2 - .../1337-unicode-everywhere/files/app/Main.hs | 2 +- .../files/package.yaml | 80 ++++++++++ .../1337-unicode-everywhere/files/stack.yaml | 2 +- .../\320\237\317\203\316\265.hs" | 4 +- ...3\201\204\343\202\215\343\201\257-LICENSE" | 31 +++- .../files/\344\273\245.cabal" | 150 ++++++++++-------- .../tests/1438-configure-options/Main.hs | 19 ++- .../1438-configure-options/files/.gitignore | 3 +- .../1438-configure-options/files/package.yaml | 13 +- .../1438-configure-options/files/src/Lib.hs | 1 + .../files/stack-everything.yaml.lock | 14 -- .../files/stack-locals.yaml.lock | 14 -- .../{stack-name.yaml => stack-myPackage.yaml} | 2 +- .../tests/1659-skip-component/Main.hs | 18 +-- .../1659-skip-component/files/.gitignore | 1 + .../tests/1659-skip-component/files/LICENSE | 30 ---- .../tests/1659-skip-component/files/README.md | 1 - .../tests/1659-skip-component/files/Setup.hs | 2 - .../files/app-failing/Main.hs | 13 ++ .../1659-skip-component/files/bench/Bench.hs | 11 +- .../1659-skip-component/files/package.yaml | 28 ++++ .../files/skip-component.cabal | 44 ----- .../1659-skip-component/files/src/Lib.hs | 7 +- .../1659-skip-component/files/stack.yaml | 2 +- .../1659-skip-component/files/test/Spec.hs | 11 +- .../tests/1884-url-to-tarball/Main.hs | 8 +- .../1884-url-to-tarball/files/.gitignore | 2 +- .../1884-url-to-tarball/files/package.yaml | 9 +- .../1884-url-to-tarball/files/stack.yaml | 9 +- .../tests/2195-depend-on-exe/Main.hs | 18 ++- .../tests/2195-depend-on-exe/files/.gitignore | 2 + .../2195-depend-on-exe/files/files.cabal | 7 - .../files/myPackageA/app/Main.hs} | 0 .../files/myPackageA/package.yaml | 12 ++ .../files/myPackageB/package.yaml | 11 ++ .../files/myPackageB/src/Lib.hs | 1 + .../tests/2195-depend-on-exe/files/stack.yaml | 6 +- .../tests/2433-ghc-by-version/Main.hs | 16 +- .../tests/2433-ghc-by-version/files/run.sh | 6 +- .../files/{foo.hs => test.hs} | 0 .../tests/2465-init-no-packages/Main.hs | 13 +- .../integration/tests/2781-shadow-bug/Main.hs | 11 +- .../tests/2781-shadow-bug/files/.gitignore | 3 +- .../tests/2781-shadow-bug/files/bar/bar.cabal | 18 --- .../2781-shadow-bug/files/bar/src/Bar.hs | 8 - .../tests/2781-shadow-bug/files/foo/foo.cabal | 10 -- .../tests/2781-shadow-bug/files/foo/v1/Foo.hs | 6 - .../tests/2781-shadow-bug/files/foo/v2/Foo.hs | 6 - .../files/{bar => myPackageA}/bench/bench.hs | 0 .../files/myPackageA/package.yaml | 19 +++ .../files/myPackageA/src/MyPackageA.hs | 8 + .../files/myPackageB/package.yaml | 10 ++ .../files/myPackageB/src/MyPackageB.hs | 1 + .../files/myPackageB/v1/MyPackageB-v1.hs | 6 + .../files/myPackageB/v2/MyPackageB-v2.hs | 6 + .../tests/2781-shadow-bug/files/stack.yaml | 5 +- .../tests/2997-ensure-warnings-output/Main.hs | 10 +- .../files/.gitignore | 3 +- .../files/bar/package.yaml | 9 -- .../files/bar/src/Bar.hs | 3 - .../files/foo/package.yaml | 9 -- .../files/foo/src/Foo.hs | 3 - .../files/myPackageA/package.yaml | 13 ++ .../files/myPackageA/src/Lib.hs | 3 + .../files/myPackageB/package.yaml | 13 ++ .../files/myPackageB/src/Lib.hs | 3 + .../files/stack.yaml | 6 +- 70 files changed, 498 insertions(+), 340 deletions(-) create mode 100644 tests/integration/tests/1337-unicode-everywhere/files/.gitignore delete mode 100644 tests/integration/tests/1337-unicode-everywhere/files/Setup.hs create mode 100644 tests/integration/tests/1337-unicode-everywhere/files/package.yaml create mode 100644 tests/integration/tests/1438-configure-options/files/src/Lib.hs delete mode 100644 tests/integration/tests/1438-configure-options/files/stack-everything.yaml.lock delete mode 100644 tests/integration/tests/1438-configure-options/files/stack-locals.yaml.lock rename tests/integration/tests/1438-configure-options/files/{stack-name.yaml => stack-myPackage.yaml} (91%) create mode 100644 tests/integration/tests/1659-skip-component/files/.gitignore delete mode 100644 tests/integration/tests/1659-skip-component/files/LICENSE delete mode 100644 tests/integration/tests/1659-skip-component/files/README.md delete mode 100644 tests/integration/tests/1659-skip-component/files/Setup.hs create mode 100644 tests/integration/tests/1659-skip-component/files/app-failing/Main.hs create mode 100644 tests/integration/tests/1659-skip-component/files/package.yaml delete mode 100644 tests/integration/tests/1659-skip-component/files/skip-component.cabal create mode 100644 tests/integration/tests/2195-depend-on-exe/files/.gitignore delete mode 100644 tests/integration/tests/2195-depend-on-exe/files/files.cabal rename tests/integration/tests/{1659-skip-component/files/app/MainFail.hs => 2195-depend-on-exe/files/myPackageA/app/Main.hs} (100%) create mode 100644 tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/2195-depend-on-exe/files/myPackageB/src/Lib.hs rename tests/integration/tests/2433-ghc-by-version/files/{foo.hs => test.hs} (100%) delete mode 100644 tests/integration/tests/2781-shadow-bug/files/bar/bar.cabal delete mode 100644 tests/integration/tests/2781-shadow-bug/files/bar/src/Bar.hs delete mode 100644 tests/integration/tests/2781-shadow-bug/files/foo/foo.cabal delete mode 100644 tests/integration/tests/2781-shadow-bug/files/foo/v1/Foo.hs delete mode 100644 tests/integration/tests/2781-shadow-bug/files/foo/v2/Foo.hs rename tests/integration/tests/2781-shadow-bug/files/{bar => myPackageA}/bench/bench.hs (100%) create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageA/src/MyPackageA.hs create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageB/src/MyPackageB.hs create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageB/v1/MyPackageB-v1.hs create mode 100644 tests/integration/tests/2781-shadow-bug/files/myPackageB/v2/MyPackageB-v2.hs delete mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/bar/package.yaml delete mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/bar/src/Bar.hs delete mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/foo/package.yaml delete mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/foo/src/Foo.hs create mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/src/Lib.hs create mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/src/Lib.hs diff --git a/tests/integration/tests/1337-unicode-everywhere/Main.hs b/tests/integration/tests/1337-unicode-everywhere/Main.hs index 2b34396fbd..4083a0c34f 100644 --- a/tests/integration/tests/1337-unicode-everywhere/Main.hs +++ b/tests/integration/tests/1337-unicode-everywhere/Main.hs @@ -1,10 +1,14 @@ -import StackTest +-- Stack accepts Unicode code points outside of the Basic Latin Unicode block +-- (ASCII). +-- +-- See: https://github.com/commercialhaskell/stack/issues/1337 + +import Control.Monad ( unless ) +import StackTest -{-# ANN module "HLint: ignore Use unless" #-} main :: IO () -main = - if isWindows - then logInfo "Disabled on Windows (see https://github.com/commercialhaskell/stack/issues/1337#issuecomment-166118678)" - else do - stack ["build"] - stack ["exec", "以-exe"] +-- The GitHub windows-latest (Microsoft Windows Server 2025) environment appears +-- to be unable to handle these Unicode code points. +main = unless isWindows $ do + stack ["build"] + stack ["exec", "以-exe"] diff --git a/tests/integration/tests/1337-unicode-everywhere/files/.gitignore b/tests/integration/tests/1337-unicode-everywhere/files/.gitignore new file mode 100644 index 0000000000..207edb0d40 --- /dev/null +++ b/tests/integration/tests/1337-unicode-everywhere/files/.gitignore @@ -0,0 +1 @@ +以.cabal diff --git a/tests/integration/tests/1337-unicode-everywhere/files/Setup.hs b/tests/integration/tests/1337-unicode-everywhere/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/1337-unicode-everywhere/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/1337-unicode-everywhere/files/app/Main.hs b/tests/integration/tests/1337-unicode-everywhere/files/app/Main.hs index 0bb0cef9be..c33747aa40 100644 --- a/tests/integration/tests/1337-unicode-everywhere/files/app/Main.hs +++ b/tests/integration/tests/1337-unicode-everywhere/files/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Пσε +import Пσε ( θυπε ) main :: IO () main = putStrLn θυπε diff --git a/tests/integration/tests/1337-unicode-everywhere/files/package.yaml b/tests/integration/tests/1337-unicode-everywhere/files/package.yaml new file mode 100644 index 0000000000..1be2c9fdd1 --- /dev/null +++ b/tests/integration/tests/1337-unicode-everywhere/files/package.yaml @@ -0,0 +1,80 @@ +spec-version: 0.36.0 + +name: 以 +version: 0.1.0.0 +synopsis: سقوط المدن من ذات. +description: | + 以呂波耳本部止 + 千利奴流乎和加 + 餘多連曽津祢那 + 良牟有為能於久 + 耶万計不己衣天 + 阿佐伎喩女美之 + 恵比毛勢須 + + いろはにほへと + ちりぬるを + わかよたれそ + つねならむ + うゐのおくやま + けふこえて + あさきゆめみし + ゑひもせす + + 永 + + The quick brown fox jumps over the lazy dog + + Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich + + Δάματρα μέλπω Κόραν τε Κλυμένοι᾽ ἄλοχον + μελιβόαν ὕμνον ἀναγνέων + Αἰολίδ᾽ ἂμ βαρύβρομον ἁρμονίαν + + Ед эож алььтэрюм витюпэраторебуз, фалля пожйдонёюм нэ квуй. Зюаз атоморюм эю + вэл, экз агам магна жкряпшэрит нам. Примич вокынт дэлььякатезшимя эа мэль, + ыам факэтэ пытынтёюм волуптатум ку. Квуым квюаэчтио йн пэр, дольор + форынчйбюж ут еюж. Эжт нонюмэш янвыняры эю. + + Υθ φιμ λιβερ δισερετ κυαεστιο. Νε δυο σονγυε φιθυπερατοριβυς, θε φις αθκυι + σενσεριτ δεφινιεβας, μολλις θαμκυαμ ηας εα. Ιν φιμ εραντ μυσιυς, αλιι δισαντ + σομμοδο νο συμ. Πρι αμετ πορρω σονσεκυυντυρ ατ. Ιδ σεα ηομερω αδιπισι, + ομνεσκυε επισυρει ετ μελ, σεα αφφερθ σωνσεκυαθ θε. + + नीचे खरिदे समस्याओ व्रुद्धि सुना शीघ्र व्याख्या निरपेक्ष शुरुआत असरकारक अविरोधता खरिदे मेमत उसीएक् + असरकारक आंतरकार्यक्षमता केवल करता। असक्षम सामूहिक विवरण हीकम सुनत सदस्य खरिदने उदेशीत + + 引全堀記物質行上初野年謝止質警細物競。委目態政業諸好岡積米真香冒班分団時大一夏。 + 帝同手怠問来視旧記次禁身妨性直権員。州駅都稿頂風著報計個勢意時言進整。 + 作敗約秘都並断旬検面事真区。則局世紙文般百校車社金名室権金練危。 + 水夫動間始旅円典中所場針仁暮中。書稿準提選別推五玲常能船岡味。 + 詩聞誌寧真身性業遠国無軽春臨個鳥相契断者。 + + 紙ウ主転ね加必キト聴4水そない岩者づど会前ラシ総過権ぜ聞快にクげそ庫辺はぴず意掲ひに真価トしざが。体ろ名録ふいに公問築ムミ数基ー原多ぞぎすど済進ハレ見況ヤラエロ館刊キイ構読増禎ヨモメ提信最フ済席ワモキル弘28思弾5健はーろ提館ぱっるけ社除左てがひ。全てれ理時渉ン勝境チ測試ヌエマラ年9億ち込全クテヒカ土止びぎこぐ署進アカモヌ同賞誕傾吹敏こ。 + + سقوط المدن من ذات. ٠٨٠٤ تعديل إبّان عن هذه, لمّ في هامش الدمج. فرنسية الجنوب ولكسمبورغ حتى أم, مع بحث لكون الشمل استطاعوا, فعل بلاده انتهت تم. كما مع واحدة الخاسر, أخذ وإعلان الشمال رجوعهم أن. تعد تم بشكل مشارف الشرقي, هو مئات مهمّات أخذ. + + בקר את הארץ מיתולוגיה. ובמתן העזרה דת מלא, שמו זקוק לחיבור אגרונומיה על. אל זכר התוכן מונחונים ארכיאולוגיה, ויש קצרמרים פסיכולוגיה אל. כתב אם בארגז אחרונים וכמקובל. ספינות ומדעים האטמוספירה ויש מה, צ'ט משחקים הקהילה ארכיאולוגיה על. אל כימיה המדינה סדר, זכר של שמות להפוך, ייִדיש לעריכת דת ויש. + + 😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏 + ➀➁➂➃➄➅➆➇➈➉ + ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏ + 💩 +homepage: http://invalid/以#readme +author: Fake 💩💩💩💩💩 Name +maintainer: 以呂波耳本部止@invalid +license-file: いろは-LICENSE +category: Δσαντ + +dependencies: +- base + +library: + source-dirs: ארץ + +executables: + 以-exe: + source-dirs: app + main: Main.hs + dependencies: + - 以 diff --git a/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml b/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml +++ b/tests/integration/tests/1337-unicode-everywhere/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git "a/tests/integration/tests/1337-unicode-everywhere/files/\327\220\327\250\327\245/\320\237\317\203\316\265.hs" "b/tests/integration/tests/1337-unicode-everywhere/files/\327\220\327\250\327\245/\320\237\317\203\316\265.hs" index c3df827706..197831ba8e 100644 --- "a/tests/integration/tests/1337-unicode-everywhere/files/\327\220\327\250\327\245/\320\237\317\203\316\265.hs" +++ "b/tests/integration/tests/1337-unicode-everywhere/files/\327\220\327\250\327\245/\320\237\317\203\316\265.hs" @@ -1,6 +1,6 @@ module Пσε - ( θυπε - ) where + ( θυπε + ) where θυπε :: String θυπε = "以呂波耳本部止" diff --git "a/tests/integration/tests/1337-unicode-everywhere/files/\343\201\204\343\202\215\343\201\257-LICENSE" "b/tests/integration/tests/1337-unicode-everywhere/files/\343\201\204\343\202\215\343\201\257-LICENSE" index ce91414e00..3d8104feae 100644 --- "a/tests/integration/tests/1337-unicode-everywhere/files/\343\201\204\343\202\215\343\201\257-LICENSE" +++ "b/tests/integration/tests/1337-unicode-everywhere/files/\343\201\204\343\202\215\343\201\257-LICENSE" @@ -1 +1,30 @@ -Whatever license. This is a project that only exists for integration testing and all rights are granted to it to whoever wants to do anything with it. It's mostly automatically generated content anyway. +Copyright فلان الفلاني (c) 2026 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Author name here nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git "a/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" "b/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" index 8c683dac94..cf837fbc07 100644 --- "a/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" +++ "b/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" @@ -1,72 +1,90 @@ -name: 以 -version: 0.1.0.0 -synopsis: سقوط المدن من ذات. -description: - 以呂波耳本部止 - 千利奴流乎和加 - 餘多連曽津祢那 - 良牟有為能於久 - 耶万計不己衣天 - 阿佐伎喩女美之 - 恵比毛勢須 +cabal-version: 1.12 - いろはにほへと - ちりぬるを - わかよたれそ - つねならむ - うゐのおくやま - けふこえて - あさきゆめみし - ゑひもせす +-- This file has been generated from package.yaml by hpack version 0.38.3. +-- +-- see: https://github.com/sol/hpack - 永 - - The quick brown fox jumps over the lazy dog - - Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich - - Δάματρα μέλπω Κόραν τε Κλυμένοι᾽ ἄλοχον - μελιβόαν ὕμνον ἀναγνέων - Αἰολίδ᾽ ἂμ βαρύβρομον ἁρμονίαν - - Ед эож алььтэрюм витюпэраторебуз, фалля пожйдонёюм нэ квуй. Зюаз атоморюм эю вэл, экз агам магна жкряпшэрит нам. Примич вокынт дэлььякатезшимя эа мэль, ыам факэтэ пытынтёюм волуптатум ку. Квуым квюаэчтио йн пэр, дольор форынчйбюж ут еюж. Эжт нонюмэш янвыняры эю. - - Υθ φιμ λιβερ δισερετ κυαεστιο. Νε δυο σονγυε φιθυπερατοριβυς, θε φις αθκυι σενσεριτ δεφινιεβας, μολλις θαμκυαμ ηας εα. Ιν φιμ εραντ μυσιυς, αλιι δισαντ σομμοδο νο συμ. Πρι αμετ πορρω σονσεκυυντυρ ατ. Ιδ σεα ηομερω αδιπισι, ομνεσκυε επισυρει ετ μελ, σεα αφφερθ σωνσεκυαθ θε. - - नीचे खरिदे समस्याओ व्रुद्धि सुना शीघ्र व्याख्या निरपेक्ष शुरुआत असरकारक अविरोधता खरिदे मेमत उसीएक् असरकारक आंतरकार्यक्षमता केवल करता। असक्षम सामूहिक विवरण हीकम सुनत सदस्य खरिदने उदेशीत - - 引全堀記物質行上初野年謝止質警細物競。委目態政業諸好岡積米真香冒班分団時大一夏。帝同手怠問来視旧記次禁身妨性直権員。州駅都稿頂風著報計個勢意時言進整。作敗約秘都並断旬検面事真区。則局世紙文般百校車社金名室権金練危。水夫動間始旅円典中所場針仁暮中。書稿準提選別推五玲常能船岡味。詩聞誌寧真身性業遠国無軽春臨個鳥相契断者。 - - 紙ウ主転ね加必キト聴4水そない岩者づど会前ラシ総過権ぜ聞快にクげそ庫辺はぴず意掲ひに真価トしざが。体ろ名録ふいに公問築ムミ数基ー原多ぞぎすど済進ハレ見況ヤラエロ館刊キイ構読増禎ヨモメ提信最フ済席ワモキル弘28思弾5健はーろ提館ぱっるけ社除左てがひ。全てれ理時渉ン勝境チ測試ヌエマラ年9億ち込全クテヒカ土止びぎこぐ署進アカモヌ同賞誕傾吹敏こ。 - - سقوط المدن من ذات. ٠٨٠٤ تعديل إبّان عن هذه, لمّ في هامش الدمج. فرنسية الجنوب ولكسمبورغ حتى أم, مع بحث لكون الشمل استطاعوا, فعل بلاده انتهت تم. كما مع واحدة الخاسر, أخذ وإعلان الشمال رجوعهم أن. تعد تم بشكل مشارف الشرقي, هو مئات مهمّات أخذ. - - בקר את הארץ מיתולוגיה. ובמתן העזרה דת מלא, שמו זקוק לחיבור אגרונומיה על. אל זכר התוכן מונחונים ארכיאולוגיה, ויש קצרמרים פסיכולוגיה אל. כתב אם בארגז אחרונים וכמקובל. ספינות ומדעים האטמוספירה ויש מה, צ'ט משחקים הקהילה ארכיאולוגיה על. אל כימיה המדינה סדר, זכר של שמות להפוך, ייִדיש לעריכת דת ויש. - - 😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏 - ➀➁➂➃➄➅➆➇➈➉ - ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏ - 💩 -homepage: http://invalid/以#readme -license: BSD3 -license-file: いろは-LICENSE -author: Fake 💩💩💩💩💩 Name -maintainer: 以呂波耳本部止@invalid -copyright: BSD3 -category: Δσαντ -build-type: Simple -cabal-version: >=1.10 +name: 以 +version: 0.1.0.0 +synopsis: سقوط المدن من ذات. +description: 以呂波耳本部止 + 千利奴流乎和加 + 餘多連曽津祢那 + 良牟有為能於久 + 耶万計不己衣天 + 阿佐伎喩女美之 + 恵比毛勢須 + . + いろはにほへと + ちりぬるを + わかよたれそ + つねならむ + うゐのおくやま + けふこえて + あさきゆめみし + ゑひもせす + . + 永 + . + The quick brown fox jumps over the lazy dog + . + Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich + . + Δάματρα μέλπω Κόραν τε Κλυμένοι᾽ ἄλοχον + μελιβόαν ὕμνον ἀναγνέων + Αἰολίδ᾽ ἂμ βαρύβρομον ἁρμονίαν + . + Ед эож алььтэрюм витюпэраторебуз, фалля пожйдонёюм нэ квуй. Зюаз атоморюм эю + вэл, экз агам магна жкряпшэрит нам. Примич вокынт дэлььякатезшимя эа мэль, + ыам факэтэ пытынтёюм волуптатум ку. Квуым квюаэчтио йн пэр, дольор + форынчйбюж ут еюж. Эжт нонюмэш янвыняры эю. + . + Υθ φιμ λιβερ δισερετ κυαεστιο. Νε δυο σονγυε φιθυπερατοριβυς, θε φις αθκυι + σενσεριτ δεφινιεβας, μολλις θαμκυαμ ηας εα. Ιν φιμ εραντ μυσιυς, αλιι δισαντ + σομμοδο νο συμ. Πρι αμετ πορρω σονσεκυυντυρ ατ. Ιδ σεα ηομερω αδιπισι, + ομνεσκυε επισυρει ετ μελ, σεα αφφερθ σωνσεκυαθ θε. + . + नीचे खरिदे समस्याओ व्रुद्धि सुना शीघ्र व्याख्या निरपेक्ष शुरुआत असरकारक अविरोधता खरिदे मेमत उसीएक् + असरकारक आंतरकार्यक्षमता केवल करता। असक्षम सामूहिक विवरण हीकम सुनत सदस्य खरिदने उदेशीत + . + 引全堀記物質行上初野年謝止質警細物競。委目態政業諸好岡積米真香冒班分団時大一夏。 + 帝同手怠問来視旧記次禁身妨性直権員。州駅都稿頂風著報計個勢意時言進整。 + 作敗約秘都並断旬検面事真区。則局世紙文般百校車社金名室権金練危。 + 水夫動間始旅円典中所場針仁暮中。書稿準提選別推五玲常能船岡味。 + 詩聞誌寧真身性業遠国無軽春臨個鳥相契断者。 + . + 紙ウ主転ね加必キト聴4水そない岩者づど会前ラシ総過権ぜ聞快にクげそ庫辺はぴず意掲ひに真価トしざが。体ろ名録ふいに公問築ムミ数基ー原多ぞぎすど済進ハレ見況ヤラエロ館刊キイ構読増禎ヨモメ提信最フ済席ワモキル弘28思弾5健はーろ提館ぱっるけ社除左てがひ。全てれ理時渉ン勝境チ測試ヌエマラ年9億ち込全クテヒカ土止びぎこぐ署進アカモヌ同賞誕傾吹敏こ。 + . + سقوط المدن من ذات. ٠٨٠٤ تعديل إبّان عن هذه, لمّ في هامش الدمج. فرنسية الجنوب ولكسمبورغ حتى أم, مع بحث لكون الشمل استطاعوا, فعل بلاده انتهت تم. كما مع واحدة الخاسر, أخذ وإعلان الشمال رجوعهم أن. تعد تم بشكل مشارف الشرقي, هو مئات مهمّات أخذ. + . + בקר את הארץ מיתולוגיה. ובמתן העזרה דת מלא, שמו זקוק לחיבור אגרונומיה על. אל זכר התוכן מונחונים ארכיאולוגיה, ויש קצרמרים פסיכולוגיה אל. כתב אם בארגז אחרונים וכמקובל. ספינות ומדעים האטמוספירה ויש מה, צ'ט משחקים הקהילה ארכיאולוגיה על. אל כימיה המדינה סדר, זכר של שמות להפוך, ייִדיש לעריכת דת ויש. + . + 😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏 + ➀➁➂➃➄➅➆➇➈➉ + ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏ + 💩 +category: Δσαντ +homepage: http://invalid/以#readme +author: Fake 💩💩💩💩💩 Name +maintainer: 以呂波耳本部止@invalid +license: BSD3 +license-file: いろは-LICENSE +build-type: Simple library - hs-source-dirs: ארץ - exposed-modules: Пσε - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 + exposed-modules: + Пσε + hs-source-dirs: + ארץ + build-depends: + base + default-language: Haskell2010 executable 以-exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - , 以 - default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: + app + build-depends: + base + , 以 + default-language: Haskell2010 diff --git a/tests/integration/tests/1438-configure-options/Main.hs b/tests/integration/tests/1438-configure-options/Main.hs index 6ee5b65040..200dd344b2 100644 --- a/tests/integration/tests/1438-configure-options/Main.hs +++ b/tests/integration/tests/1438-configure-options/Main.hs @@ -1,12 +1,21 @@ -import StackTest -import Control.Monad (unless) -import Data.Foldable (for_) -import Data.List (isInfixOf) +-- Stack allows Cabal configuration options to be set. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1337 + +import Control.Monad ( unless ) +import Data.Foldable ( for_ ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do stackCleanFull - let stackYamlFiles = words "stack-locals.yaml stack-everything.yaml stack-targets.yaml stack-name.yaml" + let stackYamlFiles = + [ "stack-locals.yaml" + , "stack-everything.yaml" + , "stack-targets.yaml" + , "stack-myPackage.yaml" + ] for_ stackYamlFiles $ \stackYaml -> stackErrStderr ["build", "--stack-yaml", stackYaml] $ \str -> unless ("invalid option" `isInfixOf` str) $ diff --git a/tests/integration/tests/1438-configure-options/files/.gitignore b/tests/integration/tests/1438-configure-options/files/.gitignore index e9c64431ea..eae186286f 100644 --- a/tests/integration/tests/1438-configure-options/files/.gitignore +++ b/tests/integration/tests/1438-configure-options/files/.gitignore @@ -1 +1,2 @@ -name.cabal +myPackage.cabal +*.yaml.lock diff --git a/tests/integration/tests/1438-configure-options/files/package.yaml b/tests/integration/tests/1438-configure-options/files/package.yaml index 13ccbf73ec..b20cb3407d 100644 --- a/tests/integration/tests/1438-configure-options/files/package.yaml +++ b/tests/integration/tests/1438-configure-options/files/package.yaml @@ -1,5 +1,10 @@ -name: name -version: 0 +spec-version: 0.36.0 -dependencies: base -library: {} +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/1438-configure-options/files/src/Lib.hs b/tests/integration/tests/1438-configure-options/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/1438-configure-options/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/1438-configure-options/files/stack-everything.yaml.lock b/tests/integration/tests/1438-configure-options/files/stack-everything.yaml.lock deleted file mode 100644 index 1c8044c146..0000000000 --- a/tests/integration/tests/1438-configure-options/files/stack-everything.yaml.lock +++ /dev/null @@ -1,14 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - hackage: acme-dont-1.1@sha256:8264ad3e5113d3e0417b46e71d5a9c0914a1f03b5b81319cc329f1dc0f49b96c,602 - pantry-tree: - sha256: 79dbeddaf0fd507611687cefe9511c8fda489849fb0cac3894925716936290b2 - size: 206 - original: - hackage: acme-dont-1.1@rev:0 -snapshots: [] diff --git a/tests/integration/tests/1438-configure-options/files/stack-locals.yaml.lock b/tests/integration/tests/1438-configure-options/files/stack-locals.yaml.lock deleted file mode 100644 index 1c8044c146..0000000000 --- a/tests/integration/tests/1438-configure-options/files/stack-locals.yaml.lock +++ /dev/null @@ -1,14 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - hackage: acme-dont-1.1@sha256:8264ad3e5113d3e0417b46e71d5a9c0914a1f03b5b81319cc329f1dc0f49b96c,602 - pantry-tree: - sha256: 79dbeddaf0fd507611687cefe9511c8fda489849fb0cac3894925716936290b2 - size: 206 - original: - hackage: acme-dont-1.1@rev:0 -snapshots: [] diff --git a/tests/integration/tests/1438-configure-options/files/stack-name.yaml b/tests/integration/tests/1438-configure-options/files/stack-myPackage.yaml similarity index 91% rename from tests/integration/tests/1438-configure-options/files/stack-name.yaml rename to tests/integration/tests/1438-configure-options/files/stack-myPackage.yaml index 4201e42892..2e66b8b9ab 100644 --- a/tests/integration/tests/1438-configure-options/files/stack-name.yaml +++ b/tests/integration/tests/1438-configure-options/files/stack-myPackage.yaml @@ -4,7 +4,7 @@ extra-deps: - acme-dont-1.1@rev:0 configure-options: - name: + myPackage: - this is an invalid option acme-dont: - this is an invalid option diff --git a/tests/integration/tests/1659-skip-component/Main.hs b/tests/integration/tests/1659-skip-component/Main.hs index 47ff86f83e..5d2c518530 100644 --- a/tests/integration/tests/1659-skip-component/Main.hs +++ b/tests/integration/tests/1659-skip-component/Main.hs @@ -1,16 +1,10 @@ -import StackTest +-- Stack can be commanded to skip the building of specific package components. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1659 -import Control.Exception (bracket) -import qualified Data.ByteString as S +import StackTest main :: IO () main = do - -- we need to build all the executables first to be able to skip them later (see issue #3229) - stack ["build"] - bracket - (S.readFile "app/MainFail.hs") - (S.writeFile "app/MainFail.hs") - (const $ do - writeFile "app/MainFail.hs" "bdsf" - stack ["build", "--test", "--bench", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "failing-exe"] - stack ["build", ":failing-test", ":failing-bench", ":exe", ":failing-exe", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "failing-exe"]) + stack ["build", "--test", "--bench", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "myPackage-failing"] + stack ["build", ":failing-test", ":failing-bench", ":myPackage", ":myPackage-failing", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "myPackage-failing"] diff --git a/tests/integration/tests/1659-skip-component/files/.gitignore b/tests/integration/tests/1659-skip-component/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/1659-skip-component/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/1659-skip-component/files/LICENSE b/tests/integration/tests/1659-skip-component/files/LICENSE deleted file mode 100644 index 60aaf72cfa..0000000000 --- a/tests/integration/tests/1659-skip-component/files/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright Author name here (c) 2000 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Author name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/integration/tests/1659-skip-component/files/README.md b/tests/integration/tests/1659-skip-component/files/README.md deleted file mode 100644 index 560a646766..0000000000 --- a/tests/integration/tests/1659-skip-component/files/README.md +++ /dev/null @@ -1 +0,0 @@ -# files diff --git a/tests/integration/tests/1659-skip-component/files/Setup.hs b/tests/integration/tests/1659-skip-component/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/1659-skip-component/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/1659-skip-component/files/app-failing/Main.hs b/tests/integration/tests/1659-skip-component/files/app-failing/Main.hs new file mode 100644 index 0000000000..fed6cef32a --- /dev/null +++ b/tests/integration/tests/1659-skip-component/files/app-failing/Main.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE CPP #-} + +module Main where + +main :: IO () +main = pure () + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#error Not going to compile, sorry + +#endif diff --git a/tests/integration/tests/1659-skip-component/files/bench/Bench.hs b/tests/integration/tests/1659-skip-component/files/bench/Bench.hs index d3f940c1ef..55ef017a49 100644 --- a/tests/integration/tests/1659-skip-component/files/bench/Bench.hs +++ b/tests/integration/tests/1659-skip-component/files/bench/Bench.hs @@ -1,2 +1,11 @@ +{-# LANGUAGE CPP #-} + main :: IO () -main = asdf +main = pure () + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#error Not going to compile, sorry + +#endif diff --git a/tests/integration/tests/1659-skip-component/files/package.yaml b/tests/integration/tests/1659-skip-component/files/package.yaml new file mode 100644 index 0000000000..84f708952a --- /dev/null +++ b/tests/integration/tests/1659-skip-component/files/package.yaml @@ -0,0 +1,28 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + +executables: + myPackage: + source-dirs: app + main: Main.hs + myPackage-failing: + source-dirs: app-failing + main: Main.hs + +tests: + failing-test: + source-dirs: test + main: Spec.hs + +benchmarks: + failing-bench: + source-dirs: bench + main: Bench.hs diff --git a/tests/integration/tests/1659-skip-component/files/skip-component.cabal b/tests/integration/tests/1659-skip-component/files/skip-component.cabal deleted file mode 100644 index 2b4def57e6..0000000000 --- a/tests/integration/tests/1659-skip-component/files/skip-component.cabal +++ /dev/null @@ -1,44 +0,0 @@ -name: skip-component -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -executable exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 - -executable failing-exe - hs-source-dirs: app - main-is: MainFail.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - default-language: Haskell2010 - -test-suite failing-test - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs - build-depends: base - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 - -benchmark failing-bench - type: exitcode-stdio-1.0 - hs-source-dirs: bench - main-is: Bench.hs - build-depends: base - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 - -source-repository head - type: git - location: https://github.com/githubuser/files diff --git a/tests/integration/tests/1659-skip-component/files/src/Lib.hs b/tests/integration/tests/1659-skip-component/files/src/Lib.hs index d36ff2714d..6d85a26fe1 100644 --- a/tests/integration/tests/1659-skip-component/files/src/Lib.hs +++ b/tests/integration/tests/1659-skip-component/files/src/Lib.hs @@ -1,6 +1 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Lib where diff --git a/tests/integration/tests/1659-skip-component/files/stack.yaml b/tests/integration/tests/1659-skip-component/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/1659-skip-component/files/stack.yaml +++ b/tests/integration/tests/1659-skip-component/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/1659-skip-component/files/test/Spec.hs b/tests/integration/tests/1659-skip-component/files/test/Spec.hs index d3f940c1ef..55ef017a49 100644 --- a/tests/integration/tests/1659-skip-component/files/test/Spec.hs +++ b/tests/integration/tests/1659-skip-component/files/test/Spec.hs @@ -1,2 +1,11 @@ +{-# LANGUAGE CPP #-} + main :: IO () -main = asdf +main = pure () + +-- Avoid problems with CPP and HLint +#ifndef __HLINT__ + +#error Not going to compile, sorry + +#endif diff --git a/tests/integration/tests/1884-url-to-tarball/Main.hs b/tests/integration/tests/1884-url-to-tarball/Main.hs index c93c2e734d..19e9a55117 100644 --- a/tests/integration/tests/1884-url-to-tarball/Main.hs +++ b/tests/integration/tests/1884-url-to-tarball/Main.hs @@ -1,6 +1,8 @@ +-- Stack allows an extra-dep to be specified as a URL for an archive file. +-- +-- See: https://github.com/commercialhaskell/stack/issues/1884 + import StackTest main :: IO () -main = do - stackCleanFull - stack ["build", "--dry-run"] +main = stack ["build", "--dry-run"] diff --git a/tests/integration/tests/1884-url-to-tarball/files/.gitignore b/tests/integration/tests/1884-url-to-tarball/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/1884-url-to-tarball/files/.gitignore +++ b/tests/integration/tests/1884-url-to-tarball/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/1884-url-to-tarball/files/package.yaml b/tests/integration/tests/1884-url-to-tarball/files/package.yaml index 2ab76b4002..92b5f6e4c9 100644 --- a/tests/integration/tests/1884-url-to-tarball/files/package.yaml +++ b/tests/integration/tests/1884-url-to-tarball/files/package.yaml @@ -1,5 +1,10 @@ -name: foo +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + dependencies: - base -- half +- acme-missiles + library: {} diff --git a/tests/integration/tests/1884-url-to-tarball/files/stack.yaml b/tests/integration/tests/1884-url-to-tarball/files/stack.yaml index 8247641fbb..515a3914f1 100644 --- a/tests/integration/tests/1884-url-to-tarball/files/stack.yaml +++ b/tests/integration/tests/1884-url-to-tarball/files/stack.yaml @@ -1,5 +1,6 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + extra-deps: -- location: https://hackage.haskell.org/package/half-0.2.2.3/half-0.2.2.3.tar.gz - sha256: 85c244c80d1c889a3d79073a6f5a99d9e769dbe3c574ca11d992b2b4f7599a5c - size: 6050 +- location: https://hackage.haskell.org/package/acme-missiles-0.3/acme-missiles-0.3.tar.gz + sha256: e563d8b524017a06b32768c4db8eff1f822f3fb22a90320b7e414402647b735b + size: 1442 diff --git a/tests/integration/tests/2195-depend-on-exe/Main.hs b/tests/integration/tests/2195-depend-on-exe/Main.hs index 11f81255a9..e78a9e7902 100644 --- a/tests/integration/tests/2195-depend-on-exe/Main.hs +++ b/tests/integration/tests/2195-depend-on-exe/Main.hs @@ -1,11 +1,17 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack reports an error if a package component depends on a package that has +-- no library component. +-- + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () -main = stackErrStderr ["build"] (expectMessage "package provides no library") +main = stackErrStderr + ["build", "myPackageB"] + (expectMessage "package provides no library") expectMessage :: String -> String -> IO () expectMessage msg stderr = - unless (msg `isInfixOf` stderr) - (error $ "Expected a warning: \n" ++ show msg) + unless (msg `isInfixOf` stderr) + (error $ "Expected a warning: \n" ++ show msg) diff --git a/tests/integration/tests/2195-depend-on-exe/files/.gitignore b/tests/integration/tests/2195-depend-on-exe/files/.gitignore new file mode 100644 index 0000000000..f9a6e152d2 --- /dev/null +++ b/tests/integration/tests/2195-depend-on-exe/files/.gitignore @@ -0,0 +1,2 @@ +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/2195-depend-on-exe/files/files.cabal b/tests/integration/tests/2195-depend-on-exe/files/files.cabal deleted file mode 100644 index 5edf065804..0000000000 --- a/tests/integration/tests/2195-depend-on-exe/files/files.cabal +++ /dev/null @@ -1,7 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - build-depends: happy diff --git a/tests/integration/tests/1659-skip-component/files/app/MainFail.hs b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/app/Main.hs similarity index 100% rename from tests/integration/tests/1659-skip-component/files/app/MainFail.hs rename to tests/integration/tests/2195-depend-on-exe/files/myPackageA/app/Main.hs diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml new file mode 100644 index 0000000000..15532f4f98 --- /dev/null +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base + +executables: + myPackageA: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml new file mode 100644 index 0000000000..62ff96d1e9 --- /dev/null +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base +- myPackageA + +library: + source-dirs: src diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageB/src/Lib.hs b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/2195-depend-on-exe/files/stack.yaml b/tests/integration/tests/2195-depend-on-exe/files/stack.yaml index c292f63385..68891a8d7c 100644 --- a/tests/integration/tests/2195-depend-on-exe/files/stack.yaml +++ b/tests/integration/tests/2195-depend-on-exe/files/stack.yaml @@ -1 +1,5 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + +packages: +- myPackageA +- myPackageB diff --git a/tests/integration/tests/2433-ghc-by-version/Main.hs b/tests/integration/tests/2433-ghc-by-version/Main.hs index 271c259449..edec7684ea 100644 --- a/tests/integration/tests/2433-ghc-by-version/Main.hs +++ b/tests/integration/tests/2433-ghc-by-version/Main.hs @@ -1,7 +1,13 @@ -import System.Process (rawSystem) -import Control.Exception (throwIO) -import StackTest -import Control.Monad (unless) +-- If using a 'system' GHC, Stack uses the specified version of GHC on the PATH +-- and not 'ghc' (without a version) on the PATH. +-- +-- See: https://github.com/commercialhaskell/stack/issues/2433 + +import Control.Exception ( throwIO ) +import Control.Monad ( unless ) +import StackTest +import System.Process ( rawSystem ) main :: IO () -main = unless isWindows $ rawSystem "bash" ["run.sh"] >>= throwIO +main = unless isWindows $ + rawSystem "bash" ["run.sh"] >>= throwIO diff --git a/tests/integration/tests/2433-ghc-by-version/files/run.sh b/tests/integration/tests/2433-ghc-by-version/files/run.sh index d872149b5c..a7d103d1d3 100644 --- a/tests/integration/tests/2433-ghc-by-version/files/run.sh +++ b/tests/integration/tests/2433-ghc-by-version/files/run.sh @@ -2,10 +2,10 @@ set -exuo pipefail -export PATH=$(pwd)/fake-path:$("$STACK_EXE" path --resolver ghc-9.10.3 --compiler-bin):$PATH +export PATH=$(pwd)/fake-path:$("$STACK_EXE" path --snapshot ghc-9.10.3 --compiler-bin):$PATH export STACK_ROOT=$(pwd)/fake-root which ghc -"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-9.10.3 ghc -- --info -"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-9.10.3 runghc foo.hs +"$STACK_EXE" --system-ghc --no-install-ghc --snapshot ghc-9.10.3 ghc -- --info +"$STACK_EXE" --system-ghc --no-install-ghc --snapshot ghc-9.10.3 runghc test.hs diff --git a/tests/integration/tests/2433-ghc-by-version/files/foo.hs b/tests/integration/tests/2433-ghc-by-version/files/test.hs similarity index 100% rename from tests/integration/tests/2433-ghc-by-version/files/foo.hs rename to tests/integration/tests/2433-ghc-by-version/files/test.hs diff --git a/tests/integration/tests/2465-init-no-packages/Main.hs b/tests/integration/tests/2465-init-no-packages/Main.hs index ec50de4782..3000a9dbc7 100644 --- a/tests/integration/tests/2465-init-no-packages/Main.hs +++ b/tests/integration/tests/2465-init-no-packages/Main.hs @@ -1,10 +1,13 @@ -import StackTest -import System.Directory -import Control.Monad (unless) +-- Stack can initialise a project directory that contains no project packages. +-- +-- See: https://github.com/commercialhaskell/stack/issues/2465 + +import Control.Monad ( unless ) +import StackTest +import System.Directory ( doesFileExist ) main :: IO () main = do - removeFileIgnore "stack.yaml" - stack ["init", "--snapshot", "ghc-9.2.4"] + stack ["--snapshot", "ghc-9.10.3", "init"] exists <- doesFileExist "stack.yaml" unless exists $ error "stack.yaml not created!" diff --git a/tests/integration/tests/2781-shadow-bug/Main.hs b/tests/integration/tests/2781-shadow-bug/Main.hs index 057606262e..53c215393b 100644 --- a/tests/integration/tests/2781-shadow-bug/Main.hs +++ b/tests/integration/tests/2781-shadow-bug/Main.hs @@ -1,10 +1,13 @@ +-- Stack rebuilds a benchmark when an indirect dependency changes. +-- +-- See: https://github.com/commercialhaskell/stack/issues/2781 + import StackTest -import System.Directory +import System.Directory ( createDirectoryIfMissing ) main :: IO () main = do - createDirectoryIfMissing True "foo/src" - readFile "foo/v1/Foo.hs" >>= writeFile "foo/src/Foo.hs" + copy "myPackageB/v1/MyPackageB-v1.hs" "myPackageB/src/MyPackageB.hs" stack ["bench"] - readFile "foo/v2/Foo.hs" >>= writeFile "foo/src/Foo.hs" + copy "myPackageB/v2/MyPackageB-v2.hs" "myPackageB/src/MyPackageB.hs" stack ["bench"] diff --git a/tests/integration/tests/2781-shadow-bug/files/.gitignore b/tests/integration/tests/2781-shadow-bug/files/.gitignore index da86f0dbe2..f9a6e152d2 100644 --- a/tests/integration/tests/2781-shadow-bug/files/.gitignore +++ b/tests/integration/tests/2781-shadow-bug/files/.gitignore @@ -1 +1,2 @@ -foo/src/ +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/2781-shadow-bug/files/bar/bar.cabal b/tests/integration/tests/2781-shadow-bug/files/bar/bar.cabal deleted file mode 100644 index 19985b85a0..0000000000 --- a/tests/integration/tests/2781-shadow-bug/files/bar/bar.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: bar -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Bar - build-depends: base, foo - default-language: Haskell2010 - -benchmark bench - type: exitcode-stdio-1.0 - hs-source-dirs: bench - main-is: bench.hs - build-depends: base - , bar - default-language: Haskell2010 diff --git a/tests/integration/tests/2781-shadow-bug/files/bar/src/Bar.hs b/tests/integration/tests/2781-shadow-bug/files/bar/src/Bar.hs deleted file mode 100644 index 3eef52eeed..0000000000 --- a/tests/integration/tests/2781-shadow-bug/files/bar/src/Bar.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Bar - ( bar - ) where - -import Foo - -bar :: IO () -bar = foo diff --git a/tests/integration/tests/2781-shadow-bug/files/foo/foo.cabal b/tests/integration/tests/2781-shadow-bug/files/foo/foo.cabal deleted file mode 100644 index 4b9dc19942..0000000000 --- a/tests/integration/tests/2781-shadow-bug/files/foo/foo.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: foo -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Foo - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/2781-shadow-bug/files/foo/v1/Foo.hs b/tests/integration/tests/2781-shadow-bug/files/foo/v1/Foo.hs deleted file mode 100644 index 0783893feb..0000000000 --- a/tests/integration/tests/2781-shadow-bug/files/foo/v1/Foo.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Foo - ( foo - ) where - -foo :: IO () -foo = putStrLn "foo1" diff --git a/tests/integration/tests/2781-shadow-bug/files/foo/v2/Foo.hs b/tests/integration/tests/2781-shadow-bug/files/foo/v2/Foo.hs deleted file mode 100644 index 819d884e1e..0000000000 --- a/tests/integration/tests/2781-shadow-bug/files/foo/v2/Foo.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Foo - ( foo - ) where - -foo :: IO () -foo = putStrLn "foo2" diff --git a/tests/integration/tests/2781-shadow-bug/files/bar/bench/bench.hs b/tests/integration/tests/2781-shadow-bug/files/myPackageA/bench/bench.hs similarity index 100% rename from tests/integration/tests/2781-shadow-bug/files/bar/bench/bench.hs rename to tests/integration/tests/2781-shadow-bug/files/myPackageA/bench/bench.hs diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml b/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml new file mode 100644 index 0000000000..ad4a6452d2 --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml @@ -0,0 +1,19 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageB + +benchmarks: + bench: + source-dirs: bench + main: bench.hs + dependencies: + - myPackageA diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageA/src/MyPackageA.hs b/tests/integration/tests/2781-shadow-bug/files/myPackageA/src/MyPackageA.hs new file mode 100644 index 0000000000..16b38c3d34 --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageA/src/MyPackageA.hs @@ -0,0 +1,8 @@ +module MyPackageA + ( funcA + ) where + +import MyPackageB ( funcB ) + +funcA :: IO () +funcA = funcB diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml b/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml new file mode 100644 index 0000000000..fa09cc7c66 --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageB/src/MyPackageB.hs b/tests/integration/tests/2781-shadow-bug/files/myPackageB/src/MyPackageB.hs new file mode 100644 index 0000000000..e50e86ed07 --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageB/src/MyPackageB.hs @@ -0,0 +1 @@ +To be replaced. diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageB/v1/MyPackageB-v1.hs b/tests/integration/tests/2781-shadow-bug/files/myPackageB/v1/MyPackageB-v1.hs new file mode 100644 index 0000000000..38ae9f9985 --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageB/v1/MyPackageB-v1.hs @@ -0,0 +1,6 @@ +module MyPackageB + ( funcB + ) where + +funcB :: IO () +funcB = putStrLn "version 1" diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageB/v2/MyPackageB-v2.hs b/tests/integration/tests/2781-shadow-bug/files/myPackageB/v2/MyPackageB-v2.hs new file mode 100644 index 0000000000..a4584de18e --- /dev/null +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageB/v2/MyPackageB-v2.hs @@ -0,0 +1,6 @@ +module MyPackageB + ( funcB + ) where + +funcB :: IO () +funcB = putStrLn "version 2" diff --git a/tests/integration/tests/2781-shadow-bug/files/stack.yaml b/tests/integration/tests/2781-shadow-bug/files/stack.yaml index e0a635d446..68891a8d7c 100644 --- a/tests/integration/tests/2781-shadow-bug/files/stack.yaml +++ b/tests/integration/tests/2781-shadow-bug/files/stack.yaml @@ -1,4 +1,5 @@ snapshot: ghc-9.10.3 + packages: -- foo -- bar +- myPackageA +- myPackageB diff --git a/tests/integration/tests/2997-ensure-warnings-output/Main.hs b/tests/integration/tests/2997-ensure-warnings-output/Main.hs index ff41be9abb..7b0d615165 100644 --- a/tests/integration/tests/2997-ensure-warnings-output/Main.hs +++ b/tests/integration/tests/2997-ensure-warnings-output/Main.hs @@ -1,10 +1,14 @@ +-- Stack dumps logs with GHC warnings for multi-package projects and +-- non-interleaved output. +-- +-- See: https://github.com/commercialhaskell/stack/issues/2997 + +import Data.List ( isInfixOf ) import StackTest -import Data.List (isInfixOf) main :: IO () main = do - stackCleanFull - stackCheckStderr ["build", "--terminal", "--color=always"] $ \str -> + stackCheckStderr ["build", "--no-interleaved-output"] $ \str -> if "no type signature" `isInfixOf` str then pure () else error "Warnings are not being shown" diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/.gitignore b/tests/integration/tests/2997-ensure-warnings-output/files/.gitignore index d43d807c0d..f9a6e152d2 100644 --- a/tests/integration/tests/2997-ensure-warnings-output/files/.gitignore +++ b/tests/integration/tests/2997-ensure-warnings-output/files/.gitignore @@ -1 +1,2 @@ -*.cabal +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/bar/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/bar/package.yaml deleted file mode 100644 index 0c7f62c5c5..0000000000 --- a/tests/integration/tests/2997-ensure-warnings-output/files/bar/package.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: bar -version: 0 - -dependencies: -- base - -library: - source-dirs: src - ghc-options: -Wall diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/bar/src/Bar.hs b/tests/integration/tests/2997-ensure-warnings-output/files/bar/src/Bar.hs deleted file mode 100644 index 08a38856f5..0000000000 --- a/tests/integration/tests/2997-ensure-warnings-output/files/bar/src/Bar.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Bar where - -bar = () diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/foo/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/foo/package.yaml deleted file mode 100644 index 0de19a6188..0000000000 --- a/tests/integration/tests/2997-ensure-warnings-output/files/foo/package.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: foo -version: 0 - -dependencies: -- base - -library: - source-dirs: src - ghc-options: -Wall diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/foo/src/Foo.hs b/tests/integration/tests/2997-ensure-warnings-output/files/foo/src/Foo.hs deleted file mode 100644 index 11391a4814..0000000000 --- a/tests/integration/tests/2997-ensure-warnings-output/files/foo/src/Foo.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Foo where - -foo = () diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml new file mode 100644 index 0000000000..687ade7529 --- /dev/null +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base + +ghc-options: +- -Wall + +library: + source-dirs: src diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/src/Lib.hs b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/src/Lib.hs new file mode 100644 index 0000000000..2bcd1d55c1 --- /dev/null +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/src/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +func = () diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml new file mode 100644 index 0000000000..6f4e79de4b --- /dev/null +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base + +ghc-options: +- -Wall + +library: + source-dirs: src diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/src/Lib.hs b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..2bcd1d55c1 --- /dev/null +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/src/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +func = () diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/stack.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/stack.yaml index ccbffc5198..46f3e0977c 100644 --- a/tests/integration/tests/2997-ensure-warnings-output/files/stack.yaml +++ b/tests/integration/tests/2997-ensure-warnings-output/files/stack.yaml @@ -1,5 +1,7 @@ snapshot: ghc-9.10.3 + packages: -- foo -- bar +- myPackageA +- myPackageB + dump-logs: warning From 0f9fe6d64f311e8f0c1f645dd10796aa2a71f980 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Thu, 30 Apr 2026 23:36:03 +0100 Subject: [PATCH 47/75] Review, document and conform further integration tests --- .../files/myPackageA/package.yaml | 2 +- .../files/myPackageB/package.yaml | 2 +- .../files/myPackageC/package.yaml | 2 +- .../tests/1659-skip-component/Main.hs | 4 +- .../files/bench/{Bench.hs => Main.hs} | 0 .../1659-skip-component/files/package.yaml | 12 ++-- .../files/test/{Spec.hs => Main.hs} | 0 .../files/myPackageA/package.yaml | 2 +- .../tests/3315-multi-ghc-options/Main.hs | 6 +- .../3315-multi-ghc-options/files/.gitignore | 1 + .../files/multi-ghc-options.cabal | 10 --- .../files/package.yaml | 5 +- .../3315-multi-ghc-options/files/src/Lib.hs | 8 +-- .../3315-multi-ghc-options/files/stack.yaml | 2 +- .../tests/3390-unbuildable-test/Main.hs | 4 ++ .../3390-unbuildable-test/files/.gitignore | 1 + .../3390-unbuildable-test/files/files.cabal | 18 ----- .../3390-unbuildable-test/files/package.yaml | 10 +++ .../3390-unbuildable-test/files/src/Lib.hs | 1 - .../files/test/{Spec.hs => Main.hs} | 0 .../tests/3431-precompiled-works/Main.hs | 18 +++-- .../files/custom1/custom1.yaml | 2 +- .../files/custom2/custom2.yaml | 2 +- .../tests/3520-revision-matching/Main.hs | 16 ----- .../3520-revision-matching/files/.gitignore | 2 - .../files/bad-stack.yaml | 6 -- .../files/good-stack.yaml | 8 --- .../3520-revision-matching/files/src/Foo.hs | 1 - .../tests/3533-extra-deps-solver/Main.hs | 15 ---- .../3533-extra-deps-solver/files/.gitignore | 3 - .../files/local-mmorph/package.yaml | 10 --- .../files/local-mmorph/src/Lib.hs | 6 -- .../files/orig-stack.yaml | 5 -- .../files/uses-mmorph/package.yaml | 10 --- .../files/uses-mmorph/src/Lib.hs | 6 -- .../tests/3574-extra-dep-local/Main.hs | 7 +- .../3574-extra-dep-local/files/.gitignore | 1 + .../3574-extra-dep-local/files/foo/Foo.hs | 3 - .../3574-extra-dep-local/files/foo/foo.cabal | 8 --- .../files/myPackage/package.yaml | 10 +++ .../files/myPackage/src/Lib.hs | 1 + .../3574-extra-dep-local/files/stack.yaml | 4 +- .../tests/3591-cabal-warnings-once/Main.hs | 14 ++-- .../3591-cabal-warnings-once/files/.gitignore | 1 + .../3591-cabal-warnings-once/files/foo.cabal | 16 ----- .../files/package.yaml | 13 ++++ .../3591-cabal-warnings-once/files/stack.yaml | 2 +- .../tests/3631-build-http2/Main.hs | 5 ++ .../tests/366-non-root-dir/Main.hs | 2 +- .../tests/366-non-root-dir/files/package.yaml | 2 +- .../3685-config-yaml-for-allow-newer/Main.hs | 20 +++--- .../files/.gitignore | 1 - .../files/stack.yaml | 3 + .../Main.hs | 11 +-- .../files/.gitignore | 1 + .../files/app/Main.hs | 6 ++ .../files/exe/Main.hs | 1 - .../files/files.cabal | 16 ----- .../files/int/Lib.hs | 6 ++ .../files/package.yaml | 18 +++++ .../files/src-sublib/B.hs | 5 -- .../files/stack.yaml | 2 +- .../files/stack.yaml.lock | 12 ---- .../Main.hs | 68 ++++++++++--------- .../3861-ignore-bounds-in-snapshots/Main.hs | 6 +- .../files/.gitignore | 2 +- .../files/package.yaml | 6 +- .../tests/3863-purge-command/Main.hs | 29 ++++---- .../tests/3863-purge-command/files/.gitignore | 1 + .../files/new-template.cabal | 11 --- .../3863-purge-command/files/package.yaml | 10 +++ .../tests/3863-purge-command/files/src/Lib.hs | 3 - .../tests/3863-purge-command/files/stack.yaml | 2 +- .../3899-dont-rebuild-sublibraries/Main.hs | 12 ++-- .../files/.gitignore | 1 + .../files/Setup.hs | 2 - .../files/app}/Main.hs | 3 +- .../files/files.cabal | 22 ------ .../files/{src-internal => int}/Internal.hs | 0 .../files/package.yaml | 23 +++++++ .../files/stack.yaml | 3 - .../tests/3926-ghci-with-sublibraries/Main.hs | 25 ++++--- .../files/.gitignore | 3 +- .../files/Setup.hs | 2 - .../files/app}/Main.hs | 3 +- .../files/files.cabal | 23 ------- .../Internal.v1 => int/Internal.hs} | 0 .../files/int/Internal.v1 | 1 + .../files/int/Internal.v2 | 6 ++ .../files/package.yaml | 23 +++++++ .../files/src-internal/Internal.v2 | 4 -- .../files/src/Lib.hs | 3 + .../files/src/Lib.v2 | 8 ++- .../files/stack.yaml | 3 - .../tests/3940-base-upgrade-warning/Main.hs | 14 ++-- .../files/.gitignore | 1 + .../files/files.cabal | 10 --- .../files/no-base-upgrade.yaml | 2 +- .../files/package.yaml | 10 +++ .../files/src/.gitkeep | 0 .../files/src/Lib.hs | 1 + .../files/unattainable-base.yaml | 2 +- .../tests/3942-solver-error-output/Main.hs | 14 ++-- .../3942-solver-error-output/files/.gitignore | 5 +- .../files/no-deps/package.yaml | 11 +-- .../files/one-deps/one-deps.cabal | 16 +++++ .../files/one-deps/package.yaml | 11 +-- .../3942-solver-error-output/files/script.hs | 2 +- .../files/test-stack.yml | 2 +- .../tests/3959-order-of-flags/Main.hs | 23 ++++--- .../3959-order-of-flags/files/.gitignore | 2 +- .../3959-order-of-flags/files/package.yaml | 6 +- .../3959-order-of-flags/files/stack.yaml | 2 +- .../files/test/{Spec.hs => Main.hs} | 0 .../files/Setup.hs | 2 - .../files/int/Internal.hs | 1 + .../files/package.yaml | 4 +- .../files/src-internal/Internal.hs | 4 -- .../files/src-myPackage/MyPackage.hs | 4 -- .../files/src/Lib.hs | 1 + .../tests/3997-coverage-with-cabal-3/Main.hs | 17 +++-- .../files/.gitignore | 1 + .../files/package.yaml | 9 ++- .../files/stack.yaml | 2 +- 124 files changed, 420 insertions(+), 458 deletions(-) rename tests/integration/tests/1659-skip-component/files/bench/{Bench.hs => Main.hs} (100%) rename tests/integration/tests/1659-skip-component/files/test/{Spec.hs => Main.hs} (100%) create mode 100644 tests/integration/tests/3315-multi-ghc-options/files/.gitignore delete mode 100644 tests/integration/tests/3315-multi-ghc-options/files/multi-ghc-options.cabal rename tests/integration/tests/{3520-revision-matching => 3315-multi-ghc-options}/files/package.yaml (64%) create mode 100644 tests/integration/tests/3390-unbuildable-test/files/.gitignore delete mode 100644 tests/integration/tests/3390-unbuildable-test/files/files.cabal create mode 100644 tests/integration/tests/3390-unbuildable-test/files/package.yaml delete mode 100644 tests/integration/tests/3390-unbuildable-test/files/src/Lib.hs rename tests/integration/tests/3390-unbuildable-test/files/test/{Spec.hs => Main.hs} (100%) delete mode 100644 tests/integration/tests/3520-revision-matching/Main.hs delete mode 100644 tests/integration/tests/3520-revision-matching/files/.gitignore delete mode 100644 tests/integration/tests/3520-revision-matching/files/bad-stack.yaml delete mode 100644 tests/integration/tests/3520-revision-matching/files/good-stack.yaml delete mode 100644 tests/integration/tests/3520-revision-matching/files/src/Foo.hs delete mode 100644 tests/integration/tests/3533-extra-deps-solver/Main.hs delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/.gitignore delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/package.yaml delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/src/Lib.hs delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/package.yaml delete mode 100644 tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/src/Lib.hs create mode 100644 tests/integration/tests/3574-extra-dep-local/files/.gitignore delete mode 100644 tests/integration/tests/3574-extra-dep-local/files/foo/Foo.hs delete mode 100644 tests/integration/tests/3574-extra-dep-local/files/foo/foo.cabal create mode 100644 tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml create mode 100644 tests/integration/tests/3574-extra-dep-local/files/myPackage/src/Lib.hs create mode 100644 tests/integration/tests/3591-cabal-warnings-once/files/.gitignore delete mode 100644 tests/integration/tests/3591-cabal-warnings-once/files/foo.cabal create mode 100644 tests/integration/tests/3591-cabal-warnings-once/files/package.yaml delete mode 100644 tests/integration/tests/3685-config-yaml-for-allow-newer/files/.gitignore create mode 100644 tests/integration/tests/3685-config-yaml-for-allow-newer/files/stack.yaml create mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/.gitignore create mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/app/Main.hs delete mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/exe/Main.hs delete mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/files.cabal create mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/int/Lib.hs create mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml delete mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/src-sublib/B.hs delete mode 100644 tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml.lock create mode 100644 tests/integration/tests/3863-purge-command/files/.gitignore delete mode 100644 tests/integration/tests/3863-purge-command/files/new-template.cabal create mode 100644 tests/integration/tests/3863-purge-command/files/package.yaml create mode 100644 tests/integration/tests/3899-dont-rebuild-sublibraries/files/.gitignore delete mode 100644 tests/integration/tests/3899-dont-rebuild-sublibraries/files/Setup.hs rename tests/integration/tests/{3926-ghci-with-sublibraries/files/src-exe => 3899-dont-rebuild-sublibraries/files/app}/Main.hs (56%) delete mode 100644 tests/integration/tests/3899-dont-rebuild-sublibraries/files/files.cabal rename tests/integration/tests/3899-dont-rebuild-sublibraries/files/{src-internal => int}/Internal.hs (100%) create mode 100644 tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml delete mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/Setup.hs rename tests/integration/tests/{3899-dont-rebuild-sublibraries/files/src-exe => 3926-ghci-with-sublibraries/files/app}/Main.hs (56%) delete mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/files.cabal rename tests/integration/tests/3926-ghci-with-sublibraries/files/{src-internal/Internal.v1 => int/Internal.hs} (100%) create mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v1 create mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v2 create mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml delete mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v2 create mode 100644 tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.hs create mode 100644 tests/integration/tests/3940-base-upgrade-warning/files/.gitignore delete mode 100644 tests/integration/tests/3940-base-upgrade-warning/files/files.cabal create mode 100644 tests/integration/tests/3940-base-upgrade-warning/files/package.yaml delete mode 100644 tests/integration/tests/3940-base-upgrade-warning/files/src/.gitkeep create mode 100644 tests/integration/tests/3940-base-upgrade-warning/files/src/Lib.hs create mode 100644 tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal rename tests/integration/tests/3959-order-of-flags/files/test/{Spec.hs => Main.hs} (100%) delete mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/Setup.hs create mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/int/Internal.hs delete mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs delete mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs create mode 100644 tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs create mode 100644 tests/integration/tests/3997-coverage-with-cabal-3/files/.gitignore diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml index 3caf99d15a..d95c5eb517 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml @@ -7,6 +7,6 @@ dependencies: - base executables: - myPackage: + myExe: source-dirs: app main: Main.hs diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml index 9f1897c21a..608bd925d5 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml @@ -7,6 +7,6 @@ dependencies: - base executables: - myPackage: + myExe: source-dirs: app main: Main.hs diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml index 01f8a94348..fbda87617d 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml @@ -7,6 +7,6 @@ dependencies: - base executables: - myPackage: + myExe: source-dirs: app main: Main.hs diff --git a/tests/integration/tests/1659-skip-component/Main.hs b/tests/integration/tests/1659-skip-component/Main.hs index 5d2c518530..f5282d88d8 100644 --- a/tests/integration/tests/1659-skip-component/Main.hs +++ b/tests/integration/tests/1659-skip-component/Main.hs @@ -6,5 +6,5 @@ import StackTest main :: IO () main = do - stack ["build", "--test", "--bench", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "myPackage-failing"] - stack ["build", ":failing-test", ":failing-bench", ":myPackage", ":myPackage-failing", "--skip", "failing-test", "--skip", "failing-bench", "--skip", "myPackage-failing"] + stack ["build", "--test", "--bench", "--skip", "test-failing", "--skip", "bench-failing", "--skip", "myExe-failing"] + stack ["build", ":test-failing", ":bench-failing", ":myExe", ":myExe-failing", "--skip", "test-failing", "--skip", "bench-failing", "--skip", "myExe-failing"] diff --git a/tests/integration/tests/1659-skip-component/files/bench/Bench.hs b/tests/integration/tests/1659-skip-component/files/bench/Main.hs similarity index 100% rename from tests/integration/tests/1659-skip-component/files/bench/Bench.hs rename to tests/integration/tests/1659-skip-component/files/bench/Main.hs diff --git a/tests/integration/tests/1659-skip-component/files/package.yaml b/tests/integration/tests/1659-skip-component/files/package.yaml index 84f708952a..0503a21855 100644 --- a/tests/integration/tests/1659-skip-component/files/package.yaml +++ b/tests/integration/tests/1659-skip-component/files/package.yaml @@ -10,19 +10,19 @@ library: source-dirs: src executables: - myPackage: + myExe: source-dirs: app main: Main.hs - myPackage-failing: + myExe-failing: source-dirs: app-failing main: Main.hs tests: - failing-test: + test-failing: source-dirs: test - main: Spec.hs + main: Main.hs benchmarks: - failing-bench: + bench-failing: source-dirs: bench - main: Bench.hs + main: Main.hs diff --git a/tests/integration/tests/1659-skip-component/files/test/Spec.hs b/tests/integration/tests/1659-skip-component/files/test/Main.hs similarity index 100% rename from tests/integration/tests/1659-skip-component/files/test/Spec.hs rename to tests/integration/tests/1659-skip-component/files/test/Main.hs diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml index 15532f4f98..c4fa96f17c 100644 --- a/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml @@ -7,6 +7,6 @@ dependencies: - base executables: - myPackageA: + myExeA: source-dirs: app main: Main.hs diff --git a/tests/integration/tests/3315-multi-ghc-options/Main.hs b/tests/integration/tests/3315-multi-ghc-options/Main.hs index 60d8c9eec4..53fde2b204 100644 --- a/tests/integration/tests/3315-multi-ghc-options/Main.hs +++ b/tests/integration/tests/3315-multi-ghc-options/Main.hs @@ -1,6 +1,10 @@ +-- Stack allows one or more GHC options to be specified on the command line. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3315 + import StackTest.Repl main :: IO () main = do - stack ["build", "--ghc-options=-ddump-simpl -ddump-asm -DBAR -DBAZ"] + stack ["build", "--ghc-options=-ddump-simpl -ddump-asm -DVARIABLE_A -DVARIABLE_B"] stackRepl ["--ghc-options=-ddump-simpl -ddump-asm"] (pure ()) diff --git a/tests/integration/tests/3315-multi-ghc-options/files/.gitignore b/tests/integration/tests/3315-multi-ghc-options/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3315-multi-ghc-options/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3315-multi-ghc-options/files/multi-ghc-options.cabal b/tests/integration/tests/3315-multi-ghc-options/files/multi-ghc-options.cabal deleted file mode 100644 index 2f25278446..0000000000 --- a/tests/integration/tests/3315-multi-ghc-options/files/multi-ghc-options.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: multi-ghc-options -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/3520-revision-matching/files/package.yaml b/tests/integration/tests/3315-multi-ghc-options/files/package.yaml similarity index 64% rename from tests/integration/tests/3520-revision-matching/files/package.yaml rename to tests/integration/tests/3315-multi-ghc-options/files/package.yaml index ed129d64f0..b20cb3407d 100644 --- a/tests/integration/tests/3520-revision-matching/files/package.yaml +++ b/tests/integration/tests/3315-multi-ghc-options/files/package.yaml @@ -1,9 +1,10 @@ -name: issue3520 +spec-version: 0.36.0 + +name: myPackage version: 0.1.0.0 dependencies: - base -- mtl library: source-dirs: src diff --git a/tests/integration/tests/3315-multi-ghc-options/files/src/Lib.hs b/tests/integration/tests/3315-multi-ghc-options/files/src/Lib.hs index b3b76855c2..71ccd7f83b 100644 --- a/tests/integration/tests/3315-multi-ghc-options/files/src/Lib.hs +++ b/tests/integration/tests/3315-multi-ghc-options/files/src/Lib.hs @@ -5,12 +5,12 @@ module Lib where -- Avoid problems with CPP and HLint #ifndef __HLINT__ -#ifndef BAR -#error BAR isn't defined +#ifndef VARIABLE_A +#error VARIABLE_A isn't defined #endif -#ifndef BAZ -#error BAZ isn't defined +#ifndef VARIABLE_B +#error VARIABLE_B isn't defined #endif #endif diff --git a/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml b/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml +++ b/tests/integration/tests/3315-multi-ghc-options/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3390-unbuildable-test/Main.hs b/tests/integration/tests/3390-unbuildable-test/Main.hs index fb222afc69..50f4eba276 100644 --- a/tests/integration/tests/3390-unbuildable-test/Main.hs +++ b/tests/integration/tests/3390-unbuildable-test/Main.hs @@ -1,3 +1,7 @@ +-- Stack ignores test suites that are not buildable. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3390 + import StackTest main :: IO () diff --git a/tests/integration/tests/3390-unbuildable-test/files/.gitignore b/tests/integration/tests/3390-unbuildable-test/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3390-unbuildable-test/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3390-unbuildable-test/files/files.cabal b/tests/integration/tests/3390-unbuildable-test/files/files.cabal deleted file mode 100644 index 4909fb438a..0000000000 --- a/tests/integration/tests/3390-unbuildable-test/files/files.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 - -test-suite test - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs - build-depends: base - default-language: Haskell2010 - buildable: False \ No newline at end of file diff --git a/tests/integration/tests/3390-unbuildable-test/files/package.yaml b/tests/integration/tests/3390-unbuildable-test/files/package.yaml new file mode 100644 index 0000000000..c179f4c2fc --- /dev/null +++ b/tests/integration/tests/3390-unbuildable-test/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +tests: + myTest: + source-dirs: test + main: Main.hs + buildable: false diff --git a/tests/integration/tests/3390-unbuildable-test/files/src/Lib.hs b/tests/integration/tests/3390-unbuildable-test/files/src/Lib.hs deleted file mode 100644 index e1ee993010..0000000000 --- a/tests/integration/tests/3390-unbuildable-test/files/src/Lib.hs +++ /dev/null @@ -1 +0,0 @@ -module Lib () where diff --git a/tests/integration/tests/3390-unbuildable-test/files/test/Spec.hs b/tests/integration/tests/3390-unbuildable-test/files/test/Main.hs similarity index 100% rename from tests/integration/tests/3390-unbuildable-test/files/test/Spec.hs rename to tests/integration/tests/3390-unbuildable-test/files/test/Main.hs diff --git a/tests/integration/tests/3431-precompiled-works/Main.hs b/tests/integration/tests/3431-precompiled-works/Main.hs index 7d9e8ce5c5..33d2ef971a 100644 --- a/tests/integration/tests/3431-precompiled-works/Main.hs +++ b/tests/integration/tests/3431-precompiled-works/Main.hs @@ -1,10 +1,14 @@ -import StackTest -import Control.Monad -import Data.List +-- Stack uses pre-compiled immutable packages where it can. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3431 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - stack ["build", "random-1.1", "--stack-yaml", "custom1/stack.yaml"] - stackCheckStderr ["build", "random-1.1", "--stack-yaml", "custom2/stack.yaml"] $ \out -> do - print out - unless ("precompiled" `isInfixOf` out) $ error "Didn't use precompiled!" + stack ["build", "random-1.1", "--stack-yaml", "custom1/stack.yaml"] + stackCheckStderr ["build", "random-1.1", "--stack-yaml", "custom2/stack.yaml"] $ \out -> do + print out + unless ("precompiled" `isInfixOf` out) $ error "Didn't use precompiled!" diff --git a/tests/integration/tests/3431-precompiled-works/files/custom1/custom1.yaml b/tests/integration/tests/3431-precompiled-works/files/custom1/custom1.yaml index f0236625e2..5223c8b3e3 100644 --- a/tests/integration/tests/3431-precompiled-works/files/custom1/custom1.yaml +++ b/tests/integration/tests/3431-precompiled-works/files/custom1/custom1.yaml @@ -1,4 +1,4 @@ -snapshot: ghc-9.10.3 name: custom1 +snapshot: ghc-9.10.3 packages: - acme-missiles-0.3 diff --git a/tests/integration/tests/3431-precompiled-works/files/custom2/custom2.yaml b/tests/integration/tests/3431-precompiled-works/files/custom2/custom2.yaml index 8f88ff08da..566739fa3e 100644 --- a/tests/integration/tests/3431-precompiled-works/files/custom2/custom2.yaml +++ b/tests/integration/tests/3431-precompiled-works/files/custom2/custom2.yaml @@ -1,4 +1,4 @@ -snapshot: ghc-9.10.3 name: custom2 +snapshot: ghc-9.10.3 packages: - acme-missiles-0.2 diff --git a/tests/integration/tests/3520-revision-matching/Main.hs b/tests/integration/tests/3520-revision-matching/Main.hs deleted file mode 100644 index 5d01c83bf3..0000000000 --- a/tests/integration/tests/3520-revision-matching/Main.hs +++ /dev/null @@ -1,16 +0,0 @@ -import StackTest -import Control.Monad -import Data.List -import System.Directory - -main :: IO () -main = do - putStrLn "Test disabled due to switch to pantry" - {- - copyFile "bad-stack.yaml" "stack.yaml" - stackErrStderr ["build", "--dry-run"] $ \msg -> - unless ("legacy 00-index.tar.gz" `isInfixOf` msg) $ - error "Expected a warning about 00-index usage" - copyFile "good-stack.yaml" "stack.yaml" - stack ["build", "--dry-run"] - -} diff --git a/tests/integration/tests/3520-revision-matching/files/.gitignore b/tests/integration/tests/3520-revision-matching/files/.gitignore deleted file mode 100644 index b894371d9b..0000000000 --- a/tests/integration/tests/3520-revision-matching/files/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -stack.yaml -*.cabal diff --git a/tests/integration/tests/3520-revision-matching/files/bad-stack.yaml b/tests/integration/tests/3520-revision-matching/files/bad-stack.yaml deleted file mode 100644 index a3f25cb2cf..0000000000 --- a/tests/integration/tests/3520-revision-matching/files/bad-stack.yaml +++ /dev/null @@ -1,6 +0,0 @@ -snapshot: lts-10.10 - -package-indices: -- name: Hackage00 - download-prefix: https://hackage.haskell.org/package - http: https://hackage.haskell.org/00-index.tar.gz diff --git a/tests/integration/tests/3520-revision-matching/files/good-stack.yaml b/tests/integration/tests/3520-revision-matching/files/good-stack.yaml deleted file mode 100644 index da70439a3d..0000000000 --- a/tests/integration/tests/3520-revision-matching/files/good-stack.yaml +++ /dev/null @@ -1,8 +0,0 @@ -snapshot: lts-10.10 - -package-indices: -- name: Hackage00 - download-prefix: https://hackage.haskell.org/package - http: https://hackage.haskell.org/00-index.tar.gz - -ignore-revision-mismatch: true diff --git a/tests/integration/tests/3520-revision-matching/files/src/Foo.hs b/tests/integration/tests/3520-revision-matching/files/src/Foo.hs deleted file mode 100644 index efbf93bbde..0000000000 --- a/tests/integration/tests/3520-revision-matching/files/src/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/tests/integration/tests/3533-extra-deps-solver/Main.hs b/tests/integration/tests/3533-extra-deps-solver/Main.hs deleted file mode 100644 index b5bafedd7b..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/Main.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-- - -import StackTest -import System.Directory - -main :: IO () -main = do - copyFile "orig-stack.yaml" "stack.yaml" - stack [defaultResolverArg, "solver", "--update-config"] - stack ["build"] - -// --} - -main :: IO () -main = putStrLn "This test is disabled (see https://github.com/commercialhaskell/stack/issues/4410)." diff --git a/tests/integration/tests/3533-extra-deps-solver/files/.gitignore b/tests/integration/tests/3533-extra-deps-solver/files/.gitignore deleted file mode 100644 index 4c65edffd7..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.stack-work/ -*.cabal -stack.yaml diff --git a/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/package.yaml b/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/package.yaml deleted file mode 100644 index 05a16e68a5..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/package.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: mmorph -version: 1.2.0 - -dependencies: -- base -- acme-missiles - -library: - source-dirs: - - src diff --git a/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/src/Lib.hs b/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/local-mmorph/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml b/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml deleted file mode 100644 index 4941659b7d..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/orig-stack.yaml +++ /dev/null @@ -1,5 +0,0 @@ -snapshot: lts-24.37 - -packages: -- ./local-mmorph -- ./uses-mmorph diff --git a/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/package.yaml b/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/package.yaml deleted file mode 100644 index cd73e5ab0f..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/package.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: uses-mmorph -version: 1.2.0 - -dependencies: -- base -- mmorph >= 1.1 - -library: - source-dirs: - - src diff --git a/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/src/Lib.hs b/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/3533-extra-deps-solver/files/uses-mmorph/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/3574-extra-dep-local/Main.hs b/tests/integration/tests/3574-extra-dep-local/Main.hs index b1b93683df..0c73c77b2e 100644 --- a/tests/integration/tests/3574-extra-dep-local/Main.hs +++ b/tests/integration/tests/3574-extra-dep-local/Main.hs @@ -1,4 +1,9 @@ +-- Stack can target a local extra-dep and distinguishes local extra-deps from +-- local packages, when applying GHC options to local packages. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3574 + import StackTest main :: IO () -main = stack ["build", "foo"] +main = stack ["build", "myPackage"] diff --git a/tests/integration/tests/3574-extra-dep-local/files/.gitignore b/tests/integration/tests/3574-extra-dep-local/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3574-extra-dep-local/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3574-extra-dep-local/files/foo/Foo.hs b/tests/integration/tests/3574-extra-dep-local/files/foo/Foo.hs deleted file mode 100644 index a23b501b27..0000000000 --- a/tests/integration/tests/3574-extra-dep-local/files/foo/Foo.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Foo(foo) where - -foo = "foo" diff --git a/tests/integration/tests/3574-extra-dep-local/files/foo/foo.cabal b/tests/integration/tests/3574-extra-dep-local/files/foo/foo.cabal deleted file mode 100644 index b37e615a97..0000000000 --- a/tests/integration/tests/3574-extra-dep-local/files/foo/foo.cabal +++ /dev/null @@ -1,8 +0,0 @@ -cabal-version: >= 1.2 -build-type: Simple -name: foo -version: 0 - -library - build-depends: base - exposed-modules: Foo diff --git a/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml b/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/3574-extra-dep-local/files/myPackage/src/Lib.hs b/tests/integration/tests/3574-extra-dep-local/files/myPackage/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/3574-extra-dep-local/files/myPackage/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/3574-extra-dep-local/files/stack.yaml b/tests/integration/tests/3574-extra-dep-local/files/stack.yaml index 828a411b7a..991c6d6ede 100644 --- a/tests/integration/tests/3574-extra-dep-local/files/stack.yaml +++ b/tests/integration/tests/3574-extra-dep-local/files/stack.yaml @@ -3,7 +3,7 @@ snapshot: ghc-9.10.3 packages: [] extra-deps: -- foo +- myPackage ghc-options: - $locals: -bob + $locals: -dummy diff --git a/tests/integration/tests/3591-cabal-warnings-once/Main.hs b/tests/integration/tests/3591-cabal-warnings-once/Main.hs index 4efb8cb5e8..c094b33158 100644 --- a/tests/integration/tests/3591-cabal-warnings-once/Main.hs +++ b/tests/integration/tests/3591-cabal-warnings-once/Main.hs @@ -1,10 +1,14 @@ -import StackTest -import Data.List (isInfixOf) +-- Stack warns about unknown fields in Cabal files, but only once. +-- +-- https://github.com/commercialhaskell/stack/issues/3591 + +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do stackCheckStderr ["build", "--dry-run"] $ \str -> - case filter ("unknown-field-name" `isInfixOf`) (lines str) of - [] -> error "unknown-field-name didn't appear once" + case filter ("unknown-cabal-field-name" `isInfixOf`) (lines str) of + [] -> error "unknown-Cabal-field-name didn't appear once" [_] -> pure () - _:_:_ -> error "unknown-field-name appeared multiple times" + _:_:_ -> error "unknown-Cabal-field-name appeared multiple times" diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/.gitignore b/tests/integration/tests/3591-cabal-warnings-once/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3591-cabal-warnings-once/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/foo.cabal b/tests/integration/tests/3591-cabal-warnings-once/files/foo.cabal deleted file mode 100644 index 411bd8742d..0000000000 --- a/tests/integration/tests/3591-cabal-warnings-once/files/foo.cabal +++ /dev/null @@ -1,16 +0,0 @@ --- This file has been generated from package.yaml by hpack version 0.20.0. --- --- see: https://github.com/sol/hpack --- --- hash: 43a4e1612fc5dee2ab88c588fee639840be01569a600ab2955961c341b89058d - -name: foo -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 1.10 - -unknown-field-name: makes a warning! - -library - hs-source-dirs: src - exposed-modules: Lib diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml b/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml new file mode 100644 index 0000000000..8556be7577 --- /dev/null +++ b/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + +verbatim: + unknown-Cabal-field-name: makes a warning! diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml b/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml +++ b/tests/integration/tests/3591-cabal-warnings-once/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3631-build-http2/Main.hs b/tests/integration/tests/3631-build-http2/Main.hs index 0a9bc97218..56518962a8 100644 --- a/tests/integration/tests/3631-build-http2/Main.hs +++ b/tests/integration/tests/3631-build-http2/Main.hs @@ -1,3 +1,8 @@ +-- Stack can build the http2 package. +-- +-- +-- https://github.com/commercialhaskell/stack/issues/3631 + import StackTest main :: IO () diff --git a/tests/integration/tests/366-non-root-dir/Main.hs b/tests/integration/tests/366-non-root-dir/Main.hs index a09cf86b64..1a7697a78a 100644 --- a/tests/integration/tests/366-non-root-dir/Main.hs +++ b/tests/integration/tests/366-non-root-dir/Main.hs @@ -9,4 +9,4 @@ main :: IO () main = do setCurrentDirectory "app" stack ["build"] - stack ["exec", "myPackage"] + stack ["exec", "myExe"] diff --git a/tests/integration/tests/366-non-root-dir/files/package.yaml b/tests/integration/tests/366-non-root-dir/files/package.yaml index 113821465d..9a989f4644 100644 --- a/tests/integration/tests/366-non-root-dir/files/package.yaml +++ b/tests/integration/tests/366-non-root-dir/files/package.yaml @@ -7,6 +7,6 @@ dependencies: - base executables: - myPackage: + myExe: source-dirs: app main: Main.hs diff --git a/tests/integration/tests/3685-config-yaml-for-allow-newer/Main.hs b/tests/integration/tests/3685-config-yaml-for-allow-newer/Main.hs index f9679e8a0b..09d8c46d6e 100644 --- a/tests/integration/tests/3685-config-yaml-for-allow-newer/Main.hs +++ b/tests/integration/tests/3685-config-yaml-for-allow-newer/Main.hs @@ -1,19 +1,21 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest -import System.Directory +-- Stack advises the use of allow-newer in a configuration file if the package +-- versions needed are not the version in the snapshot. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3685 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest planRecommendation :: String planRecommendation = "To ignore all version constraints" main :: IO () -main = do - removeFileIgnore "stack.yaml" - stack ["init", defaultSnapshotArg] +main = -- intero-0.1.23 chosen because it depends on ghc >=7.8 && <8.2.2. stackErrStderr ["install", "intero-0.1.23"] (expectMessage planRecommendation) expectMessage :: String -> String -> IO () expectMessage msg stderr = do - unless (words msg `isInfixOf` words stderr) - (error $ "Expected a recommendation: \n" ++ show msg) + unless (words msg `isInfixOf` words stderr) $ + error $ "Expected a recommendation: \n" ++ show msg diff --git a/tests/integration/tests/3685-config-yaml-for-allow-newer/files/.gitignore b/tests/integration/tests/3685-config-yaml-for-allow-newer/files/.gitignore deleted file mode 100644 index 684dbffa96..0000000000 --- a/tests/integration/tests/3685-config-yaml-for-allow-newer/files/.gitignore +++ /dev/null @@ -1 +0,0 @@ -stack.yaml diff --git a/tests/integration/tests/3685-config-yaml-for-allow-newer/files/stack.yaml b/tests/integration/tests/3685-config-yaml-for-allow-newer/files/stack.yaml new file mode 100644 index 0000000000..776ef68d10 --- /dev/null +++ b/tests/integration/tests/3685-config-yaml-for-allow-newer/files/stack.yaml @@ -0,0 +1,3 @@ +snapshot: lts-24.37 + +packages: [] diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/Main.hs b/tests/integration/tests/3787-internal-libs-with-no-main-lib/Main.hs index 09bd4aa3b0..415d810f0a 100644 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/Main.hs +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/Main.hs @@ -1,6 +1,9 @@ -import StackTest +-- Stack builds a package with a private named sublibrary (an internal library) +-- but no main library. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3787 + +import StackTest main :: IO () -main = do - stack ["clean"] - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/.gitignore b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/app/Main.hs b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/app/Main.hs new file mode 100644 index 0000000000..a392820cc0 --- /dev/null +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/app/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import Lib ( someFunc ) + +main :: IO () +main = someFunc diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/exe/Main.hs b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/exe/Main.hs deleted file mode 100644 index 83db768ed3..0000000000 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/exe/Main.hs +++ /dev/null @@ -1 +0,0 @@ -main = putStrLn "OK" diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/files.cabal b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/files.cabal deleted file mode 100644 index 631f10c48d..0000000000 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/files.cabal +++ /dev/null @@ -1,16 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 2.0 - -library sublib - exposed-modules: B - hs-source-dirs: src-sublib - build-depends: base - default-language: Haskell2010 - -executable exe - main-is: Main.hs - hs-source-dirs: exe - build-depends: base, sublib - default-language: Haskell2010 diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/int/Lib.hs b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/int/Lib.hs new file mode 100644 index 0000000000..35dc3b3347 --- /dev/null +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/int/Lib.hs @@ -0,0 +1,6 @@ +module Lib + ( someFunc + ) where + +someFunc :: IO () +someFunc = pure () diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml new file mode 100644 index 0000000000..eb885f2809 --- /dev/null +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml @@ -0,0 +1,18 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +internal-libraries: + internal: + source-dirs: int + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - internal diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/src-sublib/B.hs b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/src-sublib/B.hs deleted file mode 100644 index 53253d5dcc..0000000000 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/src-sublib/B.hs +++ /dev/null @@ -1,5 +0,0 @@ -module B where - --- | A function of the internal library -funInternal :: Int -> Int -funInternal = pred diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml.lock b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml.lock deleted file mode 100644 index e845f3fe93..0000000000 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/stack.yaml.lock +++ /dev/null @@ -1,12 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: [] -snapshots: -- completed: - sha256: bfafe5735ccb74527d754b1f9999ded72d7c3a6c3a88529449661431ccfbd6cc - size: 649327 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/8.yaml - original: lts-20.8 diff --git a/tests/integration/tests/3850-cached-templates-network-errors/Main.hs b/tests/integration/tests/3850-cached-templates-network-errors/Main.hs index e136507279..80c1c706ad 100644 --- a/tests/integration/tests/3850-cached-templates-network-errors/Main.hs +++ b/tests/integration/tests/3850-cached-templates-network-errors/Main.hs @@ -1,38 +1,40 @@ -import StackTest -import Control.Monad (when, unless) -import Data.List (isInfixOf) -import Data.Maybe (fromMaybe) -import System.Directory -import System.Environment (lookupEnv, setEnv) -import System.FilePath +-- Stack can used cached Stack project templates. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3850 + +import Control.Exception ( bracket ) +import Control.Monad ( unless, when ) +import Data.List ( isInfixOf ) +import Data.Maybe ( fromMaybe ) +import StackTest +import System.Directory ( removeDirectoryRecursive ) +import System.Environment ( lookupEnv, setEnv ) main :: IO () main = when isLinux $ do - performCachingTest templateUrl - performCachingTest githubTemplate - where - performCachingTest :: String -> IO () - performCachingTest template = do - let arguments = ["new", "tmp", template] - originalHttpProxy <- lookupEnv "HTTPS_PROXY" - stack arguments - removeDirectoryRecursive "tmp" - setEnv "HTTPS_PROXY" "http://sdsgsfgslfgsjflgkjs" -- make https requests fail - stackCheckStderr arguments $ \stderr -> - unless ("Using cached local version" `isInfixOf` stderr) - (error "stack didn't load the cached template") - - removeDirectoryRecursive "tmp" - setEnv "HTTPS_PROXY" (fromMaybe "" originalHttpProxy) - - -- this template has a `stack.yaml` file - -- so `stack new` does not have to `stack init` - -- and therefore the test runs faster - templateUrl :: String - templateUrl = - "https://raw.githubusercontent.com/commercialhaskell/stack-templates/986836cc85b0c8c5bbb78d7b94347ba095089b03/tasty-discover.hsfiles" + performCachingTest "myProjectA" "myProjectB" templateUrl + performCachingTest "myProjectC" "myProjectD" githubTemplate + where + performCachingTest :: String -> String -> String -> IO () + performCachingTest projectName1 projectName2 template = do + let arguments = ["new", projectName1, template] + bracket + ( lookupEnv "HTTPS_PROXY" ) + ( (setEnv "HTTPS_PROXY") . (fromMaybe "") ) + ( const $ do + stack ["new", projectName1, template] + setEnv "HTTPS_PROXY" "http://sdsgsfgslfgsjflgkjs" -- make https requests fail + stackCheckStderr ["new", projectName2, template] $ \stderr -> + unless ("Using cached local version." `isInfixOf` stderr) $ + error "stack didn't load the cached template" + ) - -- the same template, cached differently - githubTemplate :: String - githubTemplate = "github:commercialhaskell/tasty-discover.hsfiles" + -- This template has a `stack.yaml` file so `stack new` does not have to + -- `stack init` and therefore the test runs faster + templateUrl :: String + templateUrl = + "https://raw.githubusercontent.com/commercialhaskell/stack-templates/refs/heads/master/tasty-discover.hsfiles" + -- The same template, cached differently + githubTemplate :: String + githubTemplate = "github:commercialhaskell/tasty-discover.hsfiles" diff --git a/tests/integration/tests/3861-ignore-bounds-in-snapshots/Main.hs b/tests/integration/tests/3861-ignore-bounds-in-snapshots/Main.hs index 38e0123f5b..12ce4c6fdd 100644 --- a/tests/integration/tests/3861-ignore-bounds-in-snapshots/Main.hs +++ b/tests/integration/tests/3861-ignore-bounds-in-snapshots/Main.hs @@ -1,7 +1,11 @@ +-- Stack trusts package versions in a snapshot over Cabal file dependency +-- information. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3861 + import StackTest main :: IO () main = do - stackIgnoreException ["clean", "--stack-yaml", "stack-good.yaml", "--full"] stackErr ["build", "--stack-yaml", "stack-bad.yaml"] stack ["build", "--stack-yaml", "stack-good.yaml"] diff --git a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/.gitignore b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/.gitignore index 0afa51175a..b0a5a052a1 100644 --- a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/.gitignore +++ b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/.gitignore @@ -1 +1 @@ -foo.cabal +myPackage.cabal diff --git a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml index aaa0f35c7c..50e7e7585b 100644 --- a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml +++ b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml @@ -1,5 +1,7 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3863-purge-command/Main.hs b/tests/integration/tests/3863-purge-command/Main.hs index d86acfcf21..140de74b76 100644 --- a/tests/integration/tests/3863-purge-command/Main.hs +++ b/tests/integration/tests/3863-purge-command/Main.hs @@ -1,12 +1,15 @@ {-# LANGUAGE ViewPatterns #-} -import StackTest -import Data.Char (isSpace) -import Data.List (dropWhileEnd) -import Data.Maybe (listToMaybe, fromMaybe) -import Control.Monad (unless) -import System.Directory -import System.FilePath +-- Stack can purge all Stack work directories. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3863 + +import Control.Monad ( unless ) +import Data.Char ( isSpace ) +import Data.List ( dropWhileEnd ) +import Data.Maybe ( fromMaybe, listToMaybe ) +import StackTest +import System.FilePath ( splitDirectories ) trimEnd :: String -> String trimEnd = dropWhileEnd isSpace @@ -15,27 +18,27 @@ main :: IO () main = -- For these commands, we'll need to know the `dist` directory. -- This is usually `.stack-work/dist/$compiler-variant/Cabal-xxxx` - stackCheckStdout [defaultSnapshotArg, "path", "--dist-dir"] $ \(trimEnd -> distDir) -> do - stackCheckStdout [defaultSnapshotArg, "path", "--local-install-root"] $ \(trimEnd -> localInstallRoot) -> do + stackCheckStdout ["path", "--dist-dir"] $ \(trimEnd -> distDir) -> do + stackCheckStdout ["path", "--local-install-root"] $ \(trimEnd -> localInstallRoot) -> do -- Usually `.stack-work` let stackWork = fromMaybe (error "There must be a Stack working directory.") $ listToMaybe (splitDirectories distDir) -- First, clean the .stack-work directory. -- This is only necessary when running individual tests. - stackIgnoreException [defaultSnapshotArg, "purge"] + stackIgnoreException ["purge"] -- See #4936 for details regarding the windows condition unless isWindows $ doesNotExist stackWork -- The dist directory should exist after a build - stack [defaultSnapshotArg, "build"] + stack ["build"] doesExist distDir doesExist localInstallRoot doesExist stackWork -- The dist directory should not exist after a clean, whereas the -- .stack-work directory should - stackIgnoreException [defaultSnapshotArg, "clean"] + stackIgnoreException ["clean"] -- See #4936 for details regarding the windows condition unless isWindows $ do doesNotExist distDir @@ -43,6 +46,6 @@ main = doesExist stackWork -- The .stack-work directory should not exist after a purge - stackIgnoreException [defaultSnapshotArg, "purge"] + stackIgnoreException ["purge"] -- See #4936 for details regarding the windows condition unless isWindows $ doesNotExist stackWork diff --git a/tests/integration/tests/3863-purge-command/files/.gitignore b/tests/integration/tests/3863-purge-command/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3863-purge-command/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3863-purge-command/files/new-template.cabal b/tests/integration/tests/3863-purge-command/files/new-template.cabal deleted file mode 100644 index 192e0b2dfb..0000000000 --- a/tests/integration/tests/3863-purge-command/files/new-template.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: new-template -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/3863-purge-command/files/package.yaml b/tests/integration/tests/3863-purge-command/files/package.yaml new file mode 100644 index 0000000000..b20cb3407d --- /dev/null +++ b/tests/integration/tests/3863-purge-command/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/3863-purge-command/files/src/Lib.hs b/tests/integration/tests/3863-purge-command/files/src/Lib.hs index 1c88a82644..6d85a26fe1 100644 --- a/tests/integration/tests/3863-purge-command/files/src/Lib.hs +++ b/tests/integration/tests/3863-purge-command/files/src/Lib.hs @@ -1,4 +1 @@ module Lib where - -someFunc :: () -someFunc = () diff --git a/tests/integration/tests/3863-purge-command/files/stack.yaml b/tests/integration/tests/3863-purge-command/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3863-purge-command/files/stack.yaml +++ b/tests/integration/tests/3863-purge-command/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/Main.hs b/tests/integration/tests/3899-dont-rebuild-sublibraries/Main.hs index fa6835ebe7..8f76c8d683 100644 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/Main.hs +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/Main.hs @@ -1,10 +1,14 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack does not recompile a package with a private named sublibrary (an +-- internal library) on a second build. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3899 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - stack ["clean"] stack ["build"] res <- compilingModulesLines . snd <$> stackStderr ["build"] unless (null res) $ fail "Stack recompiled code" diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/.gitignore b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/Setup.hs b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/src-exe/Main.hs b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/app/Main.hs similarity index 56% rename from tests/integration/tests/3926-ghci-with-sublibraries/files/src-exe/Main.hs rename to tests/integration/tests/3899-dont-rebuild-sublibraries/files/app/Main.hs index cafae24793..ac9093c87d 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/src-exe/Main.hs +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/app/Main.hs @@ -3,5 +3,4 @@ module Main where import Lib main :: IO () -main = do - putStrLn "hello world" +main = pure () diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/files.cabal b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/files.cabal deleted file mode 100644 index 867797cb7b..0000000000 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/files.cabal +++ /dev/null @@ -1,22 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 2.0 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base, lib - default-language: Haskell2010 - -library lib - hs-source-dirs: src-internal - exposed-modules: Internal - build-depends: base - default-language: Haskell2010 - -executable exe - hs-source-dirs: src-exe - main-is: Main.hs - build-depends: base, files - default-language: Haskell2010 diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/src-internal/Internal.hs b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/int/Internal.hs similarity index 100% rename from tests/integration/tests/3899-dont-rebuild-sublibraries/files/src-internal/Internal.hs rename to tests/integration/tests/3899-dont-rebuild-sublibraries/files/int/Internal.hs diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml new file mode 100644 index 0000000000..20d27e31df --- /dev/null +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml @@ -0,0 +1,23 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - internal + +internal-libraries: + internal: + source-dirs: int + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/stack.yaml b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/stack.yaml index 01c7b866fc..e674eab75a 100644 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/stack.yaml +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/stack.yaml @@ -1,4 +1 @@ snapshot: ghc-9.10.3 -extra-deps: -- stm-2.4.4.1 -- mtl-2.2.1 diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/Main.hs b/tests/integration/tests/3926-ghci-with-sublibraries/Main.hs index 2685fe87e4..de824bfca1 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/Main.hs +++ b/tests/integration/tests/3926-ghci-with-sublibraries/Main.hs @@ -1,29 +1,32 @@ -import Control.Monad.IO.Class -import Control.Monad -import Data.List +-- Stack does not recompile a package with a private named sublibrary (an +-- internal library) on a second build. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3926 +import Control.Monad ( unless, when ) +import Control.Monad.IO.Class ( liftIO ) +import Data.List ( isInfixOf, isSuffixOf ) import StackTest.Repl main :: IO () main = do - stack ["clean"] -- to make sure we can load the code even after a clean copy "src/Lib.v1" "src/Lib.hs" - copy "src-internal/Internal.v1" "src-internal/Internal.hs" + copy "int/Internal.v1" "int/Internal.hs" stack ["build"] -- need a build before ghci at the moment, see #4148 stackRepl [] $ do nextPrompt replCommand ":main" line <- replGetLine - let expected = "hello world" + let expected = "Successful!" when (line /= expected) $ error $ "Main module didn't load correctly.\n" <> "Expected: " <> expected <> "\n" <> "Actual : " <> line <> "\n" - liftIO $ copy "src-internal/Internal.v2" "src-internal/Internal.hs" - reloadAndTest "testInt" "42" "Internal library didn't reload." + liftIO $ copy "int/Internal.v2" "int/Internal.hs" + reloadAndTest "checkInternal" "\"OK\"" "Internal library didn't reload." liftIO $ copy "src/Lib.v2" "src/Lib.hs" - reloadAndTest "testStr" "\"OK\"" "Main library didn't reload." + reloadAndTest "checkLib" "\"OK\"" "Main library didn't reload." reloadAndTest :: String -> String -> String -> Repl () reloadAndTest cmd exp err = do @@ -35,5 +38,5 @@ reloadAndTest cmd exp err = do reload :: Repl () reload = replCommand ":reload" >> loop - where - loop = replGetLine >>= \line -> unless ("Ok" `isInfixOf` line) loop + where + loop = replGetLine >>= \line -> unless ("Ok" `isInfixOf` line) loop diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/.gitignore b/tests/integration/tests/3926-ghci-with-sublibraries/files/.gitignore index 54bdefd6ee..b0a5a052a1 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/.gitignore +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/.gitignore @@ -1,2 +1 @@ -src/Lib.hs -src-internal/Internal.hs +myPackage.cabal diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/Setup.hs b/tests/integration/tests/3926-ghci-with-sublibraries/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/src-exe/Main.hs b/tests/integration/tests/3926-ghci-with-sublibraries/files/app/Main.hs similarity index 56% rename from tests/integration/tests/3899-dont-rebuild-sublibraries/files/src-exe/Main.hs rename to tests/integration/tests/3926-ghci-with-sublibraries/files/app/Main.hs index cafae24793..7eaf6f21c1 100644 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/src-exe/Main.hs +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/app/Main.hs @@ -3,5 +3,4 @@ module Main where import Lib main :: IO () -main = do - putStrLn "hello world" +main = putStrLn "Successful!" diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/files.cabal b/tests/integration/tests/3926-ghci-with-sublibraries/files/files.cabal deleted file mode 100644 index c661c0e007..0000000000 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/files.cabal +++ /dev/null @@ -1,23 +0,0 @@ -cabal-version: 2.0 - -name: files -version: 0.1.0.0 -build-type: Simple - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base, lib - default-language: Haskell2010 - -library lib - hs-source-dirs: src-internal - exposed-modules: Internal - build-depends: base - default-language: Haskell2010 - -executable exe - hs-source-dirs: src-exe - main-is: Main.hs - build-depends: base, files - default-language: Haskell2010 diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v1 b/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.hs similarity index 100% rename from tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v1 rename to tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.hs diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v1 b/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v1 new file mode 100644 index 0000000000..d066bb085e --- /dev/null +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v1 @@ -0,0 +1 @@ +module Internal where diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v2 b/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v2 new file mode 100644 index 0000000000..771c9f2365 --- /dev/null +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/int/Internal.v2 @@ -0,0 +1,6 @@ +module Internal + ( checkInternal + ) where + +checkInternal :: String +checkInternal = "OK" diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml b/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml new file mode 100644 index 0000000000..20d27e31df --- /dev/null +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml @@ -0,0 +1,23 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - internal + +internal-libraries: + internal: + source-dirs: int + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v2 b/tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v2 deleted file mode 100644 index da8a642c7b..0000000000 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/src-internal/Internal.v2 +++ /dev/null @@ -1,4 +0,0 @@ -module Internal where - -testInt :: Int -testInt = 42 diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.hs b/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.hs new file mode 100644 index 0000000000..1369151610 --- /dev/null +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +import Internal diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.v2 b/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.v2 index d9892d6826..ef8bb078c5 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.v2 +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/src/Lib.v2 @@ -1,6 +1,8 @@ -module Lib where +module Lib + ( checkLib + ) where import Internal -testStr :: String -testStr = "OK" +checkLib :: String +checkLib = "OK" diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/stack.yaml b/tests/integration/tests/3926-ghci-with-sublibraries/files/stack.yaml index 911c9c7645..e674eab75a 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/stack.yaml +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/stack.yaml @@ -1,4 +1 @@ snapshot: ghc-9.10.3 -extra-deps: -- stm-2.5.1.0 -- mtl-2.2.2 diff --git a/tests/integration/tests/3940-base-upgrade-warning/Main.hs b/tests/integration/tests/3940-base-upgrade-warning/Main.hs index 75baa69992..78c9521283 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/Main.hs +++ b/tests/integration/tests/3940-base-upgrade-warning/Main.hs @@ -1,5 +1,11 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) +-- Stack provides appropriate advice if the version of base required is not that +-- specified by the snapshot. Stack warns that base is a wired-in package before +-- GHC 9.12.1. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3940 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) import StackTest -- Use short message fragment because prettyWarn formatting and colour @@ -19,5 +25,5 @@ main = do expectMessage :: String -> String -> IO () expectMessage msg stderr = - unless (words msg `isInfixOf` words stderr) - (error $ "Expected a warning: \n" ++ show msg) + unless (words msg `isInfixOf` words stderr) $ + error $ "Expected a warning: \n" ++ show msg diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/.gitignore b/tests/integration/tests/3940-base-upgrade-warning/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3940-base-upgrade-warning/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/files.cabal b/tests/integration/tests/3940-base-upgrade-warning/files/files.cabal deleted file mode 100644 index 1a0eb3c82e..0000000000 --- a/tests/integration/tests/3940-base-upgrade-warning/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.0.1.0 -build-type: Simple -cabal-version: >= 1.18 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base < 4.10 && >= 4.6.0.1 - default-language: Haskell2010 diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml index 7ecb56c46d..22e1252a91 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml +++ b/tests/integration/tests/3940-base-upgrade-warning/files/no-base-upgrade.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 extra-deps: - base-4.10.1.0 diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml new file mode 100644 index 0000000000..6d362445fe --- /dev/null +++ b/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base < 4.20 + +library: + source-dirs: src diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/src/.gitkeep b/tests/integration/tests/3940-base-upgrade-warning/files/src/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/src/Lib.hs b/tests/integration/tests/3940-base-upgrade-warning/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/3940-base-upgrade-warning/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml +++ b/tests/integration/tests/3940-base-upgrade-warning/files/unattainable-base.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3942-solver-error-output/Main.hs b/tests/integration/tests/3942-solver-error-output/Main.hs index 4866d6baa7..e8369562ab 100644 --- a/tests/integration/tests/3942-solver-error-output/Main.hs +++ b/tests/integration/tests/3942-solver-error-output/Main.hs @@ -1,6 +1,10 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack build fails if a dependency is not available. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3942 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest -- | Stack's error code for failing to construct a build plan. planFailure :: String @@ -13,5 +17,5 @@ main = do expectMessage :: String -> String -> IO () expectMessage msg stderr = do - unless (words msg `isInfixOf` words stderr) - (error $ "Expected a warning: \n" ++ show msg) + unless (words msg `isInfixOf` words stderr) $ + error $ "Expected a warning: \n" ++ show msg diff --git a/tests/integration/tests/3942-solver-error-output/files/.gitignore b/tests/integration/tests/3942-solver-error-output/files/.gitignore index 4c65edffd7..d0366f1ccb 100644 --- a/tests/integration/tests/3942-solver-error-output/files/.gitignore +++ b/tests/integration/tests/3942-solver-error-output/files/.gitignore @@ -1,3 +1,2 @@ -.stack-work/ -*.cabal -stack.yaml +deps.cabal +no-deps.cabal diff --git a/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml b/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml index 63f22d1796..e3e55e6649 100644 --- a/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml +++ b/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml @@ -1,15 +1,10 @@ +spec-version: 0.36.0 + name: no-deps version: 0.1.0.0 synopsis: A package with no dependencies, other than base -license: BSD3 -author: Author name here -copyright: 2000 Author name here -category: Development -extra-source-files: [] dependencies: - base -library: - source-dirs: '.' - exposed-modules: [] +library: {} diff --git a/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal b/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal new file mode 100644 index 0000000000..be85897c1c --- /dev/null +++ b/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal @@ -0,0 +1,16 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.39.1. +-- +-- see: https://github.com/sol/hpack + +name: one-deps +version: 0.1.0.0 +synopsis: A package with one dependency (no-deps) other than base +build-type: Simple + +library + build-depends: + base + , no-deps + default-language: Haskell2010 diff --git a/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml b/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml index 59dce7c0fe..0ef677e325 100644 --- a/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml +++ b/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml @@ -1,16 +1,11 @@ +spec-version: 0.36.0 + name: one-deps version: 0.1.0.0 synopsis: A package with one dependency (no-deps) other than base -license: BSD3 -author: Author name here -copyright: 2000 Author name here -category: Development -extra-source-files: [] dependencies: - base - no-deps -library: - source-dirs: '.' - exposed-modules: [] +library: {} diff --git a/tests/integration/tests/3942-solver-error-output/files/script.hs b/tests/integration/tests/3942-solver-error-output/files/script.hs index 51083db266..fde3259536 100644 --- a/tests/integration/tests/3942-solver-error-output/files/script.hs +++ b/tests/integration/tests/3942-solver-error-output/files/script.hs @@ -2,4 +2,4 @@ -- stack runhaskell --stack-yaml test-stack.yml --package one-deps main :: IO () -main = putStrLn "yo" +main = pure () diff --git a/tests/integration/tests/3942-solver-error-output/files/test-stack.yml b/tests/integration/tests/3942-solver-error-output/files/test-stack.yml index 7805f88107..c2035ec9bc 100644 --- a/tests/integration/tests/3942-solver-error-output/files/test-stack.yml +++ b/tests/integration/tests/3942-solver-error-output/files/test-stack.yml @@ -1,4 +1,4 @@ -resolver: lts-24.37 +snapshot: ghc-9.10.3 packages: [] diff --git a/tests/integration/tests/3959-order-of-flags/Main.hs b/tests/integration/tests/3959-order-of-flags/Main.hs index 4825c04053..479eae7be6 100644 --- a/tests/integration/tests/3959-order-of-flags/Main.hs +++ b/tests/integration/tests/3959-order-of-flags/Main.hs @@ -1,21 +1,28 @@ -import StackTest +-- Stack allows build flags or options to be specified before or after the build +-- command. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3959 -import Control.Monad (unless) -import Data.List (isInfixOf) +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest --- Integration test for https://github.com/commercialhaskell/stack/issues/3959 main :: IO () main = do checkFlagsBeforeCommand checkFlagsAfterCommand checkFlagsBeforeCommand :: IO () -checkFlagsBeforeCommand = stackCheckStderr ["--test", "--no-run-tests", "build"] checker +checkFlagsBeforeCommand = + stackCheckStderr ["--test", "--no-run-tests", "build"] checker checkFlagsAfterCommand :: IO () -checkFlagsAfterCommand = stackCheckStderr ["build", "--test", "--no-run-tests"] checker +checkFlagsAfterCommand = + stackCheckStderr ["build", "--test", "--no-run-tests"] checker checker :: String -> IO () checker output = do - let testsAreDisabled = any (\ln -> "All test running disabled by" `isInfixOf` ln) (lines output) - unless testsAreDisabled $ fail "Tests should not be run" + let testsAreDisabled = + any (\ln -> "All test running disabled by" `isInfixOf` ln) (lines output) + unless testsAreDisabled $ + fail "Tests should not be run" diff --git a/tests/integration/tests/3959-order-of-flags/files/.gitignore b/tests/integration/tests/3959-order-of-flags/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/3959-order-of-flags/files/.gitignore +++ b/tests/integration/tests/3959-order-of-flags/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/3959-order-of-flags/files/package.yaml b/tests/integration/tests/3959-order-of-flags/files/package.yaml index 0eb6d8f2f9..32561805b9 100644 --- a/tests/integration/tests/3959-order-of-flags/files/package.yaml +++ b/tests/integration/tests/3959-order-of-flags/files/package.yaml @@ -1,4 +1,6 @@ -name: issue3959 +spec-version: 0.36.0 + +name: myPackage version: 0.1.0.0 dependencies: @@ -6,5 +8,5 @@ dependencies: tests: test: - main: Spec.hs + main: Main.hs source-dirs: test diff --git a/tests/integration/tests/3959-order-of-flags/files/stack.yaml b/tests/integration/tests/3959-order-of-flags/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3959-order-of-flags/files/stack.yaml +++ b/tests/integration/tests/3959-order-of-flags/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/3959-order-of-flags/files/test/Spec.hs b/tests/integration/tests/3959-order-of-flags/files/test/Main.hs similarity index 100% rename from tests/integration/tests/3959-order-of-flags/files/test/Spec.hs rename to tests/integration/tests/3959-order-of-flags/files/test/Main.hs diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/Setup.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/int/Internal.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/int/Internal.hs new file mode 100644 index 0000000000..d066bb085e --- /dev/null +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/int/Internal.hs @@ -0,0 +1 @@ +module Internal where diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml index 346994bde2..fdc3ba4f23 100644 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml @@ -7,8 +7,8 @@ dependencies: - base library: - source-dirs: src-myPackage + source-dirs: src internal-libraries: internal: - source-dirs: src-internal + source-dirs: int diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs deleted file mode 100644 index cc2b013844..0000000000 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-internal/Internal.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Internal where - -internalFunc :: IO () -internalFunc = pure () diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs deleted file mode 100644 index 986e664586..0000000000 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/src-myPackage/MyPackage.hs +++ /dev/null @@ -1,4 +0,0 @@ -module MyPackage where - -myPackageFunc :: IO () -myPackageFunc = pure () diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs b/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/Main.hs b/tests/integration/tests/3997-coverage-with-cabal-3/Main.hs index 9e3d9a0e65..c6f049f66f 100644 --- a/tests/integration/tests/3997-coverage-with-cabal-3/Main.hs +++ b/tests/integration/tests/3997-coverage-with-cabal-3/Main.hs @@ -1,10 +1,13 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack can create a coverage report for a test suite. +-- +-- See: https://github.com/commercialhaskell/stack/issues/3997 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - stack ["setup"] - stackCheckStderr ["test", "--coverage"] $ \out -> do - unless ("The coverage report for foo's test-suite foo-test is available at" `isInfixOf` out) $ - fail "Coverage report didn't build" + stackCheckStderr ["test", "--coverage"] $ \out -> do + unless ("The coverage report for myPackage's test-suite test is available at" `isInfixOf` out) $ + fail "Coverage report didn't build" diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/files/.gitignore b/tests/integration/tests/3997-coverage-with-cabal-3/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/3997-coverage-with-cabal-3/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml b/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml index d4a5b288c7..4a4c48658d 100644 --- a/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml +++ b/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml @@ -1,4 +1,7 @@ -name: foo +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 dependencies: - base @@ -7,8 +10,8 @@ library: source-dirs: src tests: - foo-test: + test: source-dirs: test main: Main.hs dependencies: - - foo + - myPackage diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml b/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml +++ b/tests/integration/tests/3997-coverage-with-cabal-3/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 From 83d049bdd1c29ce679cea9f36aa4c28d158ab01e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 2 May 2026 18:26:50 +0100 Subject: [PATCH 48/75] Review, document and conform further integration tests --- .../tests/4001-excess-recompilation/Main.hs | 25 +++++++++++-------- .../files/.gitignore | 1 + .../4001-excess-recompilation/files/Setup.hs | 2 -- .../files/bench/Main.hs | 4 +++ .../files/bench/Main.v1 | 4 +++ .../files/bench/Main.v2 | 4 +++ .../files/bench/Main1.hs | 5 ---- .../files/bench/Main2.hs | 5 ---- .../files/files.cabal | 25 ------------------- .../files/package.yaml | 24 ++++++++++++++++++ .../files/test/Main.hs | 4 +++ .../files/test/Main.v1 | 4 +++ .../files/test/Main.v2 | 4 +++ .../files/test/Main1.hs | 5 ---- .../files/test/Main2.hs | 5 ---- .../tests/4044-no-run-tests-config/Main.hs | 8 ++++-- .../4044-no-run-tests-config/files/.gitignore | 2 +- .../4044-no-run-tests-config/files/Test.hs | 2 -- .../files/package.yaml | 12 ++++++--- .../files/test/Main.hs | 2 ++ .../4085-insufficient-error-message/Main.hs | 2 ++ .../tests/4095-utf8-pure-nix/Main.hs | 13 ++++++---- .../tests/4095-utf8-pure-nix/files/.gitignore | 2 +- .../4095-utf8-pure-nix/files/ShowUnicode.hs | 5 ---- .../4095-utf8-pure-nix/files/app/Main.hs | 5 ++++ .../4095-utf8-pure-nix/files/package.yaml | 12 ++++++--- .../tests/4095-utf8-pure-nix/files/stack.yaml | 2 +- .../tests/4101-dependency-tree/Main.hs | 24 ++++++++++-------- .../4101-dependency-tree/files/.gitignore | 2 ++ .../4101-dependency-tree/files/files.cabal | 10 -------- .../files/myPackageB/package.yaml | 9 +++++++ .../4101-dependency-tree/files/package.yaml | 12 +++++++++ .../4101-dependency-tree/files/src/Main.hs | 5 ---- .../4101-dependency-tree/files/stack.yaml | 4 ++- .../files/subproject/src/Main.hs | 5 ---- .../files/subproject/subproject.cabal | 10 -------- .../Main.hs | 11 +++++--- .../files/.gitignore | 1 + .../files/files.cabal | 23 ----------------- .../files/int/Internal.hs | 7 ++++++ .../files/package.yaml | 22 ++++++++++++++++ .../files/src-sublib/B.hs | 5 ---- .../files/src/Lib.hs | 7 ++++++ .../files/src/Src.hs | 5 ---- .../files/test/Main.hs | 8 +++--- .../tests/4181-clean-wo-dl-ghc/Main.hs | 7 +++--- .../4181-clean-wo-dl-ghc/files/.gitignore | 1 + .../4181-clean-wo-dl-ghc/files/foo.cabal | 13 ---------- .../4181-clean-wo-dl-ghc/files/package.yaml | 9 +++++++ .../tests/4215-missing-unregister/Main.hs | 6 ++--- .../4215-missing-unregister/files/.gitignore | 2 +- .../4215-missing-unregister/files/stack1.yaml | 1 + .../4215-missing-unregister/files/stack2.yaml | 1 + .../files/v1/package.yaml | 5 ++-- .../files/v2/package.yaml | 5 ++-- 55 files changed, 221 insertions(+), 187 deletions(-) create mode 100644 tests/integration/tests/4001-excess-recompilation/files/.gitignore delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/Setup.hs create mode 100644 tests/integration/tests/4001-excess-recompilation/files/bench/Main.hs create mode 100644 tests/integration/tests/4001-excess-recompilation/files/bench/Main.v1 create mode 100644 tests/integration/tests/4001-excess-recompilation/files/bench/Main.v2 delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/bench/Main1.hs delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/bench/Main2.hs delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/files.cabal create mode 100644 tests/integration/tests/4001-excess-recompilation/files/package.yaml create mode 100644 tests/integration/tests/4001-excess-recompilation/files/test/Main.hs create mode 100644 tests/integration/tests/4001-excess-recompilation/files/test/Main.v1 create mode 100644 tests/integration/tests/4001-excess-recompilation/files/test/Main.v2 delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/test/Main1.hs delete mode 100644 tests/integration/tests/4001-excess-recompilation/files/test/Main2.hs delete mode 100644 tests/integration/tests/4044-no-run-tests-config/files/Test.hs create mode 100644 tests/integration/tests/4044-no-run-tests-config/files/test/Main.hs delete mode 100644 tests/integration/tests/4095-utf8-pure-nix/files/ShowUnicode.hs create mode 100644 tests/integration/tests/4095-utf8-pure-nix/files/app/Main.hs create mode 100644 tests/integration/tests/4101-dependency-tree/files/.gitignore delete mode 100644 tests/integration/tests/4101-dependency-tree/files/files.cabal create mode 100644 tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/4101-dependency-tree/files/package.yaml delete mode 100644 tests/integration/tests/4101-dependency-tree/files/src/Main.hs delete mode 100644 tests/integration/tests/4101-dependency-tree/files/subproject/src/Main.hs delete mode 100644 tests/integration/tests/4101-dependency-tree/files/subproject/subproject.cabal create mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/.gitignore delete mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/files.cabal create mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/int/Internal.hs create mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml delete mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/src-sublib/B.hs create mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Lib.hs delete mode 100644 tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Src.hs create mode 100644 tests/integration/tests/4181-clean-wo-dl-ghc/files/.gitignore delete mode 100644 tests/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal create mode 100644 tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml diff --git a/tests/integration/tests/4001-excess-recompilation/Main.hs b/tests/integration/tests/4001-excess-recompilation/Main.hs index 20b99b9a5a..03a19bcd10 100644 --- a/tests/integration/tests/4001-excess-recompilation/Main.hs +++ b/tests/integration/tests/4001-excess-recompilation/Main.hs @@ -1,19 +1,24 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack does not recompile a package when a test suite or benchmark is dirty +-- but the test suite or benchmark is not a build target. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4001 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - copy "test/Main1.hs" "test/Main.hs" - copy "bench/Main1.hs" "bench/Main.hs" + copy "test/Main.v1" "test/Main.hs" + copy "bench/Main.v1" "bench/Main.hs" stack ["build"] - copy "test/Main2.hs" "test/Main.hs" - copy "bench/Main2.hs" "bench/Main.hs" + copy "test/Main.v2" "test/Main.hs" + copy "bench/Main.v2" "bench/Main.hs" res <- unregisteringLines . snd <$> stackStderr ["build"] - removeFileIgnore "test/Main.hs" - removeFileIgnore "bench/Main.hs" - unless (null res) $ fail "Stack recompiled when a test or benchmark file was changed, but only the library was targeted" + unless (null res) $ + fail "Stack recompiled when a test or benchmark file was changed, but only \ + \the library was targeted." unregisteringLines :: String -> [String] unregisteringLines = filter (isInfixOf " unregistering ") . lines diff --git a/tests/integration/tests/4001-excess-recompilation/files/.gitignore b/tests/integration/tests/4001-excess-recompilation/files/.gitignore new file mode 100644 index 0000000000..f54a4084b1 --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/.gitignore @@ -0,0 +1 @@ +myPackage.Cabal diff --git a/tests/integration/tests/4001-excess-recompilation/files/Setup.hs b/tests/integration/tests/4001-excess-recompilation/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/4001-excess-recompilation/files/bench/Main.hs b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.hs new file mode 100644 index 0000000000..6fca540825 --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.hs @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = pure () diff --git a/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v1 b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v1 new file mode 100644 index 0000000000..a0e060b7ca --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v1 @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = putStrLn "Version 1" diff --git a/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v2 b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v2 new file mode 100644 index 0000000000..d1741bc55f --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/bench/Main.v2 @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = putStrLn "Version 2" diff --git a/tests/integration/tests/4001-excess-recompilation/files/bench/Main1.hs b/tests/integration/tests/4001-excess-recompilation/files/bench/Main1.hs deleted file mode 100644 index dbd8a1e159..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/bench/Main1.hs +++ /dev/null @@ -1,5 +0,0 @@ -import Lib - -main :: IO () -main = putStrLn "I am Main1" - diff --git a/tests/integration/tests/4001-excess-recompilation/files/bench/Main2.hs b/tests/integration/tests/4001-excess-recompilation/files/bench/Main2.hs deleted file mode 100644 index 9c51c0f9ef..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/bench/Main2.hs +++ /dev/null @@ -1,5 +0,0 @@ -import Lib - -main :: IO () -main = putStrLn "I am Main2" - diff --git a/tests/integration/tests/4001-excess-recompilation/files/files.cabal b/tests/integration/tests/4001-excess-recompilation/files/files.cabal deleted file mode 100644 index 00c3ca0303..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/files.cabal +++ /dev/null @@ -1,25 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 2.0 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 - -test-suite test - hs-source-dirs: test - main-is: Main.hs - build-depends: base, files - default-language: Haskell2010 - type: exitcode-stdio-1.0 - -benchmark bench - hs-source-dirs: bench - main-is: Main.hs - build-depends: base, files - default-language: Haskell2010 - type: exitcode-stdio-1.0 - diff --git a/tests/integration/tests/4001-excess-recompilation/files/package.yaml b/tests/integration/tests/4001-excess-recompilation/files/package.yaml new file mode 100644 index 0000000000..8f49edaee0 --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/package.yaml @@ -0,0 +1,24 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + +tests: + test: + source-dirs: test + main: Main.hs + dependencies: + - myPackage + +benchmarks: + bench: + source-dirs: bench + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/4001-excess-recompilation/files/test/Main.hs b/tests/integration/tests/4001-excess-recompilation/files/test/Main.hs new file mode 100644 index 0000000000..6fca540825 --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/test/Main.hs @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = pure () diff --git a/tests/integration/tests/4001-excess-recompilation/files/test/Main.v1 b/tests/integration/tests/4001-excess-recompilation/files/test/Main.v1 new file mode 100644 index 0000000000..a0e060b7ca --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/test/Main.v1 @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = putStrLn "Version 1" diff --git a/tests/integration/tests/4001-excess-recompilation/files/test/Main.v2 b/tests/integration/tests/4001-excess-recompilation/files/test/Main.v2 new file mode 100644 index 0000000000..d1741bc55f --- /dev/null +++ b/tests/integration/tests/4001-excess-recompilation/files/test/Main.v2 @@ -0,0 +1,4 @@ +import Lib + +main :: IO () +main = putStrLn "Version 2" diff --git a/tests/integration/tests/4001-excess-recompilation/files/test/Main1.hs b/tests/integration/tests/4001-excess-recompilation/files/test/Main1.hs deleted file mode 100644 index dbd8a1e159..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/test/Main1.hs +++ /dev/null @@ -1,5 +0,0 @@ -import Lib - -main :: IO () -main = putStrLn "I am Main1" - diff --git a/tests/integration/tests/4001-excess-recompilation/files/test/Main2.hs b/tests/integration/tests/4001-excess-recompilation/files/test/Main2.hs deleted file mode 100644 index 9c51c0f9ef..0000000000 --- a/tests/integration/tests/4001-excess-recompilation/files/test/Main2.hs +++ /dev/null @@ -1,5 +0,0 @@ -import Lib - -main :: IO () -main = putStrLn "I am Main2" - diff --git a/tests/integration/tests/4044-no-run-tests-config/Main.hs b/tests/integration/tests/4044-no-run-tests-config/Main.hs index 81d3e5a402..afd68b4d03 100644 --- a/tests/integration/tests/4044-no-run-tests-config/Main.hs +++ b/tests/integration/tests/4044-no-run-tests-config/Main.hs @@ -1,6 +1,10 @@ -import StackTest +-- Stack can be configured not to run test suites. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4044 + +import StackTest main :: IO () main = do stack ["test"] - stack ["build", "foo:test:foo"] + stack ["build", "myPackage:test:test"] diff --git a/tests/integration/tests/4044-no-run-tests-config/files/.gitignore b/tests/integration/tests/4044-no-run-tests-config/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/4044-no-run-tests-config/files/.gitignore +++ b/tests/integration/tests/4044-no-run-tests-config/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/4044-no-run-tests-config/files/Test.hs b/tests/integration/tests/4044-no-run-tests-config/files/Test.hs deleted file mode 100644 index 72891941af..0000000000 --- a/tests/integration/tests/4044-no-run-tests-config/files/Test.hs +++ /dev/null @@ -1,2 +0,0 @@ -main :: IO () -main = error "You shall not pass!" diff --git a/tests/integration/tests/4044-no-run-tests-config/files/package.yaml b/tests/integration/tests/4044-no-run-tests-config/files/package.yaml index ba64b2afad..28ed00191b 100644 --- a/tests/integration/tests/4044-no-run-tests-config/files/package.yaml +++ b/tests/integration/tests/4044-no-run-tests-config/files/package.yaml @@ -1,10 +1,14 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + dependencies: - base library: {} tests: - foo: - main: Test.hs + test: + source-dirs: test + main: Main.hs diff --git a/tests/integration/tests/4044-no-run-tests-config/files/test/Main.hs b/tests/integration/tests/4044-no-run-tests-config/files/test/Main.hs new file mode 100644 index 0000000000..40565d378d --- /dev/null +++ b/tests/integration/tests/4044-no-run-tests-config/files/test/Main.hs @@ -0,0 +1,2 @@ +main :: IO () +main = error "This test will fail if run." diff --git a/tests/integration/tests/4085-insufficient-error-message/Main.hs b/tests/integration/tests/4085-insufficient-error-message/Main.hs index 1f69420f6d..6ec7afb6c5 100644 --- a/tests/integration/tests/4085-insufficient-error-message/Main.hs +++ b/tests/integration/tests/4085-insufficient-error-message/Main.hs @@ -1,3 +1,5 @@ +-- See: https://github.com/commercialhaskell/stack/issues/4044 + {-# LANGUAGE OverloadedStrings #-} {-- diff --git a/tests/integration/tests/4095-utf8-pure-nix/Main.hs b/tests/integration/tests/4095-utf8-pure-nix/Main.hs index cbbb0dfc02..34ee080b98 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/Main.hs +++ b/tests/integration/tests/4095-utf8-pure-nix/Main.hs @@ -1,8 +1,11 @@ -import StackTest +-- Stack supports Unicode code points in a Nix environment. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4095 -import Control.Monad ( unless ) -import Data.Maybe ( isJust ) -import System.Environment ( lookupEnv ) +import Control.Monad ( unless ) +import Data.Maybe ( isJust ) +import StackTest +import System.Environment ( lookupEnv ) -- This test requires that Nix is installed and that the NIX_PATH has been set -- so as to allow the path to be used. @@ -18,7 +21,7 @@ main isInContainer <- getInContainer unless isInContainer $ do stack ["build", "--nix-pure"] - stack ["exec", "--nix-pure", "ShowUnicode"] + stack ["exec", "--nix-pure", "myExe"] -- | 'True' if we are currently running inside a Docker container. getInContainer :: IO Bool diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/.gitignore b/tests/integration/tests/4095-utf8-pure-nix/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/files/.gitignore +++ b/tests/integration/tests/4095-utf8-pure-nix/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/ShowUnicode.hs b/tests/integration/tests/4095-utf8-pure-nix/files/ShowUnicode.hs deleted file mode 100644 index 91011a6576..0000000000 --- a/tests/integration/tests/4095-utf8-pure-nix/files/ShowUnicode.hs +++ /dev/null @@ -1,5 +0,0 @@ -import System.IO (stdout) -import Text.Printf (hPrintf) - -main :: IO () -main = hPrintf stdout "平和" diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/app/Main.hs b/tests/integration/tests/4095-utf8-pure-nix/files/app/Main.hs new file mode 100644 index 0000000000..3350958478 --- /dev/null +++ b/tests/integration/tests/4095-utf8-pure-nix/files/app/Main.hs @@ -0,0 +1,5 @@ +import System.IO ( stdout ) +import Text.Printf ( hPrintf ) + +main :: IO () +main = hPrintf stdout "平和" diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml b/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml index 87c99e38ea..9a989f4644 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml +++ b/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml @@ -1,8 +1,12 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + dependencies: - base executables: - ShowUnicode: - main: ShowUnicode.hs + myExe: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml b/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml index acc9a9581d..6eed06afb0 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml +++ b/tests/integration/tests/4095-utf8-pure-nix/files/stack.yaml @@ -7,4 +7,4 @@ # # 948 (GHC 9.4.8), 967 (GHC 9.6.7), 984 (GHC 9.8.4), 9102 (GHC 9.10.2), # 9103 (GHC 9.10.3), 9122 (GHC 9.12.2). -snapshot: lts-24.32 # GHC 9.10.3 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/4101-dependency-tree/Main.hs b/tests/integration/tests/4101-dependency-tree/Main.hs index 0edaa6370c..c143ceb32c 100644 --- a/tests/integration/tests/4101-dependency-tree/Main.hs +++ b/tests/integration/tests/4101-dependency-tree/Main.hs @@ -1,13 +1,17 @@ -import Control.Monad (when, unless) -import StackTest -import System.Directory (getCurrentDirectory) -import Data.List (isPrefixOf) +-- Stack can report the dependency tree of project packages. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4101 + +import Control.Monad ( unless, when ) +import Data.List ( isPrefixOf ) +import StackTest +import System.Directory ( getCurrentDirectory ) main :: IO () main = unless isWindows $ do stackCheckStdout ["ls", "dependencies", "tree"] $ \stdOut -> do let expected = unlines [ "Packages" - , "├─┬ files 0.1.0.0" + , "├─┬ myPackageA 0.1.0.0" , "│ ├─┬ base 4.20.2.0" ] unless (expected `isPrefixOf` stdOut) $ @@ -15,20 +19,20 @@ main = unless isWindows $ do stackCheckStdout ["ls", "dependencies", "tree", "--depth=1"] $ \stdOut -> do let expected = unlines [ "Packages" - , "├─┬ files 0.1.0.0" + , "├─┬ myPackageA 0.1.0.0" , "│ ├── base 4.20.2.0" , "│ ├── filelock 0.1.1.2" , "│ ├── mtl 2.3.1" - , "│ └── subproject 0.1.0.0" - , "└─┬ subproject 0.1.0.0" + , "│ └── myPackageB 0.1.0.0" + , "└─┬ myPackageB 0.1.0.0" , " └── base 4.20.2.0" ] when (stdOut /= expected) $ error $ unlines [ "Expected:", expected, "Actual:", stdOut ] - stackCheckStdout ["ls", "dependencies", "tree", "subproject"] $ \stdOut -> do + stackCheckStdout ["ls", "dependencies", "tree", "myPackageB"] $ \stdOut -> do let expected = unlines [ "Packages" - , "└─┬ subproject 0.1.0.0" + , "└─┬ myPackageB 0.1.0.0" , " └─┬ base 4.20.2.0" , " ├─┬ ghc-internal 9.1003.0" , " │ ├─┬ ghc-bignum 1.3" diff --git a/tests/integration/tests/4101-dependency-tree/files/.gitignore b/tests/integration/tests/4101-dependency-tree/files/.gitignore new file mode 100644 index 0000000000..f9a6e152d2 --- /dev/null +++ b/tests/integration/tests/4101-dependency-tree/files/.gitignore @@ -0,0 +1,2 @@ +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/4101-dependency-tree/files/files.cabal b/tests/integration/tests/4101-dependency-tree/files/files.cabal deleted file mode 100644 index bd96bcbf9c..0000000000 --- a/tests/integration/tests/4101-dependency-tree/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, mtl, subproject, filelock - default-language: Haskell2010 diff --git a/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml b/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml new file mode 100644 index 0000000000..851655b06f --- /dev/null +++ b/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackageB +version: 0.1.0.0 + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/4101-dependency-tree/files/package.yaml b/tests/integration/tests/4101-dependency-tree/files/package.yaml new file mode 100644 index 0000000000..9ca121637a --- /dev/null +++ b/tests/integration/tests/4101-dependency-tree/files/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageA +version: 0.1.0.0 + +dependencies: +- base +- filelock +- mtl +- myPackageB + +library: {} diff --git a/tests/integration/tests/4101-dependency-tree/files/src/Main.hs b/tests/integration/tests/4101-dependency-tree/files/src/Main.hs deleted file mode 100644 index 9cd992d9e5..0000000000 --- a/tests/integration/tests/4101-dependency-tree/files/src/Main.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Main where - -main :: IO () -main = do - putStrLn "hello world" diff --git a/tests/integration/tests/4101-dependency-tree/files/stack.yaml b/tests/integration/tests/4101-dependency-tree/files/stack.yaml index 530954a8b4..743bc66c45 100644 --- a/tests/integration/tests/4101-dependency-tree/files/stack.yaml +++ b/tests/integration/tests/4101-dependency-tree/files/stack.yaml @@ -1,7 +1,9 @@ snapshot: lts-24.37 + packages: - . -- subproject +- myPackageB + extra-deps: - github: snoyberg/filelock commit: 4f080496d8bf153fbe26e64d1f52cf73c7db25f6 diff --git a/tests/integration/tests/4101-dependency-tree/files/subproject/src/Main.hs b/tests/integration/tests/4101-dependency-tree/files/subproject/src/Main.hs deleted file mode 100644 index 9cd992d9e5..0000000000 --- a/tests/integration/tests/4101-dependency-tree/files/subproject/src/Main.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Main where - -main :: IO () -main = do - putStrLn "hello world" diff --git a/tests/integration/tests/4101-dependency-tree/files/subproject/subproject.cabal b/tests/integration/tests/4101-dependency-tree/files/subproject/subproject.cabal deleted file mode 100644 index 6c3a2f939d..0000000000 --- a/tests/integration/tests/4101-dependency-tree/files/subproject/subproject.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: subproject -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/Main.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/Main.hs index 8a02ae060e..3d8d2dc4f7 100644 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/Main.hs +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/Main.hs @@ -1,6 +1,11 @@ -import Control.Monad ( unless ) -import Data.List ( isInfixOf, isPrefixOf ) -import StackTest +-- Stack generates coverage reports for main libraries and private named +-- libraries (internal libraries). +-- +-- See: https://github.com/commercialhaskell/stack/issues/4105 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf, isPrefixOf ) +import StackTest main :: IO () main = do diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/.gitignore b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/files.cabal b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/files.cabal deleted file mode 100644 index 49cd5a2431..0000000000 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/files.cabal +++ /dev/null @@ -1,23 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 2.0 - -library - exposed-modules: Src - hs-source-dirs: src - build-depends: base - default-language: Haskell2010 - -library sublib - exposed-modules: B - hs-source-dirs: src-sublib - build-depends: base - default-language: Haskell2010 - -test-suite test - type: exitcode-stdio-1.0 - main-is: Main.hs - hs-source-dirs: test - build-depends: base, files, sublib - default-language: Haskell2010 diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/int/Internal.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/int/Internal.hs new file mode 100644 index 0000000000..cd713ec4e2 --- /dev/null +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/int/Internal.hs @@ -0,0 +1,7 @@ +module Internal + ( funcInternal + ) where + +-- | A function of the internal library +funcInternal :: Int -> Int +funcInternal = pred diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml new file mode 100644 index 0000000000..0e5e66ed8a --- /dev/null +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml @@ -0,0 +1,22 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + +internal-libraries: + internal: + source-dirs: int + +tests: + test: + source-dirs: test + main: Main.hs + dependencies: + - internal + - myPackage diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src-sublib/B.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src-sublib/B.hs deleted file mode 100644 index 53253d5dcc..0000000000 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src-sublib/B.hs +++ /dev/null @@ -1,5 +0,0 @@ -module B where - --- | A function of the internal library -funInternal :: Int -> Int -funInternal = pred diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Lib.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Lib.hs new file mode 100644 index 0000000000..034418635a --- /dev/null +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Lib.hs @@ -0,0 +1,7 @@ +module Lib + ( funcLib + ) where + +-- | A function of the main library +funcLib :: Int -> Int +funcLib = succ diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Src.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Src.hs deleted file mode 100644 index 0f8db7fb77..0000000000 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/src/Src.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Src where - --- | A function of the main library -funMainLib :: Int -> Int -funMainLib = succ diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/test/Main.hs b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/test/Main.hs index b1cf81b0dc..967f9031e2 100644 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/test/Main.hs +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/test/Main.hs @@ -1,6 +1,6 @@ -import Control.Monad (when) +import Control.Monad ( when ) -import Src -import B +import Lib ( funcLib ) +import Internal ( funcInternal ) -main = when (funMainLib 41 /= funInternal 43) $ error "test failed" +main = when (funcLib 41 /= funcInternal 43) $ error "test failed" diff --git a/tests/integration/tests/4181-clean-wo-dl-ghc/Main.hs b/tests/integration/tests/4181-clean-wo-dl-ghc/Main.hs index 415380a7e6..9736da7645 100644 --- a/tests/integration/tests/4181-clean-wo-dl-ghc/Main.hs +++ b/tests/integration/tests/4181-clean-wo-dl-ghc/Main.hs @@ -1,6 +1,7 @@ --- | --- The integration tests have no ghc present, initially. Stack should not --- require ghc present to run the `clean` command. +-- Stack's clean command should not require the presence of the specified +-- version of GHC. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4181 import StackTest diff --git a/tests/integration/tests/4181-clean-wo-dl-ghc/files/.gitignore b/tests/integration/tests/4181-clean-wo-dl-ghc/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/4181-clean-wo-dl-ghc/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal b/tests/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal deleted file mode 100644 index 45446b7f9c..0000000000 --- a/tests/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal +++ /dev/null @@ -1,13 +0,0 @@ -cabal-version: >= 1.10 - --- This file has been generated from package.yaml by hpack version 0.29.6. --- --- see: https://github.com/sol/hpack --- --- hash: 941a1ab4bea2f0ee229dd6ab7fe9730517a0397fb9141fe2841a0f9748dbfd57 - -name: foo -version: 0.1.0.0 -build-type: Simple - -library diff --git a/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml b/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml new file mode 100644 index 0000000000..df88f93a9a --- /dev/null +++ b/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/4215-missing-unregister/Main.hs b/tests/integration/tests/4215-missing-unregister/Main.hs index 83056eb580..20259f013e 100644 --- a/tests/integration/tests/4215-missing-unregister/Main.hs +++ b/tests/integration/tests/4215-missing-unregister/Main.hs @@ -1,6 +1,6 @@ -import StackTest +import StackTest main :: IO () main = do - stack ["build", "--stack-yaml", "stack1.yaml"] - stack ["build", "--stack-yaml", "stack2.yaml"] + stack ["--stack-yaml", "stack1.yaml", "build"] + stack [ "--stack-yaml", "stack2.yaml", "build"] diff --git a/tests/integration/tests/4215-missing-unregister/files/.gitignore b/tests/integration/tests/4215-missing-unregister/files/.gitignore index 0afa51175a..b0a5a052a1 100644 --- a/tests/integration/tests/4215-missing-unregister/files/.gitignore +++ b/tests/integration/tests/4215-missing-unregister/files/.gitignore @@ -1 +1 @@ -foo.cabal +myPackage.cabal diff --git a/tests/integration/tests/4215-missing-unregister/files/stack1.yaml b/tests/integration/tests/4215-missing-unregister/files/stack1.yaml index b671072761..365c421b18 100644 --- a/tests/integration/tests/4215-missing-unregister/files/stack1.yaml +++ b/tests/integration/tests/4215-missing-unregister/files/stack1.yaml @@ -1,3 +1,4 @@ snapshot: ghc-9.10.3 + packages: - v1 diff --git a/tests/integration/tests/4215-missing-unregister/files/stack2.yaml b/tests/integration/tests/4215-missing-unregister/files/stack2.yaml index 9ed3d120f8..02a50554ec 100644 --- a/tests/integration/tests/4215-missing-unregister/files/stack2.yaml +++ b/tests/integration/tests/4215-missing-unregister/files/stack2.yaml @@ -1,3 +1,4 @@ snapshot: ghc-9.10.3 + packages: - v2 diff --git a/tests/integration/tests/4215-missing-unregister/files/v1/package.yaml b/tests/integration/tests/4215-missing-unregister/files/v1/package.yaml index 7bcacfcb87..4b373ba746 100644 --- a/tests/integration/tests/4215-missing-unregister/files/v1/package.yaml +++ b/tests/integration/tests/4215-missing-unregister/files/v1/package.yaml @@ -1,5 +1,6 @@ -name: foo -version: 1 +spec-version: 0.36.0 + +name: myPackage dependencies: - base diff --git a/tests/integration/tests/4215-missing-unregister/files/v2/package.yaml b/tests/integration/tests/4215-missing-unregister/files/v2/package.yaml index e49b4fdc65..4b373ba746 100644 --- a/tests/integration/tests/4215-missing-unregister/files/v2/package.yaml +++ b/tests/integration/tests/4215-missing-unregister/files/v2/package.yaml @@ -1,5 +1,6 @@ -name: foo -version: 2 +spec-version: 0.36.0 + +name: myPackage dependencies: - base From 953e2ba1208ef76eb7b32751ae253a06b66e6fd7 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 2 May 2026 18:26:50 +0100 Subject: [PATCH 49/75] Review, document and conform further integration tests --- .github/workflows/integration-tests.yml | 1 + .../111-custom-snapshot/files/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../files/myPackageC/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../files/myPackageC/package.yaml | 1 - .../files/myPackageD/package.yaml | 1 - .../files/package.yaml | 1 - .../files/\344\273\245.cabal" | 90 ------------------- .../1438-configure-options/files/package.yaml | 1 - .../1659-skip-component/files/package.yaml | 1 - .../1884-url-to-tarball/files/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../32-unlisted-module/files/package.yaml | 1 - .../3315-multi-ghc-options/files/package.yaml | 1 - .../files/package.yaml | 1 - .../3390-unbuildable-test/files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/myPackage/package.yaml | 1 - .../files/package.yaml | 1 - .../365-invalid-success/files/package.yaml | 3 +- .../tests/366-non-root-dir/files/package.yaml | 1 - .../370-invalid-setup-hs/files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/myPackageA/package.yaml | 1 - .../files/myPackageB/package.yaml | 1 - .../files/package.yaml | 1 - .../3863-purge-command/files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/package.yaml | 1 - .../3942-solver-error-output/files/.gitignore | 2 +- .../files/no-deps/package.yaml | 1 - .../files/one-deps/one-deps.cabal | 16 ---- .../files/one-deps/package.yaml | 1 - .../3959-order-of-flags/files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/package.yaml | 1 - .../files/package.yaml | 1 - .../4095-utf8-pure-nix/files/package.yaml | 1 - .../tests/4101-dependency-tree/Main.hs | 10 +-- .../files/myPackageB/package.yaml | 1 - .../files/myPackageB/src/Lib.hs | 1 + .../4101-dependency-tree/files/package.yaml | 1 - .../4101-dependency-tree/files/src/Lib.hs | 1 + .../files/package.yaml | 1 - .../4181-clean-wo-dl-ghc/files/package.yaml | 1 - .../tests/4215-missing-unregister/Main.hs | 8 +- .../tests/4270-files-order/Main.hs | 11 ++- .../tests/4270-files-order/files/.gitignore | 1 + .../files/cbits-ordering.cabal | 22 ----- .../tests/4270-files-order/files/package.yaml | 13 +++ .../tests/4270-files-order/files/src/Lib.hs | 4 +- .../tests/4270-files-order/files/stack.yaml | 2 +- .../4324-dot-includes-boot-packages/Main.hs | 12 ++- .../files/.gitignore | 2 +- .../files/package.yaml | 4 +- .../integration/tests/4390-dot-no-ghc/Main.hs | 6 +- .../tests/4390-dot-no-ghc/files/.gitignore | 2 +- .../tests/4390-dot-no-ghc/files/package.yaml | 8 +- .../tests/4408-init-internal-libs/Main.hs | 9 +- .../4408-init-internal-libs/files/.gitignore | 1 + .../4408-init-internal-libs/files/foo.cabal | 15 ---- .../files/int/Internal.hs | 1 + .../files/package.yaml | 15 ++++ .../4408-init-internal-libs/files/src/Lib.hs | 1 + tests/integration/tests/4453-detailed/Main.hs | 11 +-- .../tests/4453-detailed/files/.gitignore | 1 + .../tests/4453-detailed/files/package.yaml | 16 ++++ .../tests/4453-detailed/files/src/Lib.hs | 6 -- .../tests/4453-detailed/files/stack.yaml | 2 +- .../files/test-detailed-example.cabal | 18 ---- .../tests/4453-detailed/files/test/Spec.hs | 20 ----- .../tests/4453-detailed/files/test/Test.hs | 20 +++++ .../tests/4488-newer-cabal-version/Main.hs | 14 +-- .../4488-newer-cabal-version/files/.gitignore | 1 + .../4488-newer-cabal-version/files/Setup.hs | 2 - .../4488-newer-cabal-version/files/foo.cabal | 7 -- .../files/package.yaml | 12 +++ .../files/stack-good.yaml | 5 +- .../tests/4706-ignore-ghc-env-files/Main.hs | 33 +++---- .../files/.gitignore | 3 +- .../files/package.yaml | 5 +- .../files/stack.yaml | 1 + .../tests/4754-rebuild-haddocks/Main.hs | 5 +- .../4754-rebuild-haddocks/files/.gitignore | 2 +- .../4754-rebuild-haddocks/files/package.yaml | 5 +- .../files/src/{Foo.hs => Lib.hs} | 6 +- .../tests/4783-doctest-deps/Main.hs | 8 +- .../tests/4783-doctest-deps/files/.gitignore | 3 +- .../files/acme-dont-copy/Acme/Dont.hs | 31 ------- .../files/acme-dont-copy/COPYRIGHT | 20 ----- .../files/acme-dont-copy/Setup.hs | 2 - .../files/acme-dont-copy/acme-dont-copy.cabal | 19 ---- .../files/myPackageB/Acme/Dont.hs | 4 + .../files/myPackageB/package.yaml | 8 ++ .../4783-doctest-deps/files/package.yaml | 5 +- .../4783-doctest-deps/files/snapshot.yaml | 4 +- .../tests/4783-doctest-deps/files/src/Foo.hs | 8 -- .../tests/4783-doctest-deps/files/src/Lib.hs | 8 ++ .../tests/4783-doctest-deps/files/stack.yaml | 3 +- .../4783-doctest-deps/files/test/Main.hs | 4 +- .../tests/4897-boot-package-pruned/Main.hs | 14 +-- .../4897-boot-package-pruned/files/.gitignore | 2 + .../files/directory/directory.cabal | 18 ++-- .../files/directory/package.yaml | 8 ++ .../files/files.cabal | 8 -- .../files/package.yaml | 11 +++ .../4897-boot-package-pruned/files/stack.yaml | 3 +- .../tests/4938-non-ascii-module-names/Main.hs | 14 ++- .../files/.gitignore | 2 +- .../4938-non-ascii-module-names/files/Lib.hs | 9 -- .../files/T\303\244st.hs" | 4 - .../files/app/Main.hs | 6 -- .../files/package.yaml | 17 ++-- ...16\277\316\272\316\271\316\274\316\256.hs" | 6 ++ .../files/stack.yaml | 2 +- 125 files changed, 299 insertions(+), 455 deletions(-) delete mode 100644 "tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" delete mode 100644 tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal create mode 100644 tests/integration/tests/4101-dependency-tree/files/myPackageB/src/Lib.hs create mode 100644 tests/integration/tests/4101-dependency-tree/files/src/Lib.hs create mode 100644 tests/integration/tests/4270-files-order/files/.gitignore delete mode 100644 tests/integration/tests/4270-files-order/files/cbits-ordering.cabal create mode 100644 tests/integration/tests/4270-files-order/files/package.yaml delete mode 100644 tests/integration/tests/4408-init-internal-libs/files/foo.cabal create mode 100644 tests/integration/tests/4408-init-internal-libs/files/int/Internal.hs create mode 100644 tests/integration/tests/4408-init-internal-libs/files/package.yaml create mode 100644 tests/integration/tests/4408-init-internal-libs/files/src/Lib.hs create mode 100644 tests/integration/tests/4453-detailed/files/.gitignore create mode 100644 tests/integration/tests/4453-detailed/files/package.yaml delete mode 100644 tests/integration/tests/4453-detailed/files/src/Lib.hs delete mode 100644 tests/integration/tests/4453-detailed/files/test-detailed-example.cabal delete mode 100644 tests/integration/tests/4453-detailed/files/test/Spec.hs create mode 100644 tests/integration/tests/4453-detailed/files/test/Test.hs create mode 100644 tests/integration/tests/4488-newer-cabal-version/files/.gitignore delete mode 100644 tests/integration/tests/4488-newer-cabal-version/files/Setup.hs delete mode 100644 tests/integration/tests/4488-newer-cabal-version/files/foo.cabal create mode 100644 tests/integration/tests/4488-newer-cabal-version/files/package.yaml create mode 100644 tests/integration/tests/4706-ignore-ghc-env-files/files/stack.yaml rename tests/integration/tests/4754-rebuild-haddocks/files/src/{Foo.hs => Lib.hs} (50%) delete mode 100644 tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Acme/Dont.hs delete mode 100644 tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/COPYRIGHT delete mode 100644 tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Setup.hs delete mode 100644 tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/acme-dont-copy.cabal create mode 100644 tests/integration/tests/4783-doctest-deps/files/myPackageB/Acme/Dont.hs create mode 100644 tests/integration/tests/4783-doctest-deps/files/myPackageB/package.yaml delete mode 100644 tests/integration/tests/4783-doctest-deps/files/src/Foo.hs create mode 100644 tests/integration/tests/4783-doctest-deps/files/src/Lib.hs create mode 100644 tests/integration/tests/4897-boot-package-pruned/files/.gitignore create mode 100644 tests/integration/tests/4897-boot-package-pruned/files/directory/package.yaml delete mode 100644 tests/integration/tests/4897-boot-package-pruned/files/files.cabal create mode 100644 tests/integration/tests/4897-boot-package-pruned/files/package.yaml delete mode 100644 tests/integration/tests/4938-non-ascii-module-names/files/Lib.hs delete mode 100644 "tests/integration/tests/4938-non-ascii-module-names/files/T\303\244st.hs" delete mode 100644 tests/integration/tests/4938-non-ascii-module-names/files/app/Main.hs create mode 100644 "tests/integration/tests/4938-non-ascii-module-names/files/src/\316\224\316\277\316\272\316\271\316\274\316\256.hs" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index bd20431e2c..fdc13974b7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -189,6 +189,7 @@ jobs: - name: Build bindist shell: bash run: | + git status stack etc/scripts/release.hs build ${{ matrix.release-args }} - name: Upload bindist diff --git a/tests/integration/tests/111-custom-snapshot/files/package.yaml b/tests/integration/tests/111-custom-snapshot/files/package.yaml index cfbb4ddee5..c80a013e52 100644 --- a/tests/integration/tests/111-custom-snapshot/files/package.yaml +++ b/tests/integration/tests/111-custom-snapshot/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml index d95c5eb517..7a3a634c04 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml index 608bd925d5..9ef40bf495 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml index fbda87617d..add5c45908 100644 --- a/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml +++ b/tests/integration/tests/1198-multiple-exes-with-same-name/files/myPackageC/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageC -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml index b845717f8e..ec081f26c0 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml index 55b65b2c1d..0ef22e6550 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml index 888fa6d0f4..17a516d2c4 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageC/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageC -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml index ba13632e60..766e1dd84a 100644 --- a/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml +++ b/tests/integration/tests/1265-extensible-snapshots/files/myPackageD/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageD -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1337-unicode-everywhere/files/package.yaml b/tests/integration/tests/1337-unicode-everywhere/files/package.yaml index 1be2c9fdd1..3211b0f2e7 100644 --- a/tests/integration/tests/1337-unicode-everywhere/files/package.yaml +++ b/tests/integration/tests/1337-unicode-everywhere/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: 以 -version: 0.1.0.0 synopsis: سقوط المدن من ذات. description: | 以呂波耳本部止 diff --git "a/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" "b/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" deleted file mode 100644 index cf837fbc07..0000000000 --- "a/tests/integration/tests/1337-unicode-everywhere/files/\344\273\245.cabal" +++ /dev/null @@ -1,90 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.38.3. --- --- see: https://github.com/sol/hpack - -name: 以 -version: 0.1.0.0 -synopsis: سقوط المدن من ذات. -description: 以呂波耳本部止 - 千利奴流乎和加 - 餘多連曽津祢那 - 良牟有為能於久 - 耶万計不己衣天 - 阿佐伎喩女美之 - 恵比毛勢須 - . - いろはにほへと - ちりぬるを - わかよたれそ - つねならむ - うゐのおくやま - けふこえて - あさきゆめみし - ゑひもせす - . - 永 - . - The quick brown fox jumps over the lazy dog - . - Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich - . - Δάματρα μέλπω Κόραν τε Κλυμένοι᾽ ἄλοχον - μελιβόαν ὕμνον ἀναγνέων - Αἰολίδ᾽ ἂμ βαρύβρομον ἁρμονίαν - . - Ед эож алььтэрюм витюпэраторебуз, фалля пожйдонёюм нэ квуй. Зюаз атоморюм эю - вэл, экз агам магна жкряпшэрит нам. Примич вокынт дэлььякатезшимя эа мэль, - ыам факэтэ пытынтёюм волуптатум ку. Квуым квюаэчтио йн пэр, дольор - форынчйбюж ут еюж. Эжт нонюмэш янвыняры эю. - . - Υθ φιμ λιβερ δισερετ κυαεστιο. Νε δυο σονγυε φιθυπερατοριβυς, θε φις αθκυι - σενσεριτ δεφινιεβας, μολλις θαμκυαμ ηας εα. Ιν φιμ εραντ μυσιυς, αλιι δισαντ - σομμοδο νο συμ. Πρι αμετ πορρω σονσεκυυντυρ ατ. Ιδ σεα ηομερω αδιπισι, - ομνεσκυε επισυρει ετ μελ, σεα αφφερθ σωνσεκυαθ θε. - . - नीचे खरिदे समस्याओ व्रुद्धि सुना शीघ्र व्याख्या निरपेक्ष शुरुआत असरकारक अविरोधता खरिदे मेमत उसीएक् - असरकारक आंतरकार्यक्षमता केवल करता। असक्षम सामूहिक विवरण हीकम सुनत सदस्य खरिदने उदेशीत - . - 引全堀記物質行上初野年謝止質警細物競。委目態政業諸好岡積米真香冒班分団時大一夏。 - 帝同手怠問来視旧記次禁身妨性直権員。州駅都稿頂風著報計個勢意時言進整。 - 作敗約秘都並断旬検面事真区。則局世紙文般百校車社金名室権金練危。 - 水夫動間始旅円典中所場針仁暮中。書稿準提選別推五玲常能船岡味。 - 詩聞誌寧真身性業遠国無軽春臨個鳥相契断者。 - . - 紙ウ主転ね加必キト聴4水そない岩者づど会前ラシ総過権ぜ聞快にクげそ庫辺はぴず意掲ひに真価トしざが。体ろ名録ふいに公問築ムミ数基ー原多ぞぎすど済進ハレ見況ヤラエロ館刊キイ構読増禎ヨモメ提信最フ済席ワモキル弘28思弾5健はーろ提館ぱっるけ社除左てがひ。全てれ理時渉ン勝境チ測試ヌエマラ年9億ち込全クテヒカ土止びぎこぐ署進アカモヌ同賞誕傾吹敏こ。 - . - سقوط المدن من ذات. ٠٨٠٤ تعديل إبّان عن هذه, لمّ في هامش الدمج. فرنسية الجنوب ولكسمبورغ حتى أم, مع بحث لكون الشمل استطاعوا, فعل بلاده انتهت تم. كما مع واحدة الخاسر, أخذ وإعلان الشمال رجوعهم أن. تعد تم بشكل مشارف الشرقي, هو مئات مهمّات أخذ. - . - בקר את הארץ מיתולוגיה. ובמתן העזרה דת מלא, שמו זקוק לחיבור אגרונומיה על. אל זכר התוכן מונחונים ארכיאולוגיה, ויש קצרמרים פסיכולוגיה אל. כתב אם בארגז אחרונים וכמקובל. ספינות ומדעים האטמוספירה ויש מה, צ'ט משחקים הקהילה ארכיאולוגיה על. אל כימיה המדינה סדר, זכר של שמות להפוך, ייִדיש לעריכת דת ויש. - . - 😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏 - ➀➁➂➃➄➅➆➇➈➉ - ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏ - 💩 -category: Δσαντ -homepage: http://invalid/以#readme -author: Fake 💩💩💩💩💩 Name -maintainer: 以呂波耳本部止@invalid -license: BSD3 -license-file: いろは-LICENSE -build-type: Simple - -library - exposed-modules: - Пσε - hs-source-dirs: - ארץ - build-depends: - base - default-language: Haskell2010 - -executable 以-exe - main-is: Main.hs - hs-source-dirs: - app - build-depends: - base - , 以 - default-language: Haskell2010 diff --git a/tests/integration/tests/1438-configure-options/files/package.yaml b/tests/integration/tests/1438-configure-options/files/package.yaml index b20cb3407d..a7305a77cf 100644 --- a/tests/integration/tests/1438-configure-options/files/package.yaml +++ b/tests/integration/tests/1438-configure-options/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1659-skip-component/files/package.yaml b/tests/integration/tests/1659-skip-component/files/package.yaml index 0503a21855..0b15e2fbce 100644 --- a/tests/integration/tests/1659-skip-component/files/package.yaml +++ b/tests/integration/tests/1659-skip-component/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/1884-url-to-tarball/files/package.yaml b/tests/integration/tests/1884-url-to-tarball/files/package.yaml index 92b5f6e4c9..a410102517 100644 --- a/tests/integration/tests/1884-url-to-tarball/files/package.yaml +++ b/tests/integration/tests/1884-url-to-tarball/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml index c4fa96f17c..dc117d34c9 100644 --- a/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml index 62ff96d1e9..e5f489eebf 100644 --- a/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml +++ b/tests/integration/tests/2195-depend-on-exe/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml b/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml index ad4a6452d2..eeb7c4fcc3 100644 --- a/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml b/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml index fa09cc7c66..03b4ec87d3 100644 --- a/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml +++ b/tests/integration/tests/2781-shadow-bug/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml index 687ade7529..5cb84d72e6 100644 --- a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml index 6f4e79de4b..77d87303d7 100644 --- a/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml +++ b/tests/integration/tests/2997-ensure-warnings-output/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/32-unlisted-module/files/package.yaml b/tests/integration/tests/32-unlisted-module/files/package.yaml index 52873f9fd5..bf5bf390a9 100644 --- a/tests/integration/tests/32-unlisted-module/files/package.yaml +++ b/tests/integration/tests/32-unlisted-module/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3315-multi-ghc-options/files/package.yaml b/tests/integration/tests/3315-multi-ghc-options/files/package.yaml index b20cb3407d..a7305a77cf 100644 --- a/tests/integration/tests/3315-multi-ghc-options/files/package.yaml +++ b/tests/integration/tests/3315-multi-ghc-options/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/335-multi-package-flags/files/package.yaml b/tests/integration/tests/335-multi-package-flags/files/package.yaml index 273e2086bd..973e01a4f6 100644 --- a/tests/integration/tests/335-multi-package-flags/files/package.yaml +++ b/tests/integration/tests/335-multi-package-flags/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 flags: necessary: diff --git a/tests/integration/tests/3390-unbuildable-test/files/package.yaml b/tests/integration/tests/3390-unbuildable-test/files/package.yaml index c179f4c2fc..da5df8ac33 100644 --- a/tests/integration/tests/3390-unbuildable-test/files/package.yaml +++ b/tests/integration/tests/3390-unbuildable-test/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 tests: myTest: diff --git a/tests/integration/tests/345-override-bytestring/files/package.yaml b/tests/integration/tests/345-override-bytestring/files/package.yaml index a68b5080c9..4259e06ace 100644 --- a/tests/integration/tests/345-override-bytestring/files/package.yaml +++ b/tests/integration/tests/345-override-bytestring/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml b/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml index b20cb3407d..a7305a77cf 100644 --- a/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml +++ b/tests/integration/tests/3574-extra-dep-local/files/myPackage/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml b/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml index 8556be7577..a3a9b0e627 100644 --- a/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml +++ b/tests/integration/tests/3591-cabal-warnings-once/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/365-invalid-success/files/package.yaml b/tests/integration/tests/365-invalid-success/files/package.yaml index 2760d9419f..bb02298ab5 100644 --- a/tests/integration/tests/365-invalid-success/files/package.yaml +++ b/tests/integration/tests/365-invalid-success/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 -name: myPackage -version: 0.1.0.0 +name: myPackageA dependencies: - base diff --git a/tests/integration/tests/366-non-root-dir/files/package.yaml b/tests/integration/tests/366-non-root-dir/files/package.yaml index 9a989f4644..ee1f9f8afa 100644 --- a/tests/integration/tests/366-non-root-dir/files/package.yaml +++ b/tests/integration/tests/366-non-root-dir/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/370-invalid-setup-hs/files/package.yaml b/tests/integration/tests/370-invalid-setup-hs/files/package.yaml index b20cb3407d..a7305a77cf 100644 --- a/tests/integration/tests/370-invalid-setup-hs/files/package.yaml +++ b/tests/integration/tests/370-invalid-setup-hs/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml index eb885f2809..c3b0d2aaf8 100644 --- a/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml +++ b/tests/integration/tests/3787-internal-libs-with-no-main-lib/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml b/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml index c9c1bf8cff..d26b472ded 100644 --- a/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml +++ b/tests/integration/tests/384-local-deps/files/myPackageA/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml b/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml index 62ff96d1e9..e5f489eebf 100644 --- a/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml +++ b/tests/integration/tests/384-local-deps/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml index 50e7e7585b..ab04bf7f95 100644 --- a/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml +++ b/tests/integration/tests/3861-ignore-bounds-in-snapshots/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3863-purge-command/files/package.yaml b/tests/integration/tests/3863-purge-command/files/package.yaml index b20cb3407d..a7305a77cf 100644 --- a/tests/integration/tests/3863-purge-command/files/package.yaml +++ b/tests/integration/tests/3863-purge-command/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml index 20d27e31df..d3ca861409 100644 --- a/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml +++ b/tests/integration/tests/3899-dont-rebuild-sublibraries/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml b/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml index 20d27e31df..d3ca861409 100644 --- a/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml +++ b/tests/integration/tests/3926-ghci-with-sublibraries/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml b/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml index 6d362445fe..d734612453 100644 --- a/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml +++ b/tests/integration/tests/3940-base-upgrade-warning/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base < 4.20 diff --git a/tests/integration/tests/3942-solver-error-output/files/.gitignore b/tests/integration/tests/3942-solver-error-output/files/.gitignore index d0366f1ccb..191b37bd49 100644 --- a/tests/integration/tests/3942-solver-error-output/files/.gitignore +++ b/tests/integration/tests/3942-solver-error-output/files/.gitignore @@ -1,2 +1,2 @@ -deps.cabal no-deps.cabal +one-deps.cabal diff --git a/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml b/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml index e3e55e6649..48ede3554f 100644 --- a/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml +++ b/tests/integration/tests/3942-solver-error-output/files/no-deps/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: no-deps -version: 0.1.0.0 synopsis: A package with no dependencies, other than base dependencies: diff --git a/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal b/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal deleted file mode 100644 index be85897c1c..0000000000 --- a/tests/integration/tests/3942-solver-error-output/files/one-deps/one-deps.cabal +++ /dev/null @@ -1,16 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.39.1. --- --- see: https://github.com/sol/hpack - -name: one-deps -version: 0.1.0.0 -synopsis: A package with one dependency (no-deps) other than base -build-type: Simple - -library - build-depends: - base - , no-deps - default-language: Haskell2010 diff --git a/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml b/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml index 0ef677e325..0cabd80dac 100644 --- a/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml +++ b/tests/integration/tests/3942-solver-error-output/files/one-deps/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: one-deps -version: 0.1.0.0 synopsis: A package with one dependency (no-deps) other than base dependencies: diff --git a/tests/integration/tests/3959-order-of-flags/files/package.yaml b/tests/integration/tests/3959-order-of-flags/files/package.yaml index 32561805b9..ee1a6463a8 100644 --- a/tests/integration/tests/3959-order-of-flags/files/package.yaml +++ b/tests/integration/tests/3959-order-of-flags/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/397-case-insensitive-flags/files/package.yaml b/tests/integration/tests/397-case-insensitive-flags/files/package.yaml index 273e2086bd..973e01a4f6 100644 --- a/tests/integration/tests/397-case-insensitive-flags/files/package.yaml +++ b/tests/integration/tests/397-case-insensitive-flags/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 flags: necessary: diff --git a/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml index fdc3ba4f23..ef6e5935e5 100644 --- a/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml +++ b/tests/integration/tests/3996-sublib-not-depended-upon/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml b/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml index 4a4c48658d..3ba4c450a6 100644 --- a/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml +++ b/tests/integration/tests/3997-coverage-with-cabal-3/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4001-excess-recompilation/files/package.yaml b/tests/integration/tests/4001-excess-recompilation/files/package.yaml index 8f49edaee0..5817077e48 100644 --- a/tests/integration/tests/4001-excess-recompilation/files/package.yaml +++ b/tests/integration/tests/4001-excess-recompilation/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml b/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml index 9a989f4644..ee1f9f8afa 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml +++ b/tests/integration/tests/4095-utf8-pure-nix/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4101-dependency-tree/Main.hs b/tests/integration/tests/4101-dependency-tree/Main.hs index c143ceb32c..913b2db802 100644 --- a/tests/integration/tests/4101-dependency-tree/Main.hs +++ b/tests/integration/tests/4101-dependency-tree/Main.hs @@ -11,7 +11,7 @@ main :: IO () main = unless isWindows $ do stackCheckStdout ["ls", "dependencies", "tree"] $ \stdOut -> do let expected = unlines [ "Packages" - , "├─┬ myPackageA 0.1.0.0" + , "├─┬ myPackageA 0.0.0" , "│ ├─┬ base 4.20.2.0" ] unless (expected `isPrefixOf` stdOut) $ @@ -19,12 +19,12 @@ main = unless isWindows $ do stackCheckStdout ["ls", "dependencies", "tree", "--depth=1"] $ \stdOut -> do let expected = unlines [ "Packages" - , "├─┬ myPackageA 0.1.0.0" + , "├─┬ myPackageA 0.0.0" , "│ ├── base 4.20.2.0" , "│ ├── filelock 0.1.1.2" , "│ ├── mtl 2.3.1" - , "│ └── myPackageB 0.1.0.0" - , "└─┬ myPackageB 0.1.0.0" + , "│ └── myPackageB 0.0.0" + , "└─┬ myPackageB 0.0.0" , " └── base 4.20.2.0" ] when (stdOut /= expected) $ @@ -32,7 +32,7 @@ main = unless isWindows $ do stackCheckStdout ["ls", "dependencies", "tree", "myPackageB"] $ \stdOut -> do let expected = unlines [ "Packages" - , "└─┬ myPackageB 0.1.0.0" + , "└─┬ myPackageB 0.0.0" , " └─┬ base 4.20.2.0" , " ├─┬ ghc-internal 9.1003.0" , " │ ├─┬ ghc-bignum 1.3" diff --git a/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml b/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml index 851655b06f..f94636c710 100644 --- a/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml +++ b/tests/integration/tests/4101-dependency-tree/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageB -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4101-dependency-tree/files/myPackageB/src/Lib.hs b/tests/integration/tests/4101-dependency-tree/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/4101-dependency-tree/files/myPackageB/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/4101-dependency-tree/files/package.yaml b/tests/integration/tests/4101-dependency-tree/files/package.yaml index 9ca121637a..682e620e4c 100644 --- a/tests/integration/tests/4101-dependency-tree/files/package.yaml +++ b/tests/integration/tests/4101-dependency-tree/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackageA -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4101-dependency-tree/files/src/Lib.hs b/tests/integration/tests/4101-dependency-tree/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/4101-dependency-tree/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml index 0e5e66ed8a..18ae9cc898 100644 --- a/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml +++ b/tests/integration/tests/4105-test-coverage-of-internal-lib/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml b/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml index df88f93a9a..4b373ba746 100644 --- a/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml +++ b/tests/integration/tests/4181-clean-wo-dl-ghc/files/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 name: myPackage -version: 0.1.0.0 dependencies: - base diff --git a/tests/integration/tests/4215-missing-unregister/Main.hs b/tests/integration/tests/4215-missing-unregister/Main.hs index 20259f013e..4542b9dbaf 100644 --- a/tests/integration/tests/4215-missing-unregister/Main.hs +++ b/tests/integration/tests/4215-missing-unregister/Main.hs @@ -1,6 +1,12 @@ +-- Even if the project directory is unchanged and the project package name and +-- version is the same, Stack recognises when a project package is different to +-- a project package that has been built previously. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4215 + import StackTest main :: IO () main = do stack ["--stack-yaml", "stack1.yaml", "build"] - stack [ "--stack-yaml", "stack2.yaml", "build"] + stack ["--stack-yaml", "stack2.yaml", "build"] diff --git a/tests/integration/tests/4270-files-order/Main.hs b/tests/integration/tests/4270-files-order/Main.hs index c4b1a56588..e51067ba08 100644 --- a/tests/integration/tests/4270-files-order/Main.hs +++ b/tests/integration/tests/4270-files-order/Main.hs @@ -1,6 +1,11 @@ -import Control.Monad -import StackTest -import StackTest.Repl +-- Stack's ghci command can load a project with c-sources, if the package +-- description lists the C source files in dependency order. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4270 + +import Control.Monad ( when ) +import StackTest +import StackTest.Repl main :: IO () main = do diff --git a/tests/integration/tests/4270-files-order/files/.gitignore b/tests/integration/tests/4270-files-order/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/4270-files-order/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/4270-files-order/files/cbits-ordering.cabal b/tests/integration/tests/4270-files-order/files/cbits-ordering.cabal deleted file mode 100644 index d1444093b3..0000000000 --- a/tests/integration/tests/4270-files-order/files/cbits-ordering.cabal +++ /dev/null @@ -1,22 +0,0 @@ -cabal-version: 3.4 - -name: cbits-ordering -version: 0.0.0 -build-type: Simple - -library - exposed-modules: - Lib - other-modules: - Paths_cbits_ordering - hs-source-dirs: - src - include-dirs: - cbits - c-sources: - cbits/the_dependency.c - cbits/a_dependent.c - - build-depends: - base >=4.7 && <5 - default-language: GHC2021 diff --git a/tests/integration/tests/4270-files-order/files/package.yaml b/tests/integration/tests/4270-files-order/files/package.yaml new file mode 100644 index 0000000000..70fc7a38c9 --- /dev/null +++ b/tests/integration/tests/4270-files-order/files/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + include-dirs: cbits + c-sources: + - cbits/the_dependency.c + - cbits/a_dependent.c diff --git a/tests/integration/tests/4270-files-order/files/src/Lib.hs b/tests/integration/tests/4270-files-order/files/src/Lib.hs index 43b103779b..a1d89f1b4f 100644 --- a/tests/integration/tests/4270-files-order/files/src/Lib.hs +++ b/tests/integration/tests/4270-files-order/files/src/Lib.hs @@ -1,7 +1,7 @@ module Lib where -import Foreign.C.String -import System.IO.Unsafe +import Foreign.C.String ( CString, peekCString ) +import System.IO.Unsafe ( unsafePerformIO) foreign import ccall unsafe "a_dependent.h greeting" c_greeting :: CString diff --git a/tests/integration/tests/4270-files-order/files/stack.yaml b/tests/integration/tests/4270-files-order/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/4270-files-order/files/stack.yaml +++ b/tests/integration/tests/4270-files-order/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/4324-dot-includes-boot-packages/Main.hs b/tests/integration/tests/4324-dot-includes-boot-packages/Main.hs index 493cd2b8ca..20c4bff744 100644 --- a/tests/integration/tests/4324-dot-includes-boot-packages/Main.hs +++ b/tests/integration/tests/4324-dot-includes-boot-packages/Main.hs @@ -1,9 +1,13 @@ -import StackTest -import Control.Monad (unless) -import Data.List (isInfixOf) +-- Stack's dot command includes the dependencies of GHC's boot packages. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4324 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do stackCheckStdout ["dot", "--external"] $ \str -> unless ("\n\"process\" ->" `isInfixOf` str) $ - error "Not showing dependencies of process" + error "Not showing dependencies of process" diff --git a/tests/integration/tests/4324-dot-includes-boot-packages/files/.gitignore b/tests/integration/tests/4324-dot-includes-boot-packages/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/4324-dot-includes-boot-packages/files/.gitignore +++ b/tests/integration/tests/4324-dot-includes-boot-packages/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/4324-dot-includes-boot-packages/files/package.yaml b/tests/integration/tests/4324-dot-includes-boot-packages/files/package.yaml index 0708d2f2d3..ff5d3bfd91 100644 --- a/tests/integration/tests/4324-dot-includes-boot-packages/files/package.yaml +++ b/tests/integration/tests/4324-dot-includes-boot-packages/files/package.yaml @@ -1,4 +1,6 @@ -name: foo +spec-version: 0.36.0 + +name: myPackage dependencies: - base diff --git a/tests/integration/tests/4390-dot-no-ghc/Main.hs b/tests/integration/tests/4390-dot-no-ghc/Main.hs index ae94e7eeda..9463c22f72 100644 --- a/tests/integration/tests/4390-dot-no-ghc/Main.hs +++ b/tests/integration/tests/4390-dot-no-ghc/Main.hs @@ -1,4 +1,8 @@ -import StackTest +-- Stack's dot command does not require the presence of the specified GHC. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4390 + +import StackTest main :: IO () main = do diff --git a/tests/integration/tests/4390-dot-no-ghc/files/.gitignore b/tests/integration/tests/4390-dot-no-ghc/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/4390-dot-no-ghc/files/.gitignore +++ b/tests/integration/tests/4390-dot-no-ghc/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/4390-dot-no-ghc/files/package.yaml b/tests/integration/tests/4390-dot-no-ghc/files/package.yaml index b1eda63d9f..4b373ba746 100644 --- a/tests/integration/tests/4390-dot-no-ghc/files/package.yaml +++ b/tests/integration/tests/4390-dot-no-ghc/files/package.yaml @@ -1,6 +1,8 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage + dependencies: - base -- process + library: {} diff --git a/tests/integration/tests/4408-init-internal-libs/Main.hs b/tests/integration/tests/4408-init-internal-libs/Main.hs index e1cdc167be..5973d2da18 100644 --- a/tests/integration/tests/4408-init-internal-libs/Main.hs +++ b/tests/integration/tests/4408-init-internal-libs/Main.hs @@ -1,4 +1,9 @@ -import StackTest +-- Stack can initialise a project where a project package includes a private +-- named library (an internal library). +-- +-- See: https://github.com/commercialhaskell/stack/issues/4408 + +import StackTest main :: IO () -main = stack ["init", "--snapshot", "ghc-9.2.4", "--force"] +main = stack ["init"] diff --git a/tests/integration/tests/4408-init-internal-libs/files/.gitignore b/tests/integration/tests/4408-init-internal-libs/files/.gitignore index 684dbffa96..82bb5452c4 100644 --- a/tests/integration/tests/4408-init-internal-libs/files/.gitignore +++ b/tests/integration/tests/4408-init-internal-libs/files/.gitignore @@ -1 +1,2 @@ +myPackage.cabal stack.yaml diff --git a/tests/integration/tests/4408-init-internal-libs/files/foo.cabal b/tests/integration/tests/4408-init-internal-libs/files/foo.cabal deleted file mode 100644 index 0e4d4898ae..0000000000 --- a/tests/integration/tests/4408-init-internal-libs/files/foo.cabal +++ /dev/null @@ -1,15 +0,0 @@ -cabal-version: 2.0 -name: foo -version: 0 -build-type: Simple - -library - hs-source-dirs: src - build-depends: base, some-internal-lib - default-language: Haskell2010 - -library some-internal-lib - hs-source-dirs: src-internal - exposed-modules: Internal - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/4408-init-internal-libs/files/int/Internal.hs b/tests/integration/tests/4408-init-internal-libs/files/int/Internal.hs new file mode 100644 index 0000000000..d066bb085e --- /dev/null +++ b/tests/integration/tests/4408-init-internal-libs/files/int/Internal.hs @@ -0,0 +1 @@ +module Internal where diff --git a/tests/integration/tests/4408-init-internal-libs/files/package.yaml b/tests/integration/tests/4408-init-internal-libs/files/package.yaml new file mode 100644 index 0000000000..ab1ff55ee9 --- /dev/null +++ b/tests/integration/tests/4408-init-internal-libs/files/package.yaml @@ -0,0 +1,15 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - internal + +internal-libraries: + internal: + source-dirs: int diff --git a/tests/integration/tests/4408-init-internal-libs/files/src/Lib.hs b/tests/integration/tests/4408-init-internal-libs/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/4408-init-internal-libs/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/4453-detailed/Main.hs b/tests/integration/tests/4453-detailed/Main.hs index c54e4a21c5..fe56218f86 100644 --- a/tests/integration/tests/4453-detailed/Main.hs +++ b/tests/integration/tests/4453-detailed/Main.hs @@ -1,7 +1,8 @@ -import StackTest -import System.Directory +-- Stack supports tests of type detailed-0.9. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4453 + +import StackTest main :: IO () -main = do - removeDirIgnore ".stack-work" - stack [defaultSnapshotArg, "test"] +main = stack ["test"] diff --git a/tests/integration/tests/4453-detailed/files/.gitignore b/tests/integration/tests/4453-detailed/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/4453-detailed/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/4453-detailed/files/package.yaml b/tests/integration/tests/4453-detailed/files/package.yaml new file mode 100644 index 0000000000..8ecf25e975 --- /dev/null +++ b/tests/integration/tests/4453-detailed/files/package.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +tests: + test: + verbatim: + type: detailed-0.9 + test-module: Test + source-dirs: test + other-modules: [] + dependencies: + - Cabal >= 1.20 diff --git a/tests/integration/tests/4453-detailed/files/src/Lib.hs b/tests/integration/tests/4453-detailed/files/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/4453-detailed/files/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/4453-detailed/files/stack.yaml b/tests/integration/tests/4453-detailed/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/4453-detailed/files/stack.yaml +++ b/tests/integration/tests/4453-detailed/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/4453-detailed/files/test-detailed-example.cabal b/tests/integration/tests/4453-detailed/files/test-detailed-example.cabal deleted file mode 100644 index 87a973ce4d..0000000000 --- a/tests/integration/tests/4453-detailed/files/test-detailed-example.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: test-detailed-example -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.20 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -test-suite test-detailed-example-test - type: detailed-0.9 - hs-source-dirs: test - test-module: Spec - build-depends: base >= 4.7, - Cabal >= 1.20 - default-language: Haskell2010 diff --git a/tests/integration/tests/4453-detailed/files/test/Spec.hs b/tests/integration/tests/4453-detailed/files/test/Spec.hs deleted file mode 100644 index 3084a22747..0000000000 --- a/tests/integration/tests/4453-detailed/files/test/Spec.hs +++ /dev/null @@ -1,20 +0,0 @@ -module Spec (tests) where - -import Distribution.TestSuite - -tests :: IO [Test] -tests = do - pure [ - test "foo" Pass - ] - -test :: String -> Result -> Test -test name r = Test t - where - t = TestInstance { - run = pure (Finished r) - , name = name - , tags = [] - , options = [] - , setOption = \_ _ -> Right t - } diff --git a/tests/integration/tests/4453-detailed/files/test/Test.hs b/tests/integration/tests/4453-detailed/files/test/Test.hs new file mode 100644 index 0000000000..c0e8be21d2 --- /dev/null +++ b/tests/integration/tests/4453-detailed/files/test/Test.hs @@ -0,0 +1,20 @@ +module Test + ( tests + ) where + +import Distribution.TestSuite + ( Progress (..), Result (..), Test (..), TestInstance (..) ) + +tests :: IO [Test] +tests = pure [ test "test" Pass ] + +test :: String -> Result -> Test +test name r = Test testInstance + where + testInstance = TestInstance + { run = pure (Finished r) + , name = name + , tags = [] + , options = [] + , setOption = \_ _ -> Right testInstance + } diff --git a/tests/integration/tests/4488-newer-cabal-version/Main.hs b/tests/integration/tests/4488-newer-cabal-version/Main.hs index 0b87c0ee1d..c246a1ee4f 100644 --- a/tests/integration/tests/4488-newer-cabal-version/Main.hs +++ b/tests/integration/tests/4488-newer-cabal-version/Main.hs @@ -1,11 +1,11 @@ -import StackTest +-- Stack can build with a version of Cabal (the library) other than that which +-- is a boot package of the specified GHC version. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4488 + +import StackTest main :: IO () main = do - -- Sibi: Commenting this because we are supporting latest cabal - -- version with this change. You can uncomment it when a newer cabal - -- release is made. - -- https://cabal.readthedocs.io/en/3.6/file-format-changelog.html - -- stackErr ["--stack-yaml", "stack-bad.yaml", "build", "--dry-run"] - -- + stackErr ["--stack-yaml", "stack-bad.yaml", "build", "--dry-run"] stack ["--stack-yaml", "stack-good.yaml", "build", "--dry-run"] diff --git a/tests/integration/tests/4488-newer-cabal-version/files/.gitignore b/tests/integration/tests/4488-newer-cabal-version/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/4488-newer-cabal-version/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/4488-newer-cabal-version/files/Setup.hs b/tests/integration/tests/4488-newer-cabal-version/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/4488-newer-cabal-version/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/4488-newer-cabal-version/files/foo.cabal b/tests/integration/tests/4488-newer-cabal-version/files/foo.cabal deleted file mode 100644 index fcc3fda5bd..0000000000 --- a/tests/integration/tests/4488-newer-cabal-version/files/foo.cabal +++ /dev/null @@ -1,7 +0,0 @@ -cabal-version: 3.6 -name: foo -version: 0 -build-type: Simple - -library - default-language: Haskell2010 diff --git a/tests/integration/tests/4488-newer-cabal-version/files/package.yaml b/tests/integration/tests/4488-newer-cabal-version/files/package.yaml new file mode 100644 index 0000000000..f695f01228 --- /dev/null +++ b/tests/integration/tests/4488-newer-cabal-version/files/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackage +custom-setup: + dependencies: + - base + - Cabal == 3.16.1.0 + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/4488-newer-cabal-version/files/stack-good.yaml b/tests/integration/tests/4488-newer-cabal-version/files/stack-good.yaml index 04b1b6ac84..578b1f2a09 100644 --- a/tests/integration/tests/4488-newer-cabal-version/files/stack-good.yaml +++ b/tests/integration/tests/4488-newer-cabal-version/files/stack-good.yaml @@ -1,3 +1,6 @@ snapshot: ghc-9.10.3 + extra-deps: -- Cabal-2.4.1.0 +- Cabal-3.16.1.0 +- Cabal-syntax-3.16.1.0 +- alex-3.5.4.2 diff --git a/tests/integration/tests/4706-ignore-ghc-env-files/Main.hs b/tests/integration/tests/4706-ignore-ghc-env-files/Main.hs index d15e82e2ad..e7e1666c54 100644 --- a/tests/integration/tests/4706-ignore-ghc-env-files/Main.hs +++ b/tests/integration/tests/4706-ignore-ghc-env-files/Main.hs @@ -1,13 +1,16 @@ -import StackTest -import Control.Exception (bracket_) -import Control.Monad (when) -import System.Environment -import System.Directory -import System.Info (arch, os) +-- Stack ignores GHC_ENVIRONMENT. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4706 + +import Control.Exception ( bracket_ ) +import StackTest +import System.Directory ( canonicalizePath, removeFile ) +import System.Environment ( setEnv ) +import System.Info (arch, os) main :: IO () -main = when False $ do -- skip this test until we start using GHC 8.4.4 or later for integration tests - let ghcVer = "8.4.4" +main = do + let ghcVer = "9.10.3" fp = concat [ ".ghc.environment." , arch @@ -16,12 +19,12 @@ main = when False $ do -- skip this test until we start using GHC 8.4.4 or later , "-" , ghcVer ] - writeFile "stack.yaml" $ "snapshot: ghc-" ++ ghcVer bracket_ (writeFile fp "This is an invalid GHC environment file") - (removeFile fp) $ do - envFile <- canonicalizePath fp - setEnv "GHC_ENVIRONMENT" envFile - stack ["clean"] - stack ["build"] - stack ["runghc", "Main.hs"] + (removeFile fp) + ( do + envFile <- canonicalizePath fp + setEnv "GHC_ENVIRONMENT" envFile + stack ["build"] + stack ["runghc", "Main.hs"] + ) diff --git a/tests/integration/tests/4706-ignore-ghc-env-files/files/.gitignore b/tests/integration/tests/4706-ignore-ghc-env-files/files/.gitignore index 0afaa560b3..b0a5a052a1 100644 --- a/tests/integration/tests/4706-ignore-ghc-env-files/files/.gitignore +++ b/tests/integration/tests/4706-ignore-ghc-env-files/files/.gitignore @@ -1,2 +1 @@ -foo.cabal -stack.yaml +myPackage.cabal diff --git a/tests/integration/tests/4706-ignore-ghc-env-files/files/package.yaml b/tests/integration/tests/4706-ignore-ghc-env-files/files/package.yaml index 9bd223a0a0..4b373ba746 100644 --- a/tests/integration/tests/4706-ignore-ghc-env-files/files/package.yaml +++ b/tests/integration/tests/4706-ignore-ghc-env-files/files/package.yaml @@ -1,5 +1,6 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage dependencies: - base diff --git a/tests/integration/tests/4706-ignore-ghc-env-files/files/stack.yaml b/tests/integration/tests/4706-ignore-ghc-env-files/files/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/4706-ignore-ghc-env-files/files/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/4754-rebuild-haddocks/Main.hs b/tests/integration/tests/4754-rebuild-haddocks/Main.hs index ad3239c26c..3d5e0c499e 100644 --- a/tests/integration/tests/4754-rebuild-haddocks/Main.hs +++ b/tests/integration/tests/4754-rebuild-haddocks/Main.hs @@ -1,4 +1,7 @@ -import StackTest +-- +-- See: https://github.com/commercialhaskell/stack/issues/4754 + +import StackTest main :: IO () main = do diff --git a/tests/integration/tests/4754-rebuild-haddocks/files/.gitignore b/tests/integration/tests/4754-rebuild-haddocks/files/.gitignore index 0afa51175a..b0a5a052a1 100644 --- a/tests/integration/tests/4754-rebuild-haddocks/files/.gitignore +++ b/tests/integration/tests/4754-rebuild-haddocks/files/.gitignore @@ -1 +1 @@ -foo.cabal +myPackage.cabal diff --git a/tests/integration/tests/4754-rebuild-haddocks/files/package.yaml b/tests/integration/tests/4754-rebuild-haddocks/files/package.yaml index 42a00e8f20..3c2901b603 100644 --- a/tests/integration/tests/4754-rebuild-haddocks/files/package.yaml +++ b/tests/integration/tests/4754-rebuild-haddocks/files/package.yaml @@ -1,5 +1,6 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage dependencies: - base diff --git a/tests/integration/tests/4754-rebuild-haddocks/files/src/Foo.hs b/tests/integration/tests/4754-rebuild-haddocks/files/src/Lib.hs similarity index 50% rename from tests/integration/tests/4754-rebuild-haddocks/files/src/Foo.hs rename to tests/integration/tests/4754-rebuild-haddocks/files/src/Lib.hs index 3caec84bf1..4aa20bc752 100644 --- a/tests/integration/tests/4754-rebuild-haddocks/files/src/Foo.hs +++ b/tests/integration/tests/4754-rebuild-haddocks/files/src/Lib.hs @@ -1,5 +1,5 @@ -module Foo where +module Lib where -- | The function below intentionally contains invalid Haddock -foo :: () -foo = () -- ^ this should fail!!! +func :: () +func = () -- ^ this should fail!!! diff --git a/tests/integration/tests/4783-doctest-deps/Main.hs b/tests/integration/tests/4783-doctest-deps/Main.hs index d35e0cf24c..ccdbd4732b 100644 --- a/tests/integration/tests/4783-doctest-deps/Main.hs +++ b/tests/integration/tests/4783-doctest-deps/Main.hs @@ -1,7 +1,9 @@ -import StackTest +-- +-- See: https://github.com/commercialhaskell/stack/issues/4783 + +import StackTest main :: IO () main = do - stackCleanFull - stack ["build", "acme-dont-copy"] + stack ["build", "myPackageB"] stack ["test"] diff --git a/tests/integration/tests/4783-doctest-deps/files/.gitignore b/tests/integration/tests/4783-doctest-deps/files/.gitignore index 0afa51175a..f9a6e152d2 100644 --- a/tests/integration/tests/4783-doctest-deps/files/.gitignore +++ b/tests/integration/tests/4783-doctest-deps/files/.gitignore @@ -1 +1,2 @@ -foo.cabal +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Acme/Dont.hs b/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Acme/Dont.hs deleted file mode 100644 index e0a9cc03c3..0000000000 --- a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Acme/Dont.hs +++ /dev/null @@ -1,31 +0,0 @@ --- | --- Module : Acme.Dont --- Copyright : Gracjan Polak 2009 --- License : BSD-style --- Maintainer : Gracjan Polak --- Stability : experimental --- Portability : portable --- --- The Acme.Dont module provides the indispensable don't command, --- ported from Perl. --- --- For more information see influential documentation: --- --- --- Usage: --- --- > main = don't $ do --- > name <- getLine --- > putStrLn $ "hello " ++ name --- -module Acme.Dont where - --- | The Acme.Dont module provides a don't command, which is the --- opposite of Haskell's built-in do. It is used exactly like the do --- monadic construct except that, instead of executing the block it --- controls, it... well... doesn't. --- --- Regardless of the contents of the block, don't returns (). --- -don't :: (Monad m) => m a -> m () -don't _action = pure () diff --git a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/COPYRIGHT b/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/COPYRIGHT deleted file mode 100644 index bfa1719aa5..0000000000 --- a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/COPYRIGHT +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2009 Gracjan Polak - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -=============================================================================== - -(end of COPYRIGHT) diff --git a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Setup.hs b/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Setup.hs deleted file mode 100644 index bf6890196c..0000000000 --- a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain \ No newline at end of file diff --git a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/acme-dont-copy.cabal b/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/acme-dont-copy.cabal deleted file mode 100644 index 3e1c668a7a..0000000000 --- a/tests/integration/tests/4783-doctest-deps/files/acme-dont-copy/acme-dont-copy.cabal +++ /dev/null @@ -1,19 +0,0 @@ -Name: acme-dont-copy -Version: 1.1 -Stability: stable -Exposed-modules: Acme.Dont -Build-type: Simple -License: BSD3 -License-File: COPYRIGHT -Copyright: 2009, Gracjan Polak -Author: Gracjan Polak -Maintainer: Gracjan Polak -Synopsis: A don't construct -Description: - The Acme.Dont module provides a don't command, which is the - opposite of Haskell's built-in do. It is used exactly like the do - monadic construct except that, instead of executing the block it - controls, it... well... doesn't. -Category: Acme -Build-depends: base<1000000 -Hs-source-dirs: . diff --git a/tests/integration/tests/4783-doctest-deps/files/myPackageB/Acme/Dont.hs b/tests/integration/tests/4783-doctest-deps/files/myPackageB/Acme/Dont.hs new file mode 100644 index 0000000000..dd6e565c6f --- /dev/null +++ b/tests/integration/tests/4783-doctest-deps/files/myPackageB/Acme/Dont.hs @@ -0,0 +1,4 @@ +module Acme.Dont where + +don't :: (Monad m) => m a -> m () +don't _action = return () diff --git a/tests/integration/tests/4783-doctest-deps/files/myPackageB/package.yaml b/tests/integration/tests/4783-doctest-deps/files/myPackageB/package.yaml new file mode 100644 index 0000000000..f94636c710 --- /dev/null +++ b/tests/integration/tests/4783-doctest-deps/files/myPackageB/package.yaml @@ -0,0 +1,8 @@ +spec-version: 0.36.0 + +name: myPackageB + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/4783-doctest-deps/files/package.yaml b/tests/integration/tests/4783-doctest-deps/files/package.yaml index 251fbfb148..142bbea6b6 100644 --- a/tests/integration/tests/4783-doctest-deps/files/package.yaml +++ b/tests/integration/tests/4783-doctest-deps/files/package.yaml @@ -1,5 +1,6 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackageA dependencies: - base diff --git a/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml b/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml index fbeae1e6ce..8637adcee0 100644 --- a/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml +++ b/tests/integration/tests/4783-doctest-deps/files/snapshot.yaml @@ -1,4 +1,6 @@ +name: mySnapshot + snapshot: lts-24.37 -name: foo + packages: - acme-dont-1.1@sha256:8264ad3e5113d3e0417b46e71d5a9c0914a1f03b5b81319cc329f1dc0f49b96c,602 diff --git a/tests/integration/tests/4783-doctest-deps/files/src/Foo.hs b/tests/integration/tests/4783-doctest-deps/files/src/Foo.hs deleted file mode 100644 index 936d0ccc01..0000000000 --- a/tests/integration/tests/4783-doctest-deps/files/src/Foo.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Foo where - --- | --- --- >>> import Acme.Dont --- >>> don't foo -foo :: IO () -foo = error "foo" diff --git a/tests/integration/tests/4783-doctest-deps/files/src/Lib.hs b/tests/integration/tests/4783-doctest-deps/files/src/Lib.hs new file mode 100644 index 0000000000..c625fb3d19 --- /dev/null +++ b/tests/integration/tests/4783-doctest-deps/files/src/Lib.hs @@ -0,0 +1,8 @@ +module Lib where + +-- | +-- +-- >>> import Acme.Dont +-- >>> don't func +func :: IO () +func = error "func" diff --git a/tests/integration/tests/4783-doctest-deps/files/stack.yaml b/tests/integration/tests/4783-doctest-deps/files/stack.yaml index 6503818833..9cfd6e6102 100644 --- a/tests/integration/tests/4783-doctest-deps/files/stack.yaml +++ b/tests/integration/tests/4783-doctest-deps/files/stack.yaml @@ -1,4 +1,5 @@ snapshot: snapshot.yaml + extra-deps: # Include a package with a duplicated module name -- acme-dont-copy +- myPackageB diff --git a/tests/integration/tests/4783-doctest-deps/files/test/Main.hs b/tests/integration/tests/4783-doctest-deps/files/test/Main.hs index 20e4883829..241b37352a 100644 --- a/tests/integration/tests/4783-doctest-deps/files/test/Main.hs +++ b/tests/integration/tests/4783-doctest-deps/files/test/Main.hs @@ -1,4 +1,4 @@ -import Test.DocTest +import Test.DocTest main :: IO () -main = doctest ["src/Foo.hs"] +main = doctest ["src/Lib.hs"] diff --git a/tests/integration/tests/4897-boot-package-pruned/Main.hs b/tests/integration/tests/4897-boot-package-pruned/Main.hs index d843d8a772..8e9c457127 100644 --- a/tests/integration/tests/4897-boot-package-pruned/Main.hs +++ b/tests/integration/tests/4897-boot-package-pruned/Main.hs @@ -1,6 +1,10 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- Stack warns when a required GHC boot package has been pruned. +-- +-- See: https://github.com/commercialhaskell/stack/issues/4897 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest planFailure :: String planFailure = "but this GHC boot package has been pruned" @@ -11,5 +15,5 @@ main = do expectMessage :: String -> String -> IO () expectMessage msg stderr = do - unless (words msg `isInfixOf` words stderr) - (error $ "Expected an error: \n" ++ show msg) + unless (words msg `isInfixOf` words stderr) $ + error $ "Expected an error: \n" ++ show msg diff --git a/tests/integration/tests/4897-boot-package-pruned/files/.gitignore b/tests/integration/tests/4897-boot-package-pruned/files/.gitignore new file mode 100644 index 0000000000..59d924c932 --- /dev/null +++ b/tests/integration/tests/4897-boot-package-pruned/files/.gitignore @@ -0,0 +1,2 @@ +directory.cabal +myPackage.cabal diff --git a/tests/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal b/tests/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal index 78abfda5cf..003b0b4583 100644 --- a/tests/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal +++ b/tests/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal @@ -1,8 +1,14 @@ -name: directory -version: 1.3.3.0 -build-type: Simple -cabal-version: >=1.10 +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.39.1. +-- +-- see: https://github.com/sol/hpack + +name: directory +version: 0.0.0 +build-type: Simple library - build-depends: base - default-language: Haskell2010 + build-depends: + base + default-language: Haskell2010 diff --git a/tests/integration/tests/4897-boot-package-pruned/files/directory/package.yaml b/tests/integration/tests/4897-boot-package-pruned/files/directory/package.yaml new file mode 100644 index 0000000000..f93449661a --- /dev/null +++ b/tests/integration/tests/4897-boot-package-pruned/files/directory/package.yaml @@ -0,0 +1,8 @@ +spec-version: 0.36.0 + +name: directory + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/4897-boot-package-pruned/files/files.cabal b/tests/integration/tests/4897-boot-package-pruned/files/files.cabal deleted file mode 100644 index fd7c274440..0000000000 --- a/tests/integration/tests/4897-boot-package-pruned/files/files.cabal +++ /dev/null @@ -1,8 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - build-depends: base, directory, process - default-language: Haskell2010 diff --git a/tests/integration/tests/4897-boot-package-pruned/files/package.yaml b/tests/integration/tests/4897-boot-package-pruned/files/package.yaml new file mode 100644 index 0000000000..625da91c48 --- /dev/null +++ b/tests/integration/tests/4897-boot-package-pruned/files/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base +- directory +- process + +library: {} diff --git a/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml b/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml index a0b8b9c232..8a84491306 100644 --- a/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml +++ b/tests/integration/tests/4897-boot-package-pruned/files/stack.yaml @@ -1,3 +1,4 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + extra-deps: - ./directory diff --git a/tests/integration/tests/4938-non-ascii-module-names/Main.hs b/tests/integration/tests/4938-non-ascii-module-names/Main.hs index 7e30af7e02..5fe95a532b 100644 --- a/tests/integration/tests/4938-non-ascii-module-names/Main.hs +++ b/tests/integration/tests/4938-non-ascii-module-names/Main.hs @@ -1,9 +1,15 @@ -import StackTest -import Control.Monad (unless) +-- Stack accepts module names that include Unicode code points outside of the +-- Basic Latin Unicode block (ASCII). +-- +-- See: https://github.com/commercialhaskell/stack/issues/4938 + +import Control.Monad ( unless ) +import StackTest main :: IO () main = do - -- Disabled on Windows due to an error occurred in the integration tests + -- Disabled on Windows due to an error occurred in the integration tests -- regarding Unicode character. Tried to fix it (https://github.com/commercialhaskell/stack/pull/5162/commits/8f04ad9e4cbaa54370dc5af476e3307a16c84405) -- but it didn't work - unless isWindows $ stack ["build"] + unless isWindows $ + stack ["build"] diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/.gitignore b/tests/integration/tests/4938-non-ascii-module-names/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/4938-non-ascii-module-names/files/.gitignore +++ b/tests/integration/tests/4938-non-ascii-module-names/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/Lib.hs b/tests/integration/tests/4938-non-ascii-module-names/files/Lib.hs deleted file mode 100644 index d54290bd9b..0000000000 --- a/tests/integration/tests/4938-non-ascii-module-names/files/Lib.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Lib - ( foo - , bar - ) where - -import Täst - -bar :: Int -bar = 42 diff --git "a/tests/integration/tests/4938-non-ascii-module-names/files/T\303\244st.hs" "b/tests/integration/tests/4938-non-ascii-module-names/files/T\303\244st.hs" deleted file mode 100644 index 16c2b18123..0000000000 --- "a/tests/integration/tests/4938-non-ascii-module-names/files/T\303\244st.hs" +++ /dev/null @@ -1,4 +0,0 @@ -module Täst where - -foo :: Int -foo = 42 diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/app/Main.hs b/tests/integration/tests/4938-non-ascii-module-names/files/app/Main.hs deleted file mode 100644 index 26e9751007..0000000000 --- a/tests/integration/tests/4938-non-ascii-module-names/files/app/Main.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Main where - -import Täst - -main :: IO () -main = putStrLn "42" diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/package.yaml b/tests/integration/tests/4938-non-ascii-module-names/files/package.yaml index 96a4d01977..a7305a77cf 100644 --- a/tests/integration/tests/4938-non-ascii-module-names/files/package.yaml +++ b/tests/integration/tests/4938-non-ascii-module-names/files/package.yaml @@ -1,10 +1,9 @@ -name: umlaut -dependencies: [base] +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + library: - source-dirs: . -executables: - exe: - main: Main.hs - source-dirs: app - dependencies: - - umlaut + source-dirs: src diff --git "a/tests/integration/tests/4938-non-ascii-module-names/files/src/\316\224\316\277\316\272\316\271\316\274\316\256.hs" "b/tests/integration/tests/4938-non-ascii-module-names/files/src/\316\224\316\277\316\272\316\271\316\274\316\256.hs" new file mode 100644 index 0000000000..9e2709d52d --- /dev/null +++ "b/tests/integration/tests/4938-non-ascii-module-names/files/src/\316\224\316\277\316\272\316\271\316\274\316\256.hs" @@ -0,0 +1,6 @@ +module Δοκιμή + ( func + ) where + +func :: IO () +func = pure () diff --git a/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml b/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml +++ b/tests/integration/tests/4938-non-ascii-module-names/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 From 0db7e6dc8e73a94e0ae3188335aeae62d78a66e6 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 10:43:37 +0100 Subject: [PATCH 50/75] Review, document and conform further integration tests --- .../tests/5180-ghc-rts-flags/Main.hs | 10 ++-- .../tests/5180-ghc-rts-flags/files/.gitignore | 1 + .../5180-ghc-rts-flags/files/files.cabal | 11 ---- .../5180-ghc-rts-flags/files/package.yaml | 9 ++++ .../tests/5180-ghc-rts-flags/files/src/Lib.hs | 3 -- .../tests/5180-ghc-rts-flags/files/stack.yaml | 2 +- .../tests/5272-only-locals/Main.hs | 13 +++-- .../tests/5272-only-locals/files/.gitignore | 2 +- .../tests/5272-only-locals/files/package.yaml | 9 ++-- .../tests/5272-only-locals/files/src/Foo.hs | 3 -- .../tests/5272-only-locals/files/src/Lib.hs | 1 + .../tests/5272-only-locals/files/stack.yaml | 3 +- .../Main.hs | 13 +++-- .../files/.gitignore | 3 ++ .../files/myPackageA/package.yaml | 9 ++++ .../files/myPackageA/src/Lib.hs | 1 + .../files/myPackageA/stack.yaml | 5 ++ .../files/myPackageB/package.yaml | 9 ++++ .../files/myPackageB/src/Lib.hs | 1 + .../files/myPackageB/stack.yaml | 5 ++ .../files/myPackageC/package.yaml | 9 ++++ .../{package-a => myPackageC}/src/Lib.hs | 0 .../files/myPackageC/stack.yaml | 1 + .../files/package-a/package.yaml | 6 --- .../files/package-a/stack.yaml | 4 -- .../files/package-b/package.yaml | 6 --- .../files/package-b/src/Lib.hs | 6 --- .../files/package-b/stack.yaml | 4 -- .../files/package-c/package.yaml | 6 --- .../files/package-c/src/Lib.hs | 6 --- .../files/package-c/stack.yaml | 1 - .../6046-missing-sublib-unregister/Main.hs | 14 +++-- .../files/foo.cabal1 | 27 ---------- .../files/foo.cabal2 | 27 ---------- .../files/int/Internal.hs | 1 + .../files/package1.yaml | 16 ++++++ .../files/package2.yaml | 16 ++++++ .../files/src/Lib.hs | 6 +-- .../files/src/Sub.hs | 6 --- .../files/stack.yaml | 2 +- .../tests/6372-sdist-unicode-test/.gitignore | 2 +- .../tests/6372-sdist-unicode-test/Main.hs | 11 ++-- .../files/package.yaml | 7 ++- .../files/src/Lib\316\261\316\262\316\263.hs" | 7 +-- .../6372-sdist-unicode-test/files/stack.yaml | 2 +- .../files/test\331\241\331\242\331\243.cabal" | 24 --------- .../tests/6451-exe-targets/Main.hs | 10 ++-- .../tests/6451-exe-targets/files/.gitignore | 1 + .../tests/6451-exe-targets/files/app/Alpha.hs | 1 - .../tests/6451-exe-targets/files/app/Beta.hs | 1 - .../tests/6451-exe-targets/files/appA/Main.hs | 4 ++ .../tests/6451-exe-targets/files/appB/Main.hs | 4 ++ .../tests/6451-exe-targets/files/package.yaml | 23 ++++----- .../tests/6451-exe-targets/files/src/Foo.hs | 1 - .../tests/6451-exe-targets/files/src/Lib.hs | 1 + .../tests/6465-msys-environment/Main.hs | 9 ++-- .../6465-msys-environment/files/.gitignore | 1 + .../6465-msys-environment/files/Setup.hs | 2 - .../files/{ => app}/Main.hs | 0 .../6465-msys-environment/files/foo.cabal | 11 ---- .../6465-msys-environment/files/package.yaml | 14 +++++ .../6465-msys-environment/files/stack.yaml | 3 +- .../tests/6867-timeout-grace/Main.hs | 16 +++--- .../tests/6867-timeout-grace/files/.gitignore | 1 + .../6867-timeout-grace/files/package.yaml | 14 +++-- .../6867-timeout-grace/files/test/Main.hs | 9 ++-- .../files/timeout-grace-fixture.cabal | 27 ---------- .../tests/6879-stack-yaml-includes/Main.hs | 51 ++++++++++--------- .../6879-stack-yaml-includes/files/.gitignore | 1 + .../files/app/Main.hs | 5 +- .../files/files.cabal | 17 ------- .../files/package.yaml | 20 ++++++++ .../files/stack-flags.yaml | 2 +- ...stack-including-file-with-install-ghc.yaml | 2 +- .../stack-including-flags-with-newline.yaml | 2 +- .../files/stack-including-flags.yaml | 2 +- .../files/stack-not-including-flags.yaml | 2 +- 77 files changed, 270 insertions(+), 317 deletions(-) create mode 100644 tests/integration/tests/5180-ghc-rts-flags/files/.gitignore delete mode 100644 tests/integration/tests/5180-ghc-rts-flags/files/files.cabal create mode 100644 tests/integration/tests/5180-ghc-rts-flags/files/package.yaml delete mode 100644 tests/integration/tests/5272-only-locals/files/src/Foo.hs create mode 100644 tests/integration/tests/5272-only-locals/files/src/Lib.hs create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/.gitignore create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageA/src/Lib.hs create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageA/stack.yaml create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageB/src/Lib.hs create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageB/stack.yaml create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageC/package.yaml rename tests/integration/tests/5680-share-package-across-projects/files/{package-a => myPackageC}/src/Lib.hs (100%) create mode 100644 tests/integration/tests/5680-share-package-across-projects/files/myPackageC/stack.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-a/package.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-b/package.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-b/src/Lib.hs delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-c/package.yaml delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-c/src/Lib.hs delete mode 100644 tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml delete mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal1 delete mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal2 create mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/int/Internal.hs create mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/package1.yaml create mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/package2.yaml delete mode 100644 tests/integration/tests/6046-missing-sublib-unregister/files/src/Sub.hs delete mode 100644 "tests/integration/tests/6372-sdist-unicode-test/files/test\331\241\331\242\331\243.cabal" create mode 100644 tests/integration/tests/6451-exe-targets/files/.gitignore delete mode 100644 tests/integration/tests/6451-exe-targets/files/app/Alpha.hs delete mode 100644 tests/integration/tests/6451-exe-targets/files/app/Beta.hs create mode 100644 tests/integration/tests/6451-exe-targets/files/appA/Main.hs create mode 100644 tests/integration/tests/6451-exe-targets/files/appB/Main.hs delete mode 100644 tests/integration/tests/6451-exe-targets/files/src/Foo.hs create mode 100644 tests/integration/tests/6451-exe-targets/files/src/Lib.hs create mode 100644 tests/integration/tests/6465-msys-environment/files/.gitignore delete mode 100644 tests/integration/tests/6465-msys-environment/files/Setup.hs rename tests/integration/tests/6465-msys-environment/files/{ => app}/Main.hs (100%) delete mode 100644 tests/integration/tests/6465-msys-environment/files/foo.cabal create mode 100644 tests/integration/tests/6465-msys-environment/files/package.yaml create mode 100644 tests/integration/tests/6867-timeout-grace/files/.gitignore delete mode 100644 tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/.gitignore delete mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/files.cabal create mode 100644 tests/integration/tests/6879-stack-yaml-includes/files/package.yaml diff --git a/tests/integration/tests/5180-ghc-rts-flags/Main.hs b/tests/integration/tests/5180-ghc-rts-flags/Main.hs index e13dcd9ae4..abdca100ad 100644 --- a/tests/integration/tests/5180-ghc-rts-flags/Main.hs +++ b/tests/integration/tests/5180-ghc-rts-flags/Main.hs @@ -1,6 +1,8 @@ -import StackTest +-- Stack supports GHC RTS options. +-- +-- See: https://github.com/commercialhaskell/stack/issues/5180 + +import StackTest main :: IO () -main = do - stack ["clean"] - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/.gitignore b/tests/integration/tests/5180-ghc-rts-flags/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/5180-ghc-rts-flags/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/files.cabal b/tests/integration/tests/5180-ghc-rts-flags/files/files.cabal deleted file mode 100644 index 8f21c6b6bd..0000000000 --- a/tests/integration/tests/5180-ghc-rts-flags/files/files.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, mtl - default-language: Haskell2010 - diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/package.yaml b/tests/integration/tests/5180-ghc-rts-flags/files/package.yaml new file mode 100644 index 0000000000..a7305a77cf --- /dev/null +++ b/tests/integration/tests/5180-ghc-rts-flags/files/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/src/Lib.hs b/tests/integration/tests/5180-ghc-rts-flags/files/src/Lib.hs index 7685c7c4bf..6d85a26fe1 100644 --- a/tests/integration/tests/5180-ghc-rts-flags/files/src/Lib.hs +++ b/tests/integration/tests/5180-ghc-rts-flags/files/src/Lib.hs @@ -1,4 +1 @@ module Lib where - -main :: IO () -main = putStrLn "hello world" diff --git a/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml b/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml index 7a45b56d0e..6f95611bd9 100644 --- a/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml +++ b/tests/integration/tests/5180-ghc-rts-flags/files/stack.yaml @@ -1,4 +1,4 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 ghc-options: "$locals": -j8 +RTS -s -A128M diff --git a/tests/integration/tests/5272-only-locals/Main.hs b/tests/integration/tests/5272-only-locals/Main.hs index 57b02a7d58..0b2d4ebc3a 100644 --- a/tests/integration/tests/5272-only-locals/Main.hs +++ b/tests/integration/tests/5272-only-locals/Main.hs @@ -1,11 +1,14 @@ -import StackTest -import Control.Monad (void) +-- Stack supports a build target limited to locals. +-- +-- See: https://github.com/commercialhaskell/stack/issues/5272 + +import Control.Monad ( void ) +import StackTest main :: IO () main = do - void $ stack' ["exec", "ghc-pkg", "unregister", "unliftio-core"] - stack ["clean"] - + -- Ensure that the acme-missiles package is not in a package database + void $ stack' ["exec", "ghc-pkg", "unregister", "acme-missiles"] stackErr ["build", "--only-locals"] stack ["build", "--only-snapshot"] stack ["build", "--only-locals"] diff --git a/tests/integration/tests/5272-only-locals/files/.gitignore b/tests/integration/tests/5272-only-locals/files/.gitignore index 0afa51175a..b0a5a052a1 100644 --- a/tests/integration/tests/5272-only-locals/files/.gitignore +++ b/tests/integration/tests/5272-only-locals/files/.gitignore @@ -1 +1 @@ -foo.cabal +myPackage.cabal diff --git a/tests/integration/tests/5272-only-locals/files/package.yaml b/tests/integration/tests/5272-only-locals/files/package.yaml index d0d7ba0a96..c80a013e52 100644 --- a/tests/integration/tests/5272-only-locals/files/package.yaml +++ b/tests/integration/tests/5272-only-locals/files/package.yaml @@ -1,9 +1,10 @@ -name: foo -version: 0.0.0 +spec-version: 0.36.0 + +name: myPackage dependencies: - base -- unliftio-core +- acme-missiles library: - source-dirs: src/ + source-dirs: src diff --git a/tests/integration/tests/5272-only-locals/files/src/Foo.hs b/tests/integration/tests/5272-only-locals/files/src/Foo.hs deleted file mode 100644 index 72e1004bad..0000000000 --- a/tests/integration/tests/5272-only-locals/files/src/Foo.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Foo () where - -import Control.Monad.IO.Unlift () diff --git a/tests/integration/tests/5272-only-locals/files/src/Lib.hs b/tests/integration/tests/5272-only-locals/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/5272-only-locals/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/5272-only-locals/files/stack.yaml b/tests/integration/tests/5272-only-locals/files/stack.yaml index 63cbffa4be..bb37b901bc 100644 --- a/tests/integration/tests/5272-only-locals/files/stack.yaml +++ b/tests/integration/tests/5272-only-locals/files/stack.yaml @@ -1,5 +1,4 @@ snapshot: ghc-9.10.3 + extra-deps: -- unliftio-core-0.2.0.1@sha256:f9abcdd3f3d28e4840563efb7b8760d2de9b5707bcd6f53a87f6a0d77bb5a9f7,1082 -# Force a unique snapshot - acme-missiles-0.3@rev:0 diff --git a/tests/integration/tests/5680-share-package-across-projects/Main.hs b/tests/integration/tests/5680-share-package-across-projects/Main.hs index 1a04eb87d5..b5797bdfb8 100644 --- a/tests/integration/tests/5680-share-package-across-projects/Main.hs +++ b/tests/integration/tests/5680-share-package-across-projects/Main.hs @@ -1,8 +1,11 @@ -import StackTest +-- Stack supports project packages located outside of the project directory. +-- +-- See: https://github.com/commercialhaskell/stack/issues/5680 + +import StackTest main :: IO () main = do - stackEnv <- stackExe - withCwd "package-a" $ stack ["build"] - withCwd "package-b" $ stack ["build"] - withCwd "package-a" $ stack ["build"] + withCwd "myPackageA" $ stack ["build"] + withCwd "myPackageB" $ stack ["build"] + withCwd "myPackageA" $ stack ["build"] diff --git a/tests/integration/tests/5680-share-package-across-projects/files/.gitignore b/tests/integration/tests/5680-share-package-across-projects/files/.gitignore new file mode 100644 index 0000000000..c4ea0f5ab0 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/.gitignore @@ -0,0 +1,3 @@ +myPackageA.cabal +myPackageB.cabal +myPackageC.cabal diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/package.yaml new file mode 100644 index 0000000000..d26b472ded --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackageA + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/src/Lib.hs b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/stack.yaml new file mode 100644 index 0000000000..227a659a66 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageA/stack.yaml @@ -0,0 +1,5 @@ +snapshot: ghc-9.10.3 + +packages: +- . +- ../myPackageC diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/package.yaml new file mode 100644 index 0000000000..03b4ec87d3 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackageB + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/src/Lib.hs b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/stack.yaml new file mode 100644 index 0000000000..227a659a66 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageB/stack.yaml @@ -0,0 +1,5 @@ +snapshot: ghc-9.10.3 + +packages: +- . +- ../myPackageC diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/package.yaml new file mode 100644 index 0000000000..4ab5200b73 --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackageC + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-a/src/Lib.hs b/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/src/Lib.hs similarity index 100% rename from tests/integration/tests/5680-share-package-across-projects/files/package-a/src/Lib.hs rename to tests/integration/tests/5680-share-package-across-projects/files/myPackageC/src/Lib.hs diff --git a/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/5680-share-package-across-projects/files/myPackageC/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-a/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-a/package.yaml deleted file mode 100644 index 73f5370e6a..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-a/package.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: package-a -version: 0.1.0.0 -dependencies: -- base >= 4.7 && < 5 -library: - source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml deleted file mode 100644 index a6ceecc2ed..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-a/stack.yaml +++ /dev/null @@ -1,4 +0,0 @@ -snapshot: lts-24.37 -packages: -- . -- ../package-c diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-b/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-b/package.yaml deleted file mode 100644 index b134ba60f7..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-b/package.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: package-b -version: 0.1.0.0 -dependencies: -- base >= 4.7 && < 5 -library: - source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-b/src/Lib.hs b/tests/integration/tests/5680-share-package-across-projects/files/package-b/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-b/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml deleted file mode 100644 index a6ceecc2ed..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-b/stack.yaml +++ /dev/null @@ -1,4 +0,0 @@ -snapshot: lts-24.37 -packages: -- . -- ../package-c diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-c/package.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-c/package.yaml deleted file mode 100644 index 590f48c24a..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-c/package.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: package-c -version: 0.1.0.0 -dependencies: -- base >= 4.7 && < 5 -library: - source-dirs: src diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-c/src/Lib.hs b/tests/integration/tests/5680-share-package-across-projects/files/package-c/src/Lib.hs deleted file mode 100644 index d36ff2714d..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-c/src/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml b/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml deleted file mode 100644 index c292f63385..0000000000 --- a/tests/integration/tests/5680-share-package-across-projects/files/package-c/stack.yaml +++ /dev/null @@ -1 +0,0 @@ -snapshot: lts-24.37 diff --git a/tests/integration/tests/6046-missing-sublib-unregister/Main.hs b/tests/integration/tests/6046-missing-sublib-unregister/Main.hs index 174dad3876..c43d98a66d 100644 --- a/tests/integration/tests/6046-missing-sublib-unregister/Main.hs +++ b/tests/integration/tests/6046-missing-sublib-unregister/Main.hs @@ -1,12 +1,16 @@ +-- Stack builds a package where the main library depends on a private named +-- lirary (an internal library). +-- +-- See: https://github.com/commercialhaskell/stack/issues/6046 + import StackTest -- This tests building a package with a library and an internal sub library, --- where the library depends on the sub library, first version 0.1.0.0 (the --- Cabal file is @foo.cabal1@) and then version 0.2.0.0 (the Cabal file is --- @foo.cabal2@). +-- where the library depends on the sub library, first version 0.1.0.0 and then +-- version 0.2.0.0. main :: IO () main = do - copy "foo.cabal1" "foo.cabal" + copy "package1.yaml" "package.yaml" stack ["build"] - copy "foo.cabal2" "foo.cabal" + copy "package2.yaml" "package.yaml" stack ["build"] diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal1 b/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal1 deleted file mode 100644 index f6cf35e216..0000000000 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal1 +++ /dev/null @@ -1,27 +0,0 @@ -cabal-version: 2.0 -name: foo -version: 0.1.0.0 -build-type: Simple - -library - exposed-modules: - Lib - other-modules: - Sub - hs-source-dirs: - src - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints - build-depends: - base >=4.7 && <5 - , sub - default-language: Haskell2010 - -library sub - exposed-modules: - Sub - hs-source-dirs: - src - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints - build-depends: - base >=4.7 && <5 - default-language: Haskell2010 diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal2 b/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal2 deleted file mode 100644 index 58cd271816..0000000000 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/foo.cabal2 +++ /dev/null @@ -1,27 +0,0 @@ -cabal-version: 2.0 -name: foo -version: 0.2.0.0 -build-type: Simple - -library - exposed-modules: - Lib - other-modules: - Sub - hs-source-dirs: - src - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints - build-depends: - base >=4.7 && <5 - , sub - default-language: Haskell2010 - -library sub - exposed-modules: - Sub - hs-source-dirs: - src - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints - build-depends: - base >=4.7 && <5 - default-language: Haskell2010 diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/int/Internal.hs b/tests/integration/tests/6046-missing-sublib-unregister/files/int/Internal.hs new file mode 100644 index 0000000000..d066bb085e --- /dev/null +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/int/Internal.hs @@ -0,0 +1 @@ +module Internal where diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/package1.yaml b/tests/integration/tests/6046-missing-sublib-unregister/files/package1.yaml new file mode 100644 index 0000000000..62c65aee09 --- /dev/null +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/package1.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.1.0.0 + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - internal + +internal-libraries: + internal: + source-dirs: int diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/package2.yaml b/tests/integration/tests/6046-missing-sublib-unregister/files/package2.yaml new file mode 100644 index 0000000000..176e733308 --- /dev/null +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/package2.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackage +version: 0.2.0.0 + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - internal + +internal-libraries: + internal: + source-dirs: int diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/src/Lib.hs b/tests/integration/tests/6046-missing-sublib-unregister/files/src/Lib.hs index 7bce5cbb19..1369151610 100644 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/src/Lib.hs +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/src/Lib.hs @@ -1,5 +1,3 @@ -module Lib - ( someFunc - ) where +module Lib where -import Sub ( someFunc ) +import Internal diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/src/Sub.hs b/tests/integration/tests/6046-missing-sublib-unregister/files/src/Sub.hs deleted file mode 100644 index a173e7a513..0000000000 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/src/Sub.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Sub - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml b/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml +++ b/tests/integration/tests/6046-missing-sublib-unregister/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/6372-sdist-unicode-test/.gitignore b/tests/integration/tests/6372-sdist-unicode-test/.gitignore index 609770f0c7..a92d9c3b13 100644 --- a/tests/integration/tests/6372-sdist-unicode-test/.gitignore +++ b/tests/integration/tests/6372-sdist-unicode-test/.gitignore @@ -1 +1 @@ -stack.yaml.lock +test١٢٣.cabal diff --git a/tests/integration/tests/6372-sdist-unicode-test/Main.hs b/tests/integration/tests/6372-sdist-unicode-test/Main.hs index 1d546c1afc..0b33987b95 100644 --- a/tests/integration/tests/6372-sdist-unicode-test/Main.hs +++ b/tests/integration/tests/6372-sdist-unicode-test/Main.hs @@ -1,6 +1,9 @@ -import StackTest +-- Stack sdist handles Unicode code points. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6372 -import Control.Monad (unless) +import Control.Monad ( unless ) +import StackTest -- | The test fails at runtime on the Windows Server 2022 GitHub-hosted runner -- only, at the point of outputting a Unicode character, with: @@ -16,7 +19,5 @@ import Control.Monad (unless) -- Windows. main :: IO () -main = unless isWindows $ do - stack ["clean"] - stack ["build", "--dry-run"] +main = unless isWindows $ stack ["sdist", "."] diff --git a/tests/integration/tests/6372-sdist-unicode-test/files/package.yaml b/tests/integration/tests/6372-sdist-unicode-test/files/package.yaml index 30b809b389..42e9845b9c 100644 --- a/tests/integration/tests/6372-sdist-unicode-test/files/package.yaml +++ b/tests/integration/tests/6372-sdist-unicode-test/files/package.yaml @@ -1,8 +1,11 @@ +spec-version: 0.36.0 + name: test١٢٣ -version: 0.1.0.0 +description: Test of non-ASCII Unicode code points in file names license: BSD-3-Clause -description: Test of Unicode characters in file names + dependencies: - base < 5 + library: source-dirs: src diff --git "a/tests/integration/tests/6372-sdist-unicode-test/files/src/Lib\316\261\316\262\316\263.hs" "b/tests/integration/tests/6372-sdist-unicode-test/files/src/Lib\316\261\316\262\316\263.hs" index 62cdaa6007..5fbed3015d 100644 --- "a/tests/integration/tests/6372-sdist-unicode-test/files/src/Lib\316\261\316\262\316\263.hs" +++ "b/tests/integration/tests/6372-sdist-unicode-test/files/src/Lib\316\261\316\262\316\263.hs" @@ -1,6 +1 @@ -module Libαβγ - ( someFunc - ) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" +module Libαβγ where diff --git a/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml b/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml +++ b/tests/integration/tests/6372-sdist-unicode-test/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 diff --git "a/tests/integration/tests/6372-sdist-unicode-test/files/test\331\241\331\242\331\243.cabal" "b/tests/integration/tests/6372-sdist-unicode-test/files/test\331\241\331\242\331\243.cabal" deleted file mode 100644 index 8525055843..0000000000 --- "a/tests/integration/tests/6372-sdist-unicode-test/files/test\331\241\331\242\331\243.cabal" +++ /dev/null @@ -1,24 +0,0 @@ -cabal-version: 2.2 - --- This file has been generated from package.yaml by hpack version 0.36.0. --- --- see: https://github.com/sol/hpack - -name: test١٢٣ -version: 0.1.0.0 -description: Test of Unicode characters in file names -license: BSD-3-Clause -build-type: Simple - -library - exposed-modules: - Libαβγ - other-modules: - Paths_test١٢٣ - autogen-modules: - Paths_test١٢٣ - hs-source-dirs: - src - build-depends: - base <5 - default-language: Haskell2010 diff --git a/tests/integration/tests/6451-exe-targets/Main.hs b/tests/integration/tests/6451-exe-targets/Main.hs index d57296fcf2..09b0f66c7e 100644 --- a/tests/integration/tests/6451-exe-targets/Main.hs +++ b/tests/integration/tests/6451-exe-targets/Main.hs @@ -3,6 +3,8 @@ -- -- Issue: https://github.com/commercialhaskell/stack/issues/3229 is no longer -- applicable. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6451 module Main where @@ -13,10 +15,10 @@ import StackTest main :: IO () main = do stackCheckStderr - ["build", ":alpha"] - (rejectMessage "Installing executable beta in") + ["build", ":myExeA"] + (rejectMessage "Installing executable myExeB in") rejectMessage :: String -> String -> IO () rejectMessage msg stderr = - when (msg `isInfixOf` stderr) - (error $ "Did not expect message here: \n" ++ show msg) + when (msg `isInfixOf` stderr) $ + error $ "Did not expect message here: \n" ++ show msg diff --git a/tests/integration/tests/6451-exe-targets/files/.gitignore b/tests/integration/tests/6451-exe-targets/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/6451-exe-targets/files/app/Alpha.hs b/tests/integration/tests/6451-exe-targets/files/app/Alpha.hs deleted file mode 100644 index 76a9bdb5d4..0000000000 --- a/tests/integration/tests/6451-exe-targets/files/app/Alpha.hs +++ /dev/null @@ -1 +0,0 @@ -main = pure () diff --git a/tests/integration/tests/6451-exe-targets/files/app/Beta.hs b/tests/integration/tests/6451-exe-targets/files/app/Beta.hs deleted file mode 100644 index 76a9bdb5d4..0000000000 --- a/tests/integration/tests/6451-exe-targets/files/app/Beta.hs +++ /dev/null @@ -1 +0,0 @@ -main = pure () diff --git a/tests/integration/tests/6451-exe-targets/files/appA/Main.hs b/tests/integration/tests/6451-exe-targets/files/appA/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/appA/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/6451-exe-targets/files/appB/Main.hs b/tests/integration/tests/6451-exe-targets/files/appB/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/appB/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/6451-exe-targets/files/package.yaml b/tests/integration/tests/6451-exe-targets/files/package.yaml index 045c846203..6338785a63 100644 --- a/tests/integration/tests/6451-exe-targets/files/package.yaml +++ b/tests/integration/tests/6451-exe-targets/files/package.yaml @@ -1,24 +1,21 @@ spec-version: 0.36.0 -name: foo -version: 0 +name: myPackage dependencies: -- base >= 4.7 && < 5 +- base library: source-dirs: src executables: - alpha: - source-dirs: app - main: Alpha.hs - other-modules: [] + myExeA: + source-dirs: appA + main: Main.hs dependencies: - - foo - beta: - source-dirs: app - main: Beta.hs - other-modules: [] + - myPackage + myExeB: + source-dirs: appB + main: Main.hs dependencies: - - foo + - myPackage diff --git a/tests/integration/tests/6451-exe-targets/files/src/Foo.hs b/tests/integration/tests/6451-exe-targets/files/src/Foo.hs deleted file mode 100644 index efbf93bbde..0000000000 --- a/tests/integration/tests/6451-exe-targets/files/src/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/tests/integration/tests/6451-exe-targets/files/src/Lib.hs b/tests/integration/tests/6451-exe-targets/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/6451-exe-targets/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/6465-msys-environment/Main.hs b/tests/integration/tests/6465-msys-environment/Main.hs index efd730ccd7..8c64777059 100644 --- a/tests/integration/tests/6465-msys-environment/Main.hs +++ b/tests/integration/tests/6465-msys-environment/Main.hs @@ -1,9 +1,12 @@ -import StackTest +-- | On Windows, Stack supports different MSYS2 environments. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6465 -import Control.Monad ( when ) +import Control.Monad ( when ) +import StackTest main :: IO () main = when isWindows $ do stack ["exec", "--", "pacman", "-S", "--noconfirm", "mingw-w64-ucrt-x86_64-gsl"] stack ["build"] - stack ["exec", "--", "foo"] + stack ["exec", "--", "myExe"] diff --git a/tests/integration/tests/6465-msys-environment/files/.gitignore b/tests/integration/tests/6465-msys-environment/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/6465-msys-environment/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/6465-msys-environment/files/Setup.hs b/tests/integration/tests/6465-msys-environment/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/6465-msys-environment/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/6465-msys-environment/files/Main.hs b/tests/integration/tests/6465-msys-environment/files/app/Main.hs similarity index 100% rename from tests/integration/tests/6465-msys-environment/files/Main.hs rename to tests/integration/tests/6465-msys-environment/files/app/Main.hs diff --git a/tests/integration/tests/6465-msys-environment/files/foo.cabal b/tests/integration/tests/6465-msys-environment/files/foo.cabal deleted file mode 100644 index f007e34101..0000000000 --- a/tests/integration/tests/6465-msys-environment/files/foo.cabal +++ /dev/null @@ -1,11 +0,0 @@ -cabal-version: 2.2 -name: foo -version: 0.1.0.0 -build-type: Simple - -executable foo - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - extra-libraries: gsl - build-depends: base >=4.7 && <5 - default-language: Haskell2010 diff --git a/tests/integration/tests/6465-msys-environment/files/package.yaml b/tests/integration/tests/6465-msys-environment/files/package.yaml new file mode 100644 index 0000000000..d385615dc8 --- /dev/null +++ b/tests/integration/tests/6465-msys-environment/files/package.yaml @@ -0,0 +1,14 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +extra-libraries: +- gsl + +executables: + myExe: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/6465-msys-environment/files/stack.yaml b/tests/integration/tests/6465-msys-environment/files/stack.yaml index 594bdd467c..36d650b698 100644 --- a/tests/integration/tests/6465-msys-environment/files/stack.yaml +++ b/tests/integration/tests/6465-msys-environment/files/stack.yaml @@ -1,2 +1,3 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + msys-environment: UCRT64 diff --git a/tests/integration/tests/6867-timeout-grace/Main.hs b/tests/integration/tests/6867-timeout-grace/Main.hs index c81128476a..e5a6d6868a 100644 --- a/tests/integration/tests/6867-timeout-grace/Main.hs +++ b/tests/integration/tests/6867-timeout-grace/Main.hs @@ -1,9 +1,13 @@ -import Data.Char (toLower) -import Data.IORef (newIORef, readIORef, writeIORef) -import Data.List (isInfixOf) -import Data.Time.Clock (diffUTCTime, getCurrentTime) -import StackTest -import Control.Monad (unless) +-- | Stack supports a grace period timeout for test suites. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6867 + +import Control.Monad ( unless ) +import Data.Char ( toLower ) +import Data.IORef ( newIORef, readIORef, writeIORef ) +import Data.List ( isInfixOf ) +import Data.Time.Clock ( diffUTCTime, getCurrentTime) +import StackTest main :: IO () main = do diff --git a/tests/integration/tests/6867-timeout-grace/files/.gitignore b/tests/integration/tests/6867-timeout-grace/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/6867-timeout-grace/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/6867-timeout-grace/files/package.yaml b/tests/integration/tests/6867-timeout-grace/files/package.yaml index a0efe93896..c5ca426401 100644 --- a/tests/integration/tests/6867-timeout-grace/files/package.yaml +++ b/tests/integration/tests/6867-timeout-grace/files/package.yaml @@ -1,16 +1,14 @@ -name: timeout-grace-fixture -version: 0.1.0.0 -license: BSD-3-Clause +spec-version: 0.36.0 -ghc-options: -- -Wall +name: myPackage + +dependencies: +- base tests: - timeout-grace-fixture-test: + test: main: Main.hs source-dirs: test - dependencies: - - base when: - condition: '!os(windows)' dependencies: diff --git a/tests/integration/tests/6867-timeout-grace/files/test/Main.hs b/tests/integration/tests/6867-timeout-grace/files/test/Main.hs index 7d2c6cf974..cc4bfd8036 100644 --- a/tests/integration/tests/6867-timeout-grace/files/test/Main.hs +++ b/tests/integration/tests/6867-timeout-grace/files/test/Main.hs @@ -1,11 +1,14 @@ {-# LANGUAGE CPP #-} -module Main (main) where +module Main + ( main + ) where -import Control.Concurrent (threadDelay) +import Control.Concurrent ( threadDelay ) #ifndef mingw32_HOST_OS -import System.Posix.Signals (Handler (Ignore), installHandler, sigTERM) +import System.Posix.Signals + ( Handler (Ignore), installHandler, sigTERM ) #endif main :: IO () diff --git a/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal b/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal deleted file mode 100644 index 4813ac2d66..0000000000 --- a/tests/integration/tests/6867-timeout-grace/files/timeout-grace-fixture.cabal +++ /dev/null @@ -1,27 +0,0 @@ -cabal-version: 2.2 - --- This file has been generated from package.yaml by hpack version 0.39.1. --- --- see: https://github.com/sol/hpack - -name: timeout-grace-fixture -version: 0.1.0.0 -license: BSD-3-Clause -build-type: Simple - -test-suite timeout-grace-fixture-test - type: exitcode-stdio-1.0 - main-is: Main.hs - other-modules: - Paths_timeout_grace_fixture - autogen-modules: - Paths_timeout_grace_fixture - hs-source-dirs: - test - ghc-options: -Wall - build-depends: - base - default-language: Haskell2010 - if !os(windows) - build-depends: - unix diff --git a/tests/integration/tests/6879-stack-yaml-includes/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/Main.hs index 2c692de132..f5cc7e789a 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/Main.hs +++ b/tests/integration/tests/6879-stack-yaml-includes/Main.hs @@ -1,10 +1,13 @@ -import StackTest +-- | Stack supports an !include directive in YAML configuration files. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6879 -import Control.Monad (unless) -import Data.List (isInfixOf) -import System.Directory (getCurrentDirectory) -import System.Environment (setEnv) -import System.FilePath ( () ) +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest +import System.Directory ( getCurrentDirectory ) +import System.Environment ( setEnv ) +import System.FilePath ( () ) main :: IO () main = do @@ -15,43 +18,43 @@ main = do -- Check that includes in stack.yaml files are included stackCheckStdout - ["--stack-yaml","stack-including-flags.yaml","run"] + ["--stack-yaml", "stack-including-flags.yaml", "run"] (checkFor "TEST_FLAG was set\n") stackCheckStdout - ["--stack-yaml","stack-including-flags-with-newline.yaml","run"] + ["--stack-yaml", "stack-including-flags-with-newline.yaml", "run"] (checkFor "TEST_FLAG was set\n") stackCheckStdout - ["--stack-yaml","stack-not-including-flags.yaml","run"] + ["--stack-yaml", "stack-not-including-flags.yaml", "run"] (checkFor "TEST_FLAG was not set\n") -- Check that includes in config.yaml files are included currentDir <- getCurrentDirectory setEnv "STACK_CONFIG" (currentDir "config-including-flags.yaml") stackCheckStdout - ["--stack-yaml","stack-not-including-flags.yaml","run"] + ["--stack-yaml", "stack-not-including-flags.yaml", "run"] (checkFor "TEST_FLAG was set\n") - -- Check that 'config set' succeeds when the key already exists in a - -- stack.yaml file that uses !include directives - stackCheckStderr - ["--stack-yaml","stack-including-flags.yaml","config","set","snapshot","lts-24.37"] - (expectMessage "already") - - -- Check that 'config set' succeeds when the key already exists in a - -- stack.yaml file that uses !include directives (with newline variant) - stackCheckStderr - ["--stack-yaml","stack-including-flags-with-newline.yaml","config","set","snapshot","lts-24.37"] - (expectMessage "already") +-- Disabling test, pending investigation ... +-- -- Check that 'config set' succeeds when the key already exists in a +-- -- stack.yaml file that uses !include directives +-- stackCheckStderr +-- ["--stack-yaml", "stack-including-flags.yaml", "config", "set", "snapshot", "ghc-9.10.3"] +-- (expectMessage "already") +-- -- Check that 'config set' succeeds when the key already exists in a +-- -- stack.yaml file that uses !include directives (with newline variant) +-- stackCheckStderr +-- ["--stack-yaml", "stack-including-flags-with-newline.yaml", "config", "set", "snapshot", "ghc-9.10.3"] +-- (expectMessage "already") -- Check that 'config set' raises an error when the key does not exist in a -- stack.yaml file that uses !include directives stackErrStderr - ["--stack-yaml","stack-including-file-with-install-ghc.yaml","config","set","install-ghc","true"] + ["--stack-yaml", "stack-including-file-with-install-ghc.yaml", "config", "set", "install-ghc", "true"] (expectMessage "!include") expectMessage :: String -> String -> IO () expectMessage msg stderr' = do - unless (msg `isInfixOf` stderr') - (error $ "Expected stderr to contain " ++ show msg ++ " but got:\n" ++ stderr') + unless (msg `isInfixOf` stderr') $ + error $ "Expected stderr to contain " ++ show msg ++ " but got:\n" ++ stderr' diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/.gitignore b/tests/integration/tests/6879-stack-yaml-includes/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs index ad0614bb43..d412740785 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs +++ b/tests/integration/tests/6879-stack-yaml-includes/files/app/Main.hs @@ -1,8 +1,8 @@ {-# LANGUAGE CPP #-} module Main - ( main - ) where + ( main + ) where main :: IO () main = @@ -11,4 +11,3 @@ main = #else putStrLn "TEST_FLAG was not set" #endif - diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal b/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal deleted file mode 100644 index 6d61223142..0000000000 --- a/tests/integration/tests/6879-stack-yaml-includes/files/files.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -flag test-flag - description: Generate a compiler error for test purposes - default: False - manual: True - -executable test-exe - hs-source-dirs: app - main-is: Main.hs - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - if flag(test-flag) - cpp-options: -DTEST_FLAG diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/package.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/package.yaml new file mode 100644 index 0000000000..a211bd8344 --- /dev/null +++ b/tests/integration/tests/6879-stack-yaml-includes/files/package.yaml @@ -0,0 +1,20 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +flags: + test-flag: + description: Generate a compiler error for test purposes + default: false + manual: true + +executables: + myExe: + source-dirs: app + main: Main.hs + when: + - condition: flag(test-flag) + cpp-options: -DTEST_FLAG diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml index 37b83239fd..81f0ef1634 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-flags.yaml @@ -1,3 +1,3 @@ flags: - files: + myPackage: test-flag: true diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml index 31d6e2f246..e58b5115e2 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-file-with-install-ghc.yaml @@ -1,2 +1,2 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 <<: !include install-ghc.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml index 065a854323..4b7216c7c8 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags-with-newline.yaml @@ -1,3 +1,3 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 <<: !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml index fecebb23af..6f6a0cd5f3 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-including-flags.yaml @@ -1,2 +1,2 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 <<: !include stack-flags.yaml diff --git a/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml +++ b/tests/integration/tests/6879-stack-yaml-includes/files/stack-not-including-flags.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 From 501f72b7ee60349499431fd27cfbf472940d41fb Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 18:18:09 +0100 Subject: [PATCH 51/75] Fix #6897 Allow config set snapshot with non-synonym values Also re-enables part of integration test 6879-stack-yaml-includes --- ChangeLog.md | 2 ++ doc/commands/config_command.md | 3 +++ src/Stack/ConfigCmd.hs | 15 ++++++++++++- .../tests/6879-stack-yaml-includes/Main.hs | 21 +++++++++---------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index a27d78688b..c71858fae9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -41,6 +41,8 @@ Other enhancements: different snapshots can use `!include` to avoid duplicating shared settings. * Stack's `config set` command raises an error if the target configuration file excludes the key being set and includes an `!include` directive. +* Stack's `config set snapshot` command now works with other snapshot values + in addition to snapshot synonymns. Bug fixes: diff --git a/doc/commands/config_command.md b/doc/commands/config_command.md index 931f693c73..084249520a 100644 --- a/doc/commands/config_command.md +++ b/doc/commands/config_command.md @@ -179,6 +179,9 @@ A snapshot of `lts` or `nightly` will be translated into the most recent available. A snapshot of `lts-22` will be translated into the most recent available in the `lts-22` sequence. +Snapshot values that are compiler versions, a URL or a local file path are also +accepted. + If a (deprecated) `resolver` key is present, it will be replaced by a `snapshot` key. diff --git a/src/Stack/ConfigCmd.hs b/src/Stack/ConfigCmd.hs index b3f3fae468..635cd1b645 100644 --- a/src/Stack/ConfigCmd.hs +++ b/src/Stack/ConfigCmd.hs @@ -288,7 +288,20 @@ snapshotValue root snapshot = do concreteSnapshot <- makeConcreteSnapshot snapshot' -- Check that the snapshot actually exists void $ loadSnapshot =<< completeSnapshotLocation concreteSnapshot - pure (Yaml.toJSON concreteSnapshot) + rslValue concreteSnapshot + +rslValue :: HasConfig env => RawSnapshotLocation -> RIO env Yaml.Value +rslValue (RSLCompiler compiler) = pure $ Yaml.toJSON compiler +rslValue (RSLUrl url Nothing) = pure $ Yaml.toJSON url +rslValue (RSLUrl url _) = do + -- I can't see how this would ever arise, but it is added for completeness: + prettyWarnL + [ flow "The specified snapshot value is a URL. The associated SHA256 hash \ + \and file size will be ignored." + ] + pure $ Yaml.toJSON url +rslValue (RSLFilePath rp) = pure $ Yaml.toJSON $ resolvedRelative rp +rslValue rsl = pure $ Yaml.toJSON rsl cfgCmdSetKeys :: ConfigCmdSet -> NonEmpty (NonEmpty Text) cfgCmdSetKeys (ConfigCmdSetSnapshot _) = [["snapshot"], ["resolver"]] diff --git a/tests/integration/tests/6879-stack-yaml-includes/Main.hs b/tests/integration/tests/6879-stack-yaml-includes/Main.hs index f5cc7e789a..60e70406ad 100644 --- a/tests/integration/tests/6879-stack-yaml-includes/Main.hs +++ b/tests/integration/tests/6879-stack-yaml-includes/Main.hs @@ -36,17 +36,16 @@ main = do ["--stack-yaml", "stack-not-including-flags.yaml", "run"] (checkFor "TEST_FLAG was set\n") --- Disabling test, pending investigation ... --- -- Check that 'config set' succeeds when the key already exists in a --- -- stack.yaml file that uses !include directives --- stackCheckStderr --- ["--stack-yaml", "stack-including-flags.yaml", "config", "set", "snapshot", "ghc-9.10.3"] --- (expectMessage "already") --- -- Check that 'config set' succeeds when the key already exists in a --- -- stack.yaml file that uses !include directives (with newline variant) --- stackCheckStderr --- ["--stack-yaml", "stack-including-flags-with-newline.yaml", "config", "set", "snapshot", "ghc-9.10.3"] --- (expectMessage "already") + -- Check that 'config set' succeeds when the key already exists in a + -- stack.yaml file that uses !include directives + stackCheckStderr + ["--stack-yaml", "stack-including-flags.yaml", "config", "set", "snapshot", "ghc-9.10.3"] + (expectMessage "already") + -- Check that 'config set' succeeds when the key already exists in a + -- stack.yaml file that uses !include directives (with newline variant) + stackCheckStderr + ["--stack-yaml", "stack-including-flags-with-newline.yaml", "config", "set", "snapshot", "ghc-9.10.3"] + (expectMessage "already") -- Check that 'config set' raises an error when the key does not exist in a -- stack.yaml file that uses !include directives From e2e8dab47391f1c8e39af2798b79dfab6e59a094 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 19:46:29 +0100 Subject: [PATCH 52/75] Review, document and conform further integration tests --- .../allow-newer-specific-packages/Main.hs | 8 ++++--- .../files/.gitignore | 1 + .../files/foo.cabal | 20 ---------------- .../files/package.yaml | 8 ++++--- .../files/src/Foo.hs | 1 - .../files/src/Lib.hs | 1 + .../files/stack.yaml | 8 +++++-- tests/integration/tests/basic-install/Main.hs | 10 ++++---- .../tests/cabal-non-buildable-bug/Main.hs | 19 ++++----------- .../cabal-non-buildable-bug/files/.gitignore | 3 +-- .../files/package.yaml | 13 ++++------- .../cabal-non-buildable-bug/files/stack.yaml | 1 + .../tests/cabal-public-sublibraries/Main.hs | 6 ----- .../cabal-public-sublibraries/files/Setup.hs | 2 -- .../files/files.cabal | 17 -------------- .../files/src/Lib.hs | 7 ------ .../files/src/Sub.hs | 7 ------ .../files/stack.yaml | 5 ---- .../files/stack.yaml.lock | 23 ------------------- .../tests/cabal-sublibrary-dependency/Main.hs | 17 ++++++-------- .../files/.gitignore | 2 ++ .../files/Setup.hs | 2 -- .../files/files.cabal | 11 --------- .../files/myPackageA/app}/Main.hs | 2 ++ .../files/myPackageA/package.yaml | 12 ++++++++++ .../files/myPackageB/package.yaml | 13 +++++++++++ .../files/myPackageB/src/Lib.hs | 1 + .../files/src/Lib.hs | 11 --------- .../files/stack.yaml | 7 +++--- .../files/stack.yaml.lock | 12 ---------- .../files/subproject/src/Subproject/Lib.hs | 6 ----- .../files/subproject/src/Subproject/SubLib.hs | 6 ----- .../files/subproject/subproject.cabal | 17 -------------- .../integration/tests/copy-bins-works/Main.hs | 21 +++++++++-------- .../tests/copy-bins-works/files/.gitignore | 5 ++-- .../tests/copy-bins-works/files/app/Main.hs | 4 ++++ .../tests/copy-bins-works/files/package.yaml | 14 ++++++----- .../files/stack-copy-bins.yaml | 4 ++++ .../tests/copy-bins-works/files/stack.yaml | 4 +++- tests/integration/tests/drop-packages/Main.hs | 4 +++- .../tests/drop-packages/files/.gitignore | 2 +- .../tests/drop-packages/files/package.yaml | 7 ++++-- .../tests/drop-packages/files/stack.yaml | 1 + .../tests/duplicate-package-ids/Main.hs | 15 ++++++------ .../duplicate-package-ids/files/.gitignore | 3 +-- .../files/mySnapshot.yaml | 6 +++++ .../duplicate-package-ids/files/stack1.yaml | 3 ++- .../duplicate-package-ids/files/stack2.yaml | 5 ++-- 48 files changed, 138 insertions(+), 239 deletions(-) create mode 100644 tests/integration/tests/allow-newer-specific-packages/files/.gitignore delete mode 100644 tests/integration/tests/allow-newer-specific-packages/files/foo.cabal delete mode 100644 tests/integration/tests/allow-newer-specific-packages/files/src/Foo.hs create mode 100644 tests/integration/tests/allow-newer-specific-packages/files/src/Lib.hs create mode 100644 tests/integration/tests/cabal-non-buildable-bug/files/stack.yaml delete mode 100644 tests/integration/tests/cabal-public-sublibraries/Main.hs delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/Setup.hs delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/files.cabal delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/src/Lib.hs delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/src/Sub.hs delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/stack.yaml delete mode 100644 tests/integration/tests/cabal-public-sublibraries/files/stack.yaml.lock create mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/.gitignore delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/Setup.hs delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/files.cabal rename tests/integration/tests/{copy-bins-works/files/src => cabal-sublibrary-dependency/files/myPackageA/app}/Main.hs (60%) create mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/src/Lib.hs delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/src/Lib.hs delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml.lock delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/Lib.hs delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/SubLib.hs delete mode 100644 tests/integration/tests/cabal-sublibrary-dependency/files/subproject/subproject.cabal create mode 100644 tests/integration/tests/copy-bins-works/files/app/Main.hs create mode 100644 tests/integration/tests/copy-bins-works/files/stack-copy-bins.yaml create mode 100644 tests/integration/tests/duplicate-package-ids/files/mySnapshot.yaml diff --git a/tests/integration/tests/allow-newer-specific-packages/Main.hs b/tests/integration/tests/allow-newer-specific-packages/Main.hs index af048e917b..af0d7407fe 100644 --- a/tests/integration/tests/allow-newer-specific-packages/Main.hs +++ b/tests/integration/tests/allow-newer-specific-packages/Main.hs @@ -1,5 +1,7 @@ -import StackTest +-- | Stack allows allow-newer to be applied to the dependencies of specified +-- packages. + +import StackTest main :: IO () -main = do - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/allow-newer-specific-packages/files/.gitignore b/tests/integration/tests/allow-newer-specific-packages/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/allow-newer-specific-packages/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/allow-newer-specific-packages/files/foo.cabal b/tests/integration/tests/allow-newer-specific-packages/files/foo.cabal deleted file mode 100644 index 1cd8630056..0000000000 --- a/tests/integration/tests/allow-newer-specific-packages/files/foo.cabal +++ /dev/null @@ -1,20 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.35.0. --- --- see: https://github.com/sol/hpack - -name: foo -version: 0 -build-type: Simple - -library - exposed-modules: - Foo - other-modules: - Paths_foo - hs-source-dirs: - src - build-depends: - base ==4.13.* - default-language: Haskell2010 diff --git a/tests/integration/tests/allow-newer-specific-packages/files/package.yaml b/tests/integration/tests/allow-newer-specific-packages/files/package.yaml index c3af47cd49..9104b9bf64 100644 --- a/tests/integration/tests/allow-newer-specific-packages/files/package.yaml +++ b/tests/integration/tests/allow-newer-specific-packages/files/package.yaml @@ -1,8 +1,10 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage dependencies: -- base >= 4.13 && < 4.14 +- base +- acme-missiles < 0.3 library: source-dirs: src diff --git a/tests/integration/tests/allow-newer-specific-packages/files/src/Foo.hs b/tests/integration/tests/allow-newer-specific-packages/files/src/Foo.hs deleted file mode 100644 index efbf93bbde..0000000000 --- a/tests/integration/tests/allow-newer-specific-packages/files/src/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/tests/integration/tests/allow-newer-specific-packages/files/src/Lib.hs b/tests/integration/tests/allow-newer-specific-packages/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/allow-newer-specific-packages/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml b/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml index ba5ad2fa3c..ebf6dd48f5 100644 --- a/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml +++ b/tests/integration/tests/allow-newer-specific-packages/files/stack.yaml @@ -1,5 +1,9 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + +extra-deps: +- acme-missiles-0.3 allow-newer: true + allow-newer-deps: -- foo +- myPackage diff --git a/tests/integration/tests/basic-install/Main.hs b/tests/integration/tests/basic-install/Main.hs index b18a78a32f..659cccdb75 100644 --- a/tests/integration/tests/basic-install/Main.hs +++ b/tests/integration/tests/basic-install/Main.hs @@ -1,6 +1,8 @@ -import StackTest +-- | Stack will build packages in the package index in the absence of a Stack +-- project-level configuration file (by referring to the configuration file in +-- the global-project directory in the Stack root). + +import StackTest main :: IO () -main = do - stack [defaultSnapshotArg, "install", "acme-missiles-0.3"] - doesNotExist "stack.yaml" +main = stack ["build", "acme-missiles-0.3"] diff --git a/tests/integration/tests/cabal-non-buildable-bug/Main.hs b/tests/integration/tests/cabal-non-buildable-bug/Main.hs index 7bd8831090..ceaa053290 100644 --- a/tests/integration/tests/cabal-non-buildable-bug/Main.hs +++ b/tests/integration/tests/cabal-non-buildable-bug/Main.hs @@ -1,20 +1,9 @@ -import StackTest +-- | When building, Stack ignores the components of packages that are +-- not-buildable. + +import StackTest main :: IO () main = do - -- Newer Cabal: dry run and building should succeed, because they'll - -- both ignore the do-not-build - writeFile "stack.yaml" "snapshot: lts-24.37" stack ["build", "--dry-run"] stack ["build"] - - -- Older Cabal: both should fail, because they'll both try to - -- include the non-buildable component. If there's a regression, the - -- dry run will succeed (because Stack will use the proper logic) - -- and build will fail (because Cabal will be using its broken - -- logic). - writeFile "stack.yaml" "snapshot: ghc-7.10.3" - -- The '--install-ghc' flag is passed here, because IntegrationSpec.runApp - -- sets up `config.yaml` with `system-ghc: true` and `install-ghc: false`. - stackErr ["--install-ghc", "build"] - stackErr ["--install-ghc", "build", "--dry-run"] diff --git a/tests/integration/tests/cabal-non-buildable-bug/files/.gitignore b/tests/integration/tests/cabal-non-buildable-bug/files/.gitignore index 0008ca1636..b0a5a052a1 100644 --- a/tests/integration/tests/cabal-non-buildable-bug/files/.gitignore +++ b/tests/integration/tests/cabal-non-buildable-bug/files/.gitignore @@ -1,2 +1 @@ -stack.yaml -foo.cabal +myPackage.cabal diff --git a/tests/integration/tests/cabal-non-buildable-bug/files/package.yaml b/tests/integration/tests/cabal-non-buildable-bug/files/package.yaml index 67f3a25c46..47630ba295 100644 --- a/tests/integration/tests/cabal-non-buildable-bug/files/package.yaml +++ b/tests/integration/tests/cabal-non-buildable-bug/files/package.yaml @@ -1,14 +1,11 @@ -name: foo -version: "0" +spec-version: 0.36.0 + +name: myPackage dependencies: - base -library: {} - executables: - not-built: - main: Main.hs - dependencies: - - does-not-exist + myExe: + main: Main.hs # Does not exist buildable: false diff --git a/tests/integration/tests/cabal-non-buildable-bug/files/stack.yaml b/tests/integration/tests/cabal-non-buildable-bug/files/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/cabal-non-buildable-bug/files/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3 diff --git a/tests/integration/tests/cabal-public-sublibraries/Main.hs b/tests/integration/tests/cabal-public-sublibraries/Main.hs deleted file mode 100644 index 987ebbfe2e..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/Main.hs +++ /dev/null @@ -1,6 +0,0 @@ -import StackTest - -main :: IO () -main = do - putStrLn "Disabled: CI doesn't have GHC 8.8.1" - --stack ["build"] diff --git a/tests/integration/tests/cabal-public-sublibraries/files/Setup.hs b/tests/integration/tests/cabal-public-sublibraries/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/cabal-public-sublibraries/files/files.cabal b/tests/integration/tests/cabal-public-sublibraries/files/files.cabal deleted file mode 100644 index 5255078e44..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/files.cabal +++ /dev/null @@ -1,17 +0,0 @@ -cabal-version: 3.0 -name: files -version: 0.1.0.0 -build-type: Simple - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -library sub - visibility: public - hs-source-dirs: src - exposed-modules: Sub - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/cabal-public-sublibraries/files/src/Lib.hs b/tests/integration/tests/cabal-public-sublibraries/files/src/Lib.hs deleted file mode 100644 index d999e20553..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/src/Lib.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Lib - ( someFunc - ) where - -someFunc :: IO () -someFunc = do - putStrLn "hello world" diff --git a/tests/integration/tests/cabal-public-sublibraries/files/src/Sub.hs b/tests/integration/tests/cabal-public-sublibraries/files/src/Sub.hs deleted file mode 100644 index 08c047a5a1..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/src/Sub.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Sub - ( someFunc - ) where - -someFunc :: IO () -someFunc = do - putStrLn "hello world" diff --git a/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml b/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml deleted file mode 100644 index 6fdd699311..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml +++ /dev/null @@ -1,5 +0,0 @@ -snapshot: nightly-2020-01-17 -extra-deps: -- github: snoyberg/filelock - commit: 4f080496d8bf153fbe26e64d1f52cf73c7db25f6 -# - Cabal-3.0.0.0@sha256:1ba37b8d80e89213b17db7b8b9ea0108da55ca65f8c0cbb7433881a284c5cf67,26027 diff --git a/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml.lock b/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml.lock deleted file mode 100644 index 44b4120015..0000000000 --- a/tests/integration/tests/cabal-public-sublibraries/files/stack.yaml.lock +++ /dev/null @@ -1,23 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - name: filelock - pantry-tree: - sha256: 0563d664aefb56cacfa89bc244d377c5e63597abd827a5a3f8d6be21a2b3b4d9 - size: 584 - sha256: c27641e26137f52b27e3ef9e27e7ac3f845f719ea54a12475f00f2ea7e6d9afc - size: 9228 - url: https://github.com/snoyberg/filelock/archive/4f080496d8bf153fbe26e64d1f52cf73c7db25f6.tar.gz - version: 0.1.1.2 - original: - url: https://github.com/snoyberg/filelock/archive/4f080496d8bf153fbe26e64d1f52cf73c7db25f6.tar.gz -snapshots: -- completed: - sha256: bfafe5735ccb74527d754b1f9999ded72d7c3a6c3a88529449661431ccfbd6cc - size: 649327 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/8.yaml - original: lts-20.8 diff --git a/tests/integration/tests/cabal-sublibrary-dependency/Main.hs b/tests/integration/tests/cabal-sublibrary-dependency/Main.hs index da62ff8f13..4f9ba45ac1 100644 --- a/tests/integration/tests/cabal-sublibrary-dependency/Main.hs +++ b/tests/integration/tests/cabal-sublibrary-dependency/Main.hs @@ -1,13 +1,10 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +-- | Stack can build a project package that depends on the public named library +-- (a sublibrary) of another project package. However, the latter package must +-- also have a main library (which may be a Stack bug). +-- +-- See: https://github.com/commercialhaskell/stack/issues/6896 --- This tests building two project packages, one of which depends on the other --- (subproject). The dependency has a library and a visible sub-library named --- sub, each of which exposes a module that exports a function. +import StackTest main :: IO () --- The '--install-ghc' flag is passed here, because IntegrationSpec.runApp sets --- up `config.yaml` with `system-ghc: true` and `install-ghc: false`. --- (See stack.yaml; using GHC 9.10.3.) -main = stack ["build", "--install-ghc"] +main = stack ["build", ":myExe"] diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/.gitignore b/tests/integration/tests/cabal-sublibrary-dependency/files/.gitignore new file mode 100644 index 0000000000..f9a6e152d2 --- /dev/null +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/.gitignore @@ -0,0 +1,2 @@ +myPackageA.cabal +myPackageB.cabal diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/Setup.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/files.cabal b/tests/integration/tests/cabal-sublibrary-dependency/files/files.cabal deleted file mode 100644 index 41071cf460..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/files.cabal +++ /dev/null @@ -1,11 +0,0 @@ -cabal-version: 3.8 -name: files -version: 0.1.0.0 -build-type: Simple - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5 - , subproject:{subproject, sub} - default-language: Haskell2010 diff --git a/tests/integration/tests/copy-bins-works/files/src/Main.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/app/Main.hs similarity index 60% rename from tests/integration/tests/copy-bins-works/files/src/Main.hs rename to tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/app/Main.hs index d582e1e36a..89ad4b3e08 100644 --- a/tests/integration/tests/copy-bins-works/files/src/Main.hs +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/app/Main.hs @@ -1,2 +1,4 @@ +module Main where + main :: IO () main = pure () diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/package.yaml b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/package.yaml new file mode 100644 index 0000000000..c7b310119d --- /dev/null +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageA/package.yaml @@ -0,0 +1,12 @@ +spec-version: 0.36.0 + +name: myPackageA + +dependencies: +- base +- myPackageB:myPackageB-sub + +executables: + myExe: + source-dirs: app + main: Main.hs diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/package.yaml b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/package.yaml new file mode 100644 index 0000000000..9591417520 --- /dev/null +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/package.yaml @@ -0,0 +1,13 @@ +spec-version: 0.36.0 + +name: myPackageB + +dependencies: +- base + +library: {} + +internal-libraries: + myPackageB-sub: + visibility: public + source-dirs: src diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/src/Lib.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/myPackageB/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/src/Lib.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/src/Lib.hs deleted file mode 100644 index 6b90650128..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/src/Lib.hs +++ /dev/null @@ -1,11 +0,0 @@ -module Lib - ( someFunc - ) where - -import Subproject.Lib ( libFunc ) -import Subproject.SubLib ( subLibFunc ) - -someFunc :: IO () -someFunc = do - libFunc - subLibFunc diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml b/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml index b2901db007..68891a8d7c 100644 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml +++ b/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml @@ -1,4 +1,5 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + packages: -- . -- subproject +- myPackageA +- myPackageB diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml.lock b/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml.lock deleted file mode 100644 index 8e0b3a647f..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/stack.yaml.lock +++ /dev/null @@ -1,12 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: [] -snapshots: -- completed: - sha256: c4233cb7ff3bc39c1eaad6153615331c9adc624559391142a8b812248a31300d - size: 598787 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/3/4.yaml - original: nightly-2023-03-04 diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/Lib.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/Lib.hs deleted file mode 100644 index 381ea5e740..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/Lib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Subproject.Lib - ( libFunc - ) where - -libFunc :: IO () -libFunc = putStrLn "libFunc" diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/SubLib.hs b/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/SubLib.hs deleted file mode 100644 index ccf81c7278..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Subproject/SubLib.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Subproject.SubLib - ( subLibFunc - ) where - -subLibFunc :: IO () -subLibFunc = putStrLn "subLibFunc" diff --git a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/subproject.cabal b/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/subproject.cabal deleted file mode 100644 index f8db548fb8..0000000000 --- a/tests/integration/tests/cabal-sublibrary-dependency/files/subproject/subproject.cabal +++ /dev/null @@ -1,17 +0,0 @@ -cabal-version: 3.8 -name: subproject -version: 0.1.0.0 -build-type: Simple - -library - hs-source-dirs: src - exposed-modules: Subproject.Lib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -library sub - visibility: public - hs-source-dirs: src - exposed-modules: Subproject.SubLib - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 diff --git a/tests/integration/tests/copy-bins-works/Main.hs b/tests/integration/tests/copy-bins-works/Main.hs index 038e3f1124..d22b31fe8e 100644 --- a/tests/integration/tests/copy-bins-works/Main.hs +++ b/tests/integration/tests/copy-bins-works/Main.hs @@ -1,14 +1,15 @@ +-- | Stack's build command supports the copy-bins flag. + import StackTest -import System.Directory -import Control.Monad (unless) +import System.Directory ( createDirectoryIfMissing ) main :: IO () main = do - let test args = do - removeDirIgnore "bin" - stackCleanFull - stack args - exists <- doesDirectoryExist "bin" - unless exists $ error $ "Failed with: " ++ show args - test ["install", "--local-bin-path", "bin"] - test ["build", "--copy-bins", "--local-bin-path", "bin"] + createDirectoryIfMissing True "bin1" + stack ["build", "--copy-bins", "--local-bin-path", "bin1"] + doesExist ("bin1/" <> myPackageExe) + createDirectoryIfMissing True "bin2" + stack ["--stack-yaml", "stack-copy-bins.yaml", "build", "--local-bin-path", "bin2"] + doesExist ("bin2/" <> myPackageExe) + where + myPackageExe = "myExe" <> exeExt diff --git a/tests/integration/tests/copy-bins-works/files/.gitignore b/tests/integration/tests/copy-bins-works/files/.gitignore index f1a8228e76..fc53374c2f 100644 --- a/tests/integration/tests/copy-bins-works/files/.gitignore +++ b/tests/integration/tests/copy-bins-works/files/.gitignore @@ -1,2 +1,3 @@ -*.cabal -/bin/ +myPackage.cabal +bin1/ +bin2/ diff --git a/tests/integration/tests/copy-bins-works/files/app/Main.hs b/tests/integration/tests/copy-bins-works/files/app/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/copy-bins-works/files/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/copy-bins-works/files/package.yaml b/tests/integration/tests/copy-bins-works/files/package.yaml index 34d45cd594..ee1f9f8afa 100644 --- a/tests/integration/tests/copy-bins-works/files/package.yaml +++ b/tests/integration/tests/copy-bins-works/files/package.yaml @@ -1,9 +1,11 @@ -name: foo -version: 0 +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base executables: - bar: - source-dirs: src + myExe: + source-dirs: app main: Main.hs - dependencies: - - base diff --git a/tests/integration/tests/copy-bins-works/files/stack-copy-bins.yaml b/tests/integration/tests/copy-bins-works/files/stack-copy-bins.yaml new file mode 100644 index 0000000000..4ca93380fd --- /dev/null +++ b/tests/integration/tests/copy-bins-works/files/stack-copy-bins.yaml @@ -0,0 +1,4 @@ +snapshot: ghc-9.10.3 + +build: + copy-bins: true diff --git a/tests/integration/tests/copy-bins-works/files/stack.yaml b/tests/integration/tests/copy-bins-works/files/stack.yaml index af66d8f381..abe6c1f573 100644 --- a/tests/integration/tests/copy-bins-works/files/stack.yaml +++ b/tests/integration/tests/copy-bins-works/files/stack.yaml @@ -1,2 +1,4 @@ snapshot: ghc-9.10.3 -copy-bins: true + +build: + copy-bins: false diff --git a/tests/integration/tests/drop-packages/Main.hs b/tests/integration/tests/drop-packages/Main.hs index b16d43227b..69700c9823 100644 --- a/tests/integration/tests/drop-packages/Main.hs +++ b/tests/integration/tests/drop-packages/Main.hs @@ -1,4 +1,6 @@ -import StackTest +-- | Stack can drop packages from a snapshot. + +import StackTest main :: IO () main = stackErr ["build"] diff --git a/tests/integration/tests/drop-packages/files/.gitignore b/tests/integration/tests/drop-packages/files/.gitignore index d43d807c0d..b0a5a052a1 100644 --- a/tests/integration/tests/drop-packages/files/.gitignore +++ b/tests/integration/tests/drop-packages/files/.gitignore @@ -1 +1 @@ -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/drop-packages/files/package.yaml b/tests/integration/tests/drop-packages/files/package.yaml index 1fe2825944..e4d2cd7656 100644 --- a/tests/integration/tests/drop-packages/files/package.yaml +++ b/tests/integration/tests/drop-packages/files/package.yaml @@ -1,6 +1,9 @@ -name: unimportant -version: 0 +spec-version: 0.36.0 + +name: myPackage + dependencies: - base - unliftio-core + library: {} diff --git a/tests/integration/tests/drop-packages/files/stack.yaml b/tests/integration/tests/drop-packages/files/stack.yaml index f9d03af4eb..86308b6f48 100644 --- a/tests/integration/tests/drop-packages/files/stack.yaml +++ b/tests/integration/tests/drop-packages/files/stack.yaml @@ -1,3 +1,4 @@ snapshot: lts-24.37 + drop-packages: - unliftio-core diff --git a/tests/integration/tests/duplicate-package-ids/Main.hs b/tests/integration/tests/duplicate-package-ids/Main.hs index 88fd081bc6..38ca390b7f 100644 --- a/tests/integration/tests/duplicate-package-ids/Main.hs +++ b/tests/integration/tests/duplicate-package-ids/Main.hs @@ -1,11 +1,10 @@ -import StackTest +-- | Stack distinguises between a package in the package index and a project +-- package, even if they have the same name and version. + +import StackTest main :: IO () main = do - readFile "stack1.yaml" >>= writeFile "stack.yaml" - stack ["setup"] - stack ["build", "auto-update"] - readFile "stack2.yaml" >>= writeFile "stack.yaml" - removeDirIgnore "auto-update-0.1.2.1" - stack ["unpack", "auto-update-0.1.2.1"] - stack ["build"] + stack ["--stack-yaml", "stack1.yaml", "build", "acme-missiles"] + stack ["unpack", "acme-missiles-0.3"] + stack ["--stack-yaml", "stack2.yaml", "build"] diff --git a/tests/integration/tests/duplicate-package-ids/files/.gitignore b/tests/integration/tests/duplicate-package-ids/files/.gitignore index f39970f250..2707bad1cb 100644 --- a/tests/integration/tests/duplicate-package-ids/files/.gitignore +++ b/tests/integration/tests/duplicate-package-ids/files/.gitignore @@ -1,2 +1 @@ -stack.yaml -auto-update-0.1.2.1 +acme-missiles-0.3/ diff --git a/tests/integration/tests/duplicate-package-ids/files/mySnapshot.yaml b/tests/integration/tests/duplicate-package-ids/files/mySnapshot.yaml new file mode 100644 index 0000000000..09bb7df5ab --- /dev/null +++ b/tests/integration/tests/duplicate-package-ids/files/mySnapshot.yaml @@ -0,0 +1,6 @@ +name: mySnapshot + +snapshot: ghc-9.10.3 + +packages: +- acme-missiles-0.3 diff --git a/tests/integration/tests/duplicate-package-ids/files/stack1.yaml b/tests/integration/tests/duplicate-package-ids/files/stack1.yaml index 97ad369c4f..1412b971c3 100644 --- a/tests/integration/tests/duplicate-package-ids/files/stack1.yaml +++ b/tests/integration/tests/duplicate-package-ids/files/stack1.yaml @@ -1,2 +1,3 @@ -snapshot: lts-24.37 +snapshot: mySnapshot.yaml + packages: [] diff --git a/tests/integration/tests/duplicate-package-ids/files/stack2.yaml b/tests/integration/tests/duplicate-package-ids/files/stack2.yaml index ee6bc144a2..1b7948f75a 100644 --- a/tests/integration/tests/duplicate-package-ids/files/stack2.yaml +++ b/tests/integration/tests/duplicate-package-ids/files/stack2.yaml @@ -1,3 +1,4 @@ -snapshot: lts-24.37 +snapshot: mySnapshot.yaml + packages: -- auto-update-0.1.2.1 +- acme-missiles-0.3 From 6330f89fca3fd1ca08b09b172def05d9d9e50af7 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 20:44:14 +0100 Subject: [PATCH 53/75] Review, document and conform further integration tests --- .../tests/ghc-install-hooks/Main.hs | 9 +++-- .../files/{foo.hs => Test.hs} | 0 .../tests/ghc-install-hooks/files/run.sh | 6 +-- .../integration/tests/git-submodules/Main.hs | 18 +++++---- .../integration/tests/haddock-options/Main.hs | 12 +++--- .../tests/haddock-options/files/.gitignore | 1 + .../files/haddock-options.cabal | 10 ----- .../tests/haddock-options/files/package.yaml | 9 +++++ .../tests/haddock-options/files/src/Lib.hs | 11 +++-- .../tests/haddock-options/files/stack.yaml | 4 +- tests/integration/tests/hpack-repo/Main.hs | 12 +++--- .../tests/hpack-repo/files/.gitignore | 1 + .../tests/hpack-repo/files/files.cabal | 10 ----- .../tests/hpack-repo/files/package.yaml | 10 +++++ .../tests/hpack-repo/files/src/Lib.hs | 7 +--- .../tests/hpack-repo/files/stack.yaml | 2 + .../tests/init-omit-packages/Main.hs | 10 +++-- .../tests/init-omit-packages/files/.gitignore | 2 + .../init-omit-packages/files/bad/bad.cabal | 9 ----- .../init-omit-packages/files/bad/package.yaml | 9 +++++ .../init-omit-packages/files/good/good.cabal | 9 ----- .../files/good/package.yaml | 8 ++++ .../tests/internal-libraries/Main.hs | 23 +++-------- .../tests/internal-libraries/files/.gitignore | 1 + .../tests/internal-libraries/files/Setup.hs | 2 - .../internal-libraries/files/app/Main.hs | 4 ++ .../internal-libraries/files/files.cabal | 31 -------------- .../internal-libraries/files/int/Internal.hs | 1 + .../internal-libraries/files/package.yaml | 40 +++++++++++++++++++ .../internal-libraries/files/src-bar/Main.hs | 11 ----- .../internal-libraries/files/src-baz/Baz.hs | 12 ------ .../internal-libraries/files/src-foo/Foo.hs | 7 ---- .../files/src-foreign/Foreign.hs | 1 + .../internal-libraries/files/src/Files.hs | 4 -- .../tests/internal-libraries/files/src/Lib.hs | 1 + 35 files changed, 141 insertions(+), 166 deletions(-) rename tests/integration/tests/ghc-install-hooks/files/{foo.hs => Test.hs} (100%) create mode 100644 tests/integration/tests/haddock-options/files/.gitignore delete mode 100644 tests/integration/tests/haddock-options/files/haddock-options.cabal create mode 100644 tests/integration/tests/haddock-options/files/package.yaml create mode 100644 tests/integration/tests/hpack-repo/files/.gitignore delete mode 100644 tests/integration/tests/hpack-repo/files/files.cabal create mode 100644 tests/integration/tests/hpack-repo/files/package.yaml delete mode 100644 tests/integration/tests/init-omit-packages/files/bad/bad.cabal create mode 100644 tests/integration/tests/init-omit-packages/files/bad/package.yaml delete mode 100644 tests/integration/tests/init-omit-packages/files/good/good.cabal create mode 100644 tests/integration/tests/init-omit-packages/files/good/package.yaml create mode 100644 tests/integration/tests/internal-libraries/files/.gitignore delete mode 100644 tests/integration/tests/internal-libraries/files/Setup.hs create mode 100644 tests/integration/tests/internal-libraries/files/app/Main.hs delete mode 100644 tests/integration/tests/internal-libraries/files/files.cabal create mode 100644 tests/integration/tests/internal-libraries/files/int/Internal.hs create mode 100644 tests/integration/tests/internal-libraries/files/package.yaml delete mode 100644 tests/integration/tests/internal-libraries/files/src-bar/Main.hs delete mode 100644 tests/integration/tests/internal-libraries/files/src-baz/Baz.hs delete mode 100644 tests/integration/tests/internal-libraries/files/src-foo/Foo.hs create mode 100644 tests/integration/tests/internal-libraries/files/src-foreign/Foreign.hs delete mode 100644 tests/integration/tests/internal-libraries/files/src/Files.hs create mode 100644 tests/integration/tests/internal-libraries/files/src/Lib.hs diff --git a/tests/integration/tests/ghc-install-hooks/Main.hs b/tests/integration/tests/ghc-install-hooks/Main.hs index 491eb11761..f4013f1eb3 100644 --- a/tests/integration/tests/ghc-install-hooks/Main.hs +++ b/tests/integration/tests/ghc-install-hooks/Main.hs @@ -1,7 +1,8 @@ -import System.Process (rawSystem) -import Control.Exception (throwIO) -import StackTest -import Control.Monad (unless) +-- | Stack supports GHC installation customisation shell scripts. + +import Control.Exception ( throwIO ) +import StackTest +import System.Process ( rawSystem ) main :: IO () main = rawSystem "sh" ["run.sh"] >>= throwIO diff --git a/tests/integration/tests/ghc-install-hooks/files/foo.hs b/tests/integration/tests/ghc-install-hooks/files/Test.hs similarity index 100% rename from tests/integration/tests/ghc-install-hooks/files/foo.hs rename to tests/integration/tests/ghc-install-hooks/files/Test.hs diff --git a/tests/integration/tests/ghc-install-hooks/files/run.sh b/tests/integration/tests/ghc-install-hooks/files/run.sh index 7fdbe39f94..beaf269b9e 100644 --- a/tests/integration/tests/ghc-install-hooks/files/run.sh +++ b/tests/integration/tests/ghc-install-hooks/files/run.sh @@ -2,7 +2,7 @@ set -exu -stack_bin=$("$STACK_EXE" path --resolver ghc-9.10.3 --compiler-bin) +stack_bin=$("$STACK_EXE" path --snapshot ghc-9.10.3 --compiler-bin) export STACK_ROOT=$(pwd)/fake-root @@ -11,5 +11,5 @@ mkdir -p "${STACK_ROOT}"/hooks echo "echo '${stack_bin}/ghc'" > "${STACK_ROOT}"/hooks/ghc-install.sh chmod +x "${STACK_ROOT}"/hooks/ghc-install.sh -"$STACK_EXE" --no-install-ghc --resolver ghc-9.10.3 ghc -- --info -"$STACK_EXE" --no-install-ghc --resolver ghc-9.10.3 runghc foo.hs +"$STACK_EXE" --no-install-ghc --snapshot ghc-9.10.3 ghc -- --info +"$STACK_EXE" --no-install-ghc --snapshot ghc-9.10.3 runghc Test.hs diff --git a/tests/integration/tests/git-submodules/Main.hs b/tests/integration/tests/git-submodules/Main.hs index 29e6cbf234..196abe7e72 100644 --- a/tests/integration/tests/git-submodules/Main.hs +++ b/tests/integration/tests/git-submodules/Main.hs @@ -1,11 +1,13 @@ -import StackTest -import System.Directory - ( createDirectoryIfMissing, withCurrentDirectory, getCurrentDirectory ) -import System.Exit ( exitFailure ) -import System.FilePath ( () ) -import Data.List ( filter ) -import System.IO ( hPutStrLn, withFile, IOMode (..) ) -import Control.Monad ( when ) +import Control.Monad ( when ) +import Data.List ( filter ) +import StackTest +import System.Directory + ( createDirectoryIfMissing, getCurrentDirectory + , withCurrentDirectory + ) +import System.Exit ( exitFailure ) +import System.FilePath ( () ) +import System.IO ( IOMode (..), hPutStrLn, withFile ) main :: IO () main = when isLinux $ do diff --git a/tests/integration/tests/haddock-options/Main.hs b/tests/integration/tests/haddock-options/Main.hs index 1c65576206..5cf2f7f412 100644 --- a/tests/integration/tests/haddock-options/Main.hs +++ b/tests/integration/tests/haddock-options/Main.hs @@ -4,12 +4,10 @@ import StackTest main :: IO () main = do - removeDirIgnore ".stack-work" - - -- BAR is defined here and FOO in stack.yaml file - stackCheckStderr ["haddock", "--haddock-arguments", "--optghc=-DBAR"] $ \s -> + -- VARIABLE_B is defined here and VARIABLE_A in stack.yaml file + stackCheckStderr ["haddock", "--haddock-arguments", "--optghc=-DVARIABLE_B"] $ \s -> unless (errorMsg `isInfixOf` s) $ - error "FOO and BAR not both defined" + error "VARIABLE_A and VARIABLE_B not both defined" stack ["clean"] -- Works just fine, test #3099 while at it. stack ["haddock", "--no-haddock-hyperlink-source"] @@ -20,5 +18,5 @@ main = do -- The error message differs by operating system errorMsg :: String errorMsg = if isLinux - then "error: #error FOO and BAR is defined" - else "error: FOO and BAR is defined" + then "error: #error VARIABLE_A and VARIABLE_B is defined" + else "error: VARIABLE_A and VARIABLE_B is defined" diff --git a/tests/integration/tests/haddock-options/files/.gitignore b/tests/integration/tests/haddock-options/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/haddock-options/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/haddock-options/files/haddock-options.cabal b/tests/integration/tests/haddock-options/files/haddock-options.cabal deleted file mode 100644 index f47b3df0b4..0000000000 --- a/tests/integration/tests/haddock-options/files/haddock-options.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: haddock-options -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/haddock-options/files/package.yaml b/tests/integration/tests/haddock-options/files/package.yaml new file mode 100644 index 0000000000..a7305a77cf --- /dev/null +++ b/tests/integration/tests/haddock-options/files/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src diff --git a/tests/integration/tests/haddock-options/files/src/Lib.hs b/tests/integration/tests/haddock-options/files/src/Lib.hs index 2ad999dff9..4683fbf37e 100644 --- a/tests/integration/tests/haddock-options/files/src/Lib.hs +++ b/tests/integration/tests/haddock-options/files/src/Lib.hs @@ -1,11 +1,14 @@ {-# LANGUAGE CPP #-} + module Lib - ( someFunc - ) where + ( someFunc + ) where someFunc :: IO () someFunc = putStrLn "someFunc" -#if defined(FOO) && defined(BAR) -#error FOO and BAR is defined +#if defined(VARIABLE_A) && defined(VARIABLE_B) + +#error VARIABLE_A and VARIABLE_B is defined + #endif diff --git a/tests/integration/tests/haddock-options/files/stack.yaml b/tests/integration/tests/haddock-options/files/stack.yaml index 9cec735579..69b8c2eeb2 100644 --- a/tests/integration/tests/haddock-options/files/stack.yaml +++ b/tests/integration/tests/haddock-options/files/stack.yaml @@ -1,6 +1,6 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 build: haddock-arguments: haddock-args: - - --optghc=-DFOO + - --optghc=-DVARIABLE_A diff --git a/tests/integration/tests/hpack-repo/Main.hs b/tests/integration/tests/hpack-repo/Main.hs index 9512c6cca4..58ef93df19 100644 --- a/tests/integration/tests/hpack-repo/Main.hs +++ b/tests/integration/tests/hpack-repo/Main.hs @@ -1,7 +1,9 @@ -import StackTest -import System.Directory +-- Stack supports immutable dependency packages that are described only by a +-- package.yaml file. However, this work flow is deprecated. +-- +-- See: https://github.com/commercialhaskell/stack/issues/5210 + +import StackTest main :: IO () -main = do - removeDirIgnore ".stack-work" - stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/hpack-repo/files/.gitignore b/tests/integration/tests/hpack-repo/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/hpack-repo/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/hpack-repo/files/files.cabal b/tests/integration/tests/hpack-repo/files/files.cabal deleted file mode 100644 index e167e1ff8c..0000000000 --- a/tests/integration/tests/hpack-repo/files/files.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, validity - default-language: Haskell2010 diff --git a/tests/integration/tests/hpack-repo/files/package.yaml b/tests/integration/tests/hpack-repo/files/package.yaml new file mode 100644 index 0000000000..498b32af5d --- /dev/null +++ b/tests/integration/tests/hpack-repo/files/package.yaml @@ -0,0 +1,10 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base +- validity + +library: + source-dirs: src diff --git a/tests/integration/tests/hpack-repo/files/src/Lib.hs b/tests/integration/tests/hpack-repo/files/src/Lib.hs index 65c2b1b231..0512f4633e 100644 --- a/tests/integration/tests/hpack-repo/files/src/Lib.hs +++ b/tests/integration/tests/hpack-repo/files/src/Lib.hs @@ -1,8 +1,3 @@ -module Lib - ( someFunc - ) where +module Lib where import Data.Validity - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/tests/integration/tests/hpack-repo/files/stack.yaml b/tests/integration/tests/hpack-repo/files/stack.yaml index 86ef409b6a..a3f1d38792 100644 --- a/tests/integration/tests/hpack-repo/files/stack.yaml +++ b/tests/integration/tests/hpack-repo/files/stack.yaml @@ -1,4 +1,6 @@ snapshot: lts-24.37 + +# At this commit, the validity package is described only by a package.yaml file extra-deps: - git: https://github.com/NorfairKing/validity.git commit: d128cc30bc886e31ea7f8161fb7708c08b162937 diff --git a/tests/integration/tests/init-omit-packages/Main.hs b/tests/integration/tests/init-omit-packages/Main.hs index b7005be29e..f43e79bb4c 100644 --- a/tests/integration/tests/init-omit-packages/Main.hs +++ b/tests/integration/tests/init-omit-packages/Main.hs @@ -1,10 +1,12 @@ -import Control.Monad (unless) -import StackTest -import System.IO (readFile) +-- | Stack's init command provides an --omit-packages flag to avoid the problem +-- of bad project packages. + +import Control.Monad ( unless ) +import StackTest +import System.IO ( readFile ) main :: IO () main = do - removeFileIgnore "stack.yaml" stackErr ["init", "--snapshot", "lts-24.37"] stack ["init", "--snapshot", "lts-24.37", "--omit-packages"] contents <- lines <$> readFile "stack.yaml" diff --git a/tests/integration/tests/init-omit-packages/files/.gitignore b/tests/integration/tests/init-omit-packages/files/.gitignore index 684dbffa96..74744b2dd6 100644 --- a/tests/integration/tests/init-omit-packages/files/.gitignore +++ b/tests/integration/tests/init-omit-packages/files/.gitignore @@ -1 +1,3 @@ stack.yaml +good.cabal +bad.cabal diff --git a/tests/integration/tests/init-omit-packages/files/bad/bad.cabal b/tests/integration/tests/init-omit-packages/files/bad/bad.cabal deleted file mode 100644 index 789ad7d101..0000000000 --- a/tests/integration/tests/init-omit-packages/files/bad/bad.cabal +++ /dev/null @@ -1,9 +0,0 @@ -name: bad -version: 1.0.0 -build-type: Simple -cabal-version: >= 1.8 - -library - exposed-modules: Bad - build-depends: base, not-existing-package == 666.0 - default-language: Haskell2010 \ No newline at end of file diff --git a/tests/integration/tests/init-omit-packages/files/bad/package.yaml b/tests/integration/tests/init-omit-packages/files/bad/package.yaml new file mode 100644 index 0000000000..0875dcdae1 --- /dev/null +++ b/tests/integration/tests/init-omit-packages/files/bad/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: bad + +dependencies: +- base +- non-existent-package == 666.0 + +library: {} diff --git a/tests/integration/tests/init-omit-packages/files/good/good.cabal b/tests/integration/tests/init-omit-packages/files/good/good.cabal deleted file mode 100644 index 944e5795cf..0000000000 --- a/tests/integration/tests/init-omit-packages/files/good/good.cabal +++ /dev/null @@ -1,9 +0,0 @@ -name: good -version: 1.0.0 -build-type: Simple -cabal-version: >= 1.8 - -library - exposed-modules: Good - build-depends: base - default-language: Haskell2010 \ No newline at end of file diff --git a/tests/integration/tests/init-omit-packages/files/good/package.yaml b/tests/integration/tests/init-omit-packages/files/good/package.yaml new file mode 100644 index 0000000000..9b93276a13 --- /dev/null +++ b/tests/integration/tests/init-omit-packages/files/good/package.yaml @@ -0,0 +1,8 @@ +spec-version: 0.36.0 + +name: good + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/internal-libraries/Main.hs b/tests/integration/tests/internal-libraries/Main.hs index 1f56f3ca84..c8b3b9c6be 100644 --- a/tests/integration/tests/internal-libraries/Main.hs +++ b/tests/integration/tests/internal-libraries/Main.hs @@ -1,20 +1,7 @@ -import StackTest -import Control.Monad ( unless ) +-- | Stack supports private named libraries (internal libraries) and foreign +-- libraries. + +import StackTest --- This does not work on Windows with snapshot: ghc-9.8.4 (Cabal-3.10.3.0). It --- fails witb: --- --- Preprocessing foreign library 'baz' for files-0.1.0.0.. --- Building foreign library 'baz' for files-0.1.0.0.. --- [1 of 1] Compiling Baz --- [1 of 2] Compiling Baz [Flags changed] --- [2 of 2] Linking .stack-work\dist\eebe39f7\build\baz\baz.dll --- lld: error: unknown argument: -rpath --- lld: error: unknown argument: -rpath --- clang: error: linker command failed with exit code 1 (use -v to see invocation) --- ghc-9.8.4.exe: `clang.exe' failed in phase `Linker'. (Exit code: 1) --- --- The above is a regression from snapshot: ghc-9.6.4 (Cabal-3.10.1.0). See --- https://github.com/haskell/cabal/issues/9982. main :: IO () -main = unless isWindows $ stack ["build"] +main = stack ["build"] diff --git a/tests/integration/tests/internal-libraries/files/.gitignore b/tests/integration/tests/internal-libraries/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/internal-libraries/files/Setup.hs b/tests/integration/tests/internal-libraries/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/internal-libraries/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/internal-libraries/files/app/Main.hs b/tests/integration/tests/internal-libraries/files/app/Main.hs new file mode 100644 index 0000000000..89ad4b3e08 --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/tests/integration/tests/internal-libraries/files/files.cabal b/tests/integration/tests/internal-libraries/files/files.cabal deleted file mode 100644 index 30b6c571ce..0000000000 --- a/tests/integration/tests/internal-libraries/files/files.cabal +++ /dev/null @@ -1,31 +0,0 @@ -name: files -version: 0.1.0.0 -build-type: Simple -cabal-version: 2.0 - -library - hs-source-dirs: src - exposed-modules: Files - build-depends: base - default-language: Haskell2010 - -library foo - hs-source-dirs: src-foo - exposed-modules: Foo - build-depends: base, files, stm - default-language: Haskell2010 - -executable bar - hs-source-dirs: src-bar - main-is: Main.hs - build-depends: base, files, foo - default-language: Haskell2010 - -foreign-library baz - type: native-shared - other-modules: Baz - build-depends: base, files, foo, mtl - hs-source-dirs: src-baz - default-language: Haskell2010 - if os(Windows) - options: standalone diff --git a/tests/integration/tests/internal-libraries/files/int/Internal.hs b/tests/integration/tests/internal-libraries/files/int/Internal.hs new file mode 100644 index 0000000000..d066bb085e --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/int/Internal.hs @@ -0,0 +1 @@ +module Internal where diff --git a/tests/integration/tests/internal-libraries/files/package.yaml b/tests/integration/tests/internal-libraries/files/package.yaml new file mode 100644 index 0000000000..f991171fd9 --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/package.yaml @@ -0,0 +1,40 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + +internal-libraries: + internal: + source-dirs: int + dependencies: + - myPackage + - stm + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - internal + - myPackage + +verbatim: | + foreign-library foreign + type: native-shared + other-modules: + Foreign + build-depends: + base + , myPackage + , internal + , mtl + hs-source-dirs: + src-foreign + default-language: Haskell2010 + if os(Windows) + options: standalone diff --git a/tests/integration/tests/internal-libraries/files/src-bar/Main.hs b/tests/integration/tests/internal-libraries/files/src-bar/Main.hs deleted file mode 100644 index cc7e42ba70..0000000000 --- a/tests/integration/tests/internal-libraries/files/src-bar/Main.hs +++ /dev/null @@ -1,11 +0,0 @@ -module Main where - -import Files -import Foo - -main :: IO () -main = do - putStrLn "files:" - print files - putStrLn "foo" - foo >>= print diff --git a/tests/integration/tests/internal-libraries/files/src-baz/Baz.hs b/tests/integration/tests/internal-libraries/files/src-baz/Baz.hs deleted file mode 100644 index 7e4e962ff3..0000000000 --- a/tests/integration/tests/internal-libraries/files/src-baz/Baz.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Baz where - -import Files -import Foo -import Control.Monad.Reader - -baz :: IO () -baz = flip runReaderT () $ lift $ do - putStrLn "files:" - print files - putStrLn "foo" - foo >>= print diff --git a/tests/integration/tests/internal-libraries/files/src-foo/Foo.hs b/tests/integration/tests/internal-libraries/files/src-foo/Foo.hs deleted file mode 100644 index fba29d124c..0000000000 --- a/tests/integration/tests/internal-libraries/files/src-foo/Foo.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Foo where - -import Control.Monad.STM -import Files - -foo :: IO String -foo = atomically $ pure $ "foo using " ++ files diff --git a/tests/integration/tests/internal-libraries/files/src-foreign/Foreign.hs b/tests/integration/tests/internal-libraries/files/src-foreign/Foreign.hs new file mode 100644 index 0000000000..8c00a37599 --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/src-foreign/Foreign.hs @@ -0,0 +1 @@ +module Foreign where diff --git a/tests/integration/tests/internal-libraries/files/src/Files.hs b/tests/integration/tests/internal-libraries/files/src/Files.hs deleted file mode 100644 index b9c9eeac03..0000000000 --- a/tests/integration/tests/internal-libraries/files/src/Files.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Files where - -files :: String -files = "files" diff --git a/tests/integration/tests/internal-libraries/files/src/Lib.hs b/tests/integration/tests/internal-libraries/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/internal-libraries/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where From 5255faae4539b27c6d8df0720e5f1889177a7e65 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 22:40:18 +0100 Subject: [PATCH 54/75] Review, document and conform further integration tests --- tests/integration/tests/lock-files/Main.hs | 27 ++++++++------- .../tests/lock-files/files/.gitignore | 1 + .../integration/tests/lock-files/files/Lib.hs | 2 -- .../tests/lock-files/files/package.yaml | 11 +++++-- .../tests/lock-files/files/src/Lib.hs | 1 + .../tests/lock-files/files/stack-1-extra | 3 -- .../tests/lock-files/files/stack-2-extras | 4 --- .../tests/lock-files/files/stack1.yaml | 5 +++ .../tests/lock-files/files/stack2.yaml | 4 +++ .../tests/module-added-multiple-times/Main.hs | 6 ++-- .../files/.gitignore | 1 + .../module-added-multiple-times/files/LICENSE | 30 ----------------- .../files/Setup.hs | 2 -- .../files/app/Main.hs | 6 ++++ .../files/exe/Main.hs | 6 ---- .../files/package.yaml | 16 +++++++++ .../files/project-a.cabal | 33 ------------------- .../files/src/Lib/A.hs | 4 --- .../files/src/Lib/Lib.hs | 6 ++++ .../files/stack.yaml | 2 +- 20 files changed, 66 insertions(+), 104 deletions(-) create mode 100644 tests/integration/tests/lock-files/files/.gitignore delete mode 100644 tests/integration/tests/lock-files/files/Lib.hs create mode 100644 tests/integration/tests/lock-files/files/src/Lib.hs delete mode 100644 tests/integration/tests/lock-files/files/stack-1-extra delete mode 100644 tests/integration/tests/lock-files/files/stack-2-extras create mode 100644 tests/integration/tests/lock-files/files/stack1.yaml create mode 100644 tests/integration/tests/lock-files/files/stack2.yaml create mode 100644 tests/integration/tests/module-added-multiple-times/files/.gitignore delete mode 100644 tests/integration/tests/module-added-multiple-times/files/LICENSE delete mode 100644 tests/integration/tests/module-added-multiple-times/files/Setup.hs create mode 100644 tests/integration/tests/module-added-multiple-times/files/app/Main.hs delete mode 100644 tests/integration/tests/module-added-multiple-times/files/exe/Main.hs create mode 100644 tests/integration/tests/module-added-multiple-times/files/package.yaml delete mode 100644 tests/integration/tests/module-added-multiple-times/files/project-a.cabal delete mode 100644 tests/integration/tests/module-added-multiple-times/files/src/Lib/A.hs create mode 100644 tests/integration/tests/module-added-multiple-times/files/src/Lib/Lib.hs diff --git a/tests/integration/tests/lock-files/Main.hs b/tests/integration/tests/lock-files/Main.hs index 8f7c89700f..84131e34f0 100644 --- a/tests/integration/tests/lock-files/Main.hs +++ b/tests/integration/tests/lock-files/Main.hs @@ -1,17 +1,16 @@ -import Control.Monad (unless, when) -import Data.List (isInfixOf) -import StackTest -import System.Directory +-- | Stack creates lock files. + +import Control.Monad ( unless, when ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - copyFile "stack-2-extras" "stack.yaml" - stack ["build"] - lock1 <- readFile "stack.yaml.lock" - unless ("acme-dont" `isInfixOf` lock1) $ - error "Package acme-dont wasn't found in Stack lock file" - copyFile "stack-1-extra" "stack.yaml" - stack ["build"] - lock2 <- readFile "stack.yaml.lock" - when ("acme-dont" `isInfixOf` lock2) $ - error "Package acme-dont shouldn't be in Stack lock file anymore" + stack ["--stack-yaml", "stack1.yaml", "build"] + lock1 <- readFile "stack1.yaml.lock" + unless ("acme-box" `isInfixOf` lock1) $ + error "Package acme-box wasn't found in Stack lock file" + stack ["--stack-yaml", "stack2.yaml", "build"] + lock2 <- readFile "stack2.yaml.lock" + when ("acme-box" `isInfixOf` lock2) $ + error "Package acme-box shouldn't be in Stack lock file anymore" diff --git a/tests/integration/tests/lock-files/files/.gitignore b/tests/integration/tests/lock-files/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/lock-files/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/lock-files/files/Lib.hs b/tests/integration/tests/lock-files/files/Lib.hs deleted file mode 100644 index a3b82e6e83..0000000000 --- a/tests/integration/tests/lock-files/files/Lib.hs +++ /dev/null @@ -1,2 +0,0 @@ -foo :: Int -foo = 42 diff --git a/tests/integration/tests/lock-files/files/package.yaml b/tests/integration/tests/lock-files/files/package.yaml index 36e02ec5e7..a7305a77cf 100644 --- a/tests/integration/tests/lock-files/files/package.yaml +++ b/tests/integration/tests/lock-files/files/package.yaml @@ -1,4 +1,9 @@ -name: example +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + library: - dependencies: - - base + source-dirs: src diff --git a/tests/integration/tests/lock-files/files/src/Lib.hs b/tests/integration/tests/lock-files/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/lock-files/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/lock-files/files/stack-1-extra b/tests/integration/tests/lock-files/files/stack-1-extra deleted file mode 100644 index ae06c97f29..0000000000 --- a/tests/integration/tests/lock-files/files/stack-1-extra +++ /dev/null @@ -1,3 +0,0 @@ -resolver: lts-24.37 -extra-deps: -- acme-cuteboy-0.1.0.0 diff --git a/tests/integration/tests/lock-files/files/stack-2-extras b/tests/integration/tests/lock-files/files/stack-2-extras deleted file mode 100644 index b397fcf570..0000000000 --- a/tests/integration/tests/lock-files/files/stack-2-extras +++ /dev/null @@ -1,4 +0,0 @@ -resolver: lts-24.37 -extra-deps: -- acme-cuteboy-0.1.0.0 -- acme-dont-1.1 diff --git a/tests/integration/tests/lock-files/files/stack1.yaml b/tests/integration/tests/lock-files/files/stack1.yaml new file mode 100644 index 0000000000..e317b1aefe --- /dev/null +++ b/tests/integration/tests/lock-files/files/stack1.yaml @@ -0,0 +1,5 @@ +snapshot: ghc-9.10.3 + +extra-deps: +- acme-missiles-0.3 +- acme-box-0.0.0.0 diff --git a/tests/integration/tests/lock-files/files/stack2.yaml b/tests/integration/tests/lock-files/files/stack2.yaml new file mode 100644 index 0000000000..37425098dd --- /dev/null +++ b/tests/integration/tests/lock-files/files/stack2.yaml @@ -0,0 +1,4 @@ +snapshot: ghc-9.10.3 + +extra-deps: +- acme-missiles-0.3 diff --git a/tests/integration/tests/module-added-multiple-times/Main.hs b/tests/integration/tests/module-added-multiple-times/Main.hs index 73cfee36f5..1cb5324fff 100644 --- a/tests/integration/tests/module-added-multiple-times/Main.hs +++ b/tests/integration/tests/module-added-multiple-times/Main.hs @@ -1,4 +1,6 @@ -import Control.Monad +-- | Stack can load a package into GHC's repl. + +import Control.Monad ( when ) import StackTest.Repl main :: IO () @@ -6,7 +8,7 @@ main = stackRepl [] $ do nextPrompt replCommand ":main" line <- replGetLine - let expected = "Hello World!" + let expected = "OK" when (line /= expected) $ error $ "Main module didn't load correctly.\n" diff --git a/tests/integration/tests/module-added-multiple-times/files/.gitignore b/tests/integration/tests/module-added-multiple-times/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/module-added-multiple-times/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/module-added-multiple-times/files/LICENSE b/tests/integration/tests/module-added-multiple-times/files/LICENSE deleted file mode 100644 index d05408d876..0000000000 --- a/tests/integration/tests/module-added-multiple-times/files/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2000 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Your name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/integration/tests/module-added-multiple-times/files/Setup.hs b/tests/integration/tests/module-added-multiple-times/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/module-added-multiple-times/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/module-added-multiple-times/files/app/Main.hs b/tests/integration/tests/module-added-multiple-times/files/app/Main.hs new file mode 100644 index 0000000000..d09b7c23cd --- /dev/null +++ b/tests/integration/tests/module-added-multiple-times/files/app/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import Lib.Lib ( func ) + +main :: IO () +main = putStrLn func diff --git a/tests/integration/tests/module-added-multiple-times/files/exe/Main.hs b/tests/integration/tests/module-added-multiple-times/files/exe/Main.hs deleted file mode 100644 index 504eb17dda..0000000000 --- a/tests/integration/tests/module-added-multiple-times/files/exe/Main.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Main where - -import Lib.A - -main :: IO () -main = putStrLn messageA diff --git a/tests/integration/tests/module-added-multiple-times/files/package.yaml b/tests/integration/tests/module-added-multiple-times/files/package.yaml new file mode 100644 index 0000000000..bea19d444e --- /dev/null +++ b/tests/integration/tests/module-added-multiple-times/files/package.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/module-added-multiple-times/files/project-a.cabal b/tests/integration/tests/module-added-multiple-times/files/project-a.cabal deleted file mode 100644 index 4e230ef90b..0000000000 --- a/tests/integration/tests/module-added-multiple-times/files/project-a.cabal +++ /dev/null @@ -1,33 +0,0 @@ -name: project-a -version: 0.1.0.0 -synopsis: Simple project template from stack -description: Please see README.md -homepage: http://github.com/githubuser/project-a#readme -license: MIT -license-file: LICENSE -author: Author name here -maintainer: example@example.com -copyright: 2010 Author Here -category: Web -build-type: Simple -cabal-version: >=1.10 - -library - hs-source-dirs: src - default-language: Haskell2010 - - exposed-modules: Lib.A - - build-depends: base - - -executable project-a-exe - main-is: Main.hs - hs-source-dirs: exe - default-language: Haskell2010 - - ghc-options: -rtsopts - - build-depends: base - - , project-a \ No newline at end of file diff --git a/tests/integration/tests/module-added-multiple-times/files/src/Lib/A.hs b/tests/integration/tests/module-added-multiple-times/files/src/Lib/A.hs deleted file mode 100644 index 788d4e22d5..0000000000 --- a/tests/integration/tests/module-added-multiple-times/files/src/Lib/A.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Lib.A where - -messageA :: String -messageA = "Hello World!" diff --git a/tests/integration/tests/module-added-multiple-times/files/src/Lib/Lib.hs b/tests/integration/tests/module-added-multiple-times/files/src/Lib/Lib.hs new file mode 100644 index 0000000000..3c09853b27 --- /dev/null +++ b/tests/integration/tests/module-added-multiple-times/files/src/Lib/Lib.hs @@ -0,0 +1,6 @@ +module Lib.Lib + ( func + ) where + +func :: String +func = "OK" diff --git a/tests/integration/tests/module-added-multiple-times/files/stack.yaml b/tests/integration/tests/module-added-multiple-times/files/stack.yaml index c292f63385..e674eab75a 100644 --- a/tests/integration/tests/module-added-multiple-times/files/stack.yaml +++ b/tests/integration/tests/module-added-multiple-times/files/stack.yaml @@ -1 +1 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 From e176d96ef374f8f69d330c035fae239f4d1b051e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 23:14:33 +0100 Subject: [PATCH 55/75] multi-test: Delete verbage --- .../tests/multi-test/files/LICENSE | 30 ------------------- .../tests/multi-test/files/Setup.hs | 2 -- .../tests/multi-test/files/cyclic/LICENSE | 30 ------------------- .../tests/multi-test/files/cyclic/Setup.hs | 2 -- .../multi-test/files/cyclic/cyclic.cabal | 16 ---------- .../multi-test/files/multi-test-suite.cabal | 14 --------- .../files/sub-package/sub-package.cabal | 10 ------- 7 files changed, 104 deletions(-) delete mode 100644 tests/integration/tests/multi-test/files/LICENSE delete mode 100644 tests/integration/tests/multi-test/files/Setup.hs delete mode 100644 tests/integration/tests/multi-test/files/cyclic/LICENSE delete mode 100644 tests/integration/tests/multi-test/files/cyclic/Setup.hs diff --git a/tests/integration/tests/multi-test/files/LICENSE b/tests/integration/tests/multi-test/files/LICENSE deleted file mode 100644 index d05408d876..0000000000 --- a/tests/integration/tests/multi-test/files/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2000 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Your name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/integration/tests/multi-test/files/Setup.hs b/tests/integration/tests/multi-test/files/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/multi-test/files/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/multi-test/files/cyclic/LICENSE b/tests/integration/tests/multi-test/files/cyclic/LICENSE deleted file mode 100644 index d05408d876..0000000000 --- a/tests/integration/tests/multi-test/files/cyclic/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2000 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Your name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/integration/tests/multi-test/files/cyclic/Setup.hs b/tests/integration/tests/multi-test/files/cyclic/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/tests/integration/tests/multi-test/files/cyclic/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal b/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal index 4faef11041..e404ec8d84 100644 --- a/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal +++ b/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal @@ -1,33 +1,17 @@ --- Initial cyclic.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/ - name: cyclic version: 0.1.0.0 --- synopsis: --- description: --- license: -license-file: LICENSE -author: Michael Sloan -maintainer: mgsloan@gmail.com --- copyright: --- category: build-type: Simple --- extra-source-files: cabal-version: >=1.10 library exposed-modules: Cyclic - -- other-modules: - -- other-extensions: build-depends: base >=4.8 && <5.0 - -- hs-source-dirs: default-language: Haskell2010 test-suite cyclic-test-suite type: exitcode-stdio-1.0 main-is: Spec.hs build-depends: base - -- This is cyclic because multi-test-suite depends on this package. , multi-test-suite ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/multi-test-suite.cabal b/tests/integration/tests/multi-test/files/multi-test-suite.cabal index deb33d3572..64dc05d966 100644 --- a/tests/integration/tests/multi-test/files/multi-test-suite.cabal +++ b/tests/integration/tests/multi-test/files/multi-test-suite.cabal @@ -1,16 +1,6 @@ name: multi-test-suite version: 0.1.0.0 -synopsis: Initial project template from stack -description: Please see README.md -homepage: http://github.com/commercialhaskell/multi-test-suite#readme -license: BSD3 -license-file: LICENSE -author: Your name here -maintainer: your.address@example.com --- copyright: -category: Web build-type: Simple --- extra-source-files: cabal-version: >=1.10 library @@ -52,7 +42,3 @@ test-suite multi-test-suite-test-3 build-depends: base ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 - -source-repository head - type: git - location: https://github.com/commercialhaskell/multi-test-suite diff --git a/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal b/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal index 0e94272961..6c6ea63394 100644 --- a/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal +++ b/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal @@ -1,16 +1,6 @@ name: sub-package version: 0.1.0.0 -synopsis: Initial project template from stack -description: Please see README.md -homepage: http://github.com/commercialhaskell/multi-test-suite#readme -license: BSD3 -license-file: ../LICENSE -author: Your name here -maintainer: your.address@example.com --- copyright: -category: Web build-type: Simple --- extra-source-files: cabal-version: >=1.10 executable sub-package-exe From b7f01e36fd2deb904d8aefe599aaef66d114221b Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 23:17:18 +0100 Subject: [PATCH 56/75] multi-test: Rename sub-package to myPackageC --- .../sub-package.cabal => myPackageC/myPackageC.cabal} | 2 +- .../multi-test/files/{sub-package => myPackageC}/src/Lib2.hs | 0 .../multi-test/files/{sub-package => myPackageC}/src/main.hs | 0 .../multi-test/files/{sub-package => myPackageC}/test/Spec.hs | 0 tests/integration/tests/multi-test/files/stack.yaml | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename tests/integration/tests/multi-test/files/{sub-package/sub-package.cabal => myPackageC/myPackageC.cabal} (94%) rename tests/integration/tests/multi-test/files/{sub-package => myPackageC}/src/Lib2.hs (100%) rename tests/integration/tests/multi-test/files/{sub-package => myPackageC}/src/main.hs (100%) rename tests/integration/tests/multi-test/files/{sub-package => myPackageC}/test/Spec.hs (100%) diff --git a/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal b/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal similarity index 94% rename from tests/integration/tests/multi-test/files/sub-package/sub-package.cabal rename to tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal index 6c6ea63394..d25a6f797c 100644 --- a/tests/integration/tests/multi-test/files/sub-package/sub-package.cabal +++ b/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal @@ -1,4 +1,4 @@ -name: sub-package +name: myPackageC version: 0.1.0.0 build-type: Simple cabal-version: >=1.10 diff --git a/tests/integration/tests/multi-test/files/sub-package/src/Lib2.hs b/tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs similarity index 100% rename from tests/integration/tests/multi-test/files/sub-package/src/Lib2.hs rename to tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs diff --git a/tests/integration/tests/multi-test/files/sub-package/src/main.hs b/tests/integration/tests/multi-test/files/myPackageC/src/main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/sub-package/src/main.hs rename to tests/integration/tests/multi-test/files/myPackageC/src/main.hs diff --git a/tests/integration/tests/multi-test/files/sub-package/test/Spec.hs b/tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs similarity index 100% rename from tests/integration/tests/multi-test/files/sub-package/test/Spec.hs rename to tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs diff --git a/tests/integration/tests/multi-test/files/stack.yaml b/tests/integration/tests/multi-test/files/stack.yaml index 002c22aefd..71edf0095b 100644 --- a/tests/integration/tests/multi-test/files/stack.yaml +++ b/tests/integration/tests/multi-test/files/stack.yaml @@ -1,5 +1,5 @@ snapshot: lts-24.37 packages: - . -- sub-package +- myPackageC - cyclic From 741e92a94db09f5fda6154408872395300624797 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 23:29:39 +0100 Subject: [PATCH 57/75] multi-test: Rename multi-test-suite as myPackageA --- tests/integration/tests/multi-test/Main.hs | 2 +- .../tests/multi-test/files/cyclic/cyclic.cabal | 2 +- .../files/{multi-test-suite.cabal => myPackageA.cabal} | 8 ++++---- .../tests/multi-test/files/myPackageC/myPackageC.cabal | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename tests/integration/tests/multi-test/files/{multi-test-suite.cabal => myPackageA.cabal} (88%) diff --git a/tests/integration/tests/multi-test/Main.hs b/tests/integration/tests/multi-test/Main.hs index 56f21042ea..5b3efb59d5 100644 --- a/tests/integration/tests/multi-test/Main.hs +++ b/tests/integration/tests/multi-test/Main.hs @@ -7,7 +7,7 @@ main = do -- FIXME: Make 'clean' unnecessary (see #1411) stack ["clean"] stackCheckStderr ["test", "--coverage"] $ \out -> do - unless ("The coverage report for multi-test-suite's test-suite multi-test-suite-test is available at" `isInfixOf` out) $ + unless ("The coverage report for myPackageA's test-suite multi-test-suite-test is available at" `isInfixOf` out) $ fail "Didn't get expected report for multi-test-suite-test" unless ("[S-6829]" `isInfixOf` out) $ fail "Didn't get expected empty report for multi-test-suite-test-2" diff --git a/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal b/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal index e404ec8d84..fc8514bc4b 100644 --- a/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal +++ b/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal @@ -12,6 +12,6 @@ test-suite cyclic-test-suite type: exitcode-stdio-1.0 main-is: Spec.hs build-depends: base - , multi-test-suite + , myPackageA ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/multi-test-suite.cabal b/tests/integration/tests/multi-test/files/myPackageA.cabal similarity index 88% rename from tests/integration/tests/multi-test/files/multi-test-suite.cabal rename to tests/integration/tests/multi-test/files/myPackageA.cabal index 64dc05d966..6674aa8551 100644 --- a/tests/integration/tests/multi-test/files/multi-test-suite.cabal +++ b/tests/integration/tests/multi-test/files/myPackageA.cabal @@ -1,4 +1,4 @@ -name: multi-test-suite +name: myPackageA version: 0.1.0.0 build-type: Simple cabal-version: >=1.10 @@ -14,7 +14,7 @@ executable multi-test-suite-exe main-is: Main.hs ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base - , multi-test-suite + , myPackageA default-language: Haskell2010 test-suite multi-test-suite-test @@ -22,7 +22,7 @@ test-suite multi-test-suite-test hs-source-dirs: test main-is: Spec.hs build-depends: base - , multi-test-suite + , myPackageA ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 @@ -31,7 +31,7 @@ test-suite multi-test-suite-test-2 hs-source-dirs: test-2 main-is: Spec.hs build-depends: base - , multi-test-suite + , myPackageA ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal b/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal index d25a6f797c..e939d179eb 100644 --- a/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal +++ b/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal @@ -17,5 +17,5 @@ test-suite sub-package-test other-modules: Lib2 ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base - , multi-test-suite + , myPackageA default-language: Haskell2010 From d27779ed07db00116831432b130c59b33b8a9036 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 23:40:57 +0100 Subject: [PATCH 58/75] multi-test: Use package.yaml for myPackageA --- .../tests/multi-test/files/.gitignore | 1 + .../tests/multi-test/files/myPackageA.cabal | 85 +++++++++++-------- .../tests/multi-test/files/package.yaml | 50 +++++++++++ 3 files changed, 102 insertions(+), 34 deletions(-) create mode 100644 tests/integration/tests/multi-test/files/.gitignore create mode 100644 tests/integration/tests/multi-test/files/package.yaml diff --git a/tests/integration/tests/multi-test/files/.gitignore b/tests/integration/tests/multi-test/files/.gitignore new file mode 100644 index 0000000000..6c121d3c41 --- /dev/null +++ b/tests/integration/tests/multi-test/files/.gitignore @@ -0,0 +1 @@ +myPackageA.cabal diff --git a/tests/integration/tests/multi-test/files/myPackageA.cabal b/tests/integration/tests/multi-test/files/myPackageA.cabal index 6674aa8551..b8b8ba3bae 100644 --- a/tests/integration/tests/multi-test/files/myPackageA.cabal +++ b/tests/integration/tests/multi-test/files/myPackageA.cabal @@ -1,44 +1,61 @@ -name: myPackageA -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.39.1. +-- +-- see: https://github.com/sol/hpack + +name: myPackageA +version: 0.0.0 +build-type: Simple library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base >= 4.7 && < 5, cyclic - default-language: Haskell2010 + exposed-modules: + Lib + hs-source-dirs: + src + build-depends: + base + , cyclic + default-language: Haskell2010 executable multi-test-suite-exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - , myPackageA - default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: + app + ghc-options: -threaded -rtsopts -with-rtsopts=-N + build-depends: + base + , myPackageA + default-language: Haskell2010 test-suite multi-test-suite-test - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs - build-depends: base - , myPackageA - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: Spec.hs + hs-source-dirs: + test + ghc-options: -threaded -rtsopts -with-rtsopts=-N + build-depends: + base + , myPackageA + default-language: Haskell2010 test-suite multi-test-suite-test-2 - type: exitcode-stdio-1.0 - hs-source-dirs: test-2 - main-is: Spec.hs - build-depends: base - , myPackageA - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: Spec.hs + hs-source-dirs: + test-2 + ghc-options: -threaded -rtsopts -with-rtsopts=-N + build-depends: + base + , myPackageA + default-language: Haskell2010 test-suite multi-test-suite-test-3 - type: exitcode-stdio-1.0 - hs-source-dirs: test-3 - main-is: Spec.hs - build-depends: base - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: Spec.hs + hs-source-dirs: + test-3 + ghc-options: -threaded -rtsopts -with-rtsopts=-N + build-depends: + base + default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/package.yaml b/tests/integration/tests/multi-test/files/package.yaml new file mode 100644 index 0000000000..947bdf52f1 --- /dev/null +++ b/tests/integration/tests/multi-test/files/package.yaml @@ -0,0 +1,50 @@ +spec-version: 0.36.0 + +name: myPackageA + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - cyclic + +executables: + multi-test-suite-exe: + source-dirs: app + main: Main.hs + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - myPackageA + +tests: + multi-test-suite-test: + source-dirs: test + main: Spec.hs + other-modules: [] + dependencies: + - myPackageA + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + multi-test-suite-test-2: + source-dirs: test-2 + main: Spec.hs + dependencies: + - myPackageA + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + multi-test-suite-test-3: + source-dirs: test-3 + main: Spec.hs + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N From fc6320735ac83304e3a77ff4d3df4e1be87d455e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 3 May 2026 23:46:45 +0100 Subject: [PATCH 59/75] multi-test: Use package.yaml to describe myPackageC --- .../tests/multi-test/files/.gitignore | 1 + .../files/myPackageC/myPackageC.cabal | 21 ---------------- .../multi-test/files/myPackageC/package.yaml | 24 +++++++++++++++++++ 3 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal create mode 100644 tests/integration/tests/multi-test/files/myPackageC/package.yaml diff --git a/tests/integration/tests/multi-test/files/.gitignore b/tests/integration/tests/multi-test/files/.gitignore index 6c121d3c41..8f20fe37c5 100644 --- a/tests/integration/tests/multi-test/files/.gitignore +++ b/tests/integration/tests/multi-test/files/.gitignore @@ -1 +1,2 @@ myPackageA.cabal +myPackageC.cabal diff --git a/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal b/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal deleted file mode 100644 index e939d179eb..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageC/myPackageC.cabal +++ /dev/null @@ -1,21 +0,0 @@ -name: myPackageC -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -executable sub-package-exe - hs-source-dirs: src - main-is: main.hs - other-modules: Lib2 - build-depends: base >= 4.7 && < 5 - default-language: Haskell2010 - -test-suite sub-package-test - type: exitcode-stdio-1.0 - hs-source-dirs: src, test - main-is: Spec.hs - other-modules: Lib2 - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: base - , myPackageA - default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/myPackageC/package.yaml b/tests/integration/tests/multi-test/files/myPackageC/package.yaml new file mode 100644 index 0000000000..c86af8d87a --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageC/package.yaml @@ -0,0 +1,24 @@ +spec-version: 0.36.0 + +name: myPackageC + +dependencies: +- base + +executables: + sub-package-exe: + source-dirs: src + main: main.hs + +tests: + sub-package-test: + source-dirs: + - src + - test + main: Spec.hs + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - myPackageA From 51c77b2174de9d4a2ca6db3b6887ef0c73ed9936 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 00:06:05 +0100 Subject: [PATCH 60/75] multi-test: Rename cyclic directory myPackageB --- .../tests/multi-test/files/{cyclic => myPackageB}/Cyclic.hs | 0 .../tests/multi-test/files/{cyclic => myPackageB}/Spec.hs | 0 .../tests/multi-test/files/{cyclic => myPackageB}/cyclic.cabal | 0 tests/integration/tests/multi-test/files/stack.yaml | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename tests/integration/tests/multi-test/files/{cyclic => myPackageB}/Cyclic.hs (100%) rename tests/integration/tests/multi-test/files/{cyclic => myPackageB}/Spec.hs (100%) rename tests/integration/tests/multi-test/files/{cyclic => myPackageB}/cyclic.cabal (100%) diff --git a/tests/integration/tests/multi-test/files/cyclic/Cyclic.hs b/tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs similarity index 100% rename from tests/integration/tests/multi-test/files/cyclic/Cyclic.hs rename to tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs diff --git a/tests/integration/tests/multi-test/files/cyclic/Spec.hs b/tests/integration/tests/multi-test/files/myPackageB/Spec.hs similarity index 100% rename from tests/integration/tests/multi-test/files/cyclic/Spec.hs rename to tests/integration/tests/multi-test/files/myPackageB/Spec.hs diff --git a/tests/integration/tests/multi-test/files/cyclic/cyclic.cabal b/tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal similarity index 100% rename from tests/integration/tests/multi-test/files/cyclic/cyclic.cabal rename to tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal diff --git a/tests/integration/tests/multi-test/files/stack.yaml b/tests/integration/tests/multi-test/files/stack.yaml index 71edf0095b..5ce27196df 100644 --- a/tests/integration/tests/multi-test/files/stack.yaml +++ b/tests/integration/tests/multi-test/files/stack.yaml @@ -2,4 +2,4 @@ snapshot: lts-24.37 packages: - . - myPackageC -- cyclic +- myPackageB From 5c29d008cf221e86119253645b06663f341a97f3 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 00:13:42 +0100 Subject: [PATCH 61/75] multi-test: Use package.yaml for cyclic --- .../tests/multi-test/files/.gitignore | 1 + .../multi-test/files/myPackageB/cyclic.cabal | 17 ---------------- .../multi-test/files/myPackageB/package.yaml | 20 +++++++++++++++++++ 3 files changed, 21 insertions(+), 17 deletions(-) delete mode 100644 tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal create mode 100644 tests/integration/tests/multi-test/files/myPackageB/package.yaml diff --git a/tests/integration/tests/multi-test/files/.gitignore b/tests/integration/tests/multi-test/files/.gitignore index 8f20fe37c5..ea0553ea59 100644 --- a/tests/integration/tests/multi-test/files/.gitignore +++ b/tests/integration/tests/multi-test/files/.gitignore @@ -1,2 +1,3 @@ myPackageA.cabal myPackageC.cabal +cyclic.cabal diff --git a/tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal b/tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal deleted file mode 100644 index fc8514bc4b..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageB/cyclic.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: cyclic -version: 0.1.0.0 -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Cyclic - build-depends: base >=4.8 && <5.0 - default-language: Haskell2010 - -test-suite cyclic-test-suite - type: exitcode-stdio-1.0 - main-is: Spec.hs - build-depends: base - , myPackageA - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/myPackageB/package.yaml b/tests/integration/tests/multi-test/files/myPackageB/package.yaml new file mode 100644 index 0000000000..0dd6c6ab85 --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageB/package.yaml @@ -0,0 +1,20 @@ +spec-version: 0.36.0 + +name: cyclic + +dependencies: +- base + +library: + exposed-modules: + - Cyclic + +tests: + cyclic-test-suite: + main: Spec.hs + dependencies: + - myPackageA + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N From 781abe3012276ce8aee345498196664583d7174f Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 00:34:13 +0100 Subject: [PATCH 62/75] multi-test: Rename cyclic 0myPackageB --- .../tests/multi-test/files/myPackageA.cabal | 61 ------------------- .../multi-test/files/myPackageB/package.yaml | 3 +- .../tests/multi-test/files/package.yaml | 3 +- 3 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 tests/integration/tests/multi-test/files/myPackageA.cabal diff --git a/tests/integration/tests/multi-test/files/myPackageA.cabal b/tests/integration/tests/multi-test/files/myPackageA.cabal deleted file mode 100644 index b8b8ba3bae..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageA.cabal +++ /dev/null @@ -1,61 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.39.1. --- --- see: https://github.com/sol/hpack - -name: myPackageA -version: 0.0.0 -build-type: Simple - -library - exposed-modules: - Lib - hs-source-dirs: - src - build-depends: - base - , cyclic - default-language: Haskell2010 - -executable multi-test-suite-exe - main-is: Main.hs - hs-source-dirs: - app - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: - base - , myPackageA - default-language: Haskell2010 - -test-suite multi-test-suite-test - type: exitcode-stdio-1.0 - main-is: Spec.hs - hs-source-dirs: - test - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: - base - , myPackageA - default-language: Haskell2010 - -test-suite multi-test-suite-test-2 - type: exitcode-stdio-1.0 - main-is: Spec.hs - hs-source-dirs: - test-2 - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: - base - , myPackageA - default-language: Haskell2010 - -test-suite multi-test-suite-test-3 - type: exitcode-stdio-1.0 - main-is: Spec.hs - hs-source-dirs: - test-3 - ghc-options: -threaded -rtsopts -with-rtsopts=-N - build-depends: - base - default-language: Haskell2010 diff --git a/tests/integration/tests/multi-test/files/myPackageB/package.yaml b/tests/integration/tests/multi-test/files/myPackageB/package.yaml index 0dd6c6ab85..0be458e3f4 100644 --- a/tests/integration/tests/multi-test/files/myPackageB/package.yaml +++ b/tests/integration/tests/multi-test/files/myPackageB/package.yaml @@ -1,6 +1,7 @@ spec-version: 0.36.0 -name: cyclic +# Only builds if this package name comes before myPackageA, alphabetically! +name: 0myPackageB dependencies: - base diff --git a/tests/integration/tests/multi-test/files/package.yaml b/tests/integration/tests/multi-test/files/package.yaml index 947bdf52f1..d217a67c9a 100644 --- a/tests/integration/tests/multi-test/files/package.yaml +++ b/tests/integration/tests/multi-test/files/package.yaml @@ -8,7 +8,8 @@ dependencies: library: source-dirs: src dependencies: - - cyclic + # Only builds if this package name comes before myPackageA, alphabetically! + - 0myPackageB executables: multi-test-suite-exe: From b4ef192115a7ffa6105a08b98ae2d0750aebbc00 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 01:03:32 +0100 Subject: [PATCH 63/75] multi-test: Rename components --- tests/integration/tests/multi-test/Main.hs | 28 +++++++------- .../tests/multi-test/files/.gitignore | 2 +- .../tests/multi-test/files/app/Main.hs | 4 +- .../multi-test/files/myPackageB/Cyclic.hs | 4 -- .../tests/multi-test/files/myPackageB/Spec.hs | 4 -- .../multi-test/files/myPackageB/package.yaml | 12 ++---- .../multi-test/files/myPackageB/src/LibB.hs | 6 +++ .../multi-test/files/myPackageB/test/Main.hs | 4 ++ .../multi-test/files/myPackageC/app/Main.hs | 4 ++ .../multi-test/files/myPackageC/package.yaml | 16 ++++---- .../multi-test/files/myPackageC/src/Lib2.hs | 4 -- .../multi-test/files/myPackageC/src/LibC.hs | 6 +++ .../multi-test/files/myPackageC/src/main.hs | 3 -- .../multi-test/files/myPackageC/test/Main.hs | 7 ++++ .../multi-test/files/myPackageC/test/Spec.hs | 7 ---- .../tests/multi-test/files/package.yaml | 37 +++++-------------- .../tests/multi-test/files/src/Lib.hs | 16 -------- .../tests/multi-test/files/src/LibA.hs | 9 +++++ .../multi-test/files/test/OtherModule.hs | 0 .../tests/multi-test/files/test/Spec.hs | 4 -- .../tests/multi-test/files/test1/Main.hs | 4 ++ .../files/{test-2/Spec.hs => test2/Main.hs} | 2 +- .../files/{test-3/Spec.hs => test3/Main.hs} | 0 23 files changed, 79 insertions(+), 104 deletions(-) delete mode 100644 tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs delete mode 100644 tests/integration/tests/multi-test/files/myPackageB/Spec.hs create mode 100644 tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs create mode 100644 tests/integration/tests/multi-test/files/myPackageB/test/Main.hs create mode 100644 tests/integration/tests/multi-test/files/myPackageC/app/Main.hs delete mode 100644 tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs create mode 100644 tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs delete mode 100644 tests/integration/tests/multi-test/files/myPackageC/src/main.hs create mode 100644 tests/integration/tests/multi-test/files/myPackageC/test/Main.hs delete mode 100644 tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs delete mode 100644 tests/integration/tests/multi-test/files/src/Lib.hs create mode 100644 tests/integration/tests/multi-test/files/src/LibA.hs delete mode 100644 tests/integration/tests/multi-test/files/test/OtherModule.hs delete mode 100644 tests/integration/tests/multi-test/files/test/Spec.hs create mode 100644 tests/integration/tests/multi-test/files/test1/Main.hs rename tests/integration/tests/multi-test/files/{test-2/Spec.hs => test2/Main.hs} (71%) rename tests/integration/tests/multi-test/files/{test-3/Spec.hs => test3/Main.hs} (100%) diff --git a/tests/integration/tests/multi-test/Main.hs b/tests/integration/tests/multi-test/Main.hs index 5b3efb59d5..6a1afea640 100644 --- a/tests/integration/tests/multi-test/Main.hs +++ b/tests/integration/tests/multi-test/Main.hs @@ -1,17 +1,17 @@ -import Control.Monad (unless) -import Data.List (isInfixOf) -import StackTest +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - -- FIXME: Make 'clean' unnecessary (see #1411) - stack ["clean"] - stackCheckStderr ["test", "--coverage"] $ \out -> do - unless ("The coverage report for myPackageA's test-suite multi-test-suite-test is available at" `isInfixOf` out) $ - fail "Didn't get expected report for multi-test-suite-test" - unless ("[S-6829]" `isInfixOf` out) $ - fail "Didn't get expected empty report for multi-test-suite-test-2" - -- Test then build works too. - stack ["clean"] - stack ["test"] - stack ["build"] + -- FIXME: Make 'clean' unnecessary (see #1411) + stack ["clean"] + stackCheckStderr ["test", "--coverage"] $ \out -> do + unless ("The coverage report for myPackageA's test-suite test1 is available at" `isInfixOf` out) $ + fail "Didn't get expected report for test1" + unless ("[S-6829]" `isInfixOf` out) $ + fail "Didn't get expected empty report for test2" + -- Test then build works too. + stack ["clean"] + stack ["test"] + stack ["build"] diff --git a/tests/integration/tests/multi-test/files/.gitignore b/tests/integration/tests/multi-test/files/.gitignore index ea0553ea59..0f3e4a815f 100644 --- a/tests/integration/tests/multi-test/files/.gitignore +++ b/tests/integration/tests/multi-test/files/.gitignore @@ -1,3 +1,3 @@ myPackageA.cabal myPackageC.cabal -cyclic.cabal +0myPackageB.cabal diff --git a/tests/integration/tests/multi-test/files/app/Main.hs b/tests/integration/tests/multi-test/files/app/Main.hs index de1c1ab35c..df716cf71e 100644 --- a/tests/integration/tests/multi-test/files/app/Main.hs +++ b/tests/integration/tests/multi-test/files/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Lib +import LibA ( funcA ) main :: IO () -main = someFunc +main = funcA diff --git a/tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs b/tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs deleted file mode 100644 index 57c0764899..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageB/Cyclic.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Cyclic where - -cyclic :: String -cyclic = "Hello from cyclic" diff --git a/tests/integration/tests/multi-test/files/myPackageB/Spec.hs b/tests/integration/tests/multi-test/files/myPackageB/Spec.hs deleted file mode 100644 index 2a7e6b6085..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageB/Spec.hs +++ /dev/null @@ -1,4 +0,0 @@ -import Lib (cyclicOutput) - -main :: IO () -main = cyclicOutput diff --git a/tests/integration/tests/multi-test/files/myPackageB/package.yaml b/tests/integration/tests/multi-test/files/myPackageB/package.yaml index 0be458e3f4..202a258230 100644 --- a/tests/integration/tests/multi-test/files/myPackageB/package.yaml +++ b/tests/integration/tests/multi-test/files/myPackageB/package.yaml @@ -7,15 +7,11 @@ dependencies: - base library: - exposed-modules: - - Cyclic + source-dirs: src tests: - cyclic-test-suite: - main: Spec.hs + test: + source-dirs: test + main: Main.hs dependencies: - myPackageA - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N diff --git a/tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs b/tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs new file mode 100644 index 0000000000..e714f965fe --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs @@ -0,0 +1,6 @@ +module LibB + ( funcB + ) where + +funcB :: IO () +funcB = pure () diff --git a/tests/integration/tests/multi-test/files/myPackageB/test/Main.hs b/tests/integration/tests/multi-test/files/myPackageB/test/Main.hs new file mode 100644 index 0000000000..e7c27dd1be --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageB/test/Main.hs @@ -0,0 +1,4 @@ +import LibA ( funcB ) + +main :: IO () +main = funcB diff --git a/tests/integration/tests/multi-test/files/myPackageC/app/Main.hs b/tests/integration/tests/multi-test/files/myPackageC/app/Main.hs new file mode 100644 index 0000000000..ca55d965a4 --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageC/app/Main.hs @@ -0,0 +1,4 @@ +import LibC ( funcC ) + +main :: IO () +main = funcC diff --git a/tests/integration/tests/multi-test/files/myPackageC/package.yaml b/tests/integration/tests/multi-test/files/myPackageC/package.yaml index c86af8d87a..629f8cba45 100644 --- a/tests/integration/tests/multi-test/files/myPackageC/package.yaml +++ b/tests/integration/tests/multi-test/files/myPackageC/package.yaml @@ -6,19 +6,17 @@ dependencies: - base executables: - sub-package-exe: - source-dirs: src - main: main.hs + myExeC: + source-dirs: + - app + - src + main: Main.hs tests: - sub-package-test: + test: source-dirs: - src - test - main: Spec.hs - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N + main: Main.hs dependencies: - myPackageA diff --git a/tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs b/tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs deleted file mode 100644 index 92ce236d56..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageC/src/Lib2.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Lib2 where - -lib2 :: IO () -lib2 = putStrLn "lib2" diff --git a/tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs b/tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs new file mode 100644 index 0000000000..6289d8843d --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs @@ -0,0 +1,6 @@ +module LibC + ( funcC + ) where + +funcC :: IO () +funcC = pure () diff --git a/tests/integration/tests/multi-test/files/myPackageC/src/main.hs b/tests/integration/tests/multi-test/files/myPackageC/src/main.hs deleted file mode 100644 index e84bf058a8..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageC/src/main.hs +++ /dev/null @@ -1,3 +0,0 @@ -import Lib2 - -main = lib2 diff --git a/tests/integration/tests/multi-test/files/myPackageC/test/Main.hs b/tests/integration/tests/multi-test/files/myPackageC/test/Main.hs new file mode 100644 index 0000000000..0535c37e44 --- /dev/null +++ b/tests/integration/tests/multi-test/files/myPackageC/test/Main.hs @@ -0,0 +1,7 @@ +import LibA ( funcA ) +import LibC ( funcC ) + +main :: IO () +main = do + funcA + funcC diff --git a/tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs b/tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs deleted file mode 100644 index 87852a7dec..0000000000 --- a/tests/integration/tests/multi-test/files/myPackageC/test/Spec.hs +++ /dev/null @@ -1,7 +0,0 @@ -import Lib -import Lib2 - -main :: IO () -main = do - someOtherFunc - lib2 diff --git a/tests/integration/tests/multi-test/files/package.yaml b/tests/integration/tests/multi-test/files/package.yaml index d217a67c9a..7811ddfd05 100644 --- a/tests/integration/tests/multi-test/files/package.yaml +++ b/tests/integration/tests/multi-test/files/package.yaml @@ -12,40 +12,23 @@ library: - 0myPackageB executables: - multi-test-suite-exe: + myExeA: source-dirs: app main: Main.hs - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N dependencies: - myPackageA tests: - multi-test-suite-test: - source-dirs: test - main: Spec.hs - other-modules: [] + test1: + source-dirs: test1 + main: Main.hs dependencies: - myPackageA - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - multi-test-suite-test-2: - source-dirs: test-2 - main: Spec.hs + test2: + source-dirs: test2 + main: Main.hs dependencies: - myPackageA - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - multi-test-suite-test-3: - source-dirs: test-3 - main: Spec.hs - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N + test3: + source-dirs: test3 + main: Main.hs diff --git a/tests/integration/tests/multi-test/files/src/Lib.hs b/tests/integration/tests/multi-test/files/src/Lib.hs deleted file mode 100644 index dc9643b828..0000000000 --- a/tests/integration/tests/multi-test/files/src/Lib.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Lib - ( someFunc - , someOtherFunc - , cyclicOutput - ) where - -import Cyclic - -someFunc :: IO () -someFunc = putStrLn "someFunc" - -someOtherFunc :: IO () -someOtherFunc = putStrLn "someOtherFunc" - -cyclicOutput :: IO () -cyclicOutput = putStrLn cyclic diff --git a/tests/integration/tests/multi-test/files/src/LibA.hs b/tests/integration/tests/multi-test/files/src/LibA.hs new file mode 100644 index 0000000000..a7981b6f2c --- /dev/null +++ b/tests/integration/tests/multi-test/files/src/LibA.hs @@ -0,0 +1,9 @@ +module LibA + ( funcA + , funcB + ) where + +import LibB ( funcB ) + +funcA :: IO () +funcA = pure () diff --git a/tests/integration/tests/multi-test/files/test/OtherModule.hs b/tests/integration/tests/multi-test/files/test/OtherModule.hs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/integration/tests/multi-test/files/test/Spec.hs b/tests/integration/tests/multi-test/files/test/Spec.hs deleted file mode 100644 index 7153edaf67..0000000000 --- a/tests/integration/tests/multi-test/files/test/Spec.hs +++ /dev/null @@ -1,4 +0,0 @@ -import Lib - -main :: IO () -main = someFunc diff --git a/tests/integration/tests/multi-test/files/test1/Main.hs b/tests/integration/tests/multi-test/files/test1/Main.hs new file mode 100644 index 0000000000..71c96e8fce --- /dev/null +++ b/tests/integration/tests/multi-test/files/test1/Main.hs @@ -0,0 +1,4 @@ +import LibA ( funcA ) + +main :: IO () +main = funcA diff --git a/tests/integration/tests/multi-test/files/test-2/Spec.hs b/tests/integration/tests/multi-test/files/test2/Main.hs similarity index 71% rename from tests/integration/tests/multi-test/files/test-2/Spec.hs rename to tests/integration/tests/multi-test/files/test2/Main.hs index c85feb952a..3ca9d54762 100644 --- a/tests/integration/tests/multi-test/files/test-2/Spec.hs +++ b/tests/integration/tests/multi-test/files/test2/Main.hs @@ -1,4 +1,4 @@ -import Lib +import LibA main :: IO () main = pure () diff --git a/tests/integration/tests/multi-test/files/test-3/Spec.hs b/tests/integration/tests/multi-test/files/test3/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/test-3/Spec.hs rename to tests/integration/tests/multi-test/files/test3/Main.hs From 8ff654f819a9058aea0b0e3dfad77a39e9db157e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 10:36:38 +0100 Subject: [PATCH 64/75] multi-test: Move myPackageA into a package dir; add Haddock docs --- tests/integration/tests/multi-test/Main.hs | 17 +++++++++++++++++ .../files/{ => myPackageA}/app/Main.hs | 0 .../files/{ => myPackageA}/package.yaml | 0 .../files/{ => myPackageA}/src/LibA.hs | 0 .../files/{ => myPackageA}/test1/Main.hs | 0 .../files/{ => myPackageA}/test2/Main.hs | 0 .../files/{ => myPackageA}/test3/Main.hs | 0 .../tests/multi-test/files/stack.yaml | 7 ++++--- 8 files changed, 21 insertions(+), 3 deletions(-) rename tests/integration/tests/multi-test/files/{ => myPackageA}/app/Main.hs (100%) rename tests/integration/tests/multi-test/files/{ => myPackageA}/package.yaml (100%) rename tests/integration/tests/multi-test/files/{ => myPackageA}/src/LibA.hs (100%) rename tests/integration/tests/multi-test/files/{ => myPackageA}/test1/Main.hs (100%) rename tests/integration/tests/multi-test/files/{ => myPackageA}/test2/Main.hs (100%) rename tests/integration/tests/multi-test/files/{ => myPackageA}/test3/Main.hs (100%) diff --git a/tests/integration/tests/multi-test/Main.hs b/tests/integration/tests/multi-test/Main.hs index 6a1afea640..32853b1673 100644 --- a/tests/integration/tests/multi-test/Main.hs +++ b/tests/integration/tests/multi-test/Main.hs @@ -1,3 +1,20 @@ +-- | The test's project has project packages A, B and C (which has no library). +-- +-- In terms of main libraries, the dependencies are (->- is 'depends on'): +-- +-- A ->- B +-- +-- In terms of executables (including test suites): +-- +-- B ->- A and C ->- A +-- +-- As, overall, A ->- B and B ->- A, packages A and B cannot be built +-- 'all-in-one'. +-- +-- This integration test passes when A is named myPackageA and B is named +-- 0myPackageB, but it fails when B is renamed myPackageB. That must be a bug in +-- Stack. + import Control.Monad ( unless ) import Data.List ( isInfixOf ) import StackTest diff --git a/tests/integration/tests/multi-test/files/app/Main.hs b/tests/integration/tests/multi-test/files/myPackageA/app/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/app/Main.hs rename to tests/integration/tests/multi-test/files/myPackageA/app/Main.hs diff --git a/tests/integration/tests/multi-test/files/package.yaml b/tests/integration/tests/multi-test/files/myPackageA/package.yaml similarity index 100% rename from tests/integration/tests/multi-test/files/package.yaml rename to tests/integration/tests/multi-test/files/myPackageA/package.yaml diff --git a/tests/integration/tests/multi-test/files/src/LibA.hs b/tests/integration/tests/multi-test/files/myPackageA/src/LibA.hs similarity index 100% rename from tests/integration/tests/multi-test/files/src/LibA.hs rename to tests/integration/tests/multi-test/files/myPackageA/src/LibA.hs diff --git a/tests/integration/tests/multi-test/files/test1/Main.hs b/tests/integration/tests/multi-test/files/myPackageA/test1/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/test1/Main.hs rename to tests/integration/tests/multi-test/files/myPackageA/test1/Main.hs diff --git a/tests/integration/tests/multi-test/files/test2/Main.hs b/tests/integration/tests/multi-test/files/myPackageA/test2/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/test2/Main.hs rename to tests/integration/tests/multi-test/files/myPackageA/test2/Main.hs diff --git a/tests/integration/tests/multi-test/files/test3/Main.hs b/tests/integration/tests/multi-test/files/myPackageA/test3/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/test3/Main.hs rename to tests/integration/tests/multi-test/files/myPackageA/test3/Main.hs diff --git a/tests/integration/tests/multi-test/files/stack.yaml b/tests/integration/tests/multi-test/files/stack.yaml index 5ce27196df..14a33de5df 100644 --- a/tests/integration/tests/multi-test/files/stack.yaml +++ b/tests/integration/tests/multi-test/files/stack.yaml @@ -1,5 +1,6 @@ -snapshot: lts-24.37 +snapshot: ghc-9.10.3 + packages: -- . -- myPackageC +- myPackageA - myPackageB +- myPackageC From 971a50d2c3b94f861353ad3294354e8b5d2cbabe Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 13:53:22 +0100 Subject: [PATCH 65/75] Review, document and conform further integration tests --- tests/integration/tests/mutable-deps/Main.hs | 44 ++++++++-------- .../tests/mutable-deps/files/.gitignore | 1 + .../tests/mutable-deps/files/app/Main.hs | 2 +- .../tests/mutable-deps/files/files.cabal | 23 --------- .../tests/mutable-deps/files/package.yaml | 18 +++++++ .../files/src/{Files.hs => Lib.hs} | 2 +- .../tests/mutable-deps/files/stack.yaml | 1 + .../tests/nice-resolver-names/Main.hs | 14 ++++-- .../nice-resolver-names/files/.gitignore | 2 +- .../nice-resolver-names/files/package.yaml | 6 ++- .../integration/tests/no-rerun-tests/Main.hs | 14 +++--- .../tests/no-rerun-tests/files/.gitignore | 6 +-- .../tests/no-rerun-tests/files/package.yaml | 8 +-- .../tests/no-rerun-tests/files/test/Main.hs | 2 + .../tests/no-rerun-tests/files/test/Spec.hs | 2 - .../tests/override-compiler/Main.hs | 9 ++-- .../integration/tests/proper-rebuilds/Main.hs | 35 +++++++------ .../tests/proper-rebuilds/files/.gitignore | 2 +- .../tests/proper-rebuilds/files/app/Main.hs | 6 +-- .../tests/proper-rebuilds/files/files.cabal | 17 ------- .../tests/proper-rebuilds/files/package.yaml | 16 ++++++ .../tests/proper-rebuilds/files/src/Lib.hs | 6 +++ .../tests/proper-rebuilds/files/src/Lib.hs.v1 | 4 -- .../tests/proper-rebuilds/files/src/Lib.hs.v2 | 4 -- .../tests/proper-rebuilds/files/src/Lib.v1 | 6 +++ .../tests/proper-rebuilds/files/src/Lib.v2 | 6 +++ .../tests/relative-script-snapshots/Main.hs | 5 +- .../subdir/{snapshot.yaml => mySnapshot.yaml} | 4 +- .../files/subdir/script.hs | 5 +- tests/integration/tests/sanity/Main.hs | 39 ++++++++------- .../sanity/files/{foo.bat => script.bat} | 0 .../tests/sanity/files/{foo.sh => script.sh} | 0 .../tests/script-extra-dep/Main.hs | 4 +- .../tests/script-extra-dep/files/script.hs | 5 +- .../tests/skip-unreachable-dirs/Main.hs | 8 +-- .../skip-unreachable-dirs/files/.gitignore | 2 + .../skip-unreachable-dirs/files/foo.cabal | 10 ---- .../skip-unreachable-dirs/files/package.yaml | 8 +++ .../Main.hs | 23 ++++++++- .../files/.gitignore | 2 +- .../files/README.md | 18 ------- .../files/as-snapshot.yaml | 1 - .../files/mySnapshot.yaml | 8 +++ .../files/package.yaml | 4 +- .../files/snapshot.yaml | 5 -- .../files/{as-extra-dep.yaml => stack1.yaml} | 2 + .../files/stack2.yaml | 1 + tests/integration/tests/upload/Main.hs | 50 +++++++++---------- .../integration/tests/upload/files/.gitignore | 1 + .../tests/upload/files/FakeHackage.hs | 48 +++++++++--------- tests/integration/tests/upload/files/Foo.hs | 1 - .../tests/upload/files/package.yaml | 11 ++++ .../integration/tests/upload/files/src/Lib.hs | 1 + .../integration/tests/upload/files/stack.yaml | 1 + .../tests/upload/files/uploadtest.cabal | 13 ----- .../variables-in-template-file-names/Main.hs | 15 +++--- .../files/.gitignore | 2 +- tests/integration/tests/watched-files/Main.hs | 8 +-- .../tests/watched-files/files/.gitignore | 2 +- .../watched-files/files/{ => app}/Main.hs | 5 +- .../tests/watched-files/files/package.yaml | 8 ++- 61 files changed, 312 insertions(+), 264 deletions(-) create mode 100644 tests/integration/tests/mutable-deps/files/.gitignore delete mode 100644 tests/integration/tests/mutable-deps/files/files.cabal create mode 100644 tests/integration/tests/mutable-deps/files/package.yaml rename tests/integration/tests/mutable-deps/files/src/{Files.hs => Lib.hs} (82%) create mode 100644 tests/integration/tests/no-rerun-tests/files/test/Main.hs delete mode 100644 tests/integration/tests/no-rerun-tests/files/test/Spec.hs delete mode 100644 tests/integration/tests/proper-rebuilds/files/files.cabal create mode 100644 tests/integration/tests/proper-rebuilds/files/package.yaml create mode 100644 tests/integration/tests/proper-rebuilds/files/src/Lib.hs delete mode 100644 tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v1 delete mode 100644 tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v2 create mode 100644 tests/integration/tests/proper-rebuilds/files/src/Lib.v1 create mode 100644 tests/integration/tests/proper-rebuilds/files/src/Lib.v2 rename tests/integration/tests/relative-script-snapshots/files/subdir/{snapshot.yaml => mySnapshot.yaml} (80%) rename tests/integration/tests/sanity/files/{foo.bat => script.bat} (100%) mode change 100755 => 100644 rename tests/integration/tests/sanity/files/{foo.sh => script.sh} (100%) delete mode 100644 tests/integration/tests/skip-unreachable-dirs/files/foo.cabal create mode 100644 tests/integration/tests/skip-unreachable-dirs/files/package.yaml delete mode 100644 tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/README.md delete mode 100644 tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-snapshot.yaml create mode 100644 tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/mySnapshot.yaml delete mode 100644 tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/snapshot.yaml rename tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/{as-extra-dep.yaml => stack1.yaml} (52%) create mode 100644 tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack2.yaml create mode 100644 tests/integration/tests/upload/files/.gitignore delete mode 100644 tests/integration/tests/upload/files/Foo.hs create mode 100644 tests/integration/tests/upload/files/package.yaml create mode 100644 tests/integration/tests/upload/files/src/Lib.hs delete mode 100644 tests/integration/tests/upload/files/uploadtest.cabal rename tests/integration/tests/watched-files/files/{ => app}/Main.hs (65%) diff --git a/tests/integration/tests/mutable-deps/Main.hs b/tests/integration/tests/mutable-deps/Main.hs index 72fd0e9ab2..2106578801 100644 --- a/tests/integration/tests/mutable-deps/Main.hs +++ b/tests/integration/tests/mutable-deps/Main.hs @@ -1,6 +1,6 @@ -import Control.Monad (forM_, unless, when) -import Data.List (isInfixOf, stripPrefix) -import StackTest +import Control.Monad ( forM_, unless, when ) +import Data.List ( isInfixOf, stripPrefix ) +import StackTest -- The package 'files' depends directly on filemanip, which depends directly on -- packages directory, filepath and unix-compat. Package directory also depends @@ -12,22 +12,22 @@ import StackTest main :: IO () main = unless isWindows $ do -- dependency issues on Windows - let isBuild package line = - case stripPrefix package line of - Just x -> "> build" `isInfixOf` line - Nothing -> False - expectRecompilation pkgs stderr = forM_ pkgs $ \p -> - unless (any (isBuild p) $ lines stderr) $ - error $ "package " ++ show p ++ " recompilation was expected" - expectNoRecompilation pkgs stderr = forM_ pkgs $ \p -> - when (any (isBuild p) $ lines stderr) $ - error $ "package " ++ show p ++ " recompilation was not expected" - mutablePackages = [ "filepath" - , "directory" - , "filemanip" - , "files" - ] - stackCheckStderr ["build"] $ expectRecompilation mutablePackages - stackCheckStderr ["build" , "--profile"] $ expectRecompilation mutablePackages - stackCheckStderr ["build"] $ expectNoRecompilation mutablePackages - stackCheckStderr ["build" , "--profile"] $ expectNoRecompilation mutablePackages + let isBuild package line = + case stripPrefix package line of + Just x -> "> build" `isInfixOf` line + Nothing -> False + expectRecompilation pkgs stderr = forM_ pkgs $ \p -> + unless (any (isBuild p) $ lines stderr) $ + error $ "package " ++ show p ++ " recompilation was expected" + expectNoRecompilation pkgs stderr = forM_ pkgs $ \p -> + when (any (isBuild p) $ lines stderr) $ + error $ "package " ++ show p ++ " recompilation was not expected" + mutablePackages = [ "filepath" + , "directory" + , "filemanip" + , "myPackage" + ] + stackCheckStderr ["build"] $ expectRecompilation mutablePackages + stackCheckStderr ["build" , "--profile"] $ expectRecompilation mutablePackages + stackCheckStderr ["build"] $ expectNoRecompilation mutablePackages + stackCheckStderr ["build" , "--profile"] $ expectNoRecompilation mutablePackages diff --git a/tests/integration/tests/mutable-deps/files/.gitignore b/tests/integration/tests/mutable-deps/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/mutable-deps/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/mutable-deps/files/app/Main.hs b/tests/integration/tests/mutable-deps/files/app/Main.hs index 5e18155cea..ecf5062557 100644 --- a/tests/integration/tests/mutable-deps/files/app/Main.hs +++ b/tests/integration/tests/mutable-deps/files/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Files +import Lib main = do cFiles <- allCFiles diff --git a/tests/integration/tests/mutable-deps/files/files.cabal b/tests/integration/tests/mutable-deps/files/files.cabal deleted file mode 100644 index f269fecb00..0000000000 --- a/tests/integration/tests/mutable-deps/files/files.cabal +++ /dev/null @@ -1,23 +0,0 @@ -cabal-version: 3.8 - -name: files -version: 1.0.0 -build-type: Simple - -library - hs-source-dirs: - src - exposed-modules: - Files - build-depends: - base - , filemanip - -executable test-exe - hs-source-dirs: - app - main-is: - Main.hs - build-depends: - base - , files diff --git a/tests/integration/tests/mutable-deps/files/package.yaml b/tests/integration/tests/mutable-deps/files/package.yaml new file mode 100644 index 0000000000..79d39d13fa --- /dev/null +++ b/tests/integration/tests/mutable-deps/files/package.yaml @@ -0,0 +1,18 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - filemanip + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/mutable-deps/files/src/Files.hs b/tests/integration/tests/mutable-deps/files/src/Lib.hs similarity index 82% rename from tests/integration/tests/mutable-deps/files/src/Files.hs rename to tests/integration/tests/mutable-deps/files/src/Lib.hs index 5e3452f0b5..77d29f1945 100644 --- a/tests/integration/tests/mutable-deps/files/src/Files.hs +++ b/tests/integration/tests/mutable-deps/files/src/Lib.hs @@ -1,4 +1,4 @@ -module Files where +module Lib where import System.FilePath.Glob diff --git a/tests/integration/tests/mutable-deps/files/stack.yaml b/tests/integration/tests/mutable-deps/files/stack.yaml index e038f59be3..df1f84c742 100644 --- a/tests/integration/tests/mutable-deps/files/stack.yaml +++ b/tests/integration/tests/mutable-deps/files/stack.yaml @@ -1,4 +1,5 @@ snapshot: lts-24.37 + extra-deps: - ./filepath-1.5.4.0 # Required, otherwise Stack reports that GHC boot library has been pruned. diff --git a/tests/integration/tests/nice-resolver-names/Main.hs b/tests/integration/tests/nice-resolver-names/Main.hs index 4dd15d734f..48a2d755de 100644 --- a/tests/integration/tests/nice-resolver-names/Main.hs +++ b/tests/integration/tests/nice-resolver-names/Main.hs @@ -1,10 +1,14 @@ +-- | Stack's init command uses a convenience synonym for the snapshot in the +-- project-level configuration file, if that is what was specified at the +-- command line. + {-# LANGUAGE OverloadedStrings #-} -import StackTest -import Control.Exception (throwIO) -import Data.Maybe (mapMaybe) -import Data.Foldable (for_) -import Data.List (stripPrefix) +import Control.Exception ( throwIO ) +import Data.Maybe ( mapMaybe ) +import Data.Foldable ( for_ ) +import Data.List ( stripPrefix ) +import StackTest main :: IO () main = do diff --git a/tests/integration/tests/nice-resolver-names/files/.gitignore b/tests/integration/tests/nice-resolver-names/files/.gitignore index 66f418505d..82bb5452c4 100644 --- a/tests/integration/tests/nice-resolver-names/files/.gitignore +++ b/tests/integration/tests/nice-resolver-names/files/.gitignore @@ -1,2 +1,2 @@ +myPackage.cabal stack.yaml -unimportant.cabal diff --git a/tests/integration/tests/nice-resolver-names/files/package.yaml b/tests/integration/tests/nice-resolver-names/files/package.yaml index 4b60802c43..7e155848c9 100644 --- a/tests/integration/tests/nice-resolver-names/files/package.yaml +++ b/tests/integration/tests/nice-resolver-names/files/package.yaml @@ -1,3 +1,5 @@ -name: unimportant -version: 0 +spec-version: 0.36.0 + +name: myPackage + library: {} diff --git a/tests/integration/tests/no-rerun-tests/Main.hs b/tests/integration/tests/no-rerun-tests/Main.hs index 39d125ad1a..98d289a605 100644 --- a/tests/integration/tests/no-rerun-tests/Main.hs +++ b/tests/integration/tests/no-rerun-tests/Main.hs @@ -1,13 +1,15 @@ -import StackTest -import System.Directory -import Control.Monad +-- | Stack can avoid re-running successful test suites. + +import Control.Monad ( unless, when ) +import StackTest +import System.Directory ( doesFileExist, removeFile ) main :: IO () main = do stack ["test"] - exists1 <- doesFileExist "foo" + exists1 <- doesFileExist "testRan" unless exists1 $ error "exists1 should be True" - removeFile "foo" + removeFile "testRan" stack ["test", "--no-rerun-tests"] - exists2 <- doesFileExist "foo" + exists2 <- doesFileExist "testRan" when exists2 $ error "exists2 should be False" diff --git a/tests/integration/tests/no-rerun-tests/files/.gitignore b/tests/integration/tests/no-rerun-tests/files/.gitignore index 04c6af385a..abd3798762 100644 --- a/tests/integration/tests/no-rerun-tests/files/.gitignore +++ b/tests/integration/tests/no-rerun-tests/files/.gitignore @@ -1,4 +1,2 @@ -.stack-work/ -files.cabal -*~ -foo +myPackage.cabal +testRan diff --git a/tests/integration/tests/no-rerun-tests/files/package.yaml b/tests/integration/tests/no-rerun-tests/files/package.yaml index dcebf6d755..bbdc2419b9 100644 --- a/tests/integration/tests/no-rerun-tests/files/package.yaml +++ b/tests/integration/tests/no-rerun-tests/files/package.yaml @@ -1,12 +1,14 @@ -name: files +spec-version: 0.36.0 + +name: myPackage dependencies: -- base >= 4.7 && < 5 +- base library: source-dirs: src tests: test: - main: Spec.hs source-dirs: test + main: Main.hs diff --git a/tests/integration/tests/no-rerun-tests/files/test/Main.hs b/tests/integration/tests/no-rerun-tests/files/test/Main.hs new file mode 100644 index 0000000000..d900d0cd96 --- /dev/null +++ b/tests/integration/tests/no-rerun-tests/files/test/Main.hs @@ -0,0 +1,2 @@ +main :: IO () +main = writeFile "testRan" "" diff --git a/tests/integration/tests/no-rerun-tests/files/test/Spec.hs b/tests/integration/tests/no-rerun-tests/files/test/Spec.hs deleted file mode 100644 index d030d26e0c..0000000000 --- a/tests/integration/tests/no-rerun-tests/files/test/Spec.hs +++ /dev/null @@ -1,2 +0,0 @@ -main :: IO () -main = writeFile "foo" "" diff --git a/tests/integration/tests/override-compiler/Main.hs b/tests/integration/tests/override-compiler/Main.hs index 961973e199..d7196f4e9c 100644 --- a/tests/integration/tests/override-compiler/Main.hs +++ b/tests/integration/tests/override-compiler/Main.hs @@ -1,7 +1,10 @@ -import StackTest -import Control.Monad (unless) +-- | Stack can override the compiler specified in a snapshot. + +import Control.Monad ( unless ) +import StackTest main :: IO () main = stackCheckStdout ["exec", "--", "ghc", "--numeric-version"] $ \ver -> -- get rid of the newline character - unless (concat (lines ver) == "9.10.3") $ error $ "Invalid version: " ++ show ver + unless (concat (lines ver) == "9.10.3") $ + error $ "Invalid version: " ++ show ver diff --git a/tests/integration/tests/proper-rebuilds/Main.hs b/tests/integration/tests/proper-rebuilds/Main.hs index 643f575e9a..4a12aac853 100644 --- a/tests/integration/tests/proper-rebuilds/Main.hs +++ b/tests/integration/tests/proper-rebuilds/Main.hs @@ -1,21 +1,24 @@ -import Control.Monad (unless, when) -import Data.List (isInfixOf) -import StackTest -import System.Directory +-- | Stack rebuilds an executable if profiling is enabled or disabled or if the +-- library on which it depends changes. + +import Control.Monad ( unless, when ) +import Data.List ( isInfixOf ) +import StackTest +import System.Directory ( copyFile ) main :: IO () main = do - let expectRecompilation stderr = - unless ("> build" `isInfixOf` stderr) $ + let expectRecompilation stderr = + unless ("> build" `isInfixOf` stderr) $ error "package recompilation was expected" - expectNoRecompilation stderr = - when ("> build" `isInfixOf` stderr) $ + expectNoRecompilation stderr = + when ("> build" `isInfixOf` stderr) $ error "package recompilation was not expected" - copyFile "src/Lib.hs.v1" "src/Lib.hs" - stackCheckStderr ["build"] expectRecompilation - stackCheckStderr ["build" , "--profile"] expectRecompilation - stackCheckStderr ["build" , "--profile"] expectNoRecompilation - -- changing source file to trigger recompilation - copyFile "src/Lib.hs.v2" "src/Lib.hs" - stackCheckStderr ["build" , "--profile"] expectRecompilation - stackCheckStderr ["build"] expectRecompilation + copyFile "src/Lib.v1" "src/Lib.hs" + stackCheckStderr ["build"] expectRecompilation + stackCheckStderr ["build" , "--profile"] expectRecompilation + stackCheckStderr ["build" , "--profile"] expectNoRecompilation + -- changing source file to trigger recompilation + copyFile "src/Lib.v2" "src/Lib.hs" + stackCheckStderr ["build" , "--profile"] expectRecompilation + stackCheckStderr ["build"] expectRecompilation diff --git a/tests/integration/tests/proper-rebuilds/files/.gitignore b/tests/integration/tests/proper-rebuilds/files/.gitignore index 25dffca60e..b0a5a052a1 100644 --- a/tests/integration/tests/proper-rebuilds/files/.gitignore +++ b/tests/integration/tests/proper-rebuilds/files/.gitignore @@ -1 +1 @@ -src/Lib.hs +myPackage.cabal diff --git a/tests/integration/tests/proper-rebuilds/files/app/Main.hs b/tests/integration/tests/proper-rebuilds/files/app/Main.hs index a2fa21e3ac..c081d93bae 100644 --- a/tests/integration/tests/proper-rebuilds/files/app/Main.hs +++ b/tests/integration/tests/proper-rebuilds/files/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Lib +import Lib ( func ) -main = do - putStrLn $ "Sample strings: " ++ show someStrings +main :: IO () +main = func diff --git a/tests/integration/tests/proper-rebuilds/files/files.cabal b/tests/integration/tests/proper-rebuilds/files/files.cabal deleted file mode 100644 index b04858a5fd..0000000000 --- a/tests/integration/tests/proper-rebuilds/files/files.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: files -version: 1.0.0 -build-type: Simple -cabal-version: >= 1.10 - -library - hs-source-dirs: src - exposed-modules: Lib - build-depends: base - default-language: Haskell2010 - -executable test-exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -rtsopts - build-depends: base, files - default-language: Haskell2010 \ No newline at end of file diff --git a/tests/integration/tests/proper-rebuilds/files/package.yaml b/tests/integration/tests/proper-rebuilds/files/package.yaml new file mode 100644 index 0000000000..bea19d444e --- /dev/null +++ b/tests/integration/tests/proper-rebuilds/files/package.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: + source-dirs: src + +executables: + myExe: + source-dirs: app + main: Main.hs + dependencies: + - myPackage diff --git a/tests/integration/tests/proper-rebuilds/files/src/Lib.hs b/tests/integration/tests/proper-rebuilds/files/src/Lib.hs new file mode 100644 index 0000000000..412990b09b --- /dev/null +++ b/tests/integration/tests/proper-rebuilds/files/src/Lib.hs @@ -0,0 +1,6 @@ +module Lib + ( func + ) where + +func :: IO () +func = putStrLn "Version 1" diff --git a/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v1 b/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v1 deleted file mode 100644 index fc0ad60719..0000000000 --- a/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v1 +++ /dev/null @@ -1,4 +0,0 @@ -module Lib where - -someStrings :: [String] -someStrings = ["Hello", "world!"] diff --git a/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v2 b/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v2 deleted file mode 100644 index 59c5f8c548..0000000000 --- a/tests/integration/tests/proper-rebuilds/files/src/Lib.hs.v2 +++ /dev/null @@ -1,4 +0,0 @@ -module Lib where - -someStrings :: [String] -someStrings = ["Hello", "other", "world!"] diff --git a/tests/integration/tests/proper-rebuilds/files/src/Lib.v1 b/tests/integration/tests/proper-rebuilds/files/src/Lib.v1 new file mode 100644 index 0000000000..412990b09b --- /dev/null +++ b/tests/integration/tests/proper-rebuilds/files/src/Lib.v1 @@ -0,0 +1,6 @@ +module Lib + ( func + ) where + +func :: IO () +func = putStrLn "Version 1" diff --git a/tests/integration/tests/proper-rebuilds/files/src/Lib.v2 b/tests/integration/tests/proper-rebuilds/files/src/Lib.v2 new file mode 100644 index 0000000000..98438cc36e --- /dev/null +++ b/tests/integration/tests/proper-rebuilds/files/src/Lib.v2 @@ -0,0 +1,6 @@ +module Lib + ( func + ) where + +func :: IO () +func = putStrLn "Version 2" diff --git a/tests/integration/tests/relative-script-snapshots/Main.hs b/tests/integration/tests/relative-script-snapshots/Main.hs index 0a4044c6af..483add4c7d 100644 --- a/tests/integration/tests/relative-script-snapshots/Main.hs +++ b/tests/integration/tests/relative-script-snapshots/Main.hs @@ -1,4 +1,7 @@ -import StackTest +-- Stack's script interpreter supports snapshot locations that are relative +-- local file paths. + +import StackTest main :: IO () main = stack ["subdir/script.hs"] diff --git a/tests/integration/tests/relative-script-snapshots/files/subdir/snapshot.yaml b/tests/integration/tests/relative-script-snapshots/files/subdir/mySnapshot.yaml similarity index 80% rename from tests/integration/tests/relative-script-snapshots/files/subdir/snapshot.yaml rename to tests/integration/tests/relative-script-snapshots/files/subdir/mySnapshot.yaml index faccd3d5e8..3ab8bcbe35 100644 --- a/tests/integration/tests/relative-script-snapshots/files/subdir/snapshot.yaml +++ b/tests/integration/tests/relative-script-snapshots/files/subdir/mySnapshot.yaml @@ -1,5 +1,7 @@ +name: mySnapshot + snapshot: ghc-9.10.3 -name: snapshot + packages: - acme-missiles-0.3@rev:0 - stm-2.5.0.0@rev:0 diff --git a/tests/integration/tests/relative-script-snapshots/files/subdir/script.hs b/tests/integration/tests/relative-script-snapshots/files/subdir/script.hs index 21fa066ca2..582c1d7b5a 100644 --- a/tests/integration/tests/relative-script-snapshots/files/subdir/script.hs +++ b/tests/integration/tests/relative-script-snapshots/files/subdir/script.hs @@ -1,6 +1,7 @@ #!/usr/bin/env stack --- stack --snapshot snapshot.yaml script -import Acme.Missiles +-- stack --snapshot mySnapshot.yaml script + +import Acme.Missiles ( launchMissiles ) main :: IO () main = launchMissiles diff --git a/tests/integration/tests/sanity/Main.hs b/tests/integration/tests/sanity/Main.hs index cdf55e9c54..cb6f3f44bc 100644 --- a/tests/integration/tests/sanity/Main.hs +++ b/tests/integration/tests/sanity/Main.hs @@ -1,25 +1,26 @@ -import StackTest -import Control.Monad (unless) -import System.Directory (doesFileExist) +-- | Various tests of Stack's sanity. + +import Control.Monad ( unless ) +import StackTest +import System.Directory ( doesFileExist ) main :: IO () main = do - stack ["--version"] - stack ["--help"] - removeDirIgnore "acme-missiles-0.2" - removeDirIgnore "acme-missiles-0.3" - stack ["unpack", "acme-missiles-0.2"] - stack ["unpack", "acme-missiles"] - stackErr ["command-does-not-exist"] - stackErr ["unpack", "invalid-package-name-"] + stack ["--version"] + stack ["--help"] + removeDirIgnore "acme-missiles-0.2" + removeDirIgnore "acme-missiles-0.3" + stack ["unpack", "acme-missiles-0.2"] + stack ["unpack", "acme-missiles"] + stackErr ["command-does-not-exist"] + stackErr ["unpack", "invalid-package-name-"] - -- When running outside of IntegrationSpec.hs, this will use the - -- stack.yaml from Stack itself - exists <- doesFileExist "../../../../../stack.yaml" - unless exists $ stackErr ["build"] + -- When running outside of IntegrationSpec.hs, this will use the + -- stack.yaml from Stack itself + exists <- doesFileExist "../../../../../stack.yaml" + unless exists $ stackErr ["build"] - doesNotExist "stack.yaml" + doesNotExist "stack.yaml" - if isWindows - then stack [defaultSnapshotArg, "exec", "./foo.bat"] - else stack [defaultSnapshotArg, "exec", "./foo.sh"] + let scriptFile = if isWindows then "./script.bat" else "./script.sh" + stack [defaultSnapshotArg, "exec", scriptFile] diff --git a/tests/integration/tests/sanity/files/foo.bat b/tests/integration/tests/sanity/files/script.bat old mode 100755 new mode 100644 similarity index 100% rename from tests/integration/tests/sanity/files/foo.bat rename to tests/integration/tests/sanity/files/script.bat diff --git a/tests/integration/tests/sanity/files/foo.sh b/tests/integration/tests/sanity/files/script.sh similarity index 100% rename from tests/integration/tests/sanity/files/foo.sh rename to tests/integration/tests/sanity/files/script.sh diff --git a/tests/integration/tests/script-extra-dep/Main.hs b/tests/integration/tests/script-extra-dep/Main.hs index c2e9c88b99..b575ce035d 100644 --- a/tests/integration/tests/script-extra-dep/Main.hs +++ b/tests/integration/tests/script-extra-dep/Main.hs @@ -1,4 +1,6 @@ -import StackTest +-- Stack's script interpreter supports extra-deps. + +import StackTest main :: IO () main = stack ["script.hs"] diff --git a/tests/integration/tests/script-extra-dep/files/script.hs b/tests/integration/tests/script-extra-dep/files/script.hs index 47c25c808b..cbb5e52b49 100644 --- a/tests/integration/tests/script-extra-dep/files/script.hs +++ b/tests/integration/tests/script-extra-dep/files/script.hs @@ -1,6 +1,7 @@ #!/usr/bin/env stack --- stack --snapshot ghc-9.10.3 script --extra-dep acme-missiles-0.3@rev:0 --extra-dep stm-2.5.3.1@rev:1 -import Acme.Missiles +-- stack --snapshot ghc-9.10.3 script --extra-dep acme-missiles-0.3@rev:0 + +import Acme.Missiles ( launchMissiles ) main :: IO () main = launchMissiles diff --git a/tests/integration/tests/skip-unreachable-dirs/Main.hs b/tests/integration/tests/skip-unreachable-dirs/Main.hs index 08d36cec61..25983649fa 100644 --- a/tests/integration/tests/skip-unreachable-dirs/Main.hs +++ b/tests/integration/tests/skip-unreachable-dirs/Main.hs @@ -1,6 +1,8 @@ -import StackTest -import System.Directory -import Control.Exception (catch, IOException) +-- | Stack's init command skips unreachable directories. + +import Control.Exception ( IOException, catch) +import StackTest +import System.Directory main :: IO () main = do diff --git a/tests/integration/tests/skip-unreachable-dirs/files/.gitignore b/tests/integration/tests/skip-unreachable-dirs/files/.gitignore index 684dbffa96..20fdd32928 100644 --- a/tests/integration/tests/skip-unreachable-dirs/files/.gitignore +++ b/tests/integration/tests/skip-unreachable-dirs/files/.gitignore @@ -1 +1,3 @@ +myPackage.cabal stack.yaml +unreachabledir/ diff --git a/tests/integration/tests/skip-unreachable-dirs/files/foo.cabal b/tests/integration/tests/skip-unreachable-dirs/files/foo.cabal deleted file mode 100644 index 625239b18d..0000000000 --- a/tests/integration/tests/skip-unreachable-dirs/files/foo.cabal +++ /dev/null @@ -1,10 +0,0 @@ -name: foo -version: 0.0.0 -synopsis: foo -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Foo - build-depends: base - default-language: Haskell2010 diff --git a/tests/integration/tests/skip-unreachable-dirs/files/package.yaml b/tests/integration/tests/skip-unreachable-dirs/files/package.yaml new file mode 100644 index 0000000000..4b373ba746 --- /dev/null +++ b/tests/integration/tests/skip-unreachable-dirs/files/package.yaml @@ -0,0 +1,8 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base + +library: {} diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/Main.hs b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/Main.hs index d4efcc403c..eb84b525d1 100644 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/Main.hs +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/Main.hs @@ -1,6 +1,25 @@ +-- | The test case here is weird enough to warrant an explanation. What we +-- _really_ want to test is whether building the lts-3.12 snapshot's +-- semigroupoids package with rev-1 works. See +-- https://github.com/commercialhaskell/stackage/issues/3185. However, that test +-- requires that we use an older GHC, and as Manny commented: +-- +-- > Having integration tests with old resolvers will cause them to fail +-- > on Linux distributions with GCC with PIE enabled by default (which +-- > is the latest versions of most distributions now), since older GHC +-- > versions do not support it. I'm not sure what we should do about +-- > this, since it obviously does make sense to be able to test against +-- > old snapshots sometimes. +-- +-- So I am instead testing a totally different case here which repros the +-- same issue. If we use a custom snapshot with incompatible `stm` and +-- `async` versions, we want Stack to trust the build plan and allow a +-- `--dry-run` to succeed. But if we do this via `extra-deps`, we want it +-- to fail. + import StackTest main :: IO () main = do - stackErr ["build", "--stack-yaml", "as-extra-dep.yaml", "--dry-run"] - stack ["build", "--stack-yaml", "as-snapshot.yaml", "--dry-run"] + stackErr ["build", "--stack-yaml", "stack1.yaml", "--dry-run"] + stack ["build", "--stack-yaml", "stack2.yaml", "--dry-run"] diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/.gitignore b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/.gitignore index 6a9f1098c7..b0a5a052a1 100644 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/.gitignore +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/.gitignore @@ -1 +1 @@ -/unimportant.cabal +myPackage.cabal diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/README.md b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/README.md deleted file mode 100644 index 141a9834f3..0000000000 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/README.md +++ /dev/null @@ -1,18 +0,0 @@ -The test case here is weird enough to warrant an explanation. What we -_really_ want to test is whether building the lts-3.12 snapshot's -semigroupoids package with rev-1 works. See -https://github.com/commercialhaskell/stackage/issues/3185. However, that test -requires that we use an older GHC, and as Manny commented: - -> Having integration tests with old resolvers will cause them to fail -> on Linux distributions with GCC with PIE enabled by default (which -> is the latest versions of most distributions now), since older GHC -> versions do not support it. I'm not sure what we should do about -> this, since it obviously does make sense to be able to test against -> old snapshots sometimes. - -So I am instead testing a totally different case here which repros the -same issue. If we use a custom snapshot with incompatible `stm` and -`async` versions, we want Stack to trust the build plan and allow a -`--dry-run` to succeed. But if we do this via `extra-deps`, we want it -to fail. diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-snapshot.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-snapshot.yaml deleted file mode 100644 index 1c2b12b0f1..0000000000 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-snapshot.yaml +++ /dev/null @@ -1 +0,0 @@ -snapshot: snapshot.yaml diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/mySnapshot.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/mySnapshot.yaml new file mode 100644 index 0000000000..0c602a1e79 --- /dev/null +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/mySnapshot.yaml @@ -0,0 +1,8 @@ +name: mySnapshot + +snapshot: ghc-9.10.3 + +packages: +# The Cabal file for async-2.1.1.1 specifies stm >= 2.2 +- async-2.1.1.1 +- stm-2.1.2.2 diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/package.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/package.yaml index f403f2761f..d04e500bd6 100644 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/package.yaml +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/package.yaml @@ -1,4 +1,6 @@ -name: unimportant +spec-version: 0.36.0 + +name: myPackage dependencies: - base diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/snapshot.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/snapshot.yaml deleted file mode 100644 index f3b9e8c23d..0000000000 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/snapshot.yaml +++ /dev/null @@ -1,5 +0,0 @@ -snapshot: ghc-9.10.3 -name: hackage-revisions-are-annoying -packages: -- async-2.1.1.1 -- stm-2.1.2.2 diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-extra-dep.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack1.yaml similarity index 52% rename from tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-extra-dep.yaml rename to tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack1.yaml index 598233f978..4813fc689c 100644 --- a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/as-extra-dep.yaml +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack1.yaml @@ -1,4 +1,6 @@ snapshot: ghc-9.10.3 + extra-deps: +# The Cabal file for async-2.1.1.1 specifies stm >= 2.2 - async-2.1.1.1 - stm-2.1.2.2 diff --git a/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack2.yaml b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack2.yaml new file mode 100644 index 0000000000..5d99800320 --- /dev/null +++ b/tests/integration/tests/stackage-3185-ignore-bounds-in-snapshot/files/stack2.yaml @@ -0,0 +1 @@ +snapshot: mySnapshot.yaml diff --git a/tests/integration/tests/upload/Main.hs b/tests/integration/tests/upload/Main.hs index 2a7e47dc38..792d75e3e4 100644 --- a/tests/integration/tests/upload/Main.hs +++ b/tests/integration/tests/upload/Main.hs @@ -1,34 +1,32 @@ -import Control.Concurrent - +import Control.Concurrent ( threadDelay ) import StackTest - -import System.Directory (createDirectoryIfMissing, - getCurrentDirectory) -import System.Environment (getEnv, setEnv) -import System.FilePath (()) -import System.Process +import System.Directory + ( createDirectoryIfMissing, getCurrentDirectory ) +import System.Environment ( getEnv, setEnv ) +import System.FilePath ( () ) +import System.Process ( proc, withCreateProcess ) main :: IO () main = - withFakeHackage $ do - stackRoot <- getEnv "STACK_ROOT" - -- Ensure there are credentials available for uploading - createDirectoryIfMissing True (stackRoot "upload") - writeFile - (stackRoot "upload" "credentials.json") - "{\"username\":\"fake\",\"password\":\"fake\"}" - stack ["upload", "."] + withFakeHackage $ do + stackRoot <- getEnv "STACK_ROOT" + -- Ensure there are credentials available for uploading + createDirectoryIfMissing True (stackRoot "upload") + writeFile + (stackRoot "upload" "credentials.json") + "{\"username\":\"fake\",\"password\":\"fake\"}" + stack ["upload", "."] -- | Start a fake Hackage server to test the upload withFakeHackage :: IO a -> IO a withFakeHackage act = do - stackEnv <- stackExe - -- Build the dependencies for the fake server - stack $ withNetworkArgs ++ ["FakeHackageStart.hs"] - -- Start the fake server - withCreateProcess (proc stackEnv $ withNetworkArgs ++ ["FakeHackage.hs"]) $ \_ _ _ _ -> do - -- Wait for the fake server to start accepting requests - threadDelay 3000000 - act - where - withNetworkArgs = ["runghc", "--package", "network"] + stackEnv <- stackExe + -- Build the dependencies for the fake server + stack $ withNetworkArgs ++ ["FakeHackageStart.hs"] + -- Start the fake server + withCreateProcess (proc stackEnv $ withNetworkArgs ++ ["FakeHackage.hs"]) $ \_ _ _ _ -> do + -- Wait for the fake server to start accepting requests + threadDelay 3000000 + act + where + withNetworkArgs = ["runghc", "--package", "network"] diff --git a/tests/integration/tests/upload/files/.gitignore b/tests/integration/tests/upload/files/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/upload/files/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/upload/files/FakeHackage.hs b/tests/integration/tests/upload/files/FakeHackage.hs index eef4b9349b..3d39c7a445 100644 --- a/tests/integration/tests/upload/files/FakeHackage.hs +++ b/tests/integration/tests/upload/files/FakeHackage.hs @@ -1,32 +1,32 @@ {-# LANGUAGE OverloadedStrings #-} -import Control.Concurrent -import Control.Monad -import Network.Socket hiding (recv) -import Network.Socket.ByteString (recv, sendAll) -import System.Exit -import System.IO +import Control.Concurrent ( forkIO, threadDelay ) +import Control.Monad ( forever ) +import Network.Socket hiding ( recv ) +import Network.Socket.ByteString ( recv, sendAll ) +import System.Exit ( exitSuccess ) +import System.IO () -- | Fake server that always responds with HTTP OK main = - withSocketsDo $ do - _ <- forkIO serve - -- Exit after a delay to ensure the process doesn't linger around - threadDelay 10000000 - exitSuccess + withSocketsDo $ do + _ <- forkIO serve + -- Exit after a delay to ensure the process doesn't linger around + threadDelay 10000000 + exitSuccess serve :: IO () serve = do - let hints = defaultHints {addrFlags = [AI_PASSIVE], addrSocketType = Stream} - (addr:_) <- getAddrInfo (Just hints) Nothing (Just "12415") - sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr) - setSocketOption sock ReuseAddr 1 - bind sock (addrAddress addr) - listen sock 10 - forever $ do - (conn, _) <- accept sock - _ <- recv conn 1024 - sendAll - conn - "HTTP/1.1 200 OK\r\nContent-Length: 1\r\nContent-Type: text/plain\r\n\r\na" - shutdown conn ShutdownSend + let hints = defaultHints {addrFlags = [AI_PASSIVE], addrSocketType = Stream} + (addr:_) <- getAddrInfo (Just hints) Nothing (Just "12415") + sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr) + setSocketOption sock ReuseAddr 1 + bind sock (addrAddress addr) + listen sock 10 + forever $ do + (conn, _) <- accept sock + _ <- recv conn 1024 + sendAll + conn + "HTTP/1.1 200 OK\r\nContent-Length: 1\r\nContent-Type: text/plain\r\n\r\na" + shutdown conn ShutdownSend diff --git a/tests/integration/tests/upload/files/Foo.hs b/tests/integration/tests/upload/files/Foo.hs deleted file mode 100644 index efbf93bbde..0000000000 --- a/tests/integration/tests/upload/files/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/tests/integration/tests/upload/files/package.yaml b/tests/integration/tests/upload/files/package.yaml new file mode 100644 index 0000000000..75c0d254af --- /dev/null +++ b/tests/integration/tests/upload/files/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackage +description: Upload test description +license: BSD-3-Clause + +dependencies: +- base < 5 + +library: + source-dirs: src diff --git a/tests/integration/tests/upload/files/src/Lib.hs b/tests/integration/tests/upload/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/upload/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/upload/files/stack.yaml b/tests/integration/tests/upload/files/stack.yaml index 8fe9f02394..f4adc04431 100644 --- a/tests/integration/tests/upload/files/stack.yaml +++ b/tests/integration/tests/upload/files/stack.yaml @@ -1,2 +1,3 @@ snapshot: lts-24.37 + hackage-base-url: http://localhost:12415/ diff --git a/tests/integration/tests/upload/files/uploadtest.cabal b/tests/integration/tests/upload/files/uploadtest.cabal deleted file mode 100644 index fbf051d525..0000000000 --- a/tests/integration/tests/upload/files/uploadtest.cabal +++ /dev/null @@ -1,13 +0,0 @@ -build-type: Simple -name: uploadtest -version: 0.0.0 -category: test -maintainer: uploadtest@example.com -cabal-version: 1.20 -synopsis: Upload test -description: Upload test description -license: BSD3 -library - build-depends: base >= 4.7 && < 5 - exposed-modules: Foo - default-language: Haskell2010 diff --git a/tests/integration/tests/variables-in-template-file-names/Main.hs b/tests/integration/tests/variables-in-template-file-names/Main.hs index e2572ef0e0..598874ea80 100644 --- a/tests/integration/tests/variables-in-template-file-names/Main.hs +++ b/tests/integration/tests/variables-in-template-file-names/Main.hs @@ -1,10 +1,13 @@ -import StackTest -import System.Directory -import Control.Monad (unless) +-- | A Stack project template can be populated with the name of the Stack +-- project. + +import Control.Monad ( unless ) +import StackTest +import System.Directory ( doesFileExist ) main :: IO () main = do - removeDirIgnore "somename" - stack ["new", "somename", "./template.hsfiles"] - exists <- doesFileExist "somename/somename.cabal" + removeDirIgnore "myPackage" + stack ["new", "myPackage", "./template.hsfiles"] + exists <- doesFileExist "myPackage/myPackage.cabal" unless exists $ error "does not exist" diff --git a/tests/integration/tests/variables-in-template-file-names/files/.gitignore b/tests/integration/tests/variables-in-template-file-names/files/.gitignore index 6d57d66dd6..761adaef96 100644 --- a/tests/integration/tests/variables-in-template-file-names/files/.gitignore +++ b/tests/integration/tests/variables-in-template-file-names/files/.gitignore @@ -1 +1 @@ -/somename/ +myPackage/ diff --git a/tests/integration/tests/watched-files/Main.hs b/tests/integration/tests/watched-files/Main.hs index d683c93a0b..3cd9840459 100644 --- a/tests/integration/tests/watched-files/Main.hs +++ b/tests/integration/tests/watched-files/Main.hs @@ -1,6 +1,8 @@ -import StackTest -import Data.Foldable (for_) -import Control.Monad (unless) +-- | Stack recompiles when a file required for compilation is dirty. + +import Control.Monad ( unless ) +import Data.Foldable ( for_ ) +import StackTest main :: IO () main = for_ (words "foo bar baz bin") $ \x -> do diff --git a/tests/integration/tests/watched-files/files/.gitignore b/tests/integration/tests/watched-files/files/.gitignore index d09ee0af48..c93a3fc3e5 100644 --- a/tests/integration/tests/watched-files/files/.gitignore +++ b/tests/integration/tests/watched-files/files/.gitignore @@ -1,2 +1,2 @@ some-text-file.txt -*.cabal +myPackage.cabal diff --git a/tests/integration/tests/watched-files/files/Main.hs b/tests/integration/tests/watched-files/files/app/Main.hs similarity index 65% rename from tests/integration/tests/watched-files/files/Main.hs rename to tests/integration/tests/watched-files/files/app/Main.hs index a462eafd73..34d36111aa 100644 --- a/tests/integration/tests/watched-files/files/Main.hs +++ b/tests/integration/tests/watched-files/files/app/Main.hs @@ -1,9 +1,10 @@ {-# LANGUAGE TemplateHaskell #-} + module Main where -import Data.FileEmbed import qualified Data.ByteString as B -import System.IO (stdout) +import Data.FileEmbed ( embedFile ) +import System.IO ( stdout ) main :: IO () main = B.hPut stdout $(embedFile "some-text-file.txt") diff --git a/tests/integration/tests/watched-files/files/package.yaml b/tests/integration/tests/watched-files/files/package.yaml index 6611f13029..2132e12b97 100644 --- a/tests/integration/tests/watched-files/files/package.yaml +++ b/tests/integration/tests/watched-files/files/package.yaml @@ -1,9 +1,13 @@ -name: watched-files +spec-version: 0.36.0 + +name: myPackage + dependencies: - base - bytestring - file-embed executables: - watched: + myExe: + source-dirs: app main: Main.hs From d5ae3134951fa95d8ce3cb2551c85fb1e7cee1a0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 4 May 2026 21:05:30 +0100 Subject: [PATCH 66/75] Bump Hpack version --- ChangeLog.md | 2 +- stack-ghc-9.12.4.yaml | 2 ++ stack-ghc-9.12.4.yaml.lock | 7 +++++++ stack-ghc-9.14.1.yaml | 2 ++ stack-ghc-9.14.1.yaml.lock | 11 +++++++++-- stack.yaml | 2 ++ stack.yaml.lock | 7 +++++++ 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c71858fae9..ea5760e3c1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -18,7 +18,7 @@ Behavior changes: Other enhancements: -* Bump to Hpack 0.39.3. +* Bump to Hpack 0.39.5. * Experimental: Add flag `--[no-]semaphore` (default: disabled) to Stack's `build` command, to allow GHC to use a system semaphore to perform compilation in parallel when possible. Supported, by default, by GHC 9.10.1 or later. The diff --git a/stack-ghc-9.12.4.yaml b/stack-ghc-9.12.4.yaml index d7d09b8c8c..40933d3278 100644 --- a/stack-ghc-9.12.4.yaml +++ b/stack-ghc-9.12.4.yaml @@ -14,6 +14,8 @@ extra-deps: - crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 # nightly-2026-04-17 specifies crypton-x509-validation-1.6.14 - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +# nightly-2026-04-17 specifies hpack-0.39.3 +- hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 # nightly-2026-04-17 specifies rio-prettyprint-0.1.8.0 - rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 # nightly-2026-04-17 specifies tls-2.1.14 diff --git a/stack-ghc-9.12.4.yaml.lock b/stack-ghc-9.12.4.yaml.lock index 66dd35ed61..bc32ccd938 100644 --- a/stack-ghc-9.12.4.yaml.lock +++ b/stack-ghc-9.12.4.yaml.lock @@ -46,6 +46,13 @@ packages: size: 691 original: hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +- completed: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 + pantry-tree: + sha256: 75fe87db5a37bf3941e29e2273f530ee7b2932d64bf813b55151a889e97305ca + size: 3799 + original: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 - completed: hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 pantry-tree: diff --git a/stack-ghc-9.14.1.yaml b/stack-ghc-9.14.1.yaml index 78ab438005..27af9a4ec9 100644 --- a/stack-ghc-9.14.1.yaml +++ b/stack-ghc-9.14.1.yaml @@ -17,6 +17,8 @@ extra-deps: - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 # nightly-2026-04-17 specifies http-api-data-0.6.7 - http-api-data-0.7@sha256:b8145755fced98db1ac67f4f98c8010cd5f82c121a82b65addea2556b5fbd6d5,3157 +# nightly-2026-04-17 specifies hpack-0.39.3 +- hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 # nightly-2026-04-17 specifies rio-prettyprint-0.1.8.0 - rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 # nightly-2026-04-17 specifies tagged-0.8.9 diff --git a/stack-ghc-9.14.1.yaml.lock b/stack-ghc-9.14.1.yaml.lock index 64940d1e68..741ab25b36 100644 --- a/stack-ghc-9.14.1.yaml.lock +++ b/stack-ghc-9.14.1.yaml.lock @@ -52,7 +52,14 @@ packages: sha256: 4e67cbe25b355b6af68aee79c36b0f3c78428dbdd1be4298f4afaf000f3bc9a9 size: 819 original: - hackage: http-api-data-0.7 + hackage: http-api-data-0.7@sha256:b8145755fced98db1ac67f4f98c8010cd5f82c121a82b65addea2556b5fbd6d5,3157 +- completed: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 + pantry-tree: + sha256: 75fe87db5a37bf3941e29e2273f530ee7b2932d64bf813b55151a889e97305ca + size: 3799 + original: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 - completed: hackage: rio-prettyprint-0.1.9.0@sha256:f48afbfe28ed7be4d1a1bb96705669593dd5df12f28ed908516c6dfc4e0becbb,1375 pantry-tree: @@ -66,7 +73,7 @@ packages: sha256: 5ba1ff7ad9a676b89a2a6ab00ac2100f30a21440ef8e04094614ab5b5f494b3f size: 438 original: - hackage: tagged-0.8.10 + hackage: tagged-0.8.10@sha256:e9b97c98e9827981d62f37c5febf9e6bbb67acec92b8bd41fd9f7ace5eb31d32,2201 - completed: hackage: tls-2.2.2@sha256:95f5acd4ce76cbd6bdc46b737370dcbd93c59cf1cd1934a30e55c61c1dc140e9,7283 pantry-tree: diff --git a/stack.yaml b/stack.yaml index 5797518708..26339dc97d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -16,6 +16,8 @@ extra-deps: - crypton-x509-system-1.8.0@sha256:76bab32c7d9cb3ea356a905f85829c70967fb6f9b4b890f00d67dc54130d45ca,1521 # lts-24.37 specifies crypton-x509-validation-1.6.14 - crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +# lts-24.37 specifies hpack-0.38.3 +- hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 # lts-24.37 specifies pantry-0.10.1 - pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 # lts-24.37 specifies persistent-2.17.1.0 diff --git a/stack.yaml.lock b/stack.yaml.lock index da3ce742eb..1a119f0797 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -67,6 +67,13 @@ packages: size: 691 original: hackage: crypton-x509-validation-1.8.0@sha256:63acb2df06f28c3ffdddaf6d9402105b9026796036aa10d7347ae4f7db51c36b,2018 +- completed: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 + pantry-tree: + sha256: 75fe87db5a37bf3941e29e2273f530ee7b2932d64bf813b55151a889e97305ca + size: 3799 + original: + hackage: hpack-0.39.5@sha256:c214f49ed3df75ce75201709927fa27e08f642023ed4b4ca8cc43604e5199ced,5263 - completed: hackage: pantry-0.11.2@sha256:bc14e75f512deb22e0d9d645e62eb63b319d1732bfed6509491601215ecbd307,7896 pantry-tree: From fbd28cccc9c688670bb06675e9c8bcf3ef3e1df5 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Tue, 5 May 2026 00:01:25 +0100 Subject: [PATCH 67/75] Add/update code documentation --- src/Stack/Build/ConstructPlan.hs | 33 ++++++++++++++++---------- src/Stack/Types/Build/ConstructPlan.hs | 16 ++++++------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 8a625945a1..941ca44c04 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -46,7 +46,7 @@ import Stack.Package import Stack.Prelude hiding ( loadPackage ) import Stack.SourceMap ( getPLIVersion, mkProjectPackage ) import Stack.Types.Build.ConstructPlan - ( AddDepRes (..), CombinedMap, Ctx (..), M + ( AddDepRes (..), CombinedMap, Ctx (..), LibraryMap, M , MissingPresentDeps (..), PackageInfo (..), ToolWarning(..) , UnregisterState (..), W (..), adrHasLibrary, adrVersion , isAdrToInstall, toTask @@ -196,13 +196,17 @@ constructPlan targetPackageNames = Map.keys sourceMap.targets.targets -- Ignore the result of 'getCachedDepOrAddDep'. onTarget = void . getCachedDepOrAddDep + inner :: M () inner = mapM_ onTarget targetPackageNames - (((), W efinals installExes dirtyReason warnings parents), m) <- - liftIO $ runRIO ctx (runStateT (runWriterT inner) Map.empty) + action :: RIO Ctx (((), W), LibraryMap) + action = runStateT (runWriterT inner) Map.empty + (((), output), libraryMap) <- liftIO $ runRIO ctx action + let W efinals installExes dirtyReason warnings parents = output -- Report any warnings mapM_ prettyWarn (warnings []) -- Separate out errors - let (errlibs, adrs) = partitionEithers $ map toEither $ Map.toList m + let (errlibs, adrs) = + partitionEithers $ map toEither $ Map.toList libraryMap (errfinals, finals) = partitionEithers $ map toEither $ Map.toList efinals errs = errlibs ++ errfinals @@ -239,6 +243,13 @@ constructPlan hasBaseInDeps = Map.member (mkPackageName "base") sourceDeps + mkCtx :: + EnvConfig + -> Version + -> Map PackageName PackageSource + -> Maybe Curator + -> Text + -> Ctx mkCtx ctxEnvConfig globalCabalVersion sources curator pathEnvVar = Ctx { baseConfigOpts = baseConfigOpts0 , loadPackage = \w x y z -> runRIO ctxEnvConfig $ @@ -494,19 +505,17 @@ addFinal lp package allInOne buildHaddocks = do -- | Given a 'PackageName', adds all of the build tasks to build the package, if -- needed. First checks if the package name is in the library map. -- --- 'constructPlan' invokes this on all the target packages, setting --- @treatAsDep'@ to False, because those packages are direct build targets. +-- 'constructPlan' invokes this on all the target packages. +-- -- 'addPackageDeps' invokes this while recursing into the dependencies of a --- package. As such, it sets @treatAsDep'@ to True, forcing this package to be --- marked as a dependency, even if it is directly wanted. This makes sense - if --- we left out packages that are deps, it would break the --only-dependencies --- build plan. +-- package, even if it is directly wanted. This makes sense - if we left out +-- packages that are deps, it would break the --only-dependencies build plan. getCachedDepOrAddDep :: PackageName -> M (Either ConstructPlanException AddDepRes) getCachedDepOrAddDep name = do - libMap <- get - case Map.lookup name libMap of + libraryMap <- get + case Map.lookup name libraryMap of Just res -> do logDebugPlanS "getCachedDepOrAddDep" $ "Using cached result for " diff --git a/src/Stack/Types/Build/ConstructPlan.hs b/src/Stack/Types/Build/ConstructPlan.hs index 1f94cfbcbb..21a508c7b4 100644 --- a/src/Stack/Types/Build/ConstructPlan.hs +++ b/src/Stack/Types/Build/ConstructPlan.hs @@ -15,6 +15,7 @@ module Stack.Types.Build.ConstructPlan , CombinedMap , M , W (..) + , LibraryMap , AddDepRes (..) , toTask , adrVersion @@ -82,15 +83,7 @@ type CombinedMap = Map PackageName PackageInfo -- | Type synonym representing values used during the construction of a build -- plan. The type is an instance of 'Monad', hence its name. -type M = - WriterT - W - -- ^ The output to be collected - ( StateT - (Map PackageName (Either ConstructPlanException AddDepRes)) - -- ^ Library map - (RIO Ctx) - ) +type M = WriterT W (StateT LibraryMap (RIO Ctx)) -- | Type representing values used as the output to be collected during the -- construction of a build plan. @@ -121,6 +114,11 @@ instance Monoid W where mempty = memptydefault mappend = (<>) +-- | A type synonym representing dictionaries of package names, and either an +-- exception encountered during the construction of the build plan or the +-- 'Stack.Build.ConstructPlan.addDep' result. +type LibraryMap = Map PackageName (Either ConstructPlanException AddDepRes) + -- | Type representing results of 'Stack.Build.ConstructPlan.addDep'. data AddDepRes = ADRToInstall Task From 5d2578a4d0540ad8b76bdcfab730782905e6ce9e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 9 May 2026 19:16:02 +0100 Subject: [PATCH 68/75] Bump NSIS in CI --- .github/workflows/integration-tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index fdc13974b7..36880d2a9f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -76,22 +76,22 @@ jobs: ~\AppData\Roaming\stack ~\AppData\Local\Programs\stack key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }} - - name: Install NSIS 3.10 on Windows + - name: Install NSIS 3.12 on Windows if: startsWith(runner.os, 'Windows') - uses: repolevedavaj/install-nsis@v1.0.3 + uses: repolevedavaj/install-nsis@v1.2.0 with: - nsis-version: '3.10' + nsis-version: '3.12' # Upgrades to a 'large strings' build of NSIS 3.10 tool. See # https://nsis.sourceforge.io/Special_Builds. - - name: Upgrade NSIS 3.10 on Windows + - name: Upgrade NSIS 3.12 on Windows if: startsWith(runner.os, 'Windows') shell: bash run: | # wget is not available but the Stack-supplied MSYS2 will provide it - stack exec -- wget -O nsis-3.10-strlen_8192.zip https://downloads.sourceforge.net/nsis/NSIS%203/3.10/nsis-3.10-strlen_8192.zip - 7z x -aoa -o"/c/Program Files (x86)/NSIS" nsis-3.10-strlen_8192.zip + stack exec -- wget -O nsis-3.12-strlen_8192.zip https://downloads.sourceforge.net/nsis/NSIS%203/3.12/nsis-3.12-strlen_8192.zip + 7z x -aoa -o"/c/Program Files (x86)/NSIS" nsis-3.12-strlen_8192.zip # Clean up - rm nsis-3.10-strlen_8192.zip + rm nsis-3.12-strlen_8192.zip makensis -VERSION && echo # Should include defined symbol NSIS_MAX_STRLEN=8192 makensis -HDRINFO From 54d251bb7c1433e071af79b1fb69aef57aff6ec3 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 9 May 2026 16:50:47 +0100 Subject: [PATCH 69/75] Re #6095 Add PackageLoader type synoynm --- src/Stack/Build.hs | 9 ++------- src/Stack/Build/ConstructPlan.hs | 18 ++++++------------ src/Stack/Types/Build/ConstructPlan.hs | 26 ++++++++++++++++++-------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs index 06e754eca5..fb70273576 100644 --- a/src/Stack/Build.hs +++ b/src/Stack/Build.hs @@ -41,6 +41,7 @@ import Stack.Package ( buildableExes, resolvePackage ) import Stack.Prelude hiding ( loadPackage ) import Stack.Runners ( ShouldReexec (..), withConfig, withEnvConfig ) import Stack.Setup ( withNewLocalBuildTargets ) +import Stack.Types.Build.ConstructPlan ( PackageLoader ) import Stack.Types.Build.Exception ( BuildException (..), BuildPrettyException (..) ) import Stack.Types.BuildConfig ( HasBuildConfig, configFileL ) @@ -408,13 +409,7 @@ mkBaseConfigOpts buildOptsCLI = do } -- | Provide a function for loading package information from the package index -loadPackage :: - (HasBuildConfig env, HasSourceMap env) - => PackageLocationImmutable - -> Map FlagName Bool - -> [Text] -- ^ GHC options - -> [Text] -- ^ Cabal configure options - -> RIO env Package +loadPackage :: (HasBuildConfig env, HasSourceMap env) => PackageLoader (RIO env) loadPackage loc flags ghcOptions cabalConfigOpts = do compilerVersion <- view actualCompilerVersionL platform <- view platformL diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 941ca44c04..fce17b011b 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -47,9 +47,9 @@ import Stack.Prelude hiding ( loadPackage ) import Stack.SourceMap ( getPLIVersion, mkProjectPackage ) import Stack.Types.Build.ConstructPlan ( AddDepRes (..), CombinedMap, Ctx (..), LibraryMap, M - , MissingPresentDeps (..), PackageInfo (..), ToolWarning(..) - , UnregisterState (..), W (..), adrHasLibrary, adrVersion - , isAdrToInstall, toTask + , MissingPresentDeps (..), PackageInfo (..), PackageLoader + , ToolWarning(..), UnregisterState (..), W (..) + , adrHasLibrary, adrVersion, isAdrToInstall, toTask ) import Stack.Types.Build.Exception ( BadDependency (..), BuildException (..) @@ -122,15 +122,9 @@ constructPlan :: forall env. HasEnvConfig env => BaseConfigOpts -> [DumpPackage] -- ^ locally registered - -> ( PackageLocationImmutable - -> Map FlagName Bool - -> [Text] - -- ^ GHC options - -> [Text] - -- ^ Cabal configure options - -> RIO EnvConfig Package - ) - -- ^ load upstream package + -> PackageLoader (RIO EnvConfig) + -- ^ Function to load a 'Package' given the location of a package assumed + -- to be immutable. -> SourceMap -> InstalledMap -> Bool diff --git a/src/Stack/Types/Build/ConstructPlan.hs b/src/Stack/Types/Build/ConstructPlan.hs index 21a508c7b4..35a6c8b9a9 100644 --- a/src/Stack/Types/Build/ConstructPlan.hs +++ b/src/Stack/Types/Build/ConstructPlan.hs @@ -22,6 +22,7 @@ module Stack.Types.Build.ConstructPlan , adrHasLibrary , isAdrToInstall , Ctx (..) + , PackageLoader , UnregisterState (..) , ToolWarning (..) , MissingPresentDeps (..) @@ -173,14 +174,9 @@ instance Monoid MissingPresentDeps where data Ctx = Ctx { baseConfigOpts :: !BaseConfigOpts -- ^ Basic information used to determine configure options - , loadPackage :: !( PackageLocationImmutable - -> Map FlagName Bool - -> [Text] - -- ^ GHC options. - -> [Text] - -- ^ Cabal configure options. - -> M Package - ) + , loadPackage :: !(PackageLoader M) + -- ^ A function to load a `Package` given the location of a package assumed + -- to be immutable. , combinedMap :: !CombinedMap -- ^ A dictionary of package names, and combined information about the -- package in respect of whether or not it is already installed and, unless @@ -195,6 +191,20 @@ data Ctx = Ctx , pathEnvVar :: !Text } +-- | A type synonym representing functions that yield a 'Package' given the +-- location of a package assumed to be immutable, parameterised by the relevant +-- monad. +type PackageLoader m = + PackageLocationImmutable + -- ^ Location of a package that is assumed to be immutable. + -> Map FlagName Bool + -- ^ Cabal flags. + -> [Text] + -- ^ GHC options. + -> [Text] + -- ^ Cabal configure options. + -> m Package + instance HasPlatform Ctx where platformL = configL . platformL {-# INLINE platformL #-} From fa7576cfb73912b99c99c49d3f072bd2bcdd3c5d Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 9 May 2026 17:30:28 +0100 Subject: [PATCH 70/75] Re #6905 Increase plan construction debugging info --- src/Stack/Build/ConstructPlan.hs | 45 ++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index fce17b011b..44aac457a5 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -189,7 +189,11 @@ constructPlan let ctx = mkCtx econfig globalCabalVersion sources curator pathEnvVar targetPackageNames = Map.keys sourceMap.targets.targets -- Ignore the result of 'getCachedDepOrAddDep'. - onTarget = void . getCachedDepOrAddDep + onTarget pkgName = do + logDebugPlanS "constructPlan" $ + "Constructing for target " + <> fromPackageName pkgName + void $ getCachedDepOrAddDep pkgName inner :: M () inner = mapM_ onTarget targetPackageNames action :: RIO Ctx (((), W), LibraryMap) @@ -472,6 +476,7 @@ addFinal :: -- ^ Should Haddock documentation be built? -> M () addFinal lp package allInOne buildHaddocks = do + let name = package.name res <- addPackageDeps package >>= \case Left e -> pure $ Left e Right (MissingPresentDeps missing present _minLoc) -> do @@ -494,7 +499,11 @@ addFinal lp package allInOne buildHaddocks = do , cachePkgSrc = CacheSrcLocal (toFilePath (parent lp.cabalFP)) , buildTypeConfig = packageBuildTypeConfig package } - tell mempty { wFinals = Map.singleton package.name res } + logDebugPlanS "addFinal" $ + "Adding to construction output " + <> fromPackageName name + <> summariseResult res + tell mempty { wFinals = Map.singleton name res } -- | Given a 'PackageName', adds all of the build tasks to build the package, if -- needed. First checks if the package name is in the library map. @@ -545,10 +554,19 @@ checkCallStackAndAddDep name = do <> fromPackageName name <> "." pure $ Left $ UnknownPackage compiler name - Just packageInfo -> + Just packageInfo -> do + logDebugPlanS "checkCallStackAndAddDep" $ + "Pushing " + <> fromPackageName name + <> " on to the call stack." -- Add the current package name to the head of the call stack. - local (\ctx' -> ctx' { callStack = name : ctx'.callStack }) $ + res <- local (\ctx' -> ctx' { callStack = name : ctx'.callStack }) $ addDep name packageInfo + logDebugPlanS "checkCallStackAndAddDep" $ + "Popped " + <> fromPackageName name + <> " from the call stack." + pure res updateLibMap name res pure res @@ -816,10 +834,15 @@ packageBuildTypeConfig pkg = pkg.buildType == Configure -- Update response in the library map. If it is an error, and there's already an -- error about cyclic dependencies, prefer the cyclic error. updateLibMap :: PackageName -> Either ConstructPlanException AddDepRes -> M () -updateLibMap name val = modify $ \mp -> - case (Map.lookup name mp, val) of - (Just (Left DependencyCycleDetected{}), Left _) -> mp - _ -> Map.insert name val mp +updateLibMap name res = do + logDebugPlanS "updateLibMap" $ + "Updating for: " + <> fromPackageName name + <> summariseResult res + modify $ \mp -> + case (Map.lookup name mp, res) of + (Just (Left DependencyCycleDetected{}), Left _) -> mp + _ -> Map.insert name res mp addEllipsis :: Text -> Text addEllipsis t @@ -1267,6 +1290,12 @@ logDebugPlanS s msg = do debugPlan <- view $ globalOptsL . to (.planInLog) when debugPlan $ logDebugS s msg +-- | A function to summarise a result. Assumes that 'Left' is an error and +-- 'Right' is not. Intended to be used to annotate, so includes an initial space +-- character. +summariseResult :: Either a b -> Utf8Builder +summariseResult res = " (" <> either (const "error") (const "ok") res <> ")" + -- | A function to yield a 'PackageInfo' value from: (1) a 'PackageSource' -- value; and (2) a pair of an 'InstallLocation' value and an 'Installed' value. -- Checks that the version of the 'PackageSource' value and the version of the From 0c645f259f4ffa1677530fc33965374bd089a17e Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 9 May 2026 17:47:14 +0100 Subject: [PATCH 71/75] Re #6905 Minor reformatting/refactoring for clarity --- src/Stack/Build/ConstructPlan.hs | 53 ++++++++++++++++++++------------ src/Stack/Package.hs | 3 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 44aac457a5..5b9388a64d 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -121,7 +121,8 @@ import System.Environment ( lookupEnv ) constructPlan :: forall env. HasEnvConfig env => BaseConfigOpts - -> [DumpPackage] -- ^ locally registered + -> [DumpPackage] + -- ^ Locally registered. -> PackageLoader (RIO EnvConfig) -- ^ Function to load a 'Package' given the location of a package assumed -- to be immutable. @@ -248,18 +249,23 @@ constructPlan -> Maybe Curator -> Text -> Ctx - mkCtx ctxEnvConfig globalCabalVersion sources curator pathEnvVar = Ctx - { baseConfigOpts = baseConfigOpts0 - , loadPackage = \w x y z -> runRIO ctxEnvConfig $ - applyForceCustomBuild globalCabalVersion <$> loadPackage0 w x y z - , combinedMap = combineMap sources installedMap - , ctxEnvConfig - , callStack = [] - , wanted = Map.keysSet sourceMap.targets.targets - , localNames = Map.keysSet sourceProject - , curator - , pathEnvVar - } + mkCtx ctxEnvConfig globalCabalVersion sources curator pathEnvVar = + let loadPackage loc flags ghcOptions cabalConfigOpts = do + let action = do + package <- loadPackage0 loc flags ghcOptions cabalConfigOpts + pure $ applyForceCustomBuild globalCabalVersion package + runRIO ctxEnvConfig action + in Ctx + { baseConfigOpts = baseConfigOpts0 + , loadPackage + , combinedMap = combineMap sources installedMap + , ctxEnvConfig + , callStack = [] + , wanted = Map.keysSet sourceMap.targets.targets + , localNames = Map.keysSet sourceProject + , curator + , pathEnvVar + } toEither :: (k, Either e v) -> Either e (k, v) toEither (_, Left e) = Left e @@ -700,15 +706,16 @@ installPackage name ps minstalled = do resolveDepsAndInstall True lp.buildHaddocks ps lp.package minstalled Just tb -> do + -- Preserve the current library map. + libMap <- get -- Attempt to find a plan which performs an all-in-one build. Ignore -- the writer action + reset the state if it fails. - libMap <- get res <- pass $ do res <- addPackageDeps tb - let writerFunc w = case res of - Left _ -> mempty - _ -> w - pure (res, writerFunc) + let modifyOutput = case res of + Left _ -> const mempty + _ -> id + pure (res, modifyOutput) case res of Right deps -> do logDebugPlanS "installPackage" $ @@ -780,8 +787,14 @@ installPackageGivenDeps :: -> Maybe Installed -> MissingPresentDeps -> M AddDepRes -installPackageGivenDeps allInOne buildHaddocks ps package minstalled - (MissingPresentDeps missing present minMutable) = do +installPackageGivenDeps + allInOne + buildHaddocks + ps + package + minstalled + (MissingPresentDeps missing present minMutable) + = do let name = package.name mRightVersionInstalled <- case minstalled of Just installed -> if Set.null missing diff --git a/src/Stack/Package.hs b/src/Stack/Package.hs index a30ea47146..6ae52f7dd1 100644 --- a/src/Stack/Package.hs +++ b/src/Stack/Package.hs @@ -625,7 +625,8 @@ mkDepPackage pl = do -- | Force a package to be treated as a custom build type, see -- applyForceCustomBuild :: - Version -- ^ global Cabal version + Version + -- ^ Global Cabal version. -> Package -> Package applyForceCustomBuild cabalVersion package From 2af8b64753a01c7ef0a714464520979134e62763 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 9 May 2026 19:02:15 +0100 Subject: [PATCH 72/75] Fix #6905 Clear call stack in addFinal --- ChangeLog.md | 4 +++ src/Stack/Build/ConstructPlan.hs | 8 +++++- .../tests/6905-cyclic-plan/Main.hs | 27 +++++++++++++++++++ .../files/.gitignore | 3 ++- .../files/myPackageA/package.yaml | 11 ++++++++ .../files/myPackageA/src/LibA.hs | 5 ++++ .../files/myPackageB/package.yaml | 3 +-- .../files/myPackageB/src/LibB.hs | 0 .../files/myPackageB/test/Main.hs | 0 .../files/myPackageC/package.yaml | 16 +++++++++++ .../files/myPackageC/src/LibC.hs | 6 +++++ .../files/myPackageC/test/Main.hs | 4 +++ .../files/myPackageD/package.yaml | 11 ++++++++ .../files/myPackageD/src/LibD.hs | 5 ++++ .../tests/6905-cyclic-plan/files/stack1.yaml | 5 ++++ .../tests/6905-cyclic-plan/files/stack2.yaml | 5 ++++ .../{multi-test => 6905-multi-test}/Main.hs | 12 +++------ .../tests/6905-multi-test/files/.gitignore | 6 +++++ .../files/myPackageA/app/Main.hs | 0 .../files/myPackageA/package.yaml | 3 +-- .../files/myPackageA/src/LibA.hs | 0 .../files/myPackageA/test1/Main.hs | 0 .../files/myPackageA/test2/Main.hs | 0 .../files/myPackageA/test3/Main.hs | 0 .../files/myPackageB/package.yaml | 16 +++++++++++ .../files/myPackageB/src/LibB.hs | 6 +++++ .../files/myPackageB/test/Main.hs | 4 +++ .../files/myPackageC/app/Main.hs | 0 .../files/myPackageC/package.yaml | 0 .../files/myPackageC/src/LibC.hs | 0 .../files/myPackageC/test/Main.hs | 0 .../files/stack.yaml | 0 32 files changed, 145 insertions(+), 15 deletions(-) create mode 100644 tests/integration/tests/6905-cyclic-plan/Main.hs rename tests/integration/tests/{multi-test => 6905-cyclic-plan}/files/.gitignore (50%) create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageA/src/LibA.hs rename tests/integration/tests/{multi-test => 6905-cyclic-plan}/files/myPackageB/package.yaml (63%) rename tests/integration/tests/{multi-test => 6905-cyclic-plan}/files/myPackageB/src/LibB.hs (100%) rename tests/integration/tests/{multi-test => 6905-cyclic-plan}/files/myPackageB/test/Main.hs (100%) create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageC/package.yaml create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageC/src/LibC.hs create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageC/test/Main.hs create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageD/package.yaml create mode 100644 tests/integration/tests/6905-cyclic-plan/files/myPackageD/src/LibD.hs create mode 100644 tests/integration/tests/6905-cyclic-plan/files/stack1.yaml create mode 100644 tests/integration/tests/6905-cyclic-plan/files/stack2.yaml rename tests/integration/tests/{multi-test => 6905-multi-test}/Main.hs (71%) create mode 100644 tests/integration/tests/6905-multi-test/files/.gitignore rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/app/Main.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/package.yaml (82%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/src/LibA.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/test1/Main.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/test2/Main.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageA/test3/Main.hs (100%) create mode 100644 tests/integration/tests/6905-multi-test/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/6905-multi-test/files/myPackageB/src/LibB.hs create mode 100644 tests/integration/tests/6905-multi-test/files/myPackageB/test/Main.hs rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageC/app/Main.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageC/package.yaml (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageC/src/LibC.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/myPackageC/test/Main.hs (100%) rename tests/integration/tests/{multi-test => 6905-multi-test}/files/stack.yaml (100%) diff --git a/ChangeLog.md b/ChangeLog.md index ea5760e3c1..438070e61a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -51,6 +51,10 @@ Bug fixes: * After March 2026, Hackage requires Stack's user agent to be set when applying digest authentication to a request. Stack's `upload` command now does that, re-establishing authentication by Hackage username and password. +* Stack 3.9.3 and earlier fail to construct a build plan if project package A + depends on project package B and package B's executables (only) depend on + package A and the name of A is before that of B, alphabetically. That bug is + fixed. ## v3.9.3 - 2026-02-19 diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 5b9388a64d..37959fe739 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -483,7 +483,9 @@ addFinal :: -> M () addFinal lp package allInOne buildHaddocks = do let name = package.name - res <- addPackageDeps package >>= \case + logDebugPlanS "addFinal" "Clearing the call stack." + res <- local (\ctx' -> ctx' { callStack = [] }) $ + addPackageDeps package >>= \case Left e -> pure $ Left e Right (MissingPresentDeps missing present _minLoc) -> do let pkgConfigOpts = packageConfigureOptsFromPackage package @@ -505,6 +507,10 @@ addFinal lp package allInOne buildHaddocks = do , cachePkgSrc = CacheSrcLocal (toFilePath (parent lp.cabalFP)) , buildTypeConfig = packageBuildTypeConfig package } + ctx <- ask + logDebugPlanS "addFinal" $ + "Restoring the call stack: " + <> fromString (show $ map packageNameString ctx.callStack) logDebugPlanS "addFinal" $ "Adding to construction output " <> fromPackageName name diff --git a/tests/integration/tests/6905-cyclic-plan/Main.hs b/tests/integration/tests/6905-cyclic-plan/Main.hs new file mode 100644 index 0000000000..75120e5d06 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/Main.hs @@ -0,0 +1,27 @@ +-- | The test's project has project packages A and B. +-- +-- In terms of main libraries, the dependencies are (->- is 'depends on'): +-- +-- A ->- B +-- +-- In terms of executables (a test suite): +-- +-- B ->- A +-- +-- As, overall, A ->- B and B ->- A, packages A and B cannot be built +-- 'all-in-one'. +-- +-- This integration test tests: +-- +-- * when A is named myPackageA and B is named myPackageB; and +-- +-- * when A is named myPackageD and B is named myPackageC. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6905 + +import StackTest + +main :: IO () +main = do + stack ["--stack-yaml", "stack1.yaml", "test"] + stack ["--stack-yaml", "stack2.yaml", "test"] diff --git a/tests/integration/tests/multi-test/files/.gitignore b/tests/integration/tests/6905-cyclic-plan/files/.gitignore similarity index 50% rename from tests/integration/tests/multi-test/files/.gitignore rename to tests/integration/tests/6905-cyclic-plan/files/.gitignore index 0f3e4a815f..5087095541 100644 --- a/tests/integration/tests/multi-test/files/.gitignore +++ b/tests/integration/tests/6905-cyclic-plan/files/.gitignore @@ -1,3 +1,4 @@ myPackageA.cabal +myPackageB.cabal myPackageC.cabal -0myPackageB.cabal +myPackageD.cabal diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageA/package.yaml b/tests/integration/tests/6905-cyclic-plan/files/myPackageA/package.yaml new file mode 100644 index 0000000000..bb7167768b --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageA/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageA + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageB diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageA/src/LibA.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageA/src/LibA.hs new file mode 100644 index 0000000000..743d4bf8d0 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageA/src/LibA.hs @@ -0,0 +1,5 @@ +module LibA + ( funcB + ) where + +import LibB ( funcB ) diff --git a/tests/integration/tests/multi-test/files/myPackageB/package.yaml b/tests/integration/tests/6905-cyclic-plan/files/myPackageB/package.yaml similarity index 63% rename from tests/integration/tests/multi-test/files/myPackageB/package.yaml rename to tests/integration/tests/6905-cyclic-plan/files/myPackageB/package.yaml index 202a258230..c5d19b86c3 100644 --- a/tests/integration/tests/multi-test/files/myPackageB/package.yaml +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageB/package.yaml @@ -1,7 +1,6 @@ spec-version: 0.36.0 -# Only builds if this package name comes before myPackageA, alphabetically! -name: 0myPackageB +name: myPackageB dependencies: - base diff --git a/tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageB/src/LibB.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageB/src/LibB.hs rename to tests/integration/tests/6905-cyclic-plan/files/myPackageB/src/LibB.hs diff --git a/tests/integration/tests/multi-test/files/myPackageB/test/Main.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageB/test/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageB/test/Main.hs rename to tests/integration/tests/6905-cyclic-plan/files/myPackageB/test/Main.hs diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageC/package.yaml b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/package.yaml new file mode 100644 index 0000000000..89dfd7f40b --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/package.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackageC + +dependencies: +- base + +library: + source-dirs: src + +tests: + test: + source-dirs: test + main: Main.hs + dependencies: + - myPackageD diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageC/src/LibC.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/src/LibC.hs new file mode 100644 index 0000000000..28474cddd5 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/src/LibC.hs @@ -0,0 +1,6 @@ +module LibC + ( funcC + ) where + +funcC :: IO () +funcC = pure () diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageC/test/Main.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/test/Main.hs new file mode 100644 index 0000000000..c438615556 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageC/test/Main.hs @@ -0,0 +1,4 @@ +import LibD ( funcC ) + +main :: IO () +main = funcC diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageD/package.yaml b/tests/integration/tests/6905-cyclic-plan/files/myPackageD/package.yaml new file mode 100644 index 0000000000..1d913ac5ef --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageD/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageD + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageC diff --git a/tests/integration/tests/6905-cyclic-plan/files/myPackageD/src/LibD.hs b/tests/integration/tests/6905-cyclic-plan/files/myPackageD/src/LibD.hs new file mode 100644 index 0000000000..481d4e7f69 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/myPackageD/src/LibD.hs @@ -0,0 +1,5 @@ +module LibD + ( funcC + ) where + +import LibC ( funcC ) diff --git a/tests/integration/tests/6905-cyclic-plan/files/stack1.yaml b/tests/integration/tests/6905-cyclic-plan/files/stack1.yaml new file mode 100644 index 0000000000..68891a8d7c --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/stack1.yaml @@ -0,0 +1,5 @@ +snapshot: ghc-9.10.3 + +packages: +- myPackageA +- myPackageB diff --git a/tests/integration/tests/6905-cyclic-plan/files/stack2.yaml b/tests/integration/tests/6905-cyclic-plan/files/stack2.yaml new file mode 100644 index 0000000000..740f730a48 --- /dev/null +++ b/tests/integration/tests/6905-cyclic-plan/files/stack2.yaml @@ -0,0 +1,5 @@ +snapshot: ghc-9.10.3 + +packages: +- myPackageC +- myPackageD diff --git a/tests/integration/tests/multi-test/Main.hs b/tests/integration/tests/6905-multi-test/Main.hs similarity index 71% rename from tests/integration/tests/multi-test/Main.hs rename to tests/integration/tests/6905-multi-test/Main.hs index 32853b1673..2e21e47b41 100644 --- a/tests/integration/tests/multi-test/Main.hs +++ b/tests/integration/tests/6905-multi-test/Main.hs @@ -11,9 +11,9 @@ -- As, overall, A ->- B and B ->- A, packages A and B cannot be built -- 'all-in-one'. -- --- This integration test passes when A is named myPackageA and B is named --- 0myPackageB, but it fails when B is renamed myPackageB. That must be a bug in --- Stack. +-- A, B and C are named myPackageA, myPackageB and myPackageC respectively. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6905 import Control.Monad ( unless ) import Data.List ( isInfixOf ) @@ -21,14 +21,8 @@ import StackTest main :: IO () main = do - -- FIXME: Make 'clean' unnecessary (see #1411) - stack ["clean"] stackCheckStderr ["test", "--coverage"] $ \out -> do unless ("The coverage report for myPackageA's test-suite test1 is available at" `isInfixOf` out) $ fail "Didn't get expected report for test1" unless ("[S-6829]" `isInfixOf` out) $ fail "Didn't get expected empty report for test2" - -- Test then build works too. - stack ["clean"] - stack ["test"] - stack ["build"] diff --git a/tests/integration/tests/6905-multi-test/files/.gitignore b/tests/integration/tests/6905-multi-test/files/.gitignore new file mode 100644 index 0000000000..03e2c6587b --- /dev/null +++ b/tests/integration/tests/6905-multi-test/files/.gitignore @@ -0,0 +1,6 @@ +myPackageA.cabal +myPackageB.cabal +myPackageC.cabal +myPackageD.cabal +myPackageE.cabal +myPackageF.cabal diff --git a/tests/integration/tests/multi-test/files/myPackageA/app/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageA/app/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageA/app/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageA/app/Main.hs diff --git a/tests/integration/tests/multi-test/files/myPackageA/package.yaml b/tests/integration/tests/6905-multi-test/files/myPackageA/package.yaml similarity index 82% rename from tests/integration/tests/multi-test/files/myPackageA/package.yaml rename to tests/integration/tests/6905-multi-test/files/myPackageA/package.yaml index 7811ddfd05..d246bd23b8 100644 --- a/tests/integration/tests/multi-test/files/myPackageA/package.yaml +++ b/tests/integration/tests/6905-multi-test/files/myPackageA/package.yaml @@ -8,8 +8,7 @@ dependencies: library: source-dirs: src dependencies: - # Only builds if this package name comes before myPackageA, alphabetically! - - 0myPackageB + - myPackageB executables: myExeA: diff --git a/tests/integration/tests/multi-test/files/myPackageA/src/LibA.hs b/tests/integration/tests/6905-multi-test/files/myPackageA/src/LibA.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageA/src/LibA.hs rename to tests/integration/tests/6905-multi-test/files/myPackageA/src/LibA.hs diff --git a/tests/integration/tests/multi-test/files/myPackageA/test1/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageA/test1/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageA/test1/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageA/test1/Main.hs diff --git a/tests/integration/tests/multi-test/files/myPackageA/test2/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageA/test2/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageA/test2/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageA/test2/Main.hs diff --git a/tests/integration/tests/multi-test/files/myPackageA/test3/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageA/test3/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageA/test3/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageA/test3/Main.hs diff --git a/tests/integration/tests/6905-multi-test/files/myPackageB/package.yaml b/tests/integration/tests/6905-multi-test/files/myPackageB/package.yaml new file mode 100644 index 0000000000..c5d19b86c3 --- /dev/null +++ b/tests/integration/tests/6905-multi-test/files/myPackageB/package.yaml @@ -0,0 +1,16 @@ +spec-version: 0.36.0 + +name: myPackageB + +dependencies: +- base + +library: + source-dirs: src + +tests: + test: + source-dirs: test + main: Main.hs + dependencies: + - myPackageA diff --git a/tests/integration/tests/6905-multi-test/files/myPackageB/src/LibB.hs b/tests/integration/tests/6905-multi-test/files/myPackageB/src/LibB.hs new file mode 100644 index 0000000000..e714f965fe --- /dev/null +++ b/tests/integration/tests/6905-multi-test/files/myPackageB/src/LibB.hs @@ -0,0 +1,6 @@ +module LibB + ( funcB + ) where + +funcB :: IO () +funcB = pure () diff --git a/tests/integration/tests/6905-multi-test/files/myPackageB/test/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageB/test/Main.hs new file mode 100644 index 0000000000..e7c27dd1be --- /dev/null +++ b/tests/integration/tests/6905-multi-test/files/myPackageB/test/Main.hs @@ -0,0 +1,4 @@ +import LibA ( funcB ) + +main :: IO () +main = funcB diff --git a/tests/integration/tests/multi-test/files/myPackageC/app/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageC/app/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageC/app/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageC/app/Main.hs diff --git a/tests/integration/tests/multi-test/files/myPackageC/package.yaml b/tests/integration/tests/6905-multi-test/files/myPackageC/package.yaml similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageC/package.yaml rename to tests/integration/tests/6905-multi-test/files/myPackageC/package.yaml diff --git a/tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs b/tests/integration/tests/6905-multi-test/files/myPackageC/src/LibC.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageC/src/LibC.hs rename to tests/integration/tests/6905-multi-test/files/myPackageC/src/LibC.hs diff --git a/tests/integration/tests/multi-test/files/myPackageC/test/Main.hs b/tests/integration/tests/6905-multi-test/files/myPackageC/test/Main.hs similarity index 100% rename from tests/integration/tests/multi-test/files/myPackageC/test/Main.hs rename to tests/integration/tests/6905-multi-test/files/myPackageC/test/Main.hs diff --git a/tests/integration/tests/multi-test/files/stack.yaml b/tests/integration/tests/6905-multi-test/files/stack.yaml similarity index 100% rename from tests/integration/tests/multi-test/files/stack.yaml rename to tests/integration/tests/6905-multi-test/files/stack.yaml From c331cb2c0bf719a3b5641d4bf606db34a169df89 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 10 May 2026 01:07:52 +0100 Subject: [PATCH 73/75] Re #6905 Add another test with a genuine cycle --- .../tests/6905-invalid-cycle/Main.hs | 35 +++++++++++++++++++ .../tests/6905-invalid-cycle/files/.gitignore | 4 +++ .../files/myPackageA/package.yaml | 11 ++++++ .../files/myPackageA/src/LibA.hs | 5 +++ .../files/myPackageB/package.yaml | 17 +++++++++ .../files/myPackageB/src/LibB.hs | 6 ++++ .../files/myPackageB/test/Main.hs | 7 ++++ .../files/myPackageC/package.yaml | 11 ++++++ .../files/myPackageC/src/LibC.hs | 8 +++++ .../files/myPackageD/package.yaml | 11 ++++++ .../files/myPackageD/src/LibD.hs | 8 +++++ .../tests/6905-invalid-cycle/files/stack.yaml | 7 ++++ 12 files changed, 130 insertions(+) create mode 100644 tests/integration/tests/6905-invalid-cycle/Main.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/.gitignore create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageA/package.yaml create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageA/src/LibA.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageB/package.yaml create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageB/src/LibB.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageB/test/Main.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageC/package.yaml create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageC/src/LibC.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageD/package.yaml create mode 100644 tests/integration/tests/6905-invalid-cycle/files/myPackageD/src/LibD.hs create mode 100644 tests/integration/tests/6905-invalid-cycle/files/stack.yaml diff --git a/tests/integration/tests/6905-invalid-cycle/Main.hs b/tests/integration/tests/6905-invalid-cycle/Main.hs new file mode 100644 index 0000000000..34e3959973 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/Main.hs @@ -0,0 +1,35 @@ +-- | The test's project has project packages A, B, C and D. +-- +-- In terms of main libraries, the dependencies are (->- is 'depends on'): +-- +-- A ->- B and C ->- D, D ->- C (a cycle) +-- +-- In terms of executables (a test suite): +-- +-- B ->- A, B ->- C +-- +-- As, overall, A ->- B and B ->- A, packages A and B cannot be built +-- 'all-in-one'. However, if the test suite of B is not being built, A and B can +-- be built. + +-- The test suite of B cannot be built, because C ->- D and D ->- C. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6905 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest + +main :: IO () +main = do + stack ["build", "myPackageA", "myPackageB"] + stackErrStderr ["test", "myPackageB"] (expectMessage dependencyCycleDetected) + +dependencyCycleDetected :: String +dependencyCycleDetected = + "myPackageC dependency cycle detected: myPackageC, myPackageD, myPackageC" + +expectMessage :: String -> String -> IO () +expectMessage msg stderr = + unless (words msg `isInfixOf` words stderr) + (error $ "Expected a warning: \n" ++ show msg) diff --git a/tests/integration/tests/6905-invalid-cycle/files/.gitignore b/tests/integration/tests/6905-invalid-cycle/files/.gitignore new file mode 100644 index 0000000000..5087095541 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/.gitignore @@ -0,0 +1,4 @@ +myPackageA.cabal +myPackageB.cabal +myPackageC.cabal +myPackageD.cabal diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageA/package.yaml b/tests/integration/tests/6905-invalid-cycle/files/myPackageA/package.yaml new file mode 100644 index 0000000000..bb7167768b --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageA/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageA + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageB diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageA/src/LibA.hs b/tests/integration/tests/6905-invalid-cycle/files/myPackageA/src/LibA.hs new file mode 100644 index 0000000000..743d4bf8d0 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageA/src/LibA.hs @@ -0,0 +1,5 @@ +module LibA + ( funcB + ) where + +import LibB ( funcB ) diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageB/package.yaml b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/package.yaml new file mode 100644 index 0000000000..dbdaaca9ee --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/package.yaml @@ -0,0 +1,17 @@ +spec-version: 0.36.0 + +name: myPackageB + +dependencies: +- base + +library: + source-dirs: src + +tests: + test: + source-dirs: test + main: Main.hs + dependencies: + - myPackageA + - myPackageC diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageB/src/LibB.hs b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/src/LibB.hs new file mode 100644 index 0000000000..e714f965fe --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/src/LibB.hs @@ -0,0 +1,6 @@ +module LibB + ( funcB + ) where + +funcB :: IO () +funcB = pure () diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageB/test/Main.hs b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/test/Main.hs new file mode 100644 index 0000000000..4443983c52 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageB/test/Main.hs @@ -0,0 +1,7 @@ +import LibA ( funcB ) +import LibC ( funcC ) + +main :: IO () +main = do + funcB + funcC diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageC/package.yaml b/tests/integration/tests/6905-invalid-cycle/files/myPackageC/package.yaml new file mode 100644 index 0000000000..d657e99064 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageC/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageC + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageD diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageC/src/LibC.hs b/tests/integration/tests/6905-invalid-cycle/files/myPackageC/src/LibC.hs new file mode 100644 index 0000000000..b692cc5dc4 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageC/src/LibC.hs @@ -0,0 +1,8 @@ +module LibC + ( funcC + ) where + +import LibD ( funcD ) + +funcC :: IO () +funcC = funcD diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageD/package.yaml b/tests/integration/tests/6905-invalid-cycle/files/myPackageD/package.yaml new file mode 100644 index 0000000000..1d913ac5ef --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageD/package.yaml @@ -0,0 +1,11 @@ +spec-version: 0.36.0 + +name: myPackageD + +dependencies: +- base + +library: + source-dirs: src + dependencies: + - myPackageC diff --git a/tests/integration/tests/6905-invalid-cycle/files/myPackageD/src/LibD.hs b/tests/integration/tests/6905-invalid-cycle/files/myPackageD/src/LibD.hs new file mode 100644 index 0000000000..33b5940491 --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/myPackageD/src/LibD.hs @@ -0,0 +1,8 @@ +module LibD + ( funcD + ) where + +import LibC ( funcC ) + +funcD :: IO () +funcD = funcC diff --git a/tests/integration/tests/6905-invalid-cycle/files/stack.yaml b/tests/integration/tests/6905-invalid-cycle/files/stack.yaml new file mode 100644 index 0000000000..240f775bdc --- /dev/null +++ b/tests/integration/tests/6905-invalid-cycle/files/stack.yaml @@ -0,0 +1,7 @@ +snapshot: ghc-9.10.3 + +packages: +- myPackageA +- myPackageB +- myPackageC +- myPackageD From 3ed4c141eb939dee003238fa4dd2d2b03acc125f Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 10 May 2026 17:15:57 +0100 Subject: [PATCH 74/75] Fix, improve integration test 3770-no-rerun-tests --- .../tests/3770-no-rerun-tests/Main.hs | 25 +++++++++++++++++++ .../files/.gitignore | 1 - .../files/package.yaml | 3 --- .../files/stack.yaml | 0 .../3770-no-rerun-tests/files/test/Main.hs | 2 ++ .../integration/tests/no-rerun-tests/Main.hs | 15 ----------- .../tests/no-rerun-tests/files/test/Main.hs | 2 -- 7 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 tests/integration/tests/3770-no-rerun-tests/Main.hs rename tests/integration/tests/{no-rerun-tests => 3770-no-rerun-tests}/files/.gitignore (66%) rename tests/integration/tests/{no-rerun-tests => 3770-no-rerun-tests}/files/package.yaml (80%) rename tests/integration/tests/{no-rerun-tests => 3770-no-rerun-tests}/files/stack.yaml (100%) create mode 100644 tests/integration/tests/3770-no-rerun-tests/files/test/Main.hs delete mode 100644 tests/integration/tests/no-rerun-tests/Main.hs delete mode 100644 tests/integration/tests/no-rerun-tests/files/test/Main.hs diff --git a/tests/integration/tests/3770-no-rerun-tests/Main.hs b/tests/integration/tests/3770-no-rerun-tests/Main.hs new file mode 100644 index 0000000000..6a08206e94 --- /dev/null +++ b/tests/integration/tests/3770-no-rerun-tests/Main.hs @@ -0,0 +1,25 @@ +-- | Stack can avoid re-running successful test suites. +-- +-- See: https://github.com/commercialhaskell/stack/pull/3770 + +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest + +main :: IO () +main = do + stackCheckStderr ["test"] (expectMessage testSuitePassed) + stackCheckStderr + ["test", "--no-rerun-tests"] + (expectMessage skippedAlreadyPassedTest) + +testSuitePassed :: String +testSuitePassed = "Test suite test passed" + +skippedAlreadyPassedTest :: String +skippedAlreadyPassedTest = "skipping already passed test" + +expectMessage :: String -> String -> IO () +expectMessage msg stderr = do + unless (words msg `isInfixOf` words stderr) $ + error $ "Expected output: \n" ++ show msg diff --git a/tests/integration/tests/no-rerun-tests/files/.gitignore b/tests/integration/tests/3770-no-rerun-tests/files/.gitignore similarity index 66% rename from tests/integration/tests/no-rerun-tests/files/.gitignore rename to tests/integration/tests/3770-no-rerun-tests/files/.gitignore index abd3798762..b0a5a052a1 100644 --- a/tests/integration/tests/no-rerun-tests/files/.gitignore +++ b/tests/integration/tests/3770-no-rerun-tests/files/.gitignore @@ -1,2 +1 @@ myPackage.cabal -testRan diff --git a/tests/integration/tests/no-rerun-tests/files/package.yaml b/tests/integration/tests/3770-no-rerun-tests/files/package.yaml similarity index 80% rename from tests/integration/tests/no-rerun-tests/files/package.yaml rename to tests/integration/tests/3770-no-rerun-tests/files/package.yaml index bbdc2419b9..9a50489941 100644 --- a/tests/integration/tests/no-rerun-tests/files/package.yaml +++ b/tests/integration/tests/3770-no-rerun-tests/files/package.yaml @@ -5,9 +5,6 @@ name: myPackage dependencies: - base -library: - source-dirs: src - tests: test: source-dirs: test diff --git a/tests/integration/tests/no-rerun-tests/files/stack.yaml b/tests/integration/tests/3770-no-rerun-tests/files/stack.yaml similarity index 100% rename from tests/integration/tests/no-rerun-tests/files/stack.yaml rename to tests/integration/tests/3770-no-rerun-tests/files/stack.yaml diff --git a/tests/integration/tests/3770-no-rerun-tests/files/test/Main.hs b/tests/integration/tests/3770-no-rerun-tests/files/test/Main.hs new file mode 100644 index 0000000000..d582e1e36a --- /dev/null +++ b/tests/integration/tests/3770-no-rerun-tests/files/test/Main.hs @@ -0,0 +1,2 @@ +main :: IO () +main = pure () diff --git a/tests/integration/tests/no-rerun-tests/Main.hs b/tests/integration/tests/no-rerun-tests/Main.hs deleted file mode 100644 index 98d289a605..0000000000 --- a/tests/integration/tests/no-rerun-tests/Main.hs +++ /dev/null @@ -1,15 +0,0 @@ --- | Stack can avoid re-running successful test suites. - -import Control.Monad ( unless, when ) -import StackTest -import System.Directory ( doesFileExist, removeFile ) - -main :: IO () -main = do - stack ["test"] - exists1 <- doesFileExist "testRan" - unless exists1 $ error "exists1 should be True" - removeFile "testRan" - stack ["test", "--no-rerun-tests"] - exists2 <- doesFileExist "testRan" - when exists2 $ error "exists2 should be False" diff --git a/tests/integration/tests/no-rerun-tests/files/test/Main.hs b/tests/integration/tests/no-rerun-tests/files/test/Main.hs deleted file mode 100644 index d900d0cd96..0000000000 --- a/tests/integration/tests/no-rerun-tests/files/test/Main.hs +++ /dev/null @@ -1,2 +0,0 @@ -main :: IO () -main = writeFile "testRan" "" From a13fadbdc63da8ac8133bf46603ecd5c99cbb3b4 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Mon, 11 May 2026 14:09:33 +0100 Subject: [PATCH 75/75] Re #6342 Add an integration test --- .../6342-say-ghc-version-in-build/.gitignore | 1 + .../6342-say-ghc-version-in-build/Main.hs | 25 +++++++++++++++++++ .../files/package.yaml | 9 +++++++ .../files/src/Lib.hs | 1 + .../files/stack.yaml | 1 + 5 files changed, 37 insertions(+) create mode 100644 tests/integration/tests/6342-say-ghc-version-in-build/.gitignore create mode 100644 tests/integration/tests/6342-say-ghc-version-in-build/Main.hs create mode 100644 tests/integration/tests/6342-say-ghc-version-in-build/files/package.yaml create mode 100644 tests/integration/tests/6342-say-ghc-version-in-build/files/src/Lib.hs create mode 100644 tests/integration/tests/6342-say-ghc-version-in-build/files/stack.yaml diff --git a/tests/integration/tests/6342-say-ghc-version-in-build/.gitignore b/tests/integration/tests/6342-say-ghc-version-in-build/.gitignore new file mode 100644 index 0000000000..b0a5a052a1 --- /dev/null +++ b/tests/integration/tests/6342-say-ghc-version-in-build/.gitignore @@ -0,0 +1 @@ +myPackage.cabal diff --git a/tests/integration/tests/6342-say-ghc-version-in-build/Main.hs b/tests/integration/tests/6342-say-ghc-version-in-build/Main.hs new file mode 100644 index 0000000000..51385a13ab --- /dev/null +++ b/tests/integration/tests/6342-say-ghc-version-in-build/Main.hs @@ -0,0 +1,25 @@ +-- Stack outputs the GHC version that it is using during a build. +-- +-- See: https://github.com/commercialhaskell/stack/issues/6342 + +import Control.Monad ( unless ) +import Data.Char ( isSpace ) +import Data.List ( dropWhileEnd, isInfixOf ) +import StackTest + +main :: IO () +main = + -- Query the actual compiler + stackCheckStdout ["query", "compiler", "actual"] $ \compiler -> do + stackCheckStderr ["build"] (expectMessage $ buildWith (trimEnd compiler)) + +buildWith :: String -> String +buildWith compiler = "build (lib) with " <> compiler + +expectMessage :: String -> String -> IO () +expectMessage msg stderr = do + unless (words msg `isInfixOf` words stderr) + (error $ "Expected message: \n" ++ show msg) + +trimEnd :: String -> String +trimEnd = dropWhileEnd isSpace diff --git a/tests/integration/tests/6342-say-ghc-version-in-build/files/package.yaml b/tests/integration/tests/6342-say-ghc-version-in-build/files/package.yaml new file mode 100644 index 0000000000..2e4f2c0854 --- /dev/null +++ b/tests/integration/tests/6342-say-ghc-version-in-build/files/package.yaml @@ -0,0 +1,9 @@ +spec-version: 0.36.0 + +name: myPackage + +dependencies: +- base < 5 + +library: + source-dirs: src diff --git a/tests/integration/tests/6342-say-ghc-version-in-build/files/src/Lib.hs b/tests/integration/tests/6342-say-ghc-version-in-build/files/src/Lib.hs new file mode 100644 index 0000000000..6d85a26fe1 --- /dev/null +++ b/tests/integration/tests/6342-say-ghc-version-in-build/files/src/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/tests/integration/tests/6342-say-ghc-version-in-build/files/stack.yaml b/tests/integration/tests/6342-say-ghc-version-in-build/files/stack.yaml new file mode 100644 index 0000000000..e674eab75a --- /dev/null +++ b/tests/integration/tests/6342-say-ghc-version-in-build/files/stack.yaml @@ -0,0 +1 @@ +snapshot: ghc-9.10.3