From 42ad2fcf05fa284419caa58022b6619b03184a4e Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Thu, 28 Nov 2013 13:17:17 +0000 Subject: [PATCH 01/11] Get rid of sources/docs configurations --- sbt/src/main/scala/package.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/sbt/src/main/scala/package.scala b/sbt/src/main/scala/package.scala index 89e570a1d..48f00804a 100644 --- a/sbt/src/main/scala/package.scala +++ b/sbt/src/main/scala/package.scala @@ -34,8 +34,6 @@ package object sbt extends sbt.std.TaskExtra with sbt.internal.util.Types with s final val Runtime = C.Runtime final val IntegrationTest = C.IntegrationTest final val Default = C.Default - final val Docs = C.Docs - final val Sources = C.Sources final val Provided = C.Provided // java.lang.System is more important, so don't alias this one // final val System = C.System From 7d2054f3ae40faa9c26a3703763cdde02da29f86 Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Fri, 29 Nov 2013 09:38:22 +0000 Subject: [PATCH 02/11] ExclusionRule -> InclExclRule --- main/actions/src/main/scala/sbt/CacheIvy.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/actions/src/main/scala/sbt/CacheIvy.scala b/main/actions/src/main/scala/sbt/CacheIvy.scala index d9f27a334..7045b44e5 100644 --- a/main/actions/src/main/scala/sbt/CacheIvy.scala +++ b/main/actions/src/main/scala/sbt/CacheIvy.scala @@ -90,8 +90,8 @@ object CacheIvy { implicit def callerFormat: Format[Caller] = wrap[Caller, (ModuleID, Seq[String], Map[String, String], Boolean, Boolean, Boolean, Boolean)](c => (c.caller, c.callerConfigurations, c.callerExtraAttributes, c.isForceDependency, c.isChangingDependency, c.isTransitiveDependency, c.isDirectlyForceDependency), { case (c, cc, ea, fd, cd, td, df) => new Caller(c, cc, ea, fd, cd, td, df) }) - implicit def exclusionRuleFormat(implicit sf: Format[String]): Format[ExclusionRule] = - wrap[ExclusionRule, (String, String, String, Seq[String])](e => (e.organization, e.name, e.artifact, e.configurations), { case (o, n, a, cs) => ExclusionRule(o, n, a, cs) }) + implicit def exclusionRuleFormat(implicit sf: Format[String]): Format[InclExclRule] = + wrap[InclExclRule, (String, String, String, Seq[String])](e => (e.organization, e.name, e.artifact, e.configurations), { case (o, n, a, cs) => InclExclRule(o, n, a, cs) }) implicit def crossVersionFormat: Format[CrossVersion] = wrap(crossToInt, crossFromInt) implicit def sourcePositionFormat: Format[SourcePosition] = wrap[SourcePosition, (Int, String, Int, Int)]( @@ -186,7 +186,7 @@ object CacheIvy { implicit def sshConnectionToHL = (s: SshConnection) => s.authentication :+: s.hostname :+: s.port :+: HNil implicit def artifactToHL = (a: Artifact) => a.name :+: a.`type` :+: a.extension :+: a.classifier :+: names(a.configurations) :+: a.url :+: a.extraAttributes :+: HNil - implicit def exclusionToHL = (e: ExclusionRule) => e.organization :+: e.name :+: e.artifact :+: e.configurations :+: HNil + implicit def inclExclToHL = (e: InclExclRule) => e.organization :+: e.name :+: e.artifact :+: e.configurations :+: HNil implicit def sbtExclusionToHL = (e: SbtExclusionRule) => e.organization :+: e.name :+: e.artifact :+: e.configurations :+: e.crossVersion :+: HNil implicit def crossToHL = (c: CrossVersion) => crossToInt(c) :+: HNil @@ -200,7 +200,7 @@ object CacheIvy { implicit def ivyFileIC: InputCache[IvyFileConfiguration] = wrapIn implicit def connectionIC: InputCache[SshConnection] = wrapIn implicit def artifactIC: InputCache[Artifact] = wrapIn - implicit def exclusionIC: InputCache[ExclusionRule] = wrapIn + implicit def exclusionIC: InputCache[InclExclRule] = wrapIn implicit def sbtExclusionIC: InputCache[SbtExclusionRule] = wrapIn implicit def crossVersionIC: InputCache[CrossVersion] = wrapIn /* implicit def publishConfIC: InputCache[PublishConfiguration] = wrapIn From f11755e181d7e35b10dd6e7c2695acf1194c4e84 Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Fri, 29 Nov 2013 09:48:46 +0000 Subject: [PATCH 03/11] ModuleID + inclusions --- main/actions/src/main/scala/sbt/CacheIvy.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/actions/src/main/scala/sbt/CacheIvy.scala b/main/actions/src/main/scala/sbt/CacheIvy.scala index 7045b44e5..45d5b4e2e 100644 --- a/main/actions/src/main/scala/sbt/CacheIvy.scala +++ b/main/actions/src/main/scala/sbt/CacheIvy.scala @@ -115,9 +115,9 @@ object CacheIvy { private[this] val crossToInt = (c: CrossVersion) => c match { case Disabled => 0; case b: Binary => BinaryValue; case f: Full => FullValue } implicit def moduleIDFormat(implicit sf: Format[String], bf: Format[Boolean]): Format[ModuleID] = - wrap[ModuleID, ((String, String, String, Option[String]), (Boolean, Boolean, Boolean, Seq[Artifact], Seq[ExclusionRule], Map[String, String], CrossVersion))]( - m => ((m.organization, m.name, m.revision, m.configurations), (m.isChanging, m.isTransitive, m.isForce, m.explicitArtifacts, m.exclusions, m.extraAttributes, m.crossVersion)), - { case ((o, n, r, cs), (ch, t, f, as, excl, x, cv)) => ModuleID(o, n, r, cs, ch, t, f, as, excl, x, cv) } + wrap[ModuleID, ((String, String, String, Option[String]), (Boolean, Boolean, Boolean, Seq[Artifact], Seq[ExclusionRule], Seq[InclusionRule], Map[String, String], CrossVersion))]( + m => ((m.organization, m.name, m.revision, m.configurations), (m.isChanging, m.isTransitive, m.isForce, m.explicitArtifacts, m.exclusions, m.inclusions, m.extraAttributes, m.crossVersion)), + { case ((o, n, r, cs), (ch, t, f, as, excl, incl, x, cv)) => ModuleID(o, n, r, cs, ch, t, f, as, excl, incl, x, cv) } ) // For some reason sbinary seems to detect unserialized instance Set[ModuleID] to be not equal. #1620 implicit def moduleSetIC: InputCache[Set[ModuleID]] = @@ -169,7 +169,7 @@ object CacheIvy { implicit def sftpRToHL = (s: SftpRepository) => s.name :+: s.connection :+: s.patterns :+: HNil implicit def rawRToHL = (r: RawRepository) => r.name :+: r.resolver.getClass.getName :+: HNil implicit def chainRToHL = (c: ChainedResolver) => c.name :+: c.resolvers :+: HNil - implicit def moduleToHL = (m: ModuleID) => m.organization :+: m.name :+: m.revision :+: m.configurations :+: m.isChanging :+: m.isTransitive :+: m.explicitArtifacts :+: m.exclusions :+: m.extraAttributes :+: m.crossVersion :+: HNil + implicit def moduleToHL = (m: ModuleID) => m.organization :+: m.name :+: m.revision :+: m.configurations :+: m.isChanging :+: m.isTransitive :+: m.explicitArtifacts :+: m.exclusions :+: m.inclusions :+: m.extraAttributes :+: m.crossVersion :+: HNil } import L3._ From 63d657e9c0098a819624a26b7f4fe9b105fd6a99 Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Fri, 29 Nov 2013 10:11:27 +0000 Subject: [PATCH 04/11] [1/2] Add {source,doc}ArtifactTypes settings, use them in update* tasks in conjunction with ArtifactTypeFilter --- main/src/main/scala/sbt/Defaults.scala | 18 +++++++++++++++--- main/src/main/scala/sbt/Keys.scala | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index d8cb03695..42cc0f380 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -679,6 +679,7 @@ object Defaults extends BuildCommon { a.copy(classifier = Some(classifierString), `type` = Artifact.classifierType(classifierString), configurations = confs) } } + // TODO bad, remove. The configuration(s) should not be decided from the classifier. def artifactConfigurations(base: Artifact, scope: Configuration, classifier: Option[String]): Iterable[Configuration] = classifier match { case Some(c) => Artifact.classifierConf(c) :: Nil @@ -1133,6 +1134,8 @@ object Classpaths { resolvers :== Nil, retrievePattern :== Resolver.defaultRetrievePattern, transitiveClassifiers :== Seq(SourceClassifier, DocClassifier), + sourceArtifactTypes :== Artifact.DefaultSourceTypes, + docArtifactTypes :== Artifact.DefaultDocTypes, sbtDependency := { val app = appConfiguration.value val id = app.provider.id @@ -1194,7 +1197,12 @@ object Classpaths { projectID <<= defaultProjectID, projectID <<= pluginProjectID, projectDescriptors <<= depMap, - updateConfiguration := new UpdateConfiguration(retrieveConfiguration.value, false, ivyLoggingLevel.value), + updateConfiguration := { + // Tell the UpdateConfiguration which artifact types are special (for sources and javadocs) + val specialArtifactTypes = sourceArtifactTypes.value union docArtifactTypes.value + // By default, to retrieve all types *but* these (it's assumed that everything else is binary/resource) + new UpdateConfiguration(retrieveConfiguration.value, false, ivyLoggingLevel.value, ArtifactTypeFilter.forbid(specialArtifactTypes)) + }, updateOptions := (updateOptions in Global).value, retrieveConfiguration := { if (retrieveManaged.value) Some(new RetrieveConfiguration(managedDirectory.value, retrievePattern.value, retrieveManagedSync.value, configurationsToRetrieve.value)) else None }, ivyConfiguration <<= mkIvyConfiguration, @@ -1248,6 +1256,8 @@ object Classpaths { val mod = (classifiersModule in updateClassifiers).value val c = updateConfiguration.value val app = appConfiguration.value + val srcTypes = sourceArtifactTypes.value + val docTypes = docArtifactTypes.value val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir) val uwConfig = (unresolvedWarningConfiguration in update).value val depDir = dependencyCacheDirectory.value @@ -1255,7 +1265,7 @@ object Classpaths { val uwConfig = (unresolvedWarningConfiguration in update).value val logicalClock = LogicalClock(state.value.hashCode) val depDir = dependencyCacheDirectory.value - IvyActions.updateClassifiers(is, GetClassifiersConfiguration(mod, excludes, c, ivyScala.value), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), s.log) + IvyActions.updateClassifiers(is, GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), ivyScala.value, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), Vector.empty, s.log) } } tag (Tags.Update, Tags.Network) ) @@ -1327,12 +1337,14 @@ object Classpaths { val mod = classifiersModule.value val c = updateConfiguration.value val app = appConfiguration.value + val srcTypes = sourceArtifactTypes.value + val docTypes = docArtifactTypes.value val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir) val uwConfig = (unresolvedWarningConfiguration in update).value val depDir = dependencyCacheDirectory.value withExcludes(out, mod.classifiers, lock(app)) { excludes => val noExplicitCheck = ivyScala.value.map(_.copy(checkExplicit = false)) - IvyActions.transitiveScratch(is, "sbt", GetClassifiersConfiguration(mod, excludes, c, noExplicitCheck), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), s.log) + IvyActions.transitiveScratch(is, "sbt", GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), noExplicitCheck, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), s.log) } } tag (Tags.Update, Tags.Network) )) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index dccc48b23..de381c6ce 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -306,6 +306,8 @@ object Keys { val updateClassifiers = TaskKey[UpdateReport]("update-classifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update) val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers", "List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.", BSetting) val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers", "Resolves and optionally retrieves classifiers, such as javadocs and sources, for sbt, transitively.", BPlusTask, updateClassifiers) + val sourceArtifactTypes = SettingKey[Set[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting) + val docArtifactTypes = SettingKey[Set[String]]("doc-artifact-types", "Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.", BSetting) val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration", "Configuration for publishing to a repository.", DTask) val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration", "Configuration for publishing to the local Ivy repository.", DTask) From 978f2304e5e1392404cf4f2f545c30d3c296a977 Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Wed, 4 Dec 2013 13:46:53 +0000 Subject: [PATCH 05/11] Stop deducing confs from classifier when delivering --- main/src/main/scala/sbt/Defaults.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 42cc0f380..383e2f6ec 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -679,7 +679,7 @@ object Defaults extends BuildCommon { a.copy(classifier = Some(classifierString), `type` = Artifact.classifierType(classifierString), configurations = confs) } } - // TODO bad, remove. The configuration(s) should not be decided from the classifier. + @deprecated("The configuration(s) should not be decided based on the classifier.", "1.0") def artifactConfigurations(base: Artifact, scope: Configuration, classifier: Option[String]): Iterable[Configuration] = classifier match { case Some(c) => Artifact.classifierConf(c) :: Nil From 1d8ec0430d6a78b3a490ff68c5a1257d47ead89d Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Tue, 9 Feb 2016 14:27:12 +0000 Subject: [PATCH 06/11] Depend on custom librarymanagement 0.1.0 which contains the sourcesDocs changes. --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 066246b10..d61f21035 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -12,7 +12,7 @@ object Dependencies { val utilVersion = "0.1.0-M5" val ioVersion = "1.0.0-M3" val incremenalcompilerVersion = "0.1.0-M1-168cb7a4877917e01917e35b9b82a62afe5c2a01" - val librarymanagementVersion = "0.1.0-M4" + val librarymanagementVersion = "0.1.0-M7" lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion lazy val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion From abb53d4cb2e1fe7bbc75e221caaf713a27242d8d Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Tue, 9 Feb 2016 15:39:39 +0000 Subject: [PATCH 07/11] Fix for weird bug where sbt.librarymanagement's package object somehow conflicts with sbt.Keys.. Thanks Scala --- main/src/main/scala/sbt/Defaults.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 383e2f6ec..2aada95e7 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -23,7 +23,7 @@ import std.TaskExtra._ import sbt.internal.inc.{ Analysis, ClassfileManager, ClasspathOptions, CompilerCache, FileValueCache, IncOptions, Locate, LoggerReporter, MixedAnalyzingCompiler, ScalaInstance } import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint } -import sbt.librarymanagement._ +import sbt.librarymanagement.{ `package` => _, _ } import sbt.internal.librarymanagement._ import sbt.internal.librarymanagement.syntax._ import sbt.internal.util._ From 20d0c41473f515cf94ebbc5ac9d59e2602284b76 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 24 Feb 2016 15:00:57 +0100 Subject: [PATCH 08/11] Update to latest util, incrementalcompiler and librarymanagement --- .../actions/src/main/scala/sbt/Compiler.scala | 81 ++++++------- main/actions/src/main/scala/sbt/Console.scala | 9 +- main/actions/src/main/scala/sbt/Tests.scala | 5 +- main/src/main/scala/sbt/Build.scala | 2 +- main/src/main/scala/sbt/ConsoleProject.scala | 4 +- main/src/main/scala/sbt/Defaults.scala | 112 ++++++++++-------- main/src/main/scala/sbt/Keys.scala | 23 ++-- main/src/main/scala/sbt/Load.scala | 2 +- main/src/main/scala/sbt/PluginDiscovery.scala | 7 +- project/Dependencies.scala | 18 +-- sbt/src/main/scala/Import.scala | 2 +- 11 files changed, 145 insertions(+), 120 deletions(-) diff --git a/main/actions/src/main/scala/sbt/Compiler.scala b/main/actions/src/main/scala/sbt/Compiler.scala index 0af0cc0df..5332da9f9 100644 --- a/main/actions/src/main/scala/sbt/Compiler.scala +++ b/main/actions/src/main/scala/sbt/Compiler.scala @@ -4,11 +4,10 @@ package sbt import sbt.internal.inc.javac.{ IncrementalCompilerJavaTools, JavaTools } -import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions, CompileSetup, CompileOutput, IC, JavaTool, LoggerReporter, ScalaInstance } +import sbt.internal.inc.{ Analysis, AnalyzingCompiler, ClasspathOptions, CompileOutput, ComponentCompiler, IncrementalCompilerImpl, JavaTool, Locate, LoggerReporter, ScalaInstance } import xsbti.{ Logger => _, _ } -import xsbti.compile.{ CompileOrder, GlobalsCache } +import xsbti.compile.{ CompileOrder, Compilers, CompileResult, GlobalsCache, IncOptions, Inputs, MiniSetup } import CompileOrder.{ JavaThenScala, Mixed, ScalaThenJava } -import sbt.internal.inc.{ Analysis, ComponentCompiler, IncOptions, Locate } import Locate.DefinesClass import java.io.File @@ -31,29 +30,29 @@ object Compiler { ComponentCompiler.incrementalVersion, Some("component")).sources() /** Inputs necessary to run the incremental compiler. */ - final case class Inputs(compilers: Compilers, config: Options, incSetup: IncSetup) - /** The inputs for the copiler *and* the previous analysis of source dependecnies. */ - final case class InputsWithPrevious(inputs: Inputs, previousAnalysis: PreviousAnalysis) - final case class Options(classpath: Seq[File], sources: Seq[File], classesDirectory: File, options: Seq[String], javacOptions: Seq[String], maxErrors: Int, sourcePositionMapper: Position => Position, order: CompileOrder) - final case class IncSetup(analysisMap: File => Option[Analysis], definesClass: DefinesClass, skip: Boolean, cacheFile: File, cache: GlobalsCache, incOptions: IncOptions) - private[sbt] trait JavaToolWithNewInterface extends JavaTool { - def newJavac: IncrementalCompilerJavaTools - } + // final case class Inputs(compilers: Compilers, config: Options, incSetup: IncSetup) + // /** The inputs for the copiler *and* the previous analysis of source dependecnies. */ + // final case class InputsWithPrevious(inputs: Inputs, previousAnalysis: PreviousAnalysis) + // final case class Options(classpath: Seq[File], sources: Seq[File], classesDirectory: File, options: Seq[String], javacOptions: Seq[String], maxErrors: Int, sourcePositionMapper: Position => Position, order: CompileOrder) + // final case class IncSetup(analysisMap: File => Option[Analysis], definesClass: DefinesClass, skip: Boolean, cacheFile: File, cache: GlobalsCache, incOptions: IncOptions) + + // private[sbt] trait JavaToolWithNewInterface extends JavaTool { + // def newJavac: IncrementalCompilerJavaTools + // } /** The instances of Scalac/Javac used to compile the current project. */ - final case class Compilers(scalac: AnalyzingCompiler, javac: IncrementalCompilerJavaTools) + // final case class Compilers(scalac: AnalyzingCompiler, javac: IncrementalCompilerJavaTools) /** The previous source dependency analysis result from compilation. */ - final case class PreviousAnalysis(analysis: Analysis, setup: Option[CompileSetup]) - type CompileResult = IC.Result + // final case class PreviousAnalysis(analysis: Analysis, setup: Option[MiniSetup]) - def inputs(classpath: Seq[File], sources: Seq[File], classesDirectory: File, options: Seq[String], - javacOptions: Seq[String], maxErrors: Int, sourcePositionMappers: Seq[Position => Option[Position]], - order: CompileOrder)(implicit compilers: Compilers, incSetup: IncSetup, log: Logger): Inputs = - new Inputs( - compilers, - new Options(classpath, sources, classesDirectory, options, javacOptions, maxErrors, foldMappers(sourcePositionMappers), order), - incSetup - ) + // def inputs(classpath: Seq[File], sources: Seq[File], classesDirectory: File, options: Seq[String], + // javacOptions: Seq[String], maxErrors: Int, sourcePositionMappers: Seq[Position => Option[Position]], + // order: CompileOrder)(implicit compilers: Compilers, incSetup: IncSetup, log: Logger): Inputs = + // new Inputs( + // compilers, + // new Options(classpath, sources, classesDirectory, options, javacOptions, maxErrors, foldMappers(sourcePositionMappers), order), + // incSetup + // ) // @deprecated("Use `compilers(ScalaInstance, ClasspathOptions, Option[File], IvyConfiguration)`.", "0.13.10") // def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File])(implicit app: AppConfiguration, log: Logger): Compilers = @@ -122,7 +121,7 @@ object Compiler { ivyConfiguration: IvyConfiguration, sourcesModule: ModuleID)(implicit app: AppConfiguration, log: Logger): Compilers = { val scalac = scalaCompiler(instance, cpOptions, javaHome, ivyConfiguration, sourcesModule) val javac = JavaTools.directOrFork(instance, cpOptions, javaHome) - new Compilers(scalac, javac) + IncrementalCompilerImpl.Compilers(scalac, javac) } def scalaCompiler(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File], ivyConfiguration: IvyConfiguration, sourcesModule: ModuleID)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler = { @@ -132,25 +131,27 @@ object Compiler { new AnalyzingCompiler(instance, provider, cpOptions) } - def compile(in: InputsWithPrevious, log: Logger): CompileResult = + def compile(in: Inputs, log: Logger): CompileResult = { - import in.inputs.config._ - compile(in, log, new LoggerReporter(maxErrors, log, sourcePositionMapper)) - } - def compile(in: InputsWithPrevious, log: Logger, reporter: xsbti.Reporter): CompileResult = - { - import in.inputs.compilers._ - import in.inputs.config._ - import in.inputs.incSetup._ - // Here is some trickery to choose the more recent (reporter-using) java compiler rather - // than the previously defined versions. - // TODO - Remove this hackery in sbt 1.0. - val javacChosen: xsbti.compile.JavaCompiler = - in.inputs.compilers.javac.xsbtiCompiler // ).getOrElse(in.inputs.compilers.javac) - // TODO - Why are we not using the IC interface??? - IC.incrementalCompile(scalac, javacChosen, sources, classpath, CompileOutput(classesDirectory), cache, None, options, javacOptions, - in.previousAnalysis.analysis, in.previousAnalysis.setup, analysisMap, definesClass, reporter, order, skip, incOptions)(log) + sbt.inc.IncrementalCompilerUtil.defaultIncrementalCompiler.compile(in, log) + // import in.inputs.config._ + // compile(in, log, new LoggerReporter(maxErrors, log, sourcePositionMapper)) } + // def compile(in: Inputs, log: Logger, reporter: xsbti.Reporter): CompileResult = + // { + // import in.inputs.compilers._ + // import in.inputs.config._ + // import in.inputs.incSetup._ + // // Here is some trickery to choose the more recent (reporter-using) java compiler rather + // // than the previously defined versions. + // // TODO - Remove this hackery in sbt 1.0. + // val javacChosen: xsbti.compile.JavaCompiler = + // in.inputs.compilers.javac.xsbtiCompiler // ).getOrElse(in.inputs.compilers.javac) + // // TODO - Why are we not using the IC interface??? + // val compiler = new IncrementalCompilerImpl + // compiler.incrementalCompile(scalac, javacChosen, sources, classpath, CompileOutput(classesDirectory), cache, None, options, javacOptions, + // in.previousAnalysis.analysis, in.previousAnalysis.setup, analysisMap, definesClass, reporter, order, skip, incOptions)(log) + // } private[sbt] def foldMappers[A](mappers: Seq[A => Option[A]]) = mappers.foldRight({ p: A => p }) { (mapper, mappers) => { p: A => mapper(p).getOrElse(mappers(p)) } } diff --git a/main/actions/src/main/scala/sbt/Console.scala b/main/actions/src/main/scala/sbt/Console.scala index d6dc07074..6e6ea8418 100644 --- a/main/actions/src/main/scala/sbt/Console.scala +++ b/main/actions/src/main/scala/sbt/Console.scala @@ -4,10 +4,12 @@ package sbt import java.io.File -import sbt.internal.inc.AnalyzingCompiler +import sbt.internal.inc.{ AnalyzingCompiler, IncrementalCompilerImpl } import sbt.internal.util.JLine import sbt.util.Logger +import xsbti.compile.Inputs + final class Console(compiler: AnalyzingCompiler) { /** Starts an interactive scala interpreter session with the given classpath.*/ def apply(classpath: Seq[File], log: Logger): Option[String] = @@ -28,5 +30,8 @@ final class Console(compiler: AnalyzingCompiler) { } } object Console { - def apply(conf: Compiler.Inputs): Console = new Console(conf.compilers.scalac) + def apply(conf: Inputs): Console = + conf.compilers match { + case IncrementalCompilerImpl.Compilers(scalac, _) => new Console(scalac) + } } diff --git a/main/actions/src/main/scala/sbt/Tests.scala b/main/actions/src/main/scala/sbt/Tests.scala index cd0bdb87d..1aab7ada9 100644 --- a/main/actions/src/main/scala/sbt/Tests.scala +++ b/main/actions/src/main/scala/sbt/Tests.scala @@ -10,6 +10,7 @@ import TaskExtra._ import sbt.internal.util.FeedbackProvidedException import sbt.internal.util.Types._ import xsbti.api.Definition +import xsbti.compile.CompileAnalysis import ConcurrentRestrictions.Tag import testing.{ AnnotatedFingerprint, Fingerprint, Framework, SubclassFingerprint, Runner, TaskDef, SuiteSelector, Task => TestTask } @@ -269,10 +270,10 @@ object Tests { } def overall(results: Iterable[TestResult.Value]): TestResult.Value = (TestResult.Passed /: results) { (acc, result) => if (acc.id < result.id) result else acc } - def discover(frameworks: Seq[Framework], analysis: Analysis, log: Logger): (Seq[TestDefinition], Set[String]) = + def discover(frameworks: Seq[Framework], analysis: CompileAnalysis, log: Logger): (Seq[TestDefinition], Set[String]) = discover(frameworks flatMap TestFramework.getFingerprints, allDefs(analysis), log) - def allDefs(analysis: Analysis) = analysis.apis.internal.values.flatMap(_.api.definitions).toSeq + def allDefs(analysis: CompileAnalysis) = analysis match { case analysis: Analysis => analysis.apis.internal.values.flatMap(_.api.definitions).toSeq } def discover(fingerprints: Seq[Fingerprint], definitions: Seq[Definition], log: Logger): (Seq[TestDefinition], Set[String]) = { val subclasses = fingerprints collect { case sub: SubclassFingerprint => (sub.superclassName, sub.isModule, sub) }; diff --git a/main/src/main/scala/sbt/Build.scala b/main/src/main/scala/sbt/Build.scala index 64e7939e9..a88cae1a2 100644 --- a/main/src/main/scala/sbt/Build.scala +++ b/main/src/main/scala/sbt/Build.scala @@ -69,5 +69,5 @@ object Build { @deprecated("Use Attributed.data", "0.13.0") def data[T](in: Seq[Attributed[T]]): Seq[T] = Attributed.data(in) - def analyzed(in: Seq[Attributed[_]]): Seq[sbt.internal.inc.Analysis] = in.flatMap { _.metadata.get(Keys.analysis) } + def analyzed(in: Seq[Attributed[_]]): Seq[xsbti.compile.CompileAnalysis] = in.flatMap { _.metadata.get(Keys.analysis) } } diff --git a/main/src/main/scala/sbt/ConsoleProject.scala b/main/src/main/scala/sbt/ConsoleProject.scala index c8546c075..c8a3e283b 100644 --- a/main/src/main/scala/sbt/ConsoleProject.scala +++ b/main/src/main/scala/sbt/ConsoleProject.scala @@ -7,7 +7,7 @@ import sbt.util.Logger import java.io.File import sbt.librarymanagement.Resolver import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths } -import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions } +import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions, IncrementalCompilerImpl } object ConsoleProject { def apply(state: State, extra: String, cleanupCommands: String = "", options: Seq[String] = Nil)(implicit log: Logger): Unit = { @@ -21,7 +21,7 @@ object ConsoleProject { val ivyPaths = new IvyPaths(unit.unit.localBase, bootIvyHome(state.configuration)) val ivyConfiguration = new InlineIvyConfiguration(ivyPaths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, checksums, None, log) - val compiler: AnalyzingCompiler = Compiler.compilers(ClasspathOptions.repl, ivyConfiguration)(state.configuration, log).scalac + val compiler: AnalyzingCompiler = Compiler.compilers(ClasspathOptions.repl, ivyConfiguration)(state.configuration, log) match { case IncrementalCompilerImpl.Compilers(scalac, _) => scalac } val imports = BuildUtil.getImports(unit.unit) ++ BuildUtil.importAll(bindings.map(_._1)) val importString = imports.mkString("", ";\n", ";\n\n") val initCommands = importString + extra diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 2aada95e7..2860c67d8 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -7,10 +7,9 @@ import scala.concurrent.duration.{ FiniteDuration, Duration } import sbt.internal.util.Attributed import sbt.internal.util.Attributed.data import Scope.{ fillTaskAxis, GlobalScope, ThisScope } -import sbt.Compiler.InputsWithPrevious import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties } import xsbt.api.Discovery -import xsbti.compile.CompileOrder +import xsbti.compile.{ CompileAnalysis, CompileOptions, CompileOrder, CompileResult, DefinesClass, IncOptions, IncOptionsUtil, Inputs, MiniSetup, PreviousResult, Setup, TransactionalManagerType } import Project.{ inConfig, inScope, inTask, richInitialize, richInitializeTask, richTaskSessionVar } import Def.{ Initialize, ScopedKey, Setting, SettingsDefinition } import sbt.internal.librarymanagement.{ CustomPomParser, DependencyFilter } @@ -20,7 +19,7 @@ import sbt.librarymanagement.Configurations.{ Compile, CompilerPlugin, Integrati import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion } import sbt.internal.util.complete._ import std.TaskExtra._ -import sbt.internal.inc.{ Analysis, ClassfileManager, ClasspathOptions, CompilerCache, FileValueCache, IncOptions, Locate, LoggerReporter, MixedAnalyzingCompiler, ScalaInstance } +import sbt.internal.inc.{ Analysis, ClassfileManager, ClasspathOptions, CompilerCache, FileValueCache, IncrementalCompilerImpl, Locate, LoggerReporter, MixedAnalyzingCompiler, ScalaInstance } import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint } import sbt.librarymanagement.{ `package` => _, _ } @@ -41,6 +40,9 @@ import sbt.internal.util.Cache.seqFormat import sbt.util.Logger import CommandStrings.ExportStream +import xsbti.Maybe +import sbt.util.InterfaceUtil.{ f1, o2m } + import sbt.internal.util.Types._ import sbt.internal.io.WatchState @@ -58,10 +60,10 @@ object Defaults extends BuildCommon { def lock(app: xsbti.AppConfiguration): xsbti.GlobalLock = app.provider.scalaProvider.launcher.globalLock - def extractAnalysis[T](a: Attributed[T]): (T, Analysis) = + def extractAnalysis[T](a: Attributed[T]): (T, CompileAnalysis) = (a.data, a.metadata get Keys.analysis getOrElse Analysis.Empty) - def analysisMap[T](cp: Seq[Attributed[T]]): T => Option[Analysis] = + def analysisMap[T](cp: Seq[Attributed[T]]): T => Option[CompileAnalysis] = { val m = (for (a <- cp; an <- a.metadata get Keys.analysis) yield (a.data, an)).toMap m.get _ @@ -237,8 +239,8 @@ object Defaults extends BuildCommon { ) def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq( - incOptions := incOptions.value.withNewClassfileManager( - ClassfileManager.transactional(crossTarget.value / "classes.bak", sbt.util.Logger.Null)), + incOptions := incOptions.value.withClassfileManagerType( + Maybe.just(new TransactionalManagerType(crossTarget.value / "classes.bak", sbt.util.Logger.Null))), scalaInstance <<= scalaInstanceTask, crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.Disabled), crossTarget := makeCrossTarget(target.value, scalaBinaryVersion.value, sbtBinaryVersion.value, sbtPlugin.value, crossPaths.value), @@ -250,7 +252,7 @@ object Defaults extends BuildCommon { ) // must be a val: duplication detected by object identity private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(Seq( - incOptions := IncOptions.Default, + incOptions := IncOptionsUtil.defaultIncOptions, classpathOptions :== ClasspathOptions.boot, classpathOptions in console :== ClasspathOptions.repl, compileOrder :== CompileOrder.Mixed, @@ -496,7 +498,7 @@ object Defaults extends BuildCommon { def testQuickFilter: Initialize[Task[Seq[String] => Seq[String => Boolean]]] = (fullClasspath in test, streams in test) map { (cp, s) => - val ans = cp.flatMap(_.metadata get Keys.analysis) + val ans: Seq[Analysis] = cp.flatMap(_.metadata get Keys.analysis) map { case a0: Analysis => a0 } val succeeded = TestStatus.read(succeededFile(s.cacheDirectory)) val stamps = collection.mutable.Map.empty[File, Long] def stamp(dep: String): Long = { @@ -788,7 +790,7 @@ object Defaults extends BuildCommon { fileInputOptions := Seq("-doc-root-content", "-diagrams-dot-path"), key in TaskGlobal := { val s = streams.value - val cs = compilers.value + val cs: IncrementalCompilerImpl.Compilers = compilers.value match { case c: IncrementalCompilerImpl.Compilers => c } val srcs = sources.value val out = target.value val sOpts = scalacOptions.value @@ -801,11 +803,7 @@ object Defaults extends BuildCommon { val logger: Logger = s.log val maxer = maxErrors.value val spms = sourcePositionMappers.value - val reporter: xsbti.Reporter = - (compilerReporter in compile).value match { - case Some(r) => r - case _ => new LoggerReporter(maxer, logger, Compiler.foldMappers(spms)) - } + val reporter = (compilerReporter in compile).value (hasScala, hasJava) match { case (true, _) => val options = sOpts ++ Opts.doc.externalAPI(xapis) @@ -823,7 +821,7 @@ object Defaults extends BuildCommon { def mainRunTask = run <<= runTask(fullClasspath in Runtime, mainClass in run, runner in run) def mainRunMainTask = runMain <<= runMainTask(fullClasspath in Runtime, runner in run) - def discoverMainClasses(analysis: Analysis): Seq[String] = + def discoverMainClasses(analysis: CompileAnalysis): Seq[String] = Discovery.applications(Tests.allDefs(analysis)).collect({ case (definition, discovered) if discovered.hasMain => definition.name }).sorted def consoleProjectTask = (state, streams, initialCommands in consoleProject) map { (state, s, extra) => ConsoleProject(state, extra)(s.log); println() } @@ -831,7 +829,7 @@ object Defaults extends BuildCommon { def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick) def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] = (compilers in task, classpath in task, scalacOptions in task, initialCommands in task, cleanupCommands in task, taskTemporaryDirectory in task, scalaInstance in task, streams) map { - (cs, cp, options, initCommands, cleanup, temp, si, s) => + case (cs: IncrementalCompilerImpl.Compilers, cp, options, initCommands, cleanup, temp, si, s) => val cpFiles = data(cp) val fullcp = (cpFiles ++ si.allJars).distinct val loader = sbt.internal.inc.classpath.ClasspathUtilities.makeLoader(fullcp, si, IO.createUniqueDirectory(temp)) @@ -851,10 +849,10 @@ object Defaults extends BuildCommon { @deprecated("Use inTask(compile)(compileInputsSettings)", "0.13.0") def compileTaskSettings: Seq[Setting[_]] = inTask(compile)(compileInputsSettings) - def compileTask: Initialize[Task[Analysis]] = Def.task { - val setup: Compiler.IncSetup = compileIncSetup.value + def compileTask: Initialize[Task[CompileAnalysis]] = Def.task { + val setup: Setup = compileIncSetup.value // TODO - expose bytecode manipulation phase. - val analysisResult: Compiler.CompileResult = manipulateBytecode.value + val analysisResult: CompileResult = manipulateBytecode.value if (analysisResult.hasModified) { val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile) store.set(analysisResult.analysis, analysisResult.setup) @@ -863,52 +861,70 @@ object Defaults extends BuildCommon { } def compileIncrementalTask = Def.task { // TODO - Should readAnalysis + saveAnalysis be scoped by the compile task too? - compileIncrementalTaskImpl(streams.value, (compileInputs in compile).value, previousCompile.value, (compilerReporter in compile).value) + compileIncrementalTaskImpl(streams.value, (compileInputs in compile).value) } - private[this] def compileIncrementalTaskImpl(s: TaskStreams, ci: Compiler.Inputs, previous: Compiler.PreviousAnalysis, reporter: Option[xsbti.Reporter]): Compiler.CompileResult = + private[this] def compileIncrementalTaskImpl(s: TaskStreams, ci: Inputs): CompileResult = { lazy val x = s.text(ExportStream) - def onArgs(cs: Compiler.Compilers) = cs.copy(scalac = cs.scalac.onArgs(exported(x, "scalac")), javac = cs.javac /*.onArgs(exported(x, "javac"))*/ ) - val i = InputsWithPrevious(ci.copy(compilers = onArgs(ci.compilers)), previous) - try reporter match { - case Some(reporter) => Compiler.compile(i, s.log, reporter) - case None => Compiler.compile(i, s.log) - } + def onArgs(cs: IncrementalCompilerImpl.Compilers) = cs.copy(scalac = cs.scalac.onArgs(exported(x, "scalac")), javac = cs.javac /*.onArgs(exported(x, "javac"))*/ ) + val compilers: IncrementalCompilerImpl.Compilers = ci.compilers match { case compilers: IncrementalCompilerImpl.Compilers => compilers } + val i = ci.withCompilers(onArgs(compilers)) + try Compiler.compile(i, s.log) finally x.close() // workaround for #937 } def compileIncSetupTask = Def.task { - Compiler.IncSetup( - analysisMap(dependencyClasspath.value), - definesClass.value, + val dc: File => DefinesClass = { + val dc = definesClass.value + f => new DefinesClass { override def apply(className: String): Boolean = dc(f)(className) } + } + new Setup( + f1(t => o2m(analysisMap(dependencyClasspath.value)(t))), + f1(dc), (skip in compile).value, // TODO - this is kind of a bad way to grab the cache directory for streams... streams.value.cacheDirectory / compileAnalysisFilename.value, compilerCache.value, - incOptions.value) + incOptions.value, + (compilerReporter in compile).value, + // TODO - task / setting for extra, + Array.empty) + } + def compileInputsSettings: Seq[Setting[_]] = { + Seq( + compileOptions := new CompileOptions( + (classDirectory.value +: data(dependencyClasspath.value)).toArray, + sources.value.toArray, + classDirectory.value, + scalacOptions.value.toArray, + javacOptions.value.toArray, + maxErrors.value, + f1(Compiler.foldMappers(sourcePositionMappers.value)), + compileOrder.value), + compilerReporter := new LoggerReporter(maxErrors.value, streams.value.log, Compiler.foldMappers(sourcePositionMappers.value)), + compileInputs := new Inputs( + compilers.value, + compileOptions.value, + compileIncSetup.value, + previousCompile.value) + ) } - def compileInputsSettings: Seq[Setting[_]] = - Seq(compileInputs := { - val cp = classDirectory.value +: data(dependencyClasspath.value) - Compiler.inputs(cp, sources.value, classDirectory.value, scalacOptions.value, javacOptions.value, - maxErrors.value, sourcePositionMappers.value, compileOrder.value)(compilers.value, compileIncSetup.value, streams.value.log) - }, - compilerReporter := None) def compileAnalysisSettings: Seq[Setting[_]] = Seq( previousCompile := { - val setup: Compiler.IncSetup = compileIncSetup.value + val setup = compileIncSetup.value val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile) store.get() match { - case Some((an, setup)) => Compiler.PreviousAnalysis(an, Some(setup)) - case None => Compiler.PreviousAnalysis(Analysis.empty(nameHashing = setup.incOptions.nameHashing), None) + case Some((an, setup)) => new PreviousResult(Maybe.just(an), Maybe.just(setup)) + case None => new PreviousResult(Maybe.nothing[CompileAnalysis], Maybe.nothing[MiniSetup]) } } ) def printWarningsTask: Initialize[Task[Unit]] = - (streams, compile, maxErrors, sourcePositionMappers) map { (s, analysis, max, spms) => - val problems = analysis.infos.allInfos.values.flatMap(i => i.reportedProblems ++ i.unreportedProblems) - val reporter = new LoggerReporter(max, s.log, Compiler.foldMappers(spms)) - problems foreach { p => reporter.display(p.position, p.message, p.severity) } + (streams, compile, maxErrors, sourcePositionMappers) map { + case (s, analysis: Analysis, max, spms) => + val problems = analysis.infos.allInfos.values.flatMap(i => i.reportedProblems ++ i.unreportedProblems) + val reporter = new LoggerReporter(max, s.log, Compiler.foldMappers(spms)) + problems foreach { p => reporter.display(p.position, p.message, p.severity) } } def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID = @@ -926,7 +942,7 @@ object Defaults extends BuildCommon { def discoverPlugins: Initialize[Task[Set[String]]] = (compile, sbtPlugin, streams) map { (analysis, isPlugin, s) => if (isPlugin) discoverSbtPlugins(analysis, s.log) else Set.empty } @deprecated("Use PluginDiscovery.sourceModuleNames[Plugin].", "0.13.2") - def discoverSbtPlugins(analysis: Analysis, log: Logger): Set[String] = + def discoverSbtPlugins(analysis: CompileAnalysis, log: Logger): Set[String] = PluginDiscovery.sourceModuleNames(analysis, classOf[Plugin].getName).toSet def copyResourcesTask = @@ -1584,7 +1600,7 @@ object Classpaths { new RawRepository(new ProjectResolver(ProjectResolver.InterProject, m)) } - def analyzed[T](data: T, analysis: Analysis) = Attributed.blank(data).put(Keys.analysis, analysis) + def analyzed[T](data: T, analysis: CompileAnalysis) = Attributed.blank(data).put(Keys.analysis, analysis) def makeProducts: Initialize[Task[Seq[File]]] = Def.task { val x1 = compile.value val x2 = copyResources.value diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index de381c6ce..5536feeca 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -9,9 +9,9 @@ import scala.concurrent.duration.{ FiniteDuration, Duration } import Def.ScopedKey import sbt.internal.util.complete._ import sbt.internal.inc.Locate.DefinesClass -import sbt.internal.inc.{ Analysis, ClasspathOptions, IncOptions, MixedAnalyzingCompiler, ScalaInstance } +import sbt.internal.inc.{ ClasspathOptions, MixedAnalyzingCompiler, ScalaInstance } import std.TaskExtra._ -import xsbti.compile.{ CompileOrder, GlobalsCache } +import xsbti.compile.{ CompileAnalysis, CompileOptions, CompileOrder, Compilers, CompileResult, GlobalsCache, IncOptions, Inputs, PreviousResult, Setup } import scala.xml.{ Node => XNode, NodeSeq } import org.apache.ivy.core.module.{ descriptor, id } import descriptor.ModuleDescriptor, id.ModuleRevisionId @@ -103,7 +103,7 @@ object Keys { // Command keys val historyPath = SettingKey(BasicKeys.historyPath) val shellPrompt = SettingKey(BasicKeys.shellPrompt) - val analysis = AttributeKey[Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting) + val analysis = AttributeKey[CompileAnalysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting) val watch = SettingKey(BasicKeys.watch) val pollInterval = SettingKey[Int]("poll-interval", "Interval between checks for modified sources by the continuous execution command.", BMinusSetting) val watchSources = TaskKey[Seq[File]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.", BMinusSetting) @@ -165,7 +165,8 @@ object Keys { val compileOrder = SettingKey[CompileOrder]("compile-order", "Configures the order in which Java and sources within a single compilation are compiled. Valid values are: JavaThenScala, ScalaThenJava, or Mixed.", BPlusSetting) val initialCommands = SettingKey[String]("initial-commands", "Initial commands to execute when starting up the Scala interpreter.", AMinusSetting) val cleanupCommands = SettingKey[String]("cleanup-commands", "Commands to execute before the Scala interpreter exits.", BMinusSetting) - val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs", "Collects all inputs needed for compilation.", DTask) + val compileOptions = TaskKey[CompileOptions]("compile-options", "Collects basic options to configure compilers", DTask) + val compileInputs = TaskKey[Inputs]("compile-inputs", "Collects all inputs needed for compilation.", DTask) val scalaHome = SettingKey[Option[File]]("scala-home", "If Some, defines the local Scala installation to use for compilation, running, and testing.", ASetting) val scalaInstance = TaskKey[ScalaInstance]("scala-instance", "Defines the Scala instance to use for compilation, running, and testing.", DTask) val scalaOrganization = SettingKey[String]("scala-organization", "Organization/group ID of the Scala used in the project. Default value is 'org.scala-lang'. This is an advanced setting used for clones of the Scala Language. It should be disregarded in standard use cases.", CSetting) @@ -185,13 +186,13 @@ object Keys { val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.", APlusTask) val consoleQuick = TaskKey[Unit]("console-quick", "Starts the Scala interpreter with the project dependencies on the classpath.", ATask, console) val consoleProject = TaskKey[Unit]("console-project", "Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.", AMinusTask) - val compile = TaskKey[Analysis]("compile", "Compiles sources.", APlusTask) - val manipulateBytecode = TaskKey[Compiler.CompileResult]("manipulateBytecode", "Manipulates generated bytecode", BTask) - val compileIncremental = TaskKey[Compiler.CompileResult]("compileIncremental", "Actually runs the incremental compilation", DTask) - val previousCompile = TaskKey[Compiler.PreviousAnalysis]("readAnalysis", "Read the incremental compiler analysis from disk", DTask) - val compilers = TaskKey[Compiler.Compilers]("compilers", "Defines the Scala and Java compilers to use for compilation.", DTask) + val compile = TaskKey[CompileAnalysis]("compile", "Compiles sources.", APlusTask) + val manipulateBytecode = TaskKey[CompileResult]("manipulateBytecode", "Manipulates generated bytecode", BTask) + val compileIncremental = TaskKey[CompileResult]("compileIncremental", "Actually runs the incremental compilation", DTask) + val previousCompile = TaskKey[PreviousResult]("readAnalysis", "Read the incremental compiler analysis from disk", DTask) + val compilers = TaskKey[Compilers]("compilers", "Defines the Scala and Java compilers to use for compilation.", DTask) val compileAnalysisFilename = TaskKey[String]("compileAnalysisFilename", "Defines the filename used to store the incremental compiler analysis file (inside the streams cacheDirectory).", DTask) - val compileIncSetup = TaskKey[Compiler.IncSetup]("inc-compile-setup", "Configures aspects of incremental compilation.", DTask) + val compileIncSetup = TaskKey[Setup]("inc-compile-setup", "Configures aspects of incremental compilation.", DTask) val compilerCache = TaskKey[GlobalsCache]("compiler-cache", "Cache of scala.tools.nsc.Global instances. This should typically be cached so that it isn't recreated every task run.", DTask) val stateCompilerCache = AttributeKey[GlobalsCache]("compiler-cache", "Internal use: Global cache.") val definesClass = TaskKey[DefinesClass]("defines-class", "Internal use: provides a function that determines whether the provided file contains a given class.", Invisible) @@ -418,7 +419,7 @@ object Keys { private[sbt] val taskCancelStrategy = SettingKey[State => TaskCancellationStrategy]("taskCancelStrategy", "Experimental task cancellation handler.", DTask) // Experimental in sbt 0.13.2 to enable grabing semantic compile failures. - private[sbt] val compilerReporter = TaskKey[Option[xsbti.Reporter]]("compilerReporter", "Experimental hook to listen (or send) compilation failure messages.", DTask) + private[sbt] val compilerReporter = TaskKey[xsbti.Reporter]("compilerReporter", "Experimental hook to listen (or send) compilation failure messages.", DTask) val triggeredBy = Def.triggeredBy val runBefore = Def.runBefore diff --git a/main/src/main/scala/sbt/Load.scala b/main/src/main/scala/sbt/Load.scala index 398292e3d..eb26a0a72 100755 --- a/main/src/main/scala/sbt/Load.scala +++ b/main/src/main/scala/sbt/Load.scala @@ -12,7 +12,6 @@ import java.net.{ URI, URL } import compiler.{ Eval, EvalImports } import scala.annotation.tailrec import collection.mutable -import Compiler.Compilers import sbt.internal.inc.{ Analysis, ClasspathOptions, FileValueCache, Locate, ModuleUtilities } import sbt.internal.inc.classpath.ClasspathUtilities import Project.{ inScope, makeSettings } @@ -30,6 +29,7 @@ import Locate.DefinesClass import sbt.io.{ GlobFilter, IO, Path } import sbt.internal.io.Alternatives import sbt.util.Logger +import xsbti.compile.Compilers object Load { // note that there is State passed in but not pulled out diff --git a/main/src/main/scala/sbt/PluginDiscovery.scala b/main/src/main/scala/sbt/PluginDiscovery.scala index 41f637fa1..11c729178 100644 --- a/main/src/main/scala/sbt/PluginDiscovery.scala +++ b/main/src/main/scala/sbt/PluginDiscovery.scala @@ -7,7 +7,8 @@ import java.net.URL import Attributed.data import Build.analyzed import xsbt.api.{ Discovered, Discovery } -import sbt.internal.inc.{ Analysis, ModuleUtilities } +import xsbti.compile.CompileAnalysis +import sbt.internal.inc.ModuleUtilities import sbt.io.IO @@ -48,7 +49,7 @@ object PluginDiscovery { } /** Discovers the sbt-plugin-related top-level modules from the provided source `analysis`. */ - def discoverSourceAll(analysis: Analysis): DiscoveredNames = + def discoverSourceAll(analysis: CompileAnalysis): DiscoveredNames = { def discover[T](implicit classTag: reflect.ClassTag[T]): Seq[String] = sourceModuleNames(analysis, classTag.runtimeClass.getName) @@ -92,7 +93,7 @@ object PluginDiscovery { ).distinct /** Discovers top-level modules in `analysis` that inherit from any of `subclasses`. */ - def sourceModuleNames(analysis: Analysis, subclasses: String*): Seq[String] = + def sourceModuleNames(analysis: CompileAnalysis, subclasses: String*): Seq[String] = { val subclassSet = subclasses.toSet val ds = Discovery(subclassSet, Set.empty)(Tests.allDefs(analysis)) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d61f21035..333733685 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,9 +9,9 @@ object Dependencies { lazy val scala211 = "2.11.7" // sbt modules - val utilVersion = "0.1.0-M5" + val utilVersion = "0.1.0-M8" val ioVersion = "1.0.0-M3" - val incremenalcompilerVersion = "0.1.0-M1-168cb7a4877917e01917e35b9b82a62afe5c2a01" + val incrementalcompilerVersion = "0.1.0-M2-ea408e4710e2616f437d5cfae5ba4846fcb9a019-SNAPSHOT" val librarymanagementVersion = "0.1.0-M7" lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion @@ -28,13 +28,13 @@ object Dependencies { lazy val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0-M1" lazy val testInterface = "org.scala-sbt" % "test-interface" % "1.0" - lazy val incrementalcompiler = "org.scala-sbt" %% "incrementalcompiler" % incremenalcompilerVersion - lazy val incrementalcompilerCompile = "org.scala-sbt" %% "incrementalcompiler-compile" % incremenalcompilerVersion - lazy val compilerInterface = "org.scala-sbt" % "compiler-interface" % incremenalcompilerVersion - lazy val compilerBrdige = "org.scala-sbt" %% "compiler-bridge" % incremenalcompilerVersion - lazy val compilerClasspath = "org.scala-sbt" %% "incrementalcompiler-classpath" % incremenalcompilerVersion - lazy val compilerApiInfo = "org.scala-sbt" %% "incrementalcompiler-apiinfo" % incremenalcompilerVersion - lazy val compilerIvyIntegration = "org.scala-sbt" %% "incrementalcompiler-ivy-integration" % incremenalcompilerVersion + lazy val incrementalcompiler = "org.scala-sbt" %% "incrementalcompiler" % incrementalcompilerVersion + lazy val incrementalcompilerCompile = "org.scala-sbt" %% "incrementalcompiler-compile" % incrementalcompilerVersion + lazy val compilerInterface = "org.scala-sbt" % "compiler-interface" % incrementalcompilerVersion + lazy val compilerBrdige = "org.scala-sbt" %% "compiler-bridge" % incrementalcompilerVersion + lazy val compilerClasspath = "org.scala-sbt" %% "incrementalcompiler-classpath" % incrementalcompilerVersion + lazy val compilerApiInfo = "org.scala-sbt" %% "incrementalcompiler-apiinfo" % incrementalcompilerVersion + lazy val compilerIvyIntegration = "org.scala-sbt" %% "incrementalcompiler-ivy-integration" % incrementalcompilerVersion lazy val jline = "jline" % "jline" % "2.11" lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-d592b1b0f77cf706e882b1b8e0162dee28165fb2" diff --git a/sbt/src/main/scala/Import.scala b/sbt/src/main/scala/Import.scala index 7a5d9be3c..4bd3928bf 100644 --- a/sbt/src/main/scala/Import.scala +++ b/sbt/src/main/scala/Import.scala @@ -431,7 +431,7 @@ object Import { type SelfFirstLoader = sbt.internal.inc.classpath.SelfFirstLoader } - val IncOptions = sbt.internal.inc.IncOptions + type IncOptions = xsbti.compile.IncOptions type Analysis = sbt.internal.inc.Analysis val Analysis = sbt.internal.inc.Analysis val ClassfileManager = sbt.internal.inc.ClassfileManager From bf12a2b9c6ae5483d077ba2380c4654517460fbe Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 24 Feb 2016 19:49:09 +0100 Subject: [PATCH 09/11] Update incrementalcompiler to 0.1.0-M3 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 333733685..fa11f325f 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,7 +11,7 @@ object Dependencies { // sbt modules val utilVersion = "0.1.0-M8" val ioVersion = "1.0.0-M3" - val incrementalcompilerVersion = "0.1.0-M2-ea408e4710e2616f437d5cfae5ba4846fcb9a019-SNAPSHOT" + val incrementalcompilerVersion = "0.1.0-M3" val librarymanagementVersion = "0.1.0-M7" lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion From 33a7f6395a8dca01e8119a354270d6b1adca94b3 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 24 Feb 2016 21:32:48 +0100 Subject: [PATCH 10/11] Adapt scripted tests to recent API changes --- sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt | 6 +++--- .../sbt-test/apiinfo/unstable-existential-names/build.sbt | 2 +- .../compiler-project/error-in-invalidated/build.sbt | 2 +- sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt | 2 +- .../compiler-project/inc-package-class-dependency/build.sbt | 2 +- .../compiler-project/inc-pickled-existential/build.sbt | 2 +- .../compiler-project/inc-pickled-refinement/build.sbt | 2 +- .../project/src/main/scala/sbt/TestPlugin.scala | 2 +- .../compiler-project/separate-analysis-per-scala/build.sbt | 6 +++--- .../source-dependencies/abstract-type-override/build.sbt | 2 +- sbt/src/sbt-test/source-dependencies/canon/build.sbt | 2 +- sbt/src/sbt-test/source-dependencies/ext/build.sbt | 2 +- .../source-dependencies/inherited-dependencies/build.sbt | 2 +- .../source-dependencies/inherited-deps-java/build.sbt | 2 +- .../inherited-macros/macro-client/build.sbt | 2 +- .../source-dependencies/inherited_type_params/build.sbt | 2 +- .../source-dependencies/less-inter-inv-java/build.sbt | 2 +- .../sbt-test/source-dependencies/less-inter-inv/build.sbt | 2 +- .../sbt-test/source-dependencies/restore-classes/build.sbt | 2 +- .../source-dependencies/transitive-memberRef/build.sbt | 2 +- 20 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt index 0d2d72459..a796de4e7 100644 --- a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt +++ b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt @@ -2,11 +2,11 @@ logLevel := Level.Debug incOptions ~= { _.withApiDebug(true) } -TaskKey[Unit]("show-apis") <<= (compile in Compile, scalaSource in Compile, javaSource in Compile) map { (a: sbt.internal.inc.Analysis, scalaSrc: java.io.File, javaSrc: java.io.File) => +TaskKey[Unit]("show-apis") <<= (compile in Compile, scalaSource in Compile, javaSource in Compile) map { case (a: sbt.internal.inc.Analysis, scalaSrc: java.io.File, javaSrc: java.io.File) => val aApi = a.apis.internalAPI(scalaSrc / "A.scala").api val jApi = a.apis.internalAPI(javaSrc / "test/J.java").api import xsbt.api.DefaultShowAPI import DefaultShowAPI._ - DefaultShowAPI.showSource.show(aApi) - DefaultShowAPI.showSource.show(jApi) + DefaultShowAPI(aApi) + DefaultShowAPI(jApi) } diff --git a/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt b/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt index c8a3bbc69..aad2f129c 100644 --- a/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt +++ b/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt @@ -1,6 +1,6 @@ // checks number of compilation iterations performed since last `clean` run InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask, compile in Compile) map { (args: Seq[String], a: sbt.internal.inc.Analysis) => + (argTask, compile in Compile) map { case (args: Seq[String], a: sbt.internal.inc.Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt val allCompilationsSize = a.compilations.allCompilations.size diff --git a/sbt/src/sbt-test/compiler-project/error-in-invalidated/build.sbt b/sbt/src/sbt-test/compiler-project/error-in-invalidated/build.sbt index d29c7592e..c92667cfa 100644 --- a/sbt/src/sbt-test/compiler-project/error-in-invalidated/build.sbt +++ b/sbt/src/sbt-test/compiler-project/error-in-invalidated/build.sbt @@ -1 +1 @@ -incOptions := IncOptions.Default +incOptions := xsbti.compile.IncOptionsUtil.defaultIncOptions diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt b/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt index dd071c738..c00ed3d45 100644 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt @@ -7,7 +7,7 @@ incOptions := incOptions.value.withNameHashing(false).withAntStyle(true) * b) checks overall number of compilations performed */ TaskKey[Unit]("check-compilations") := { - val analysis = (compile in Compile).value + val analysis = (compile in Compile).value match { case analysis: Analysis => analysis } val srcDir = (scalaSource in Compile).value def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f val allCompilations = analysis.compilations.allCompilations diff --git a/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt b/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt index 43460d0c0..7f57c476f 100644 --- a/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt @@ -1,5 +1,5 @@ TaskKey[Unit]("verify-binary-deps") <<= (compile in Compile, classDirectory in Compile, baseDirectory) map { - (a: sbt.internal.inc.Analysis, classDir: java.io.File, base: java.io.File) => + case (a: sbt.internal.inc.Analysis, classDir: java.io.File, base: java.io.File) => val nestedPkgClass = classDir / "test/nested.class" val fooSrc = base / "src/main/scala/test/nested/Foo.scala" assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString) diff --git a/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt b/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt index 57e9adbc3..a27ed56ee 100644 --- a/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt @@ -2,7 +2,7 @@ logLevel := Level.Debug // dumps analysis into target/analysis-dump.txt file InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask, compile in Compile) map { (args: Seq[String], a: Analysis) => + (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) diff --git a/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt b/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt index b7454ac88..a479d91d1 100644 --- a/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt @@ -1,5 +1,5 @@ InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask, compile in Compile) map { (args: Seq[String], a: Analysis) => + (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) diff --git a/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala b/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala index caa4e7006..b763b174f 100644 --- a/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala +++ b/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala @@ -14,7 +14,7 @@ object TestPlugin extends AutoPlugin { import autoImport._ override def projectSettings = Seq( savedReporter := new CollectingReporter, - compilerReporter in (Compile, compile) := Some(savedReporter.value), + compilerReporter in (Compile, compile) := savedReporter.value, problems := savedReporter.value.problems ) } diff --git a/sbt/src/sbt-test/compiler-project/separate-analysis-per-scala/build.sbt b/sbt/src/sbt-test/compiler-project/separate-analysis-per-scala/build.sbt index 7a7e1a0e4..c590b6d8f 100644 --- a/sbt/src/sbt-test/compiler-project/separate-analysis-per-scala/build.sbt +++ b/sbt/src/sbt-test/compiler-project/separate-analysis-per-scala/build.sbt @@ -4,9 +4,9 @@ scalaVersion := "2.10.4" crossScalaVersions := List("2.10.4", "2.11.0") -incOptions := incOptions.value.withNewClassfileManager( - ClassfileManager.transactional( +incOptions := incOptions.value.withClassfileManagerType( + xsbti.Maybe.just(new xsbti.compile.TransactionalManagerType( crossTarget.value / "classes.bak", (streams in (Compile, compile)).value.log - ) + )) ) diff --git a/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt b/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt index b7454ac88..a479d91d1 100644 --- a/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt @@ -1,5 +1,5 @@ InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask, compile in Compile) map { (args: Seq[String], a: Analysis) => + (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) diff --git a/sbt/src/sbt-test/source-dependencies/canon/build.sbt b/sbt/src/sbt-test/source-dependencies/canon/build.sbt index d23dff705..e34f4dcfe 100644 --- a/sbt/src/sbt-test/source-dependencies/canon/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/canon/build.sbt @@ -4,7 +4,7 @@ val checkIterations = inputKey[Unit]("Verifies the accumlated number of iteratio checkIterations := { val expected: Int = (Space ~> NatBasic).parsed - val actual: Int = (compile in Compile).value.compilations.allCompilations.size + val actual: Int = (compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size } assert(expected == actual, s"Expected $expected compilations, got $actual") } diff --git a/sbt/src/sbt-test/source-dependencies/ext/build.sbt b/sbt/src/sbt-test/source-dependencies/ext/build.sbt index 8aaec76ec..3a1e994b0 100644 --- a/sbt/src/sbt-test/source-dependencies/ext/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/ext/build.sbt @@ -4,6 +4,6 @@ val checkIterations = inputKey[Unit]("Verifies the accumlated number of iteratio checkIterations := { val expected: Int = (Space ~> NatBasic).parsed - val actual: Int = (compile in Compile).value.compilations.allCompilations.size + val actual: Int = (compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size } assert(expected == actual, s"Expected $expected compilations, got $actual") } \ No newline at end of file diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt index 095a01198..5bab26a24 100644 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt @@ -4,7 +4,7 @@ incOptions := incOptions.value.withNameHashing(false) lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted") verifyDeps := { - val a = compile.in(Compile).value + val a = compile.in(Compile).value match { case a: Analysis => a } val baseDir = baseDirectory.value def relative(f: java.io.File): java.io.File = f.relativeTo(baseDir) getOrElse f def toFile(s: String) = relative(baseDir / (s + ".scala")) diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt index c25b54921..da70e229f 100644 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt @@ -4,7 +4,7 @@ incOptions := incOptions.value.withNameHashing(false) lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted") verifyDeps := { - val a = compile.in(Compile).value + val a = compile.in(Compile).value match { case a: Analysis => a } same(a.relations.publicInherited.internal.forwardMap, expectedDeps.forwardMap) } diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt index f416323a0..03a7c3fe5 100644 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt @@ -1,6 +1,6 @@ // Check that a file has not been recompiled during last compilation InputKey[Unit]("check-not-recompiled") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask, compile in Compile) map { (args: Seq[String], a: Analysis) => + (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val fileCompilation = a.apis.internal.collect { case (file, src) if file.name.endsWith(args(0)) => src.compilation }.head val lastCompilation = a.compilations.allCompilations.last diff --git a/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt index a5982f901..7b9a03bb5 100644 --- a/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt @@ -1,6 +1,6 @@ name := "test" -TaskKey[Unit]("check-same") <<= compile in Configurations.Compile map { analysis => +TaskKey[Unit]("check-same") <<= compile in Configurations.Compile map { case analysis: Analysis => analysis.apis.internal foreach { case (_, api) => assert( xsbt.api.SameAPI(api.api, api.api) ) } diff --git a/sbt/src/sbt-test/source-dependencies/less-inter-inv-java/build.sbt b/sbt/src/sbt-test/source-dependencies/less-inter-inv-java/build.sbt index d23dff705..e34f4dcfe 100644 --- a/sbt/src/sbt-test/source-dependencies/less-inter-inv-java/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/less-inter-inv-java/build.sbt @@ -4,7 +4,7 @@ val checkIterations = inputKey[Unit]("Verifies the accumlated number of iteratio checkIterations := { val expected: Int = (Space ~> NatBasic).parsed - val actual: Int = (compile in Compile).value.compilations.allCompilations.size + val actual: Int = (compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size } assert(expected == actual, s"Expected $expected compilations, got $actual") } diff --git a/sbt/src/sbt-test/source-dependencies/less-inter-inv/build.sbt b/sbt/src/sbt-test/source-dependencies/less-inter-inv/build.sbt index d23dff705..e34f4dcfe 100644 --- a/sbt/src/sbt-test/source-dependencies/less-inter-inv/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/less-inter-inv/build.sbt @@ -4,7 +4,7 @@ val checkIterations = inputKey[Unit]("Verifies the accumlated number of iteratio checkIterations := { val expected: Int = (Space ~> NatBasic).parsed - val actual: Int = (compile in Compile).value.compilations.allCompilations.size + val actual: Int = (compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size } assert(expected == actual, s"Expected $expected compilations, got $actual") } diff --git a/sbt/src/sbt-test/source-dependencies/restore-classes/build.sbt b/sbt/src/sbt-test/source-dependencies/restore-classes/build.sbt index 2231204ea..2ec08ca41 100644 --- a/sbt/src/sbt-test/source-dependencies/restore-classes/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/restore-classes/build.sbt @@ -6,7 +6,7 @@ val checkIterations = inputKey[Unit]("Verifies the accumlated number of iteratio checkIterations := { val expected: Int = (Space ~> NatBasic).parsed - val actual: Int = (compile in Compile).value.compilations.allCompilations.size + val actual: Int = (compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size } assert(expected == actual, s"Expected $expected compilations, got $actual") } diff --git a/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt b/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt index b6deda492..e3f040678 100644 --- a/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt @@ -13,7 +13,7 @@ incOptions := incOptions.value.withRecompileAllFraction(1.0) * b) checks overall number of compilations performed */ TaskKey[Unit]("check-compilations") := { - val analysis = (compile in Compile).value + val analysis = (compile in Compile).value match { case a: Analysis => a } val srcDir = (scalaSource in Compile).value def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f val allCompilations = analysis.compilations.allCompilations From 5e16bbacca4b0491aad1c68d0f03e5e917b8f0b0 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 24 Feb 2016 21:33:34 +0100 Subject: [PATCH 11/11] Mark scripted `dependency-management/pom-type` as pending It has changed and will be re-enabled by changes that have not yet been forward-ported from sbt 0.13. --- sbt/src/sbt-test/dependency-management/pom-type/{test => pending} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sbt/src/sbt-test/dependency-management/pom-type/{test => pending} (100%) diff --git a/sbt/src/sbt-test/dependency-management/pom-type/test b/sbt/src/sbt-test/dependency-management/pom-type/pending similarity index 100% rename from sbt/src/sbt-test/dependency-management/pom-type/test rename to sbt/src/sbt-test/dependency-management/pom-type/pending