diff --git a/compile/AnalyzingCompiler.scala b/compile/AnalyzingCompiler.scala index a3e856d70..923d82c4a 100644 --- a/compile/AnalyzingCompiler.scala +++ b/compile/AnalyzingCompiler.scala @@ -41,7 +41,7 @@ class AnalyzingCompiler(val scalaInstance: ScalaInstance, val manager: Component def console(classpath: Seq[File], options: Seq[String], initialCommands: String, log: Logger)(loader: Option[ClassLoader] = None, bindings: Seq[(String, Any)] = Nil): Unit = { val arguments = new CompilerArguments(scalaInstance, cp) - val classpathString = CompilerArguments.absString(arguments.finishClasspath(classpath ++ jlineJar)) + val classpathString = CompilerArguments.absString(arguments.finishClasspath(classpath)) val bootClasspath = if(cp.autoBoot) arguments.createBootClasspath else "" val (names, values) = bindings.unzip call("xsbt.ConsoleInterface", log)( @@ -80,7 +80,4 @@ class AnalyzingCompiler(val scalaInstance: ScalaInstance, val manager: Component new classpath.DualLoader(scalaLoader, notXsbtiFilter, x => true, sbtLoader, xsbtiFilter, x => false) } override def toString = "Analyzing compiler (Scala " + scalaInstance.actualVersion + ")" - lazy val jlineJar = - try { IO.classLocationFile[jline.ConsoleReader] :: Nil } - catch { case e: Exception => Nil } } \ No newline at end of file diff --git a/compile/src/test/scala/CompileTest.scala b/compile/src/test/scala/CompileTest.scala index 2c2332e2c..f30d600f7 100644 --- a/compile/src/test/scala/CompileTest.scala +++ b/compile/src/test/scala/CompileTest.scala @@ -56,8 +56,8 @@ object CompileTest extends Specification private def isMissingRequirementError(t: Throwable) = t.getClass.getName == "scala.tools.nsc.MissingRequirementError" private def testClasspath(scalaVersion: String) = WithCompiler.launcher { (launch, log) => - def compiler(autoBoot: Boolean, compilerOnClasspath: Boolean): RawCompiler = - new RawCompiler(ScalaInstance(scalaVersion, launch), new ClasspathOptions(autoBoot, compilerOnClasspath, true), log) + def compiler(bootLibrary: Boolean, compilerOnClasspath: Boolean): RawCompiler = + new RawCompiler(ScalaInstance(scalaVersion, launch), new ClasspathOptions(bootLibrary, compilerOnClasspath, true, true), log) val callback = new xsbti.TestCallback diff --git a/main/Aggregation.scala b/main/Aggregation.scala index ac8b0e345..8e314b0b3 100644 --- a/main/Aggregation.scala +++ b/main/Aggregation.scala @@ -11,6 +11,7 @@ package sbt import sbt.complete.Parser import java.net.URI import Parser._ + import collection.mutable sealed trait Aggregation final object Aggregation @@ -24,16 +25,19 @@ final object Aggregation final case class KeyValue[+T](key: ScopedKey[_], value: T) def getTasks[T](key: ScopedKey[T], structure: BuildStructure, transitive: Boolean): Seq[KeyValue[T]] = - { - val task = structure.data.get(key.scope, key.key).toList.map(t => KeyValue(key,t)) - if(transitive) aggregateDeps(key, structure) ++ task else task - } + getTasks0(key, structure, transitive, new mutable.HashMap[(ScopedKey[_], Boolean), Seq[KeyValue[T]]]) + private type Memo[T] = mutable.Map[(ScopedKey[_], Boolean), Seq[KeyValue[T]]] + private[this] def getTasks0[T](key: ScopedKey[T], structure: BuildStructure, transitive: Boolean, memo: Memo[T]): Seq[KeyValue[T]] = + memo.getOrElseUpdate( (key, transitive), { + val task = structure.data.get(key.scope, key.key).toList.map(t => KeyValue(key,t)) + if(transitive) aggregateDeps(key, structure, memo) ++ task else task + }) def projectAggregate(key: ScopedKey[_], structure: BuildStructure): Seq[ProjectRef] = { val project = key.scope.project.toOption.flatMap { ref => Project.getProjectForReference(ref, structure) } project match { case Some(p) => p.aggregate; case None => Nil } } - def aggregateDeps[T](key: ScopedKey[T], structure: BuildStructure): Seq[KeyValue[T]] = + private[this] def aggregateDeps[T](key: ScopedKey[T], structure: BuildStructure, memo: Memo[T]): Seq[KeyValue[T]] = { val aggregated = aggregate in Scope.fillTaskAxis(key.scope, key.key) get structure.data getOrElse Enabled val (agg, transitive) = diff --git a/tasks/src/test/scala/DemoTask.scala b/tasks/src/test/scala/DemoTask.scala index b59670967..fab5d7682 100644 --- a/tasks/src/test/scala/DemoTask.scala +++ b/tasks/src/test/scala/DemoTask.scala @@ -112,7 +112,7 @@ object Task val uniformIn = tasks def work(mixed: Results[HNil], uniform: Seq[Result[Uniform]]) = { val inc = failures(uniform) - if(inc.isEmpty) f(uniform) else throw Incomplete(causes = inc) + if(inc.isEmpty) f(uniform) else throw Incomplete(None, causes = inc) } } def toNode[T, In <: HList](in: Tasks[In], f: Results[In] => Either[Task[T], T]): Node[Task, T] = new Node[Task, T] { @@ -125,12 +125,12 @@ object Task def allM[In <: HList]: Results[In] => In = in => { val incs = failuresM(in) - if(incs.isEmpty) in.down(Result.tryValue) else throw Incomplete(causes = incs) + if(incs.isEmpty) in.down(Result.tryValue) else throw Incomplete(None, causes = incs) } def all[D]: Seq[Result[D]] => Seq[D] = in => { val incs = failures(in) - if(incs.isEmpty) in.map(Result.tryValue.apply[D]) else throw Incomplete(causes = incs) + if(incs.isEmpty) in.map(Result.tryValue.apply[D]) else throw Incomplete(None, causes = incs) } def failuresM[In <: HList]: Results[In] => Seq[Incomplete] = x => failures[Any](x.toList) def failures[A]: Seq[Result[A]] => Seq[Incomplete] = _.collect { case Inc(i) => i } diff --git a/tasks/src/test/scala/Test.scala b/tasks/src/test/scala/Test.scala index 14cf59948..31c38625b 100644 --- a/tasks/src/test/scala/Test.scala +++ b/tasks/src/test/scala/Test.scala @@ -27,7 +27,7 @@ object Test case Value(aa) :^: Value(bb) :^: Value(cc) :^: KNil => aa + " " + bb + " " + cc case x => val cs = x.toList.collect { case Inc(x) => x } // workaround for double definition bug - throw Incomplete(causes = cs) + throw Incomplete(None, causes = cs) } val d2 = i32 mapR f val f2: Values => Task[Any] = { diff --git a/tasks/src/test/scala/checkResult.scala b/tasks/src/test/scala/checkResult.scala index 8459b143c..2279a7c93 100644 --- a/tasks/src/test/scala/checkResult.scala +++ b/tasks/src/test/scala/checkResult.scala @@ -18,7 +18,7 @@ object checkResult catch { case i: Incomplete => - println(Incomplete.show(i, true)) + println(i) "One or more tasks failed" |: false case e => e.printStackTrace