Commit 53e7da37 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add a --keep-going flag and plumb it through

For both install and new-build.
parent bf72b4f0
......@@ -256,6 +256,7 @@ instance Semigroup SavedConfig where
installSymlinkBinDir = combine installSymlinkBinDir,
installOneShot = combine installOneShot,
installNumJobs = combine installNumJobs,
installKeepGoing = combine installKeepGoing,
installRunTests = combine installRunTests,
installOfflineMode = combine installOfflineMode
}
......
......@@ -1107,7 +1107,7 @@ performInstallations verbosity
numJobs = determineNumJobs (installNumJobs installFlags)
numFetchJobs = 2
parallelInstall = numJobs >= 2
keepGoing = False
keepGoing = fromFlag (installKeepGoing installFlags)
distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(configDistPref configFlags)
......
......@@ -577,7 +577,10 @@ rebuildTargets verbosity
installPlan
sharedPackageConfig
pkgsBuildStatus
buildSettings@BuildTimeSettings{buildSettingNumJobs} = do
buildSettings@BuildTimeSettings{
buildSettingNumJobs,
buildSettingKeepGoing
} = do
-- Concurrency control: create the job controller and concurrency limits
-- for downloading, building and installing.
......@@ -614,7 +617,7 @@ rebuildTargets verbosity
pkgBuildStatus
where
isParallelBuild = buildSettingNumJobs >= 2
keepGoing = False
keepGoing = buildSettingKeepGoing
withRepoCtx = projectConfigWithBuilderRepoContext verbosity
buildSettings
......
......@@ -251,6 +251,7 @@ resolveBuildTimeSettings verbosity
buildSettingSymlinkBinDir = flagToList projectConfigSymlinkBinDir
buildSettingOneShot = fromFlag projectConfigOneShot
buildSettingNumJobs = determineNumJobs projectConfigNumJobs
buildSettingKeepGoing = fromFlag projectConfigKeepGoing
buildSettingOfflineMode = fromFlag projectConfigOfflineMode
buildSettingKeepTempFiles = fromFlag projectConfigKeepTempFiles
buildSettingRemoteRepos = fromNubList projectConfigRemoteRepos
......@@ -270,6 +271,7 @@ resolveBuildTimeSettings verbosity
projectConfigOnlyDeps = toFlag False,
projectConfigBuildReports = toFlag NoReports,
projectConfigReportPlanningFailure = toFlag False,
projectConfigKeepGoing = toFlag False,
projectConfigOneShot = toFlag False,
projectConfigOfflineMode = toFlag False,
projectConfigKeepTempFiles = toFlag False,
......
......@@ -410,6 +410,7 @@ convertLegacyBuildOnlyFlags globalFlags configFlags
installSymlinkBinDir = projectConfigSymlinkBinDir,
installOneShot = projectConfigOneShot,
installNumJobs = projectConfigNumJobs,
installKeepGoing = projectConfigKeepGoing,
installOfflineMode = projectConfigOfflineMode
} = installFlags
......@@ -507,6 +508,7 @@ convertToLegacySharedConfig
installSymlinkBinDir = projectConfigSymlinkBinDir,
installOneShot = projectConfigOneShot,
installNumJobs = projectConfigNumJobs,
installKeepGoing = projectConfigKeepGoing,
installRunTests = mempty,
installOfflineMode = projectConfigOfflineMode
}
......@@ -823,7 +825,7 @@ legacySharedConfigFieldDescrs =
, "root-cmd", "symlink-bindir"
, "build-log"
, "remote-build-reporting", "report-planning-failure"
, "one-shot", "jobs", "offline"
, "one-shot", "jobs", "keep-going", "offline"
-- solver flags:
, "max-backjumps", "reorder-goals", "strong-flags"
]
......
......@@ -123,6 +123,7 @@ data ProjectConfigBuildOnly
projectConfigSymlinkBinDir :: Flag FilePath,
projectConfigOneShot :: Flag Bool,
projectConfigNumJobs :: Flag (Maybe Int),
projectConfigKeepGoing :: Flag Bool,
projectConfigOfflineMode :: Flag Bool,
projectConfigKeepTempFiles :: Flag Bool,
projectConfigHttpTransport :: Flag String,
......@@ -356,6 +357,7 @@ data BuildTimeSettings
buildSettingSymlinkBinDir :: [FilePath],
buildSettingOneShot :: Bool,
buildSettingNumJobs :: Int,
buildSettingKeepGoing :: Bool,
buildSettingOfflineMode :: Bool,
buildSettingKeepTempFiles :: Bool,
buildSettingRemoteRepos :: [RemoteRepo],
......
......@@ -1161,6 +1161,7 @@ data InstallFlags = InstallFlags {
installSymlinkBinDir :: Flag FilePath,
installOneShot :: Flag Bool,
installNumJobs :: Flag (Maybe Int),
installKeepGoing :: Flag Bool,
installRunTests :: Flag Bool,
installOfflineMode :: Flag Bool
}
......@@ -1192,6 +1193,7 @@ defaultInstallFlags = InstallFlags {
installSymlinkBinDir = mempty,
installOneShot = Flag False,
installNumJobs = mempty,
installKeepGoing = Flag False,
installRunTests = mempty,
installOfflineMode = Flag False
}
......@@ -1401,6 +1403,11 @@ installOptions showOrParseArgs =
, optionNumJobs
installNumJobs (\v flags -> flags { installNumJobs = v })
, option [] ["keep-going"]
"After a build failure, continue to build other unaffected packages."
installKeepGoing (\v flags -> flags { installKeepGoing = v })
trueArg
, option [] ["offline"]
"Don't download packages from the Internet."
installOfflineMode (\v flags -> flags { installOfflineMode = v })
......
......@@ -299,11 +299,12 @@ instance Arbitrary ProjectConfigBuildOnly where
<*> arbitrary
<*> arbitraryNumJobs
<*> arbitrary
<*> arbitrary -- 12
<*> arbitrary
<*> arbitrary
<*> (fmap getShortToken <$> arbitrary)
<*> arbitrary
<*> (fmap getShortToken <$> arbitrary)
<*> (fmap getShortToken <$> arbitrary) -- 16
<*> (fmap getShortToken <$> arbitrary)
<*> (fmap getShortToken <$> arbitrary)
where
arbitraryNumJobs = fmap (fmap getPositive) <$> arbitrary
......@@ -311,19 +312,19 @@ instance Arbitrary ProjectConfigBuildOnly where
shrink (ProjectConfigBuildOnly
x00 x01 x02 x03 x04 x05 x06 x07
x08 x09 x10 x11 x12 x13 x14 x15
x16) =
x16 x17) =
[ ProjectConfigBuildOnly
x00' x01' x02' x03' x04'
x05' x06' x07' x08' (postShrink_NumJobs x09')
x10' x11' x12 x13' x14
x15 x16
x10' x11' x12' x13 x14'
x15 x16 x17
| ((x00', x01', x02', x03', x04'),
(x05', x06', x07', x08', x09'),
(x10', x11', x13'))
(x10', x11', x12', x14'))
<- shrink
((x00, x01, x02, x03, x04),
(x05, x06, x07, x08, preShrink_NumJobs x09),
(x10, x11, x13))
(x10, x11, x12, x14))
]
where
preShrink_NumJobs = fmap (fmap Positive)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment