summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-03 19:16:23 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-03 19:16:23 -0800
commitec39948ed1333699daf246e2ba37ccec67db5bd2 (patch)
treea9d46242337543bcf589c33a596e7edf91b64664 /core/src
parent6fa39162250c2477b3c9d322c453dfd51646245b (diff)
downloadmill-ec39948ed1333699daf246e2ba37ccec67db5bd2.tar.gz
mill-ec39948ed1333699daf246e2ba37ccec67db5bd2.tar.bz2
mill-ec39948ed1333699daf246e2ba37ccec67db5bd2.zip
Make use of `CrossScalaModule` in `HelloWorldTests`
Also standardize the `HelloWorldTests` onto the typical project layout, where the module of interest is nested within a top-level `BaseModule`
Diffstat (limited to 'core/src')
-rw-r--r--core/src/mill/eval/Evaluator.scala3
-rw-r--r--core/src/mill/eval/Result.scala12
-rw-r--r--core/src/mill/main/ReplApplyHandler.scala4
-rw-r--r--core/src/mill/main/RunScript.scala3
4 files changed, 17 insertions, 5 deletions
diff --git a/core/src/mill/eval/Evaluator.scala b/core/src/mill/eval/Evaluator.scala
index 9d65e95f..bb78a020 100644
--- a/core/src/mill/eval/Evaluator.scala
+++ b/core/src/mill/eval/Evaluator.scala
@@ -6,6 +6,7 @@ import ammonite.main.Router.EntryPoint
import ammonite.ops._
import ammonite.runtime.SpecialClassLoader
import mill.define.{Ctx => _, _}
+import mill.eval.Result.OuterStack
import mill.util
import mill.util._
import mill.util.Strict.Agg
@@ -274,7 +275,7 @@ class Evaluator[T](val outPath: Path,
}
}catch{ case NonFatal(e) =>
- Result.Exception(e, currentStack)
+ Result.Exception(e, new OuterStack(currentStack))
}finally{
System.setErr(err)
System.setOut(out)
diff --git a/core/src/mill/eval/Result.scala b/core/src/mill/eval/Result.scala
index 174dfcd1..f5293c8c 100644
--- a/core/src/mill/eval/Result.scala
+++ b/core/src/mill/eval/Result.scala
@@ -10,11 +10,19 @@ sealed trait Result[+T]{
object Result{
implicit def create[T](t: => T): Result[T] = {
try Success(t)
- catch { case e: Throwable => Exception(e, new java.lang.Exception().getStackTrace) }
+ catch { case e: Throwable => Exception(e, new OuterStack(new java.lang.Exception().getStackTrace)) }
}
case class Success[T](value: T) extends Result[T]
case object Skipped extends Result[Nothing]
sealed trait Failing extends Result[Nothing]
case class Failure(msg: String) extends Failing
- case class Exception(throwable: Throwable, outerStack: Seq[StackTraceElement]) extends Failing
+ case class Exception(throwable: Throwable, outerStack: OuterStack) extends Failing
+ class OuterStack(val value: Seq[StackTraceElement]){
+ override def hashCode() = value.hashCode()
+
+ override def equals(obj: scala.Any) = obj match{
+ case o: OuterStack => value.equals(o.value)
+ case _ => false
+ }
+ }
} \ No newline at end of file
diff --git a/core/src/mill/main/ReplApplyHandler.scala b/core/src/mill/main/ReplApplyHandler.scala
index 387951b2..66f80630 100644
--- a/core/src/mill/main/ReplApplyHandler.scala
+++ b/core/src/mill/main/ReplApplyHandler.scala
@@ -54,7 +54,9 @@ class ReplApplyHandler(pprinter0: pprint.PPrinter,
case Result.Failure(m) => msg.append(m + "\n")
case Result.Exception(t, outerStack) =>
msg.append(
- t.toString + t.getStackTrace.dropRight(outerStack.length).map("\n " + _).mkString + "\n"
+ t.toString +
+ t.getStackTrace.dropRight(outerStack.value.length).map("\n " + _).mkString +
+ "\n"
)
}
diff --git a/core/src/mill/main/RunScript.scala b/core/src/mill/main/RunScript.scala
index 55fd8937..e5c92e3e 100644
--- a/core/src/mill/main/RunScript.scala
+++ b/core/src/mill/main/RunScript.scala
@@ -173,7 +173,8 @@ object RunScript{
}
val fss = fs.map{
case Result.Exception(t, outerStack) =>
- t.toString + t.getStackTrace.dropRight(outerStack.length).map("\n " + _).mkString
+ t.toString +
+ t.getStackTrace.dropRight(outerStack.value.length).map("\n " + _).mkString
case Result.Failure(t) => t
}
s"$ks ${fss.mkString(", ")}"