summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTobias Roeser <le.petit.fou@web.de>2018-12-20 16:52:55 +0100
committerTobias Roeser <le.petit.fou@web.de>2018-12-21 20:19:29 +0100
commit0cea8f67adc515e58b511283905caa3bce5e632a (patch)
tree4c7e39978fa7364a53c1a041ccd384d6c27d6d2e /main
parent54bb990738fe896e29a652f2e84c3c8a2a8d865b (diff)
downloadmill-0cea8f67adc515e58b511283905caa3bce5e632a.tar.gz
mill-0cea8f67adc515e58b511283905caa3bce5e632a.tar.bz2
mill-0cea8f67adc515e58b511283905caa3bce5e632a.zip
Added cmdline option -k/--keep-going
See https://github.com/lihaoyi/mill/issues/477
Diffstat (limited to 'main')
-rw-r--r--main/src/MillMain.scala18
-rw-r--r--main/src/main/MainRunner.scala6
-rw-r--r--main/src/main/MillServerMain.scala6
-rw-r--r--main/src/main/ReplApplyHandler.scala6
-rw-r--r--main/src/main/RunScript.scala5
-rw-r--r--main/test/src/util/ScriptTestSuite.scala3
6 files changed, 31 insertions, 13 deletions
diff --git a/main/src/MillMain.scala b/main/src/MillMain.scala
index e953e65d..f1a7a9e7 100644
--- a/main/src/MillMain.scala
+++ b/main/src/MillMain.scala
@@ -73,8 +73,18 @@ object MillMain {
}
)
+ var keepGoing = false
+ val keepGoingSignature = Arg[Config, Unit] (
+ name = "keep-going", shortName = Some('k'), doc = "Continue build, even after build failures",
+ (c,v) => {
+ keepGoing = true
+ c
+ }
+ )
+
val millArgSignature =
- Cli.genericSignature.filter(a => !removed(a.name)) ++ Seq(interactiveSignature, disableTickerSignature, debugLogSignature)
+ Cli.genericSignature.filter(a => !removed(a.name)) ++
+ Seq(interactiveSignature, disableTickerSignature, debugLogSignature, keepGoingSignature)
Cli.groupArgs(
args.toList,
@@ -115,7 +125,8 @@ object MillMain {
| repl.pprinter(),
| build.millSelf.get,
| build.millDiscover,
- | $debugLog
+ | $debugLog,
+ | keepGoing = $keepGoing
|)
|repl.pprinter() = replApplyHandler.pprinter
|import replApplyHandler.generatedEval._
@@ -131,7 +142,8 @@ object MillMain {
stateCache,
env,
setIdle,
- debugLog
+ debugLog,
+ keepGoing = keepGoing
)
if (mill.main.client.Util.isJava9OrAbove) {
diff --git a/main/src/main/MainRunner.scala b/main/src/main/MainRunner.scala
index e50ed370..e08905a6 100644
--- a/main/src/main/MainRunner.scala
+++ b/main/src/main/MainRunner.scala
@@ -24,7 +24,8 @@ class MainRunner(val config: ammonite.main.Cli.Config,
stateCache0: Option[Evaluator.State] = None,
env : Map[String, String],
setIdle: Boolean => Unit,
- debugLog: Boolean)
+ debugLog: Boolean,
+ keepGoing: Boolean)
extends ammonite.MainRunner(
config, outprintStream, errPrintStream,
stdIn, outprintStream, errPrintStream
@@ -83,7 +84,8 @@ class MainRunner(val config: ammonite.main.Cli.Config,
stdIn,
debugEnabled = debugLog
),
- env
+ env,
+ keepGoing = keepGoing
)
result match{
diff --git a/main/src/main/MillServerMain.scala b/main/src/main/MillServerMain.scala
index 26ca99e6..07d51254 100644
--- a/main/src/main/MillServerMain.scala
+++ b/main/src/main/MillServerMain.scala
@@ -55,12 +55,12 @@ object MillServerMain extends mill.main.MillServerMain[Evaluator.State]{
MillMain.main0(
args,
stateCache,
- mainInteractive,
+ mainInteractive = mainInteractive,
DummyInputStream,
stdout,
stderr,
env,
- setIdle
+ setIdle = setIdle
)
}
}
@@ -141,7 +141,7 @@ class Server[T](lockBase: String,
stdout,
stderr,
env.asScala.toMap,
- idle = _
+ idle = _,
)
sm.stateCache = newStateCache
diff --git a/main/src/main/ReplApplyHandler.scala b/main/src/main/ReplApplyHandler.scala
index 786a1409..6f1e060d 100644
--- a/main/src/main/ReplApplyHandler.scala
+++ b/main/src/main/ReplApplyHandler.scala
@@ -16,7 +16,8 @@ object ReplApplyHandler{
pprinter0: pprint.PPrinter,
rootModule: mill.define.BaseModule,
discover: Discover[_],
- debugLog: Boolean) = {
+ debugLog: Boolean,
+ keepGoing: Boolean) = {
new ReplApplyHandler(
pprinter0,
new Evaluator(
@@ -33,7 +34,8 @@ object ReplApplyHandler{
System.err,
System.in,
debugEnabled = debugLog
- )
+ ),
+ failFast = !keepGoing
)
)
}
diff --git a/main/src/main/RunScript.scala b/main/src/main/RunScript.scala
index b858c8b9..ea8e554f 100644
--- a/main/src/main/RunScript.scala
+++ b/main/src/main/RunScript.scala
@@ -29,7 +29,8 @@ object RunScript{
scriptArgs: Seq[String],
stateCache: Option[Evaluator.State],
log: Logger,
- env : Map[String, String])
+ env : Map[String, String],
+ keepGoing: Boolean)
: (Res[(Evaluator, Seq[PathRef], Either[String, Seq[ujson.Value]])], Seq[(os.Path, Long)]) = {
val (evalState, interpWatched) = stateCache match{
@@ -54,7 +55,7 @@ object RunScript{
val evalRes =
for(s <- evalState)
yield new Evaluator(home, wd / 'out, wd / 'out, s.rootModule, log,
- s.classLoaderSig, s.workerCache, env)
+ s.classLoaderSig, s.workerCache, env, failFast = !keepGoing)
val evaluated = for{
evaluator <- evalRes
diff --git a/main/test/src/util/ScriptTestSuite.scala b/main/test/src/util/ScriptTestSuite.scala
index f448aaaf..92f57c4f 100644
--- a/main/test/src/util/ScriptTestSuite.scala
+++ b/main/test/src/util/ScriptTestSuite.scala
@@ -15,10 +15,11 @@ abstract class ScriptTestSuite(fork: Boolean) extends TestSuite{
val stdIn = new ByteArrayInputStream(Array())
val disableTicker = false
val debugLog = false
+ val keepGoing = false
lazy val runner = new mill.main.MainRunner(
ammonite.main.Cli.Config(wd = wd), disableTicker,
stdOutErr, stdOutErr, stdIn, None, Map.empty,
- b => (), debugLog
+ b => (), debugLog, keepGoing = keepGoing
)
def eval(s: String*) = {
if (!fork) runner.runScript(workspacePath / buildPath , s.toList)