From 1f51ff7d7a763103340a84d077719c44f7a5fdf8 Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 17:17:43 +0900 Subject: [PATCH 01/10] Add bcClean flag to BuildConfig --- src/Stack/Config.hs | 1 + src/Stack/Types/Config.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index d6cc446cf7..4d2b9f0600 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -616,6 +616,7 @@ loadBuildConfig mproject maresolver mcompiler = do LCSProject _ -> False LCSNoConfig _ -> False , bcCurator = projectCurator project + , bcClean = False } where getEmptyProject :: Maybe SnapshotLocation -> RIO Config Project diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index f189a03305..06fd66019d 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -507,6 +507,7 @@ data BuildConfig = BuildConfig -- ^ Are we loading from the implicit global stack.yaml? This is useful -- for providing better error messages. , bcCurator :: !(Maybe Curator) + , bcClean :: !Bool } stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File) From 1f2b95dc2bf73a5e035dcff48a867a5ff348b8f0 Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 17:47:54 +0900 Subject: [PATCH 02/10] Add extra flag --- src/Stack/Runners.hs | 6 ++++-- src/main/Main.hs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Stack/Runners.hs b/src/Stack/Runners.hs index 24c6b56817..72e505d2fd 100644 --- a/src/Stack/Runners.hs +++ b/src/Stack/Runners.hs @@ -140,6 +140,7 @@ withBuildConfigAndLockNoDocker go inner = withBuildConfigExt :: Bool + -> Bool -- ^ If perform the stack clean -> GlobalOpts -> Maybe (RIO Config ()) -- ^ Action to perform before the build. This will be run on the host @@ -155,7 +156,7 @@ withBuildConfigExt -- available in this action, since that would require build tools to be -- installed on the host OS. -> IO () -withBuildConfigExt skipDocker go@GlobalOpts{..} mbefore inner mafter = loadConfigWithOpts go $ \lc -> do +withBuildConfigExt skipDocker isClean go@GlobalOpts{..} mbefore inner mafter = loadConfigWithOpts go $ \lc -> do withUserFileLock go (view stackRootL lc) $ \lk0 -> do -- A local bit of state for communication between callbacks: curLk <- newIORef lk0 @@ -173,7 +174,8 @@ withBuildConfigExt skipDocker go@GlobalOpts{..} mbefore inner mafter = loadConfi let inner'' lk = do bconfig <- lcLoadBuildConfig lc globalCompiler - envConfig <- runRIO bconfig (setupEnv Nothing) + let bconfig' = bconfig { bcClean = isClean } + envConfig <- runRIO bconfig' (setupEnv Nothing) runRIO envConfig (inner' lk) let getCompilerVersion = loadCompilerVersion go lc diff --git a/src/main/Main.hs b/src/main/Main.hs index db29112ce4..086d62be0e 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -963,6 +963,7 @@ imgDockerCmd :: (Bool, [Text]) -> GlobalOpts -> IO () imgDockerCmd (rebuild,images) go@GlobalOpts{..} = loadConfigWithOpts go $ \lc -> do let mProjectRoot = lcProjectRoot lc withBuildConfigExt + False False go Nothing From 8eaed53150d29d17202a8a57bd83535bff1012b0 Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 17:48:52 +0900 Subject: [PATCH 03/10] Update cleanCmd --- src/main/Main.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/Main.hs b/src/main/Main.hs index 086d62be0e..cc53923ec7 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -635,8 +635,8 @@ cleanCmd opts go = -- See issues #2010 and #3468 for why "stack clean --full" is not used -- within docker. case opts of - CleanFull{} -> withBuildConfigAndLockNoDocker go (const (clean opts)) - CleanShallow{} -> withBuildConfigAndLock go (const (clean opts)) + CleanFull{} -> withBuildConfigAndLockNoDockerInClean go (const (clean opts)) + CleanShallow{} -> withBuildConfigAndLockInClean go (const (clean opts)) -- | Helper for build and install commands buildCmd :: BuildOptsCLI -> GlobalOpts -> IO () From 1974a2403a3952559c9cdddf2b18d061773be1af Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 17:23:06 +0900 Subject: [PATCH 04/10] Avoid to download ghc --- src/Stack/Setup.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index b743ca8fdb..0971156c66 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -234,7 +234,7 @@ setupEnv mResolveMissingGHC = do , soptsGHCJSBootOpts = ["--clean"] } - (mghcBin, compilerBuild, _) <- ensureCompiler sopts + (mghcBin, compilerBuild, _) <- if bcClean bconfig then pure (Nothing, CompilerBuildStandard, False) else ensureCompiler sopts -- Modify the initial environment to include the GHC path, if a local GHC -- is being used From 391d2e5542c2cecc4a558251231c3c4e64fd43ee Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 17:24:01 +0900 Subject: [PATCH 05/10] Add util functions (and a bit tweak) --- src/Stack/Runners.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Stack/Runners.hs b/src/Stack/Runners.hs index 72e505d2fd..4c66cc3562 100644 --- a/src/Stack/Runners.hs +++ b/src/Stack/Runners.hs @@ -11,6 +11,8 @@ module Stack.Runners , withMiniConfigAndLock , withBuildConfigAndLock , withBuildConfigAndLockNoDocker + , withBuildConfigAndLockInClean + , withBuildConfigAndLockNoDockerInClean , withBuildConfig , withBuildConfigExt , withBuildConfigDot @@ -127,7 +129,7 @@ withBuildConfigAndLock -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLock go inner = - withBuildConfigExt False go Nothing inner Nothing + withBuildConfigExt False False go Nothing inner Nothing -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". @@ -136,7 +138,23 @@ withBuildConfigAndLockNoDocker -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockNoDocker go inner = - withBuildConfigExt True go Nothing inner Nothing + withBuildConfigExt True False go Nothing inner Nothing + +withBuildConfigAndLockInClean + :: GlobalOpts + -> (Maybe FileLock -> RIO EnvConfig ()) + -> IO () +withBuildConfigAndLockInClean go inner = + withBuildConfigExt False True go Nothing inner Nothing + +-- | See issue #2010 for why this exists. Currently just used for the +-- specific case of "stack clean --full". +withBuildConfigAndLockNoDockerInClean + :: GlobalOpts + -> (Maybe FileLock -> RIO EnvConfig ()) + -> IO () +withBuildConfigAndLockNoDockerInClean go inner = + withBuildConfigExt True True go Nothing inner Nothing withBuildConfigExt :: Bool From 2d8998ed1c3c39baa11f74ddbbd0f34c1dc6048e Mon Sep 17 00:00:00 2001 From: waddlaw Date: Mon, 27 Aug 2018 18:02:46 +0900 Subject: [PATCH 06/10] Update Changelog --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index f351bbd38a..ad58cf70fa 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -96,7 +96,7 @@ Bug fixes: * Fix for git packages to update submodules to the correct state. See [#4314](https://github.com/commercialhaskell/stack/pull/4314) * Add `--cabal-files` flag to `stack ide targets` command. - +* Don't download ghc when using `stack clean`. ## v1.9.1 From f4eb713964f56a2cd4fa18ac1492daed6bc63ce9 Mon Sep 17 00:00:00 2001 From: waddlaw Date: Fri, 31 Aug 2018 18:05:31 +0900 Subject: [PATCH 07/10] Use WithDocker instead of Bool --- src/Stack/Runners.hs | 40 +++++++++++++++++++-------------------- src/Stack/Types/Config.hs | 6 ++++++ src/main/Main.hs | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/Stack/Runners.hs b/src/Stack/Runners.hs index 4c66cc3562..ef65b73fae 100644 --- a/src/Stack/Runners.hs +++ b/src/Stack/Runners.hs @@ -129,7 +129,7 @@ withBuildConfigAndLock -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLock go inner = - withBuildConfigExt False False go Nothing inner Nothing + withBuildConfigExt WithDocker False go Nothing inner Nothing -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". @@ -138,14 +138,14 @@ withBuildConfigAndLockNoDocker -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockNoDocker go inner = - withBuildConfigExt True False go Nothing inner Nothing + withBuildConfigExt SkipDocker False go Nothing inner Nothing withBuildConfigAndLockInClean :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockInClean go inner = - withBuildConfigExt False True go Nothing inner Nothing + withBuildConfigExt WithDocker True go Nothing inner Nothing -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". @@ -154,10 +154,10 @@ withBuildConfigAndLockNoDockerInClean -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockNoDockerInClean go inner = - withBuildConfigExt True True go Nothing inner Nothing + withBuildConfigExt SkipDocker True go Nothing inner Nothing withBuildConfigExt - :: Bool + :: WithDocker -> Bool -- ^ If perform the stack clean -> GlobalOpts -> Maybe (RIO Config ()) @@ -197,21 +197,21 @@ withBuildConfigExt skipDocker isClean go@GlobalOpts{..} mbefore inner mafter = l runRIO envConfig (inner' lk) let getCompilerVersion = loadCompilerVersion go lc - if skipDocker - then runRIO (lcConfig lc) $ do - forM_ mbefore id - Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0) - forM_ mafter id - else runRIO (lcConfig lc) $ - Docker.reexecWithOptionalContainer - (lcProjectRoot lc) - mbefore - (runRIO (lcConfig lc) $ - Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)) - mafter - (Just $ liftIO $ - do lk' <- readIORef curLk - munlockFile lk') + runRIO (lcConfig lc) $ + case skipDocker of + SkipDocker -> do + forM_ mbefore id + Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0) + forM_ mafter id + WithDocker -> Docker.reexecWithOptionalContainer + (lcProjectRoot lc) + mbefore + (runRIO (lcConfig lc) $ + Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)) + mafter + (Just $ liftIO $ + do lk' <- readIORef curLk + munlockFile lk') -- | Load the configuration. Convenience function used -- throughout this module. diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 06fd66019d..3cf7db9548 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -81,6 +81,8 @@ module Stack.Types.Config ,defaultLogLevel -- ** LoadConfig ,LoadConfig(..) + -- ** WithDocker + ,WithDocker(..) -- ** Project & ProjectAndConfigMonoid ,Project(..) @@ -510,6 +512,10 @@ data BuildConfig = BuildConfig , bcClean :: !Bool } +data WithDocker + = SkipDocker + | WithDocker + stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File) stackYamlL = buildConfigL.lens bcStackYaml (\x y -> x { bcStackYaml = y }) diff --git a/src/main/Main.hs b/src/main/Main.hs index cc53923ec7..526cb0d16f 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -963,7 +963,7 @@ imgDockerCmd :: (Bool, [Text]) -> GlobalOpts -> IO () imgDockerCmd (rebuild,images) go@GlobalOpts{..} = loadConfigWithOpts go $ \lc -> do let mProjectRoot = lcProjectRoot lc withBuildConfigExt - False + WithDocker False go Nothing From 12f0c43a3ac1c8815241c2ed8e30e4e1e0323960 Mon Sep 17 00:00:00 2001 From: waddlaw Date: Fri, 31 Aug 2018 18:25:09 +0900 Subject: [PATCH 08/10] Change Bool to proper type --- src/Stack/Config.hs | 2 +- src/Stack/Runners.hs | 14 +++++++------- src/Stack/Setup.hs | 5 ++++- src/Stack/Types/Config.hs | 8 +++++++- src/main/Main.hs | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 4d2b9f0600..a9e54647b1 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -616,7 +616,7 @@ loadBuildConfig mproject maresolver mcompiler = do LCSProject _ -> False LCSNoConfig _ -> False , bcCurator = projectCurator project - , bcClean = False + , bcDownloadCompiler = WithDownloadCompiler } where getEmptyProject :: Maybe SnapshotLocation -> RIO Config Project diff --git a/src/Stack/Runners.hs b/src/Stack/Runners.hs index ef65b73fae..deaa68f714 100644 --- a/src/Stack/Runners.hs +++ b/src/Stack/Runners.hs @@ -129,7 +129,7 @@ withBuildConfigAndLock -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLock go inner = - withBuildConfigExt WithDocker False go Nothing inner Nothing + withBuildConfigExt WithDocker WithDownloadCompiler go Nothing inner Nothing -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". @@ -138,14 +138,14 @@ withBuildConfigAndLockNoDocker -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockNoDocker go inner = - withBuildConfigExt SkipDocker False go Nothing inner Nothing + withBuildConfigExt SkipDocker WithDownloadCompiler go Nothing inner Nothing withBuildConfigAndLockInClean :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockInClean go inner = - withBuildConfigExt WithDocker True go Nothing inner Nothing + withBuildConfigExt WithDocker SkipDownloadCompiler go Nothing inner Nothing -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". @@ -154,11 +154,11 @@ withBuildConfigAndLockNoDockerInClean -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLockNoDockerInClean go inner = - withBuildConfigExt SkipDocker True go Nothing inner Nothing + withBuildConfigExt SkipDocker SkipDownloadCompiler go Nothing inner Nothing withBuildConfigExt :: WithDocker - -> Bool -- ^ If perform the stack clean + -> WithDownloadCompiler -- ^ bypassed download compiler if SkipDownloadCompiler. -> GlobalOpts -> Maybe (RIO Config ()) -- ^ Action to perform before the build. This will be run on the host @@ -174,7 +174,7 @@ withBuildConfigExt -- available in this action, since that would require build tools to be -- installed on the host OS. -> IO () -withBuildConfigExt skipDocker isClean go@GlobalOpts{..} mbefore inner mafter = loadConfigWithOpts go $ \lc -> do +withBuildConfigExt skipDocker downloadCompiler go@GlobalOpts{..} mbefore inner mafter = loadConfigWithOpts go $ \lc -> do withUserFileLock go (view stackRootL lc) $ \lk0 -> do -- A local bit of state for communication between callbacks: curLk <- newIORef lk0 @@ -192,7 +192,7 @@ withBuildConfigExt skipDocker isClean go@GlobalOpts{..} mbefore inner mafter = l let inner'' lk = do bconfig <- lcLoadBuildConfig lc globalCompiler - let bconfig' = bconfig { bcClean = isClean } + let bconfig' = bconfig { bcDownloadCompiler = downloadCompiler } envConfig <- runRIO bconfig' (setupEnv Nothing) runRIO envConfig (inner' lk) diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index 0971156c66..e1e64f3a59 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -234,7 +234,10 @@ setupEnv mResolveMissingGHC = do , soptsGHCJSBootOpts = ["--clean"] } - (mghcBin, compilerBuild, _) <- if bcClean bconfig then pure (Nothing, CompilerBuildStandard, False) else ensureCompiler sopts + (mghcBin, compilerBuild, _) <- + case bcDownloadCompiler bconfig of + SkipDownloadCompiler -> pure (Nothing, CompilerBuildStandard, False) + WithDownloadCompiler -> ensureCompiler sopts -- Modify the initial environment to include the GHC path, if a local GHC -- is being used diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 3cf7db9548..2360016fe9 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -83,6 +83,8 @@ module Stack.Types.Config ,LoadConfig(..) -- ** WithDocker ,WithDocker(..) + -- ** WithDownloadCompiler + ,WithDownloadCompiler(..) -- ** Project & ProjectAndConfigMonoid ,Project(..) @@ -509,13 +511,17 @@ data BuildConfig = BuildConfig -- ^ Are we loading from the implicit global stack.yaml? This is useful -- for providing better error messages. , bcCurator :: !(Maybe Curator) - , bcClean :: !Bool + , bcDownloadCompiler :: !WithDownloadCompiler } data WithDocker = SkipDocker | WithDocker +data WithDownloadCompiler + = SkipDownloadCompiler + | WithDownloadCompiler + stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File) stackYamlL = buildConfigL.lens bcStackYaml (\x y -> x { bcStackYaml = y }) diff --git a/src/main/Main.hs b/src/main/Main.hs index 526cb0d16f..8f7f380dff 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -964,7 +964,7 @@ imgDockerCmd (rebuild,images) go@GlobalOpts{..} = loadConfigWithOpts go $ \lc -> let mProjectRoot = lcProjectRoot lc withBuildConfigExt WithDocker - False + WithDownloadCompiler go Nothing (\lk -> From 67c07b242208eb0e6e00ab555339789b5741fd4a Mon Sep 17 00:00:00 2001 From: waddlaw Date: Sun, 2 Sep 2018 15:27:11 +0900 Subject: [PATCH 09/10] Fix fake value --- src/Stack/Setup.hs | 12 ++++++------ src/Stack/Types/Config.hs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index e1e64f3a59..04c3caf6f5 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -234,9 +234,9 @@ setupEnv mResolveMissingGHC = do , soptsGHCJSBootOpts = ["--clean"] } - (mghcBin, compilerBuild, _) <- + (mghcBin, mCompilerBuild, _) <- case bcDownloadCompiler bconfig of - SkipDownloadCompiler -> pure (Nothing, CompilerBuildStandard, False) + SkipDownloadCompiler -> return (Nothing, Nothing, False) WithDownloadCompiler -> ensureCompiler sopts -- Modify the initial environment to include the GHC path, if a local GHC @@ -269,7 +269,7 @@ setupEnv mResolveMissingGHC = do { envConfigBuildConfig = bc , envConfigCabalVersion = cabalVer , envConfigCompilerVersion = compilerVer - , envConfigCompilerBuild = compilerBuild + , envConfigCompilerBuild = mCompilerBuild , envConfigLoadedSnapshot = ls } @@ -356,7 +356,7 @@ setupEnv mResolveMissingGHC = do } , envConfigCabalVersion = cabalVer , envConfigCompilerVersion = compilerVer - , envConfigCompilerBuild = compilerBuild + , envConfigCompilerBuild = mCompilerBuild , envConfigLoadedSnapshot = ls } @@ -374,7 +374,7 @@ addIncludeLib (ExtraDirs _bins includes libs) config = config -- | Ensure compiler (ghc or ghcjs) is installed and provide the PATHs to add if necessary ensureCompiler :: (HasConfig env, HasGHCVariant env) => SetupOpts - -> RIO env (Maybe ExtraDirs, CompilerBuild, Bool) + -> RIO env (Maybe ExtraDirs, Maybe CompilerBuild, Bool) ensureCompiler sopts = do let wc = whichCompiler (wantedToActual (soptsWantedCompiler sopts)) when (getGhcVersion (wantedToActual (soptsWantedCompiler sopts)) < mkVersion [7, 8]) $ do @@ -532,7 +532,7 @@ ensureCompiler sopts = do when (soptsSanityCheck sopts) $ withProcessContext menv $ sanityCheck wc - return (mpaths, compilerBuild, needLocal) + return (mpaths, Just compilerBuild, needLocal) -- | Determine which GHC builds to use depending on which shared libraries are available -- on the system. diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 2360016fe9..fe73732617 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -543,7 +543,7 @@ data EnvConfig = EnvConfig -- ^ The actual version of the compiler to be used, as opposed to -- 'wantedCompilerL', which provides the version specified by the -- build plan. - ,envConfigCompilerBuild :: !CompilerBuild + ,envConfigCompilerBuild :: !(Maybe CompilerBuild) ,envConfigLoadedSnapshot :: !LoadedSnapshot -- ^ The fully resolved snapshot information. } @@ -1282,9 +1282,9 @@ platformGhcRelDir => m (Path Rel Dir) platformGhcRelDir = do ec <- view envConfigL + let cbSuffix = maybe "" compilerBuildSuffix $ envConfigCompilerBuild ec verOnly <- platformGhcVerOnlyRelDirStr - parseRelDir (mconcat [ verOnly - , compilerBuildSuffix (envConfigCompilerBuild ec)]) + parseRelDir (mconcat [ verOnly, cbSuffix ]) -- | Relative directory for the platform and GHC identifier without GHC bindist build platformGhcVerOnlyRelDir From ae16993d42e2fdfbbc1a16392d558401217a5c83 Mon Sep 17 00:00:00 2001 From: David Baynard Date: Fri, 16 Nov 2018 14:17:01 +0000 Subject: [PATCH 10/10] Add integration test --- test/integration/tests/4181-clean-wo-dl-ghc/Main.hs | 12 ++++++++++++ .../tests/4181-clean-wo-dl-ghc/files/foo.cabal | 13 +++++++++++++ .../tests/4181-clean-wo-dl-ghc/files/stack.yaml | 8 ++++++++ 3 files changed, 33 insertions(+) create mode 100644 test/integration/tests/4181-clean-wo-dl-ghc/Main.hs create mode 100644 test/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal create mode 100644 test/integration/tests/4181-clean-wo-dl-ghc/files/stack.yaml diff --git a/test/integration/tests/4181-clean-wo-dl-ghc/Main.hs b/test/integration/tests/4181-clean-wo-dl-ghc/Main.hs new file mode 100644 index 0000000000..61a3a31162 --- /dev/null +++ b/test/integration/tests/4181-clean-wo-dl-ghc/Main.hs @@ -0,0 +1,12 @@ +-- | +-- The integration tests have no ghc present, initially. Stack should not +-- require ghc present to run the `clean` command. + +import StackTest + +main :: IO () +main = do + -- `stack clean` should succeed even though there is no ghc available. + -- See the stack.yaml file for how this works. + stack ["clean"] + stack ["clean", "--full"] diff --git a/test/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal b/test/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal new file mode 100644 index 0000000000..45446b7f9c --- /dev/null +++ b/test/integration/tests/4181-clean-wo-dl-ghc/files/foo.cabal @@ -0,0 +1,13 @@ +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/test/integration/tests/4181-clean-wo-dl-ghc/files/stack.yaml b/test/integration/tests/4181-clean-wo-dl-ghc/files/stack.yaml new file mode 100644 index 0000000000..654a70d662 --- /dev/null +++ b/test/integration/tests/4181-clean-wo-dl-ghc/files/stack.yaml @@ -0,0 +1,8 @@ +# Update the resolver as necessary +resolver: ghc-8.22 +# Do not use the system ghc, as ghc must not be available +system-ghc: false +# Do not install any other ghc, as ghc must not be available +install-ghc: false +packages: +- '.'