Don't build stack dependencies by default

Adds a global option `--stack-build-deps` to enable old behavior
This commit is contained in:
Nikolay Yakimov 2016-08-24 18:09:29 +03:00
parent c97049836f
commit 637f73ec80
3 changed files with 10 additions and 3 deletions

View File

@ -208,7 +208,7 @@ withCabal action = do
-- "--flag PACKAGE:[-]FLAG Override flags set in stack.yaml
-- (applies to local packages and extra-deps)"
stackReconfigure crdl (optPrograms opts)
stackReconfigure (optStackBuildDeps opts) crdl (optPrograms opts)
_ ->
error $ "withCabal: unsupported project type: " ++ show proj
@ -234,12 +234,13 @@ withCabal action = do
flagOpt = ["--flags", unwords $ map toFlag flgs]
liftIO $ void $ readProc (T.cabalProgram progs) ("configure":progOpts) ""
stackReconfigure crdl progs = do
stackReconfigure deps crdl progs = do
withDirectory_ (cradleRootDir crdl) $ do
supported <- haveStackSupport
if supported
then do
spawn [T.stackProgram progs, "build", "--only-dependencies", "."]
when deps $
spawn [T.stackProgram progs, "build", "--only-dependencies", "."]
spawn [T.stackProgram progs, "build", "--only-configure", "."]
else
gmLog GmWarning "" $ strDoc $ "Stack project configuration is out of date, please reconfigure manually using 'stack build' as your stack version is too old (need at least 0.1.4.0)"

View File

@ -146,6 +146,10 @@ globalArgSpec = Options
<=> value "UTF-8"
<=> showDefault
<=> help "I/O encoding"
<*> switch
$$ long "stack-build-deps"
<=> showDefault
<=> help "Build dependencies if needed when using stack"
where
fileMappingSpec =
getFileMapping . splitOn '=' <$> strOption

View File

@ -106,6 +106,7 @@ data Options = Options {
, optGhcUserOptions :: [GHCOption]
, optFileMappings :: [(FilePath, Maybe FilePath)]
, optEncoding :: String
, optStackBuildDeps :: Bool
} deriving (Show)
-- | A default 'Options'.
@ -126,6 +127,7 @@ defaultOptions = Options {
, optGhcUserOptions = []
, optFileMappings = []
, optEncoding = "UTF-8"
, optStackBuildDeps = False
}
----------------------------------------------------------------