diff --git a/compile/inc/src/main/scala/sbt/inc/Compile.scala b/compile/inc/src/main/scala/sbt/inc/Compile.scala index 714edc94e..df79a9b24 100644 --- a/compile/inc/src/main/scala/sbt/inc/Compile.scala +++ b/compile/inc/src/main/scala/sbt/inc/Compile.scala @@ -22,7 +22,7 @@ object IncrementalCompile def doCompile(compile: (Set[File], DependencyChanges, xsbti.AnalysisCallback) => Unit, internalMap: File => Option[File], externalAPI: (File, String) => Option[Source], current: ReadStamps, output: Output) = (srcs: Set[File], changes: DependencyChanges) => { val callback = new AnalysisCallback(internalMap, externalAPI, current, output) compile(srcs, changes, callback) - callback.get + callback.get } def getExternalAPI(entry: String => Option[File], forEntry: File => Option[Analysis]): (File, String) => Option[Source] = (file: File,className: String) => @@ -49,9 +49,9 @@ private final class AnalysisCallback(internalMap: File => Option[File], external } override def toString = ( List("APIs", "Binary deps", "Products", "Source deps") zip List(apis, binaryDeps, classes, sourceDeps)).map { case (label, map) => label + "\n\t" + map.mkString("\n\t") }.mkString("\n") - + import collection.mutable.{HashMap, HashSet, ListBuffer, Map, Set} - + private[this] val apis = new HashMap[File, (Int, SourceAPI)] private[this] val unreporteds = new HashMap[File, ListBuffer[Problem]] private[this] val reporteds = new HashMap[File, ListBuffer[Problem]] @@ -113,13 +113,13 @@ private final class AnalysisCallback(internalMap: File => Option[File], external // dependency is some other binary on the classpath externalBinaryDependency(classFile, name, source) } - + def generatedClass(source: File, module: File, name: String) = { add(classes, source, (module, name)) classToSource.put(module, source) } - + def api(sourceFile: File, source: SourceAPI) { import xsbt.api.{APIUtil, HashAPI} if (APIUtil.hasMacro(source)) macroSources += sourceFile @@ -128,7 +128,7 @@ private final class AnalysisCallback(internalMap: File => Option[File], external def endSource(sourcePath: File): Unit = assert(apis.contains(sourcePath)) - + def get: Analysis = addCompilation( addExternals( addBinaries( addProducts( addSources(Analysis.Empty) ) ) ) ) def addProducts(base: Analysis): Analysis = addAll(base, classes) { case (a, src, (prod, name)) => a.addProduct(src, prod, current product prod, name ) } def addBinaries(base: Analysis): Analysis = addAll(base, binaryDeps)( (a, src, bin) => a.addBinaryDep(src, bin, binaryClassName(bin), current binary bin) ) @@ -145,7 +145,7 @@ private final class AnalysisCallback(internalMap: File => Option[File], external def getOrNil[A,B](m: collection.Map[A, Seq[B]], a: A): Seq[B] = m.get(a).toList.flatten def addExternals(base: Analysis): Analysis = (base /: extSrcDeps) { case (a, (source, name, api)) => a.addExternalDep(source, name, api) } def addCompilation(base: Analysis): Analysis = base.copy(compilations = base.compilations.add(compilation)) - + def addAll[A,B](base: Analysis, m: Map[A, Set[B]])( f: (Analysis, A, B) => Analysis): Analysis = (base /: m) { case (outer, (a, bs)) => (outer /: bs) { (inner, b) => diff --git a/compile/inc/src/main/scala/sbt/inc/Incremental.scala b/compile/inc/src/main/scala/sbt/inc/Incremental.scala index cae3db08a..d2047e94f 100644 --- a/compile/inc/src/main/scala/sbt/inc/Incremental.scala +++ b/compile/inc/src/main/scala/sbt/inc/Incremental.scala @@ -101,7 +101,7 @@ object Incremental { val previous = previousAnalysis.stamps val previousAPIs = previousAnalysis.apis - + val srcChanges = changes(previous.allInternalSources.toSet, sources, f => !equivS.equiv( previous.internalSource(f), current.internalSource(f) ) ) val removedProducts = previous.allProducts.filter( p => !equivS.equiv( previous.product(p), current.product(p) ) ).toSet val binaryDepChanges = previous.allBinaries.filter( externalBinaryModified(entry, forEntry, previous, current)).toSet @@ -158,7 +158,7 @@ object Incremental /** Returns the transitive source dependencies of `initial`, excluding the files in `initial` in most cases. * In three-stage incremental compilation, the `initial` files are the sources from step 2 that had API changes. - * Because strongly connected components (cycles) are included in step 2, the files with API changes shouldn't + * Because strongly connected components (cycles) are included in step 2, the files with API changes shouldn't * need to be compiled in step 3 if their dependencies haven't changed. If there are new cycles introduced after * step 2, these can require step 2 sources to be included in step 3 recompilation. */ diff --git a/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala b/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala index 4e42d8767..6aa9dfb58 100644 --- a/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala +++ b/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala @@ -56,7 +56,7 @@ class AggressiveCompile(cacheFile: File) val cArgs = new CompilerArguments(compiler.scalaInstance, compiler.cp) val searchClasspath = explicitBootClasspath(options.options) ++ withBootclasspath(cArgs, absClasspath) val entry = Locate.entry(searchClasspath, definesClass) - + val compile0 = (include: Set[File], changes: DependencyChanges, callback: AnalysisCallback) => { val outputDirs = outputDirectories(output) outputDirs foreach (IO.createDirectory) @@ -111,7 +111,7 @@ class AggressiveCompile(cacheFile: File) } if(order == JavaThenScala) { compileJava(); compileScala() } else { compileScala(); compileJava() } } - + val sourcesSet = sources.toSet val analysis = previousSetup match { case Some(previous) if equiv.equiv(previous, currentSetup) => previousAnalysis diff --git a/interface/src/main/java/xsbti/compile/Setup.java b/interface/src/main/java/xsbti/compile/Setup.java index 050e20c2f..9a2a6bf4c 100644 --- a/interface/src/main/java/xsbti/compile/Setup.java +++ b/interface/src/main/java/xsbti/compile/Setup.java @@ -19,7 +19,7 @@ public interface Setup boolean skip(); /** The file used to cache information across compilations. - * This file can be removed to force a full recompilation. + * This file can be removed to force a full recompilation. * The file should be unique and not shared between compilations. */ File cacheFile(); diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 969c43d3f..4f65ba371 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -312,7 +312,7 @@ object Defaults extends BuildCommon def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task { val toolReport = update.value.configuration(Configurations.ScalaTool.name) getOrElse error(noToolConfiguration(managedScalaInstance.value)) - def files(id: String) = + def files(id: String) = for { m <- toolReport.modules if m.module.name == id; (art, file) <- m.artifacts if art.`type` == Artifact.DefaultType } yield file @@ -617,7 +617,7 @@ object Defaults extends BuildCommon val hasJava = srcs.exists(_.name.endsWith(".java")) val cp = in.config.classpath.toList.filterNot(_ == in.config.classesDirectory) val label = nameForSrc(config.name) - val (options, runDoc) = + val (options, runDoc) = if(hasScala) (in.config.options ++ Opts.doc.externalAPI(xapis), Doc.scaladoc(label, s.cacheDirectory / "scala", in.compilers.scalac)) else if(hasJava) @@ -866,7 +866,7 @@ object Classpaths fullResolvers <<= (projectResolver,externalResolvers,sbtPlugin,sbtResolver,bootResolvers,overrideBuildResolvers) map { (proj,rs,isPlugin,sbtr, boot, overrideFlag) => boot match { case Some(repos) if overrideFlag => proj +: repos - case _ => + case _ => val base = if(isPlugin) sbtr +: sbtPluginReleases +: rs else rs proj +: base } @@ -1086,7 +1086,7 @@ object Classpaths def projectDependenciesTask: Initialize[Task[Seq[ModuleID]]] = (thisProjectRef, settings, buildDependencies) map { (ref, data, deps) => deps.classpath(ref) flatMap { dep => (projectID in dep.project) get data map { - _.copy(configurations = dep.configuration, explicitArtifacts = Nil) } + _.copy(configurations = dep.configuration, explicitArtifacts = Nil) } } } @@ -1326,11 +1326,11 @@ object Classpaths def bootRepositories(app: xsbti.AppConfiguration): Option[Seq[Resolver]] = try { Some(app.provider.scalaProvider.launcher.ivyRepositories.toSeq map bootRepository) } catch { case _: NoSuchMethodError => None } - + private[this] def mavenCompatible(ivyRepo: xsbti.IvyRepository): Boolean = try { ivyRepo.mavenCompatible } catch { case _: NoSuchMethodError => false } - + private[this] def bootRepository(repo: xsbti.Repository): Resolver = { import xsbti.Predefined