diff --git a/compile/inc/Analysis.scala b/compile/inc/Analysis.scala index d56132498..7babe26ff 100644 --- a/compile/inc/Analysis.scala +++ b/compile/inc/Analysis.scala @@ -6,7 +6,6 @@ package inc import xsbti.api.Source import java.io.File -import sbt.Util.counted trait Analysis { @@ -46,6 +45,15 @@ object Analysis counted("unreported warning", "", "s", unreportedCount) sections.mkString("Analysis: ", ", ", "") } + + def counted(prefix: String, single: String, plural: String, count: Int): Option[String] = + count match + { + case 0 => None + case 1 => Some("1 " + prefix + single) + case x => Some(x.toString + " " + prefix + plural) + } + } private class MAnalysis(val stamps: Stamps, val apis: APIs, val relations: Relations, val infos: SourceInfos) extends Analysis { @@ -73,4 +81,4 @@ private class MAnalysis(val stamps: Stamps, val apis: APIs, val relations: Relat def addProduct(src: File, product: File, stamp: Stamp, name: String): Analysis = copy( stamps.markProduct(product, stamp), apis, relations.addProduct(src, product, name), infos ) -} \ No newline at end of file +} diff --git a/compile/integration/AggressiveCompile.scala b/compile/integration/AggressiveCompile.scala index ac37e0fc7..77bfeb620 100644 --- a/compile/integration/AggressiveCompile.scala +++ b/compile/integration/AggressiveCompile.scala @@ -12,7 +12,6 @@ import inc._ import inc.Locate.DefinesClass import CompileSetup._ import sbinary.DefaultProtocol.{ immutableMapFormat, immutableSetFormat, StringFormat } - import Types.const import xsbti.AnalysisCallback import xsbti.api.Source @@ -25,7 +24,7 @@ final class CompileConfiguration(val sources: Seq[File], val classpath: Seq[File class AggressiveCompile(cacheFile: File) { - def apply(compiler: AnalyzingCompiler, javac: xsbti.compile.JavaCompiler, sources: Seq[File], classpath: Seq[File], outputDirectory: File, cache: GlobalsCache, options: Seq[String] = Nil, javacOptions: Seq[String] = Nil, analysisMap: File => Option[Analysis] = const(None), definesClass: DefinesClass = Locate.definesClass _, maxErrors: Int = 100, compileOrder: CompileOrder = Mixed, skip: Boolean = false)(implicit log: Logger): Analysis = + def apply(compiler: AnalyzingCompiler, javac: xsbti.compile.JavaCompiler, sources: Seq[File], classpath: Seq[File], outputDirectory: File, cache: GlobalsCache, options: Seq[String] = Nil, javacOptions: Seq[String] = Nil, analysisMap: File => Option[Analysis] = { _ => None }, definesClass: DefinesClass = Locate.definesClass _, maxErrors: Int = 100, compileOrder: CompileOrder = Mixed, skip: Boolean = false)(implicit log: Logger): Analysis = { val setup = new CompileSetup(outputDirectory, new CompileOptions(options, javacOptions), compiler.scalaInstance.actualVersion, compileOrder) compile1(sources, classpath, setup, store, analysisMap, definesClass, compiler, javac, maxErrors, skip, cache) @@ -105,8 +104,8 @@ class AggressiveCompile(cacheFile: File) } private[this] def logInputs(log: Logger, javaCount: Int, scalaCount: Int, out: File) { - val scalaMsg = Util.counted("Scala source", "", "s", scalaCount) - val javaMsg = Util.counted("Java source", "", "s", javaCount) + val scalaMsg = Analysis.counted("Scala source", "", "s", scalaCount) + val javaMsg = Analysis.counted("Java source", "", "s", javaCount) val combined = scalaMsg ++ javaMsg if(!combined.isEmpty) log.info(combined.mkString("Compiling ", " and ", " to " + out.getAbsolutePath + "...")) diff --git a/project/Sbt.scala b/project/Sbt.scala index a1e24a196..2bbf6f88e 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -63,6 +63,8 @@ object Sbt extends Build lazy val completeSub = testedBaseProject(utilPath / "complete", "Completion") dependsOn(collectionSub, controlSub, ioSub) settings(jline) // logging lazy val logSub = testedBaseProject(utilPath / "log", "Logging") dependsOn(interfaceSub, processSub) settings(libraryDependencies += jlineDep % "optional") + // Relation + lazy val relationSub = testedBaseProject(utilPath / "relation", "Relation") dependsOn(interfaceSub, processSub) // class file reader and analyzer lazy val classfileSub = testedBaseProject(utilPath / "classfile", "Classfile") dependsOn(ioSub, interfaceSub, logSub) // generates immutable or mutable Java data types according to a simple input format @@ -98,7 +100,7 @@ object Sbt extends Build // Implements the core functionality of detecting and propagating changes incrementally. // Defines the data structures for representing file fingerprints and relationships and the overall source analysis - lazy val compileIncrementalSub = testedBaseProject(compilePath / "inc", "Incremental Compiler") dependsOn(collectionSub, apiSub, ioSub, logSub, classpathSub) + lazy val compileIncrementalSub = testedBaseProject(compilePath / "inc", "Incremental Compiler") dependsOn(apiSub, ioSub, logSub, classpathSub, relationSub) // Persists the incremental data structures using SBinary lazy val compilePersistSub = baseProject(compilePath / "persist", "Persist") dependsOn(compileIncrementalSub, apiSub) settings(sbinary) // sbt-side interface to compiler. Calls compiler-side interface reflectively @@ -116,7 +118,7 @@ object Sbt extends Build // Implementation and support code for defining actions. lazy val actionsSub = baseProject(mainPath / "actions", "Actions") dependsOn( classpathSub, completeSub, apiSub, compilerIntegrationSub, compilerIvySub, - interfaceSub, ioSub, ivySub, logSub, processSub, runSub, stdTaskSub, taskSub, trackingSub, testingSub) + interfaceSub, ioSub, ivySub, logSub, processSub, runSub, relationSub, stdTaskSub, taskSub, trackingSub, testingSub) lazy val commandSub = testedBaseProject(commandPath, "Command") dependsOn(interfaceSub, ioSub, launchInterfaceSub, logSub, completeSub, classpathSub) diff --git a/util/collection/Util.scala b/util/collection/Util.scala index 429a1b61d..a886c233d 100644 --- a/util/collection/Util.scala +++ b/util/collection/Util.scala @@ -20,13 +20,6 @@ object Util case Left(l) => (l +: acc._1, acc._2) case Right(r) => (acc._1, r +: acc._2) } - def counted(prefix: String, single: String, plural: String, count: Int): Option[String] = - count match - { - case 0 => None - case 1 => Some("1 " + prefix + single) - case x => Some(x.toString + " " + prefix + plural) - } def pairID[A,B] = (a: A, b: B) => (a,b) } diff --git a/util/collection/Relation.scala b/util/relation/Relation.scala similarity index 99% rename from util/collection/Relation.scala rename to util/relation/Relation.scala index dce3d9048..0128333bd 100644 --- a/util/collection/Relation.scala +++ b/util/relation/Relation.scala @@ -119,4 +119,4 @@ private final class MRelation[A,B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]]) ext def contains(a: A, b: B): Boolean = forward(a)(b) override def toString = all.map { case (a,b) => a + " -> " + b }.mkString("Relation [", ", ", "]") -} \ No newline at end of file +} diff --git a/util/collection/src/test/scala/RelationTest.scala b/util/relation/src/test/scala/RelationTest.scala similarity index 100% rename from util/collection/src/test/scala/RelationTest.scala rename to util/relation/src/test/scala/RelationTest.scala