-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make dot and ls dependencies work without ghc installed #4405
Changes from all commits
55504f1
c0ed27c
3fc58f8
8bee990
7412fc0
0ac8a8b
3167481
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ | |||||
{-# LANGUAGE FlexibleContexts #-} | ||||||
{-# LANGUAGE OverloadedStrings #-} | ||||||
{-# LANGUAGE RecordWildCards #-} | ||||||
{-# LANGUAGE RankNTypes #-} | ||||||
|
||||||
-- | Utilities for running stack commands. | ||||||
module Stack.Runners | ||||||
|
@@ -261,10 +262,18 @@ munlockFile Nothing = return () | |||||
munlockFile (Just lk) = liftIO $ unlockFile lk | ||||||
|
||||||
-- Plumbing for --test and --bench flags | ||||||
-- Force enable --no-install-ghc and --skip-ghc-check flags | ||||||
withBuildConfigDot :: DotOpts -> GlobalOpts -> RIO EnvConfig () -> IO () | ||||||
withBuildConfigDot opts go f = withBuildConfig go' f | ||||||
withBuildConfigDot opts go = withBuildConfig (updateGlobalOpts go) | ||||||
where | ||||||
go' = | ||||||
(if dotTestTargets opts then set (globalOptsBuildOptsMonoidL.buildOptsMonoidTestsL) (Just True) else id) $ | ||||||
(if dotBenchTargets opts then set (globalOptsBuildOptsMonoidL.buildOptsMonoidBenchmarksL) (Just True) else id) | ||||||
go | ||||||
updateGlobalOpts | ||||||
= updateOpts (dotTestTargets opts) (globalOptsBuildOptsMonoidL.buildOptsMonoidTestsL) (Just True) | ||||||
. updateOpts (dotBenchTargets opts) (globalOptsBuildOptsMonoidL.buildOptsMonoidBenchmarksL) (Just True) | ||||||
. set (globalOptsL.configMonoidSkipGHCCheckL) (Just True) | ||||||
. set (globalOptsL.configMonoidInstallGHCL) (Just False) | ||||||
|
||||||
-- helper function for update some option | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It would be good to document what the |
||||||
updateOpts :: Bool -> Lens' opts v -> v -> opts -> opts | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this combinator 👍 |
||||||
updateOpts isRequired opt v | ||||||
| isRequired = set opt v | ||||||
| otherwise = id |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,6 +206,17 @@ instance Show SetupException where | |
show UnsupportedSetupConfiguration = | ||
"I don't know how to install GHC on your system configuration, please install manually" | ||
|
||
checkDownloadCompiler :: (HasConfig env, HasGHCVariant env) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As @qrilka noted, this could do with some documentation. We may want to change the |
||
=> SetupOpts | ||
-> WithDownloadCompiler | ||
-> RIO env (Maybe ExtraDirs, Maybe CompilerBuild, Bool) | ||
checkDownloadCompiler _ SkipDownloadCompiler = return (Nothing, Nothing, False) | ||
checkDownloadCompiler sopts WithDownloadCompiler | ||
| installIfMissing = ensureCompiler sopts | ||
| otherwise = return (Nothing, Nothing, False) | ||
where | ||
installIfMissing = soptsInstallIfMissing sopts | ||
|
||
-- | Modify the environment variables (like PATH) appropriately, possibly doing installation too | ||
setupEnv :: (HasBuildConfig env, HasGHCVariant env) | ||
=> Maybe Text -- ^ Message to give user when necessary GHC is not available | ||
|
@@ -234,10 +245,7 @@ setupEnv mResolveMissingGHC = do | |
, soptsGHCJSBootOpts = ["--clean"] | ||
} | ||
|
||
(mghcBin, mCompilerBuild, _) <- | ||
case bcDownloadCompiler bconfig of | ||
SkipDownloadCompiler -> return (Nothing, Nothing, False) | ||
WithDownloadCompiler -> ensureCompiler sopts | ||
(mghcBin, mCompilerBuild, _) <- checkDownloadCompiler sopts (bcDownloadCompiler bconfig) | ||
|
||
-- Modify the initial environment to include the GHC path, if a local GHC | ||
-- is being used | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better as two lines; respecting
--no-install-ghc
in bug fixes and the lack of GHC requirement merged with thestack clean
line above, and moved toOther enhancements
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that 2nd second sentence is misleading, the flag was respected at least in version 1.7.1 already:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's perfectly clear, thanks!!