From 0cc3cfb36444e1efda7c4b5661f8a7ef95fcd7da Mon Sep 17 00:00:00 2001 From: jvican Date: Fri, 14 Jul 2017 14:32:53 +0200 Subject: [PATCH 01/34] Synchronize with changes to Zinc logger API https://github.com/sbt/zinc/pull/325 --- main/src/main/scala/sbt/Defaults.scala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index d29dd3858..db214bc33 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -101,7 +101,7 @@ import sbt.internal.inc.{ Analysis, FileValueCache, Locate, - LoggerReporter, + ManagedLoggedReporter, MixedAnalyzingCompiler, ScalaInstance } @@ -1435,9 +1435,13 @@ object Defaults extends BuildCommon { f1(foldMappers(sourcePositionMappers.value)), compileOrder.value ), - compilerReporter := new LoggerReporter(maxErrors.value, - streams.value.log, - foldMappers(sourcePositionMappers.value)), + compilerReporter := { + new ManagedLoggedReporter( + maxErrors.value, + streams.value.log, + foldMappers(sourcePositionMappers.value) + ) + }, compileInputs := new Inputs( compilers.value, compileOptions.value, @@ -1477,10 +1481,8 @@ object Defaults extends BuildCommon { val problems = analysis.infos.allInfos.values.flatMap(i => i.getReportedProblems ++ i.getUnreportedProblems) - val reporter = new LoggerReporter(max, streams.value.log, foldMappers(spms)) - problems foreach { p => - reporter.display(p) - } + val reporter = new ManagedLoggedReporter(max, streams.value.log, foldMappers(spms)) + problems.foreach(p => reporter.log(p)) } def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID = From 26cfe0cb7b75c39c10377f83896a01d14411eb93 Mon Sep 17 00:00:00 2001 From: jvican Date: Fri, 14 Jul 2017 17:29:06 +0200 Subject: [PATCH 02/34] Remove any reference to `F0` and `F1` Syncs with https://github.com/sbt/zinc/pull/359 and https://github.com/sbt/util/pull/84. --- main/src/main/scala/sbt/Defaults.scala | 2 +- run/src/main/scala/sbt/TrapExit.scala | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index d29dd3858..dc3205d1b 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -64,7 +64,7 @@ import sbt.librarymanagement.Configurations.{ import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion } import sbt.librarymanagement.{ `package` => _, _ } import sbt.librarymanagement.syntax._ -import sbt.util.InterfaceUtil.f1 +import sbt.util.InterfaceUtil.{ toJavaFunction => f1 } import sbt.util._ import sbt.util.CacheImplicits._ import scala.concurrent.duration.FiniteDuration diff --git a/run/src/main/scala/sbt/TrapExit.scala b/run/src/main/scala/sbt/TrapExit.scala index a78403c2b..8cc944351 100644 --- a/run/src/main/scala/sbt/TrapExit.scala +++ b/run/src/main/scala/sbt/TrapExit.scala @@ -9,15 +9,15 @@ package sbt import scala.reflect.Manifest import scala.collection.concurrent.TrieMap - import java.lang.ref.WeakReference import Thread.currentThread import java.security.Permission import java.util.concurrent.{ ConcurrentHashMap => CMap } import java.lang.Integer.{ toHexString => hex } +import java.util.function.Supplier import sbt.util.Logger - +import sbt.util.InterfaceUtil import TrapExit._ /** @@ -39,7 +39,7 @@ object TrapExit { */ def apply(execute: => Unit, log: Logger): Int = System.getSecurityManager match { - case m: TrapExit => m.runManaged(Logger.f0(execute), log) + case m: TrapExit => m.runManaged(InterfaceUtil.toSupplier(execute), log) case _ => runUnmanaged(execute, log) } @@ -149,12 +149,12 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM private[this] val threadToApp = new CMap[ThreadID, App] /** Executes `f` in a managed context. */ - def runManaged(f: xsbti.F0[Unit], xlog: xsbti.Logger): Int = { + def runManaged(f: Supplier[Unit], xlog: xsbti.Logger): Int = { val _ = running.incrementAndGet() try runManaged0(f, xlog) finally running.decrementAndGet() } - private[this] def runManaged0(f: xsbti.F0[Unit], xlog: xsbti.Logger): Int = { + private[this] def runManaged0(f: Supplier[Unit], xlog: xsbti.Logger): Int = { val log: Logger = xlog val app = new App(f, log) val executionThread = app.mainThread @@ -214,7 +214,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM * `execute` is the application code to evaluate. * `log` is used for debug logging. */ - private final class App(val execute: xsbti.F0[Unit], val log: Logger) extends Runnable { + private final class App(val execute: Supplier[Unit], val log: Logger) extends Runnable { /** * Tracks threads and groups created by this application. @@ -249,7 +249,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM val exitCode = new ExitCode def run(): Unit = { - try execute() + try execute.get() catch { case x: Throwable => exitCode.set(1) //exceptions in the main thread cause the exit code to be 1 From 32d8f4724842aed85e310543c3a745c3900caee3 Mon Sep 17 00:00:00 2001 From: jvican Date: Sat, 15 Jul 2017 09:46:55 +0200 Subject: [PATCH 03/34] Add setting to switch to text analysis As per suggestions in https://github.com/sbt/zinc/pull/351. --- main/src/main/scala/sbt/Defaults.scala | 11 ++++++++--- main/src/main/scala/sbt/Keys.scala | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index db214bc33..c2a9926d9 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -492,8 +492,11 @@ object Defaults extends BuildCommon { } } + def defaultCompileSettings: Seq[Setting[_]] = + globalDefaults(enableBinaryCompileAnalysis := true) + lazy val configTasks: Seq[Setting[_]] = docTaskSettings(doc) ++ inTask(compile)( - compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq( + compileInputsSettings) ++ configGlobal ++ defaultCompileSettings ++ compileAnalysisSettings ++ Seq( compile := compileTask.value, manipulateBytecode := compileIncremental.value, compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value, @@ -1369,10 +1372,11 @@ object Defaults extends BuildCommon { def compileTask: Initialize[Task[CompileAnalysis]] = Def.task { val setup: Setup = compileIncSetup.value + val useBinary: Boolean = enableBinaryCompileAnalysis.value // TODO - expose bytecode manipulation phase. val analysisResult: CompileResult = manipulateBytecode.value if (analysisResult.hasModified) { - val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile) + val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !enableBinaryCompileAnalysis) store.set(analysisResult.analysis, analysisResult.setup) } analysisResult.analysis @@ -1464,7 +1468,8 @@ object Defaults extends BuildCommon { def compileAnalysisSettings: Seq[Setting[_]] = Seq( previousCompile := { val setup = compileIncSetup.value - val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile) + val useBinary: Boolean = enableBinaryCompileAnalysis.value + val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary) store.get() match { case Some((an, setup)) => new PreviousResult(Option(an).toOptional, Option(setup).toOptional) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index a492a72d4..1f196f269 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -208,6 +208,7 @@ object Keys { val fileInputOptions = SettingKey[Seq[String]]("file-input-options", "Options that take file input, which may invalidate the cache.", CSetting) val scalaCompilerBridgeSource = SettingKey[ModuleID]("scala-compiler-bridge-source", "Configures the module ID of the sources of the compiler bridge.", CSetting) val scalaArtifacts = SettingKey[Seq[String]]("scala-artifacts", "Configures the list of artifacts which should match the Scala binary version", CSetting) + val enableBinaryCompileAnalysis = SettingKey[Boolean]("binary-analysis", "Writes the analysis file in binary format") val clean = TaskKey[Unit]("clean", "Deletes files produced by the build, such as generated sources, compiled classes, and task caches.", APlusTask) val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.", APlusTask) From 2da90fee035b990f47f3420fe2e1db75201a213a Mon Sep 17 00:00:00 2001 From: jvican Date: Sat, 15 Jul 2017 10:08:08 +0200 Subject: [PATCH 04/34] Sync up with changes to `AnalysisContents` --- main/src/main/scala/sbt/Defaults.scala | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index c2a9926d9..06f1ebc20 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -74,7 +74,7 @@ import Scope.{ fillTaskAxis, GlobalScope, ThisScope } import sjsonnew.{ IsoLList, JsonFormat, LList, LNil }, LList.:*: import std.TaskExtra._ import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint } -import xsbti.compile.IncToolOptionsUtil +import xsbti.compile.{ IncToolOptionsUtil, AnalysisContents } import xsbti.CrossValue // incremental compiler @@ -1376,8 +1376,10 @@ object Defaults extends BuildCommon { // TODO - expose bytecode manipulation phase. val analysisResult: CompileResult = manipulateBytecode.value if (analysisResult.hasModified) { - val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !enableBinaryCompileAnalysis) - store.set(analysisResult.analysis, analysisResult.setup) + val store = + MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary) + val contents = AnalysisContents.create(analysisResult.analysis(), analysisResult.setup()) + store.set(contents) } analysisResult.analysis } @@ -1470,9 +1472,11 @@ object Defaults extends BuildCommon { val setup = compileIncSetup.value val useBinary: Boolean = enableBinaryCompileAnalysis.value val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary) - store.get() match { - case Some((an, setup)) => - new PreviousResult(Option(an).toOptional, Option(setup).toOptional) + store.get().toOption match { + case Some(contents) => + val analysis = Option(contents.getAnalysis).toOptional + val setup = Option(contents.getMiniSetup).toOptional + new PreviousResult(analysis, setup) case None => new PreviousResult(jnone[CompileAnalysis], jnone[MiniSetup]) } } From 49765c373dfcb049aaf7d6b70627f0090d10b447 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 15 Jul 2017 09:35:22 -0400 Subject: [PATCH 05/34] An attempt to reproduce the cache update --- .../cache-update/build.sbt | 17 +++++++++++++++++ .../dependency-management/cache-update/test | 3 +++ 2 files changed, 20 insertions(+) diff --git a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt index 5afcc2440..40988bdc6 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt @@ -4,6 +4,23 @@ dependencyOverrides in ThisBuild += "com.github.nscala-time" %% "nscala-time" % lazy val root = (project in file(".")) .dependsOn(p1 % Compile) .settings( + inThisBuild(List( + organizationName := "eed3si9n", + organizationHomepage := Some(url("http://example.com/")), + homepage := Some(url("https://github.com/example/example")), + scmInfo := Some(ScmInfo(url("https://github.com/example/example"), "git@github.com:example/example.git")), + developers := List( + Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")), + Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")), + Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth")), + Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")), + Developer("gkossakowski", "Grzegorz Kossakowski", "@gkossakowski", url("https://github.com/gkossakowski")), + Developer("Duhemm", "Martin Duhem", "@Duhemm", url("https://github.com/Duhemm")) + ), + version := "0.3.1-SNAPSHOT", + description := "An HTTP client for Scala with Async Http Client underneath.", + licenses := Seq("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt")), + )), ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache") diff --git a/sbt/src/sbt-test/dependency-management/cache-update/test b/sbt/src/sbt-test/dependency-management/cache-update/test index 468a2b8d7..086420496 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/test +++ b/sbt/src/sbt-test/dependency-management/cache-update/test @@ -1,3 +1,6 @@ > compile +$ sleep 2000 +> check +$ sleep 2000 > check > check2 From 3fe068a4c16f7b69da579e015bba503f20fecbd0 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Sat, 15 Jul 2017 17:01:31 +0200 Subject: [PATCH 06/34] Adapt to changes in ConsoleAppender --- main-command/src/main/scala/sbt/Highlight.scala | 4 ++-- main-settings/src/main/scala/sbt/Def.scala | 2 +- main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala | 8 ++++---- main/src/main/scala/sbt/internal/LogManager.scala | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/main-command/src/main/scala/sbt/Highlight.scala b/main-command/src/main/scala/sbt/Highlight.scala index 3ee8d12ec..811efabfb 100644 --- a/main-command/src/main/scala/sbt/Highlight.scala +++ b/main-command/src/main/scala/sbt/Highlight.scala @@ -9,7 +9,7 @@ object Highlight { def showMatches(pattern: Pattern)(line: String): Option[String] = { val matcher = pattern.matcher(line) - if (ConsoleAppender.formatEnabled) { + if (ConsoleAppender.formatEnabledInEnv) { // ANSI codes like \033[39m (normal text color) don't work on Windows val highlighted = matcher.replaceAll(scala.Console.RED + "$0" + RESET) if (highlighted == line) None else Some(highlighted) @@ -19,5 +19,5 @@ object Highlight { None } def bold(s: String) = - if (ConsoleAppender.formatEnabled) BOLD + s.replace(RESET, RESET + BOLD) + RESET else s + if (ConsoleAppender.formatEnabledInEnv) BOLD + s.replace(RESET, RESET + BOLD) + RESET else s } diff --git a/main-settings/src/main/scala/sbt/Def.scala b/main-settings/src/main/scala/sbt/Def.scala index 68f78d360..6b195ba8d 100644 --- a/main-settings/src/main/scala/sbt/Def.scala +++ b/main-settings/src/main/scala/sbt/Def.scala @@ -68,7 +68,7 @@ object Def extends Init[Scope] with TaskMacroExtra { Scope.displayMasked(scoped.scope, scoped.key.label, mask) def withColor(s: String, color: Option[String]): String = { - val useColor = ConsoleAppender.formatEnabled + val useColor = ConsoleAppender.formatEnabledInEnv color match { case Some(c) if useColor => c + s + scala.Console.RESET case _ => s diff --git a/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala b/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala index 69cc100e3..af691f165 100644 --- a/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala +++ b/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala @@ -145,10 +145,10 @@ object OnlyTaskDynLinterDSL extends BaseTaskLinterDSL { } object TaskLinterDSLFeedback { - private final val startBold = if (ConsoleAppender.formatEnabled) AnsiColor.BOLD else "" - private final val startRed = if (ConsoleAppender.formatEnabled) AnsiColor.RED else "" - private final val startGreen = if (ConsoleAppender.formatEnabled) AnsiColor.GREEN else "" - private final val reset = if (ConsoleAppender.formatEnabled) AnsiColor.RESET else "" + private final val startBold = if (ConsoleAppender.formatEnabledInEnv) AnsiColor.BOLD else "" + private final val startRed = if (ConsoleAppender.formatEnabledInEnv) AnsiColor.RED else "" + private final val startGreen = if (ConsoleAppender.formatEnabledInEnv) AnsiColor.GREEN else "" + private final val reset = if (ConsoleAppender.formatEnabledInEnv) AnsiColor.RESET else "" private final val ProblemHeader = s"${startRed}Problem${reset}" private final val SolutionHeader = s"${startGreen}Solution${reset}" diff --git a/main/src/main/scala/sbt/internal/LogManager.scala b/main/src/main/scala/sbt/internal/LogManager.scala index 16b22b306..5468442ef 100644 --- a/main/src/main/scala/sbt/internal/LogManager.scala +++ b/main/src/main/scala/sbt/internal/LogManager.scala @@ -164,10 +164,11 @@ object LogManager { ): SuppressedTraceContext => Option[String] = { lazy val display = Project.showContextKey(state) def commandBase = "last " + display.show(unwrapStreamsKey(key)) - def command(useColor: Boolean) = - if (useColor) BLUE + commandBase + RESET else s"'$commandBase'" + def command(useFormat: Boolean) = + if (useFormat) BLUE + commandBase + RESET else s"'$commandBase'" context => - Some("Stack trace suppressed: run %s for the full output.".format(command(context.useColor))) + Some( + "Stack trace suppressed: run %s for the full output.".format(command(context.useFormat))) } def unwrapStreamsKey(key: ScopedKey[_]): ScopedKey[_] = key.scope.task match { From 850832a31cb80edcc2b948a67727cfefbc157fe0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 15 Jul 2017 17:50:00 -0400 Subject: [PATCH 07/34] Bump modules --- project/Dependencies.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index b65ce1108..7ffa7e76e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -13,9 +13,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.0.0-M12" - private val utilVersion = "1.0.0-M26" - private val lmVersion = "1.0.0-X17" - private val zincVersion = "1.0.0-X18" + private val utilVersion = "1.0.0-M27" + private val lmVersion = "1.0.0-X18" + private val zincVersion = "1.0.0-X19" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From 347914191a8af2f2ad53abbb120fb4144122380b Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Sat, 15 Jul 2017 18:09:40 -0400 Subject: [PATCH 08/34] Adapt to new library management API --- build.sbt | 14 +- .../src/main/scala/sbt/RawCompileLike.scala | 1 + .../src/test/scala/sbt/CacheIvyTest.scala | 16 +- main-settings/src/main/scala/sbt/Append.scala | 8 + main/src/main/scala/sbt/Defaults.scala | 330 ++++++++++-------- main/src/main/scala/sbt/EvaluateTask.scala | 2 +- main/src/main/scala/sbt/Keys.scala | 58 ++- main/src/main/scala/sbt/Opts.scala | 12 +- main/src/main/scala/sbt/TemplateCommand.scala | 27 +- .../internal/AltLibraryManagementCodec.scala | 47 ++- .../scala/sbt/internal/ConsoleProject.scala | 4 +- .../scala/sbt/internal/GlobalPlugin.scala | 2 +- .../main/scala/sbt/internal/IvyConsole.scala | 2 +- .../sbt/internal/LibraryManagement.scala | 5 +- main/src/main/scala/sbt/internal/Load.scala | 24 +- .../scala/sbt/internal/PluginManagement.scala | 2 +- .../librarymanagement/FakeRawRepository.scala | 2 +- project/Dependencies.scala | 6 +- sbt/src/main/scala/Import.scala | 37 +- sbt/src/main/scala/package.scala | 23 +- .../cache-classifiers/multi.sbt | 2 +- .../cache-update/build.sbt | 3 +- .../configurations-to-retrieve/build.sbt | 4 +- .../exclude-dependencies/build.sbt | 3 +- .../exclude-scala/build.sbt | 2 +- .../gh-1484-npe/build.sbt | 2 +- .../ivy-settings-c/build.sbt | 2 +- .../dependency-management/make-pom/build.sbt | 5 +- .../dependency-management/override/build.sbt | 4 +- .../dependency-management/override/test | 8 +- .../dependency-management/override2/build.sbt | 2 +- .../dependency-management/pom-scope/build.sbt | 2 +- .../provided-multi/changes/p.sbt | 2 +- .../src/main/scala/sbt/ScriptedPlugin.scala | 18 +- 34 files changed, 366 insertions(+), 315 deletions(-) diff --git a/build.sbt b/build.sbt index df186e3cd..507c80b23 100644 --- a/build.sbt +++ b/build.sbt @@ -241,11 +241,11 @@ lazy val actionsProj = (project in file("main-actions")) addSbtIO, addSbtUtilLogging, addSbtUtilRelation, + addSbtUtilTracking, addSbtCompilerInterface, addSbtCompilerClasspath, addSbtCompilerApiInfo, - addSbtUtilTracking, - addSbtLm, + addSbtLmCore, addSbtCompilerIvyIntegration, addSbtZinc ) @@ -281,7 +281,7 @@ lazy val commandProj = (project in file("main-command")) addSbtUtilLogging, addSbtCompilerInterface, addSbtCompilerClasspath, - addSbtLm + addSbtLmCore ) // The core macro project defines the main logic of the DSL, abstracted @@ -329,7 +329,7 @@ lazy val mainSettingsProj = (project in file("main-settings")) addSbtUtilRelation, addSbtCompilerInterface, addSbtCompilerClasspath, - addSbtLm + addSbtLmCore ) // The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions. @@ -347,10 +347,10 @@ lazy val mainProj = (project in file("main")) .configure( addSbtIO, addSbtUtilLogging, + addSbtLmCore, + addSbtLmIvy, addSbtCompilerInterface, - addSbtLm, - addSbtZincCompile - ) + addSbtZincCompile) // Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object // technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project diff --git a/main-actions/src/main/scala/sbt/RawCompileLike.scala b/main-actions/src/main/scala/sbt/RawCompileLike.scala index 543590277..9d1bb540c 100644 --- a/main-actions/src/main/scala/sbt/RawCompileLike.scala +++ b/main-actions/src/main/scala/sbt/RawCompileLike.scala @@ -16,6 +16,7 @@ import sbt.util.CacheImplicits._ import sbt.util.Tracked.inputChanged import sbt.util.{ CacheStoreFactory, FilesInfo, HashFileInfo, ModifiedFileInfo, PlainFileInfo } import sbt.internal.util.HNil +import sbt.internal.util.HListFormats._ import sbt.util.FileInfo.{ exists, hash, lastModified } import xsbti.compile.ClasspathOptions diff --git a/main-actions/src/test/scala/sbt/CacheIvyTest.scala b/main-actions/src/test/scala/sbt/CacheIvyTest.scala index a7ac95e0d..e8c83270f 100644 --- a/main-actions/src/test/scala/sbt/CacheIvyTest.scala +++ b/main-actions/src/test/scala/sbt/CacheIvyTest.scala @@ -46,14 +46,20 @@ class CacheIvyTest extends Properties("CacheIvy") { eq(out, m) :| s"Expected: ${str(m)}" :| s"Got: ${str(out)}" } - implicit val arbExclusionRule: Arbitrary[ExclusionRule] = Arbitrary( + implicit val arbConfigRef: Arbitrary[ConfigRef] = Arbitrary( + for { + n <- Gen.alphaStr + } yield ConfigRef(n) + ) + + implicit val arbExclusionRule: Arbitrary[InclExclRule] = Arbitrary( for { o <- Gen.alphaStr n <- Gen.alphaStr a <- Gen.alphaStr v <- arbCrossVersion.arbitrary - cs <- arbitrary[List[String]] - } yield ExclusionRule(o, n, a, cs.toVector, v) + cs <- arbitrary[List[ConfigRef]] + } yield InclExclRule(o, n, a, cs.toVector, v) ) implicit val arbCrossVersion: Arbitrary[CrossVersion] = Arbitrary { @@ -78,8 +84,8 @@ class CacheIvyTest extends Properties("CacheIvy") { isTransitive <- arbitrary[Boolean] isForce <- arbitrary[Boolean] explicitArtifacts <- Gen.listOf(arbitrary[Artifact]) - exclusions <- Gen.listOf(arbitrary[ExclusionRule]) - inclusions <- Gen.listOf(arbitrary[InclusionRule]) + exclusions <- Gen.listOf(arbitrary[InclExclRule]) + inclusions <- Gen.listOf(arbitrary[InclExclRule]) extraAttributes <- Gen.mapOf(arbitrary[(String, String)]) crossVersion <- arbitrary[CrossVersion] } yield diff --git a/main-settings/src/main/scala/sbt/Append.scala b/main-settings/src/main/scala/sbt/Append.scala index eea1c82f7..4b2c1987f 100644 --- a/main-settings/src/main/scala/sbt/Append.scala +++ b/main-settings/src/main/scala/sbt/Append.scala @@ -56,6 +56,14 @@ object Append { }) def appendValue(a: List[T], b: V): List[T] = a :+ (b: T) } + implicit def appendVectorImplicit[T, V](implicit ev: V => T): Sequence[Vector[T], Seq[V], V] = + new Sequence[Vector[T], Seq[V], V] { + def appendValues(a: Vector[T], b: Seq[V]): Vector[T] = + a ++ (b map { x => + (x: T) + }) + def appendValue(a: Vector[T], b: V): Vector[T] = a :+ (b: T) + } implicit def appendString: Value[String, String] = new Value[String, String] { def appendValue(a: String, b: String) = a + b } diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index b3dd868eb..0deb94a11 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -48,8 +48,7 @@ import sbt.io.{ PathFinder, SimpleFileFilter, DirectoryFilter, - Hash, - WatchService + Hash }, Path._ import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier } import sbt.librarymanagement.Configurations.{ @@ -62,7 +61,8 @@ import sbt.librarymanagement.Configurations.{ Test } import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion } -import sbt.librarymanagement.{ `package` => _, _ } +import sbt.librarymanagement._ +import sbt.librarymanagement.ivy._ import sbt.librarymanagement.syntax._ import sbt.util.InterfaceUtil.{ toJavaFunction => f1 } import sbt.util._ @@ -470,7 +470,7 @@ object Defaults extends BuildCommon { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - ivyConfiguration = bootIvyConfiguration.value, + dependencyResolution = dependencyResolution.value, compilerBridgeSource = scalaCompilerBridgeSource.value, scalaJarsTarget = zincDir, log = streams.value.log @@ -625,7 +625,7 @@ object Defaults extends BuildCommon { } def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task { - val toolReport = update.value.configuration(Configurations.ScalaTool.name) getOrElse + val toolReport = update.value.configuration(Configurations.ScalaTool) getOrElse sys.error(noToolConfiguration(managedScalaInstance.value)) def files(id: String) = for { @@ -1065,12 +1065,13 @@ object Defaults extends BuildCommon { case c => Some(c.name) } val combined = cPart.toList ++ classifier.toList - if (combined.isEmpty) a.withClassifier(None).withConfigurations(cOpt.toVector) + val configurations = cOpt.map(c => ConfigRef(c.name)).toVector + if (combined.isEmpty) a.withClassifier(None).withConfigurations(configurations) else { val classifierString = combined mkString "-" a.withClassifier(Some(classifierString)) .withType(Artifact.classifierType(classifierString)) - .withConfigurations(cOpt.toVector) + .withConfigurations(configurations) } } @@ -1667,7 +1668,9 @@ object Classpaths { def notFound = sys.error( "Configuration to use for managed classpath must be explicitly defined when default configurations are not present.") - search find { defined contains _.name } getOrElse notFound + search find { c => + defined contains ConfigRef(c.name) + } getOrElse notFound } def packaged(pkgTasks: Seq[TaskKey[File]]): Initialize[Task[Map[Artifact, File]]] = @@ -1703,12 +1706,14 @@ object Classpaths { packagedArtifacts :== Map.empty, crossTarget := target.value, makePom := { - val config = makePomConfiguration.value; - IvyActions.makePom(ivyModule.value, config, streams.value.log); config.file + val config = makePomConfiguration.value + val publisher = Keys.publisher.value + publisher.makePomFile(ivyModule.value, config, streams.value.log) + config.file }, packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value), - deliver := deliverTask(deliverConfiguration).value, - deliverLocal := deliverTask(deliverLocalConfiguration).value, + deliver := deliverTask(publishConfiguration).value, + deliverLocal := deliverTask(publishLocalConfiguration).value, publish := publishTask(publishConfiguration, deliver).value, publishLocal := publishTask(publishLocalConfiguration, deliverLocal).value, publishM2 := publishTask(publishM2Configuration, deliverLocal).value @@ -1726,7 +1731,7 @@ object Classpaths { scmInfo :== None, offline :== false, defaultConfiguration :== Some(Configurations.Compile), - dependencyOverrides :== Set.empty, + dependencyOverrides :== Vector.empty, libraryDependencies :== Nil, excludeDependencies :== Nil, ivyLoggingLevel :== { @@ -1739,12 +1744,12 @@ object Classpaths { ivyValidate :== false, moduleConfigurations :== Nil, publishTo :== None, - resolvers :== Nil, + resolvers :== Vector.empty, useJCenter :== false, retrievePattern :== Resolver.defaultRetrievePattern, transitiveClassifiers :== Seq(SourceClassifier, DocClassifier), - sourceArtifactTypes :== Artifact.DefaultSourceTypes, - docArtifactTypes :== Artifact.DefaultDocTypes, + sourceArtifactTypes :== Artifact.DefaultSourceTypes.toVector, + docArtifactTypes :== Artifact.DefaultDocTypes.toVector, sbtDependency := { val app = appConfiguration.value val id = app.provider.id @@ -1788,13 +1793,13 @@ object Classpaths { useJCenter.value) match { case (Some(delegated), Seq(), _, _) => delegated case (_, rs, Some(ars), uj) => ars ++ rs - case (_, rs, _, uj) => Resolver.withDefaultResolvers(rs, uj, mavenCentral = true) + case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs, uj, mavenCentral = true) }), appResolvers := { val ac = appConfiguration.value val uj = useJCenter.value appRepositories(ac) map { ars => - val useMavenCentral = ars contains DefaultMavenRepository + val useMavenCentral = ars contains Resolver.DefaultMavenRepository Resolver.reorganizeAppResolvers(ars, uj, useMavenCentral) } }, @@ -1817,7 +1822,7 @@ object Classpaths { val st = state.value BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st)) }, - otherResolvers := Resolver.publishMavenLocal :: publishTo.value.toList, + otherResolvers := Resolver.publishMavenLocal +: publishTo.value.toVector, projectResolver := projectResolverTask.value, projectDependencies := projectDependenciesTask.value, // TODO - Is this the appropriate split? Ivy defines this simply as @@ -1826,10 +1831,10 @@ object Classpaths { allDependencies := { projectDependencies.value ++ libraryDependencies.value }, - ivyScala := (ivyScala or ( + scalaModuleInfo := (scalaModuleInfo or ( Def.setting { Option( - IvyScala( + ScalaModuleInfo( (scalaVersion in update).value, (scalaBinaryVersion in update).value, Vector.empty, @@ -1848,26 +1853,27 @@ object Classpaths { projectDescriptors := depMap.value, updateConfiguration := { // Tell the UpdateConfiguration which artifact types are special (for sources and javadocs) - val specialArtifactTypes = sourceArtifactTypes.value union docArtifactTypes.value + val specialArtifactTypes = sourceArtifactTypes.value.toSet union docArtifactTypes.value.toSet // By default, to retrieve all types *but* these (it's assumed that everything else is binary/resource) - UpdateConfiguration( - retrieve = retrieveConfiguration.value, - missingOk = false, - logging = ivyLoggingLevel.value, - artifactFilter = ArtifactTypeFilter.forbid(specialArtifactTypes), - offline = offline.value, - frozen = false - ) + UpdateConfiguration() + .withRetrieveManaged(retrieveConfiguration.value) + .withLogging(ivyLoggingLevel.value) + .withArtifactFilter(ArtifactTypeFilter.forbid(specialArtifactTypes)) + .withOffline(offline.value) }, retrieveConfiguration := { if (retrieveManaged.value) Some( - RetrieveConfiguration(managedDirectory.value, - retrievePattern.value, - retrieveManagedSync.value, - configurationsToRetrieve.value)) + RetrieveConfiguration( + managedDirectory.value, + retrievePattern.value, + retrieveManagedSync.value, + configurationsToRetrieve.value.getOrElse(Vector.empty).map(c => ConfigRef(c.name)) + )) else None }, + dependencyResolution := IvyDependencyResolution(ivyConfiguration.value), + publisher := IvyPublisher(ivyConfiguration.value), ivyConfiguration := mkIvyConfiguration.value, ivyConfigurations := { val confs = thisProject.value.configurations @@ -1888,36 +1894,37 @@ object Classpaths { pomPostProcess.value, pomIncludeRepository.value, pomAllRepositories.value), - deliverLocalConfiguration := deliverConfig(crossTarget.value, - status = - if (isSnapshot.value) "integration" - else "release", - logging = ivyLoggingLevel.value), - deliverConfiguration := deliverLocalConfiguration.value, publishConfiguration := { - // TODO(jvican): I think this is a bug. - val delivered = deliver.value publishConfig( - packagedArtifacts.in(publish).value, - if (publishMavenStyle.value) None else Some(delivered), - resolverName = getPublishTo(publishTo.value).name, - checksums = checksums.in(publish).value, - logging = ivyLoggingLevel.value, - overwrite = isSnapshot.value + publishMavenStyle.value, + deliverPattern(crossTarget.value), + if (isSnapshot.value) "integration" else "release", + ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, + packagedArtifacts.in(publish).value.toVector, + checksums.in(publish).value, + getPublishTo(publishTo.value).name, + ivyLoggingLevel.value, + isSnapshot.value ) }, publishLocalConfiguration := publishConfig( - packagedArtifacts.in(publishLocal).value, - Some(deliverLocal.value), + false, //publishMavenStyle.value, + deliverPattern(crossTarget.value), + if (isSnapshot.value) "integration" else "release", + ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, + packagedArtifacts.in(publishLocal).value.toVector, checksums.in(publishLocal).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value ), publishM2Configuration := publishConfig( - packagedArtifacts.in(publishM2).value, - None, - resolverName = Resolver.publishMavenLocal.name, + true, + deliverPattern(crossTarget.value), + if (isSnapshot.value) "integration" else "release", + ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, + packagedArtifacts.in(publishM2).value.toVector, checksums = checksums.in(publishM2).value, + resolverName = Resolver.publishMavenLocal.name, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value ), @@ -1955,14 +1962,18 @@ object Classpaths { implicit val key = (m: ModuleID) => (m.organization, m.name, m.revision) val projectDeps = projectDependencies.value.iterator.map(key).toSet val externalModules = update.value.allModules.filterNot(m => projectDeps contains key(m)) - GetClassifiersModule(projectID.value, - externalModules, - ivyConfigurations.in(updateClassifiers).value.toVector, - transitiveClassifiers.in(updateClassifiers).value.toVector) + GetClassifiersModule( + projectID.value, + None, + externalModules, + ivyConfigurations.in(updateClassifiers).value.toVector, + transitiveClassifiers.in(updateClassifiers).value.toVector + ) }, updateClassifiers := (Def.task { val s = streams.value val is = ivySbt.value + val lm = new DependencyResolution(new IvyDependencyResolution(is)) val mod = (classifiersModule in updateClassifiers).value val c = updateConfiguration.value val app = appConfiguration.value @@ -1970,24 +1981,23 @@ object Classpaths { val docTypes = docArtifactTypes.value val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir) val uwConfig = (unresolvedWarningConfiguration in update).value - val depDir = dependencyCacheDirectory.value - val ivy = ivyScala.value - val st = state.value + val scalaModule = scalaModuleInfo.value withExcludes(out, mod.classifiers, lock(app)) { excludes => - IvyActions.updateClassifiers( - is, - GetClassifiersConfiguration(mod, - excludes, - c.withArtifactFilter(c.artifactFilter.invert), - ivy, - srcTypes, - docTypes), + lm.updateClassifiers( + GetClassifiersConfiguration( + mod, + excludes.toVector, + c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), + // scalaModule, + srcTypes, + docTypes), uwConfig, - LogicalClock(st.hashCode), - Some(depDir), Vector.empty, s.log - ) + ) match { + case Left(_) => ??? + case Right(ur) => ur + } } } tag (Tags.Update, Tags.Network)).value ) @@ -2010,7 +2020,7 @@ object Classpaths { else base val sbtOrg = scalaOrganization.value val version = scalaVersion.value - if (scalaHome.value.isDefined || ivyScala.value.isEmpty || !managedScalaInstance.value) + if (scalaHome.value.isDefined || scalaModuleInfo.value.isEmpty || !managedScalaInstance.value) pluginAdjust else { val isDotty = ScalaInstance.isDotty(version) @@ -2050,9 +2060,9 @@ object Classpaths { new IvySbt(ivyConfiguration.value) } def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { - InlineConfiguration( + ModuleDescriptorConfiguration( ivyValidate.value, - ivyScala.value, + scalaModuleInfo.value, projectID.value, projectInfo.value, allDependencies.value.toVector, @@ -2083,7 +2093,7 @@ object Classpaths { .resolvers explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value }, - ivyConfiguration := new InlineIvyConfiguration( + ivyConfiguration := InlineIvyConfiguration( paths = ivyPaths.value, resolvers = externalResolvers.value.toVector, otherResolvers = Vector.empty, @@ -2101,16 +2111,18 @@ object Classpaths { // to fix https://github.com/sbt/sbt/issues/2686 scalaVersion := appConfiguration.value.provider.scalaProvider.version, scalaBinaryVersion := binaryScalaVersion(scalaVersion.value), - ivyScala := { + scalaModuleInfo := { Some( - IvyScala(scalaVersion.value, - scalaBinaryVersion.value, - Vector(), - checkExplicit = false, - filterImplicit = false, - overrideScalaVersion = true).withScalaOrganization(scalaOrganization.value)) + ScalaModuleInfo( + scalaVersion.value, + scalaBinaryVersion.value, + Vector(), + checkExplicit = false, + filterImplicit = false, + overrideScalaVersion = true).withScalaOrganization(scalaOrganization.value)) }, updateSbtClassifiers in TaskGlobal := (Def.task { + val lm = dependencyResolution.value val s = streams.value val is = ivySbt.value val mod = classifiersModule.value @@ -2122,24 +2134,24 @@ object Classpaths { val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir) val uwConfig = (unresolvedWarningConfiguration in update).value val depDir = dependencyCacheDirectory.value - val ivy = ivyScala.value + val ivy = scalaModuleInfo.value val st = state.value withExcludes(out, mod.classifiers, lock(app)) { excludes => - val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) - IvyActions.transitiveScratch( - is, + // val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) + lm.transitiveScratch( "sbt", - GetClassifiersConfiguration(mod, - excludes, - c.withArtifactFilter(c.artifactFilter.invert), - noExplicitCheck, - srcTypes, - docTypes), + GetClassifiersConfiguration( + mod, + excludes.toVector, + c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), + srcTypes, + docTypes), uwConfig, - LogicalClock(st.hashCode), - Some(depDir), log - ) + ) match { + case Left(uw) => ??? + case Right(ur) => ur + } } } tag (Tags.Update, Tags.Network)).value )) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) @@ -2151,12 +2163,16 @@ object Classpaths { val pluginClasspath = loadedBuild.value.units(ref.build).unit.plugins.fullClasspath.toVector val pluginJars = pluginClasspath.filter(_.data.isFile) // exclude directories: an approximation to whether they've been published val pluginIDs: Vector[ModuleID] = pluginJars.flatMap(_ get moduleID.key) - GetClassifiersModule(projectID.value, - sbtDependency.value +: pluginIDs, - Vector(Configurations.Default), - classifiers.toVector) + GetClassifiersModule( + projectID.value, + // TODO: Should it be sbt's scalaModuleInfo? + scalaModuleInfo.value, + sbtDependency.value +: pluginIDs, + Vector(Configurations.Default), + classifiers.toVector + ) } - def deliverTask(config: TaskKey[DeliverConfiguration]): Initialize[Task[File]] = + def deliverTask(config: TaskKey[PublishConfiguration]): Initialize[Task[File]] = Def.task { val _ = update.value IvyActions.deliver(ivyModule.value, config.value, streams.value.log) @@ -2178,7 +2194,7 @@ object Classpaths { } def withExcludes(out: File, classifiers: Seq[String], lock: xsbti.GlobalLock)( - f: Map[ModuleID, Set[String]] => UpdateReport): UpdateReport = { + f: Map[ModuleID, Vector[ConfigRef]] => UpdateReport): UpdateReport = { import sbt.librarymanagement.LibraryManagementCodec._ import sbt.util.FileBasedStore implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] = @@ -2195,11 +2211,17 @@ object Classpaths { def call = { implicit val midJsonKeyFmt: sjsonnew.JsonKeyFormat[ModuleID] = moduleIdJsonKeyFormat val excludes = - store.read[Map[ModuleID, Set[String]]](default = Map.empty[ModuleID, Set[String]]) + store + .read[Map[ModuleID, Vector[ConfigRef]]]( + default = Map.empty[ModuleID, Vector[ConfigRef]]) val report = f(excludes) - val allExcludes = excludes ++ IvyActions.extractExcludes(report) + val allExcludes: Map[ModuleID, Vector[ConfigRef]] = excludes ++ IvyActions + .extractExcludes(report) + .mapValues(cs => cs.map(c => ConfigRef(c)).toVector) store.write(allExcludes) - IvyActions.addExcluded(report, classifiers.toVector, allExcludes) + IvyActions.addExcluded(report, + classifiers.toVector, + allExcludes.mapValues(_.map(_.name).toSet)) } } ) @@ -2373,25 +2395,24 @@ object Classpaths { def getPublishTo(repo: Option[Resolver]): Resolver = repo getOrElse sys.error("Repository for publishing is not specified.") - def deliverConfig(outputDirectory: File, - status: String = "release", - logging: UpdateLogging = UpdateLogging.DownloadOnly) = - new DeliverConfiguration(deliverPattern(outputDirectory), status, None, logging) - - def publishConfig( - artifacts: Map[Artifact, File], - ivyFile: Option[File], - checksums: Seq[String], - resolverName: String = "local", - logging: UpdateLogging = UpdateLogging.DownloadOnly, - overwrite: Boolean = false - ) = - new PublishConfiguration(ivyFile, - resolverName, - artifacts, - checksums.toVector, - logging, - overwrite) + def publishConfig(publishMavenStyle: Boolean, + deliverIvyPattern: String, + status: String, + configurations: Vector[ConfigRef], + artifacts: Vector[(Artifact, File)], + checksums: Vector[String], + resolverName: String = "local", + logging: UpdateLogging = UpdateLogging.DownloadOnly, + overwrite: Boolean = false) = + PublishConfiguration(publishMavenStyle, + deliverIvyPattern, + status, + configurations, + resolverName, + artifacts, + checksums, + logging, + overwrite) def deliverPattern(outputPath: File): String = (outputPath / "[artifact]-[revision](-[classifier]).[ext]").absolutePath @@ -2426,7 +2447,8 @@ object Classpaths { def projectResolverTask: Initialize[Task[Resolver]] = projectDescriptors map { m => - new RawRepository(new ProjectResolver(ProjectResolver.InterProject, m)) + val resolver = new ProjectResolver(ProjectResolver.InterProject, m) + new RawRepository(resolver, resolver.getName) } def analyzed[T](data: T, analysis: CompileAnalysis) = @@ -2555,19 +2577,16 @@ object Classpaths { val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector) val s = streams.value warnResolversConflict(rs ++: other, s.log) - new InlineIvyConfiguration( - paths = ivyPaths.value, - resolvers = rs, - otherResolvers = other, - moduleConfigurations = moduleConfigurations.value.toVector, - // offline.value, - lock = Option(lock(appConfiguration.value)), - checksums = (checksums in update).value.toVector, - managedChecksums = false, - resolutionCacheDir = Some(crossTarget.value / "resolution-cache"), - updateOptions = updateOptions.value, - log = s.log - ) + InlineIvyConfiguration() + .withPaths(ivyPaths.value) + .withResolvers(rs) + .withOtherResolvers(other) + .withModuleConfigurations(moduleConfigurations.value.toVector) + .withLock(lock(appConfiguration.value)) + .withChecksums((checksums in update).value) + .withResolutionCacheDir(crossTarget.value / "resolution-cache") + .withUpdateOptions(updateOptions.value) + .withLog(s.log) } import java.util.LinkedHashSet @@ -2581,12 +2600,12 @@ object Classpaths { val applicableConfigs = allConfigs(c) for (ac <- applicableConfigs) // add all configurations in this project visited add (p -> ac.name) - val masterConfs = names(getConfigurations(projectRef, data)) + val masterConfs = names(getConfigurations(projectRef, data).toVector) for (ResolvedClasspathDependency(dep, confMapping) <- deps.classpath(p)) { val configurations = getConfigurations(dep, data) val mapping = - mapped(confMapping, masterConfs, names(configurations), "compile", "*->compile") + mapped(confMapping, masterConfs, names(configurations.toVector), "compile", "*->compile") // map master configuration 'c' and all extended configurations to the appropriate dependency configuration for (ac <- applicableConfigs; depConfName <- mapping(ac.name)) { for (depConf <- confOpt(configurations, depConfName)) @@ -2824,8 +2843,8 @@ object Classpaths { case _: NoSuchMethodError => None } - def bootChecksums(app: xsbti.AppConfiguration): Seq[String] = - try { app.provider.scalaProvider.launcher.checksums.toSeq } catch { + def bootChecksums(app: xsbti.AppConfiguration): Vector[String] = + try { app.provider.scalaProvider.launcher.checksums.toVector } catch { case _: NoSuchMethodError => IvySbt.DefaultChecksums } @@ -2834,13 +2853,13 @@ object Classpaths { catch { case _: NoSuchMethodError => false } /** Loads the `appRepositories` configured for this launcher, if supported. */ - def appRepositories(app: xsbti.AppConfiguration): Option[Seq[Resolver]] = - try { Some(app.provider.scalaProvider.launcher.appRepositories.toSeq map bootRepository) } catch { + def appRepositories(app: xsbti.AppConfiguration): Option[Vector[Resolver]] = + try { Some(app.provider.scalaProvider.launcher.appRepositories.toVector map bootRepository) } catch { case _: NoSuchMethodError => None } - def bootRepositories(app: xsbti.AppConfiguration): Option[Seq[Resolver]] = - try { Some(app.provider.scalaProvider.launcher.ivyRepositories.toSeq map bootRepository) } catch { + def bootRepositories(app: xsbti.AppConfiguration): Option[Vector[Resolver]] = + try { Some(app.provider.scalaProvider.launcher.ivyRepositories.toVector map bootRepository) } catch { case _: NoSuchMethodError => None } @@ -2874,7 +2893,7 @@ object Classpaths { p.id match { case Predefined.Local => Resolver.defaultLocal case Predefined.MavenLocal => Resolver.mavenLocal - case Predefined.MavenCentral => DefaultMavenRepository + case Predefined.MavenCentral => Resolver.DefaultMavenRepository case Predefined.ScalaToolsReleases => Resolver.ScalaToolsReleases case Predefined.ScalaToolsSnapshots => Resolver.ScalaToolsSnapshots case Predefined.SonatypeOSSReleases => Resolver.sonatypeRepo("releases") @@ -2998,7 +3017,13 @@ trait BuildExtra extends BuildCommon with DefExtra { otherTask map { case (base, app, pr, uo, s) => val extraResolvers = if (addMultiResolver) Vector(pr) else Vector.empty - ExternalIvyConfiguration(Option(lock(app)), base, s.log, uo, u, extraResolvers) + ExternalIvyConfiguration() + .withLock(lock(app)) + .withBaseDirectory(base) + .withLog(s.log) + .withUpdateOptions(uo) + .withUri(u) + .withExtraResolvers(extraResolvers) } }).value } @@ -3007,18 +3032,19 @@ trait BuildExtra extends BuildCommon with DefExtra { baseDirectory.value / name } - def externalIvyFile( - file: Initialize[File] = inBase("ivy.xml"), - iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] = + def externalIvyFile(file: Initialize[File] = inBase("ivy.xml"), + iScala: Initialize[Option[ScalaModuleInfo]] = scalaModuleInfo) + : Setting[Task[ModuleSettings]] = moduleSettings := IvyFileConfiguration(ivyValidate.value, iScala.value, file.value, managedScalaInstance.value) def externalPom(file: Initialize[File] = inBase("pom.xml"), - iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] = + iScala: Initialize[Option[ScalaModuleInfo]] = scalaModuleInfo) + : Setting[Task[ModuleSettings]] = moduleSettings := PomConfiguration(ivyValidate.value, - ivyScala.value, + scalaModuleInfo.value, file.value, managedScalaInstance.value) diff --git a/main/src/main/scala/sbt/EvaluateTask.scala b/main/src/main/scala/sbt/EvaluateTask.scala index 968ef1e59..e14af7571 100644 --- a/main/src/main/scala/sbt/EvaluateTask.scala +++ b/main/src/main/scala/sbt/EvaluateTask.scala @@ -140,7 +140,7 @@ object EvaluateTaskConfig { final case class PluginData( dependencyClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]], - resolvers: Option[Seq[Resolver]], + resolvers: Option[Vector[Resolver]], report: Option[UpdateReport], scalacOptions: Seq[String] ) { diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 1f196f269..5fea4ca9d 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -42,44 +42,40 @@ import sbt.internal.util.{ AttributeKey, SourcePosition } import sbt.librarymanagement.Configurations.CompilerPlugin import sbt.librarymanagement.LibraryManagementCodec._ +import sbt.librarymanagement.ivy.{ Credentials, UpdateOptions } import sbt.librarymanagement.{ Artifact, Configuration, ConflictManager, ConflictWarning, - Credentials, CrossVersion, Developer, + DependencyResolution, EvictionWarning, EvictionWarningOptions, - IvyScala, + GetClassifiersModule, + MakePomConfiguration, MavenRepository, ModuleConfiguration, ModuleID, ModuleInfo, ModuleSettings, + PublishConfiguration, + Publisher, Resolver, + RetrieveConfiguration, + ScalaModuleInfo, ScalaVersion, ScmInfo, TrackLevel, + UnresolvedWarningConfiguration, UpdateConfiguration, - UpdateOptions, UpdateLogging, UpdateReport } -import sbt.librarymanagement.ExclusionRule -import sbt.internal.librarymanagement.{ - CompatibilityWarningOptions, - DeliverConfiguration, - GetClassifiersModule, - IvyConfiguration, - IvyPaths, - IvySbt, - MakePomConfiguration, - PublishConfiguration, - RetrieveConfiguration, - UnresolvedWarningConfiguration -} +import sbt.librarymanagement.InclExclRule +import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt } +import sbt.librarymanagement.ivy.{ IvyConfiguration, IvyPaths } import sbt.util.{ Level, Logger } import org.apache.logging.log4j.core.Appender import sbt.BuildSyntax._ @@ -344,6 +340,8 @@ object Keys { val updateOptions = SettingKey[UpdateOptions]("update-options", "Options for resolving managed dependencies.", DSetting) val unresolvedWarningConfiguration = TaskKey[UnresolvedWarningConfiguration]("unresolved-warning-configuration", "Configuration for unresolved dependency warning.", DTask) val dependencyPositions = TaskKey[Map[ModuleID, SourcePosition]]("dependency-positions", "Source positions where the dependencies are defined.", DTask) + val dependencyResolution = TaskKey[DependencyResolution]("dependency-resolution", "Provides the sbt interface to dependency resolution.", CTask) + val publisher = TaskKey[Publisher]("publisher", "Provides the sbt interface to publisher") val ivySbt = TaskKey[IvySbt]("ivy-sbt", "Provides the sbt interface to Ivy.", CTask) val ivyModule = TaskKey[IvySbt#Module]("ivy-module", "Provides the sbt interface to a configured Ivy module.", CTask) val updateCacheName = TaskKey[String]("updateCacheName", "Defines the directory name used to store the update cache files (inside the streams cacheDirectory).", DTask) @@ -354,14 +352,12 @@ 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 sourceArtifactTypes = SettingKey[Vector[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting) + val docArtifactTypes = SettingKey[Vector[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) val publishM2Configuration = TaskKey[PublishConfiguration]("publish-m2-configuration", "Configuration for publishing to the local Maven repository.", DTask) - val deliverConfiguration = TaskKey[DeliverConfiguration]("deliver-configuration", "Configuration for generating the finished Ivy file for publishing.", DTask) - val deliverLocalConfiguration = TaskKey[DeliverConfiguration]("deliver-local-configuration", "Configuration for generating the finished Ivy file for local publishing.", DTask) val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration", "Configuration for generating a pom.", DSetting) val packagedArtifacts = TaskKey[Map[Artifact, File]]("packaged-artifacts", "Packages all artifacts for publishing and maps the Artifact definition to the generated file.", CTask) val publishMavenStyle = SettingKey[Boolean]("publish-maven-style", "Configures whether to generate and publish a pom (true) or Ivy file (false).", BSetting) @@ -385,13 +381,13 @@ object Keys { val moduleID = SettingKey[ModuleID]("module-id", "A dependency management descriptor. This is currently used for associating a ModuleID with a classpath entry.", BPlusSetting) val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.", BMinusSetting) val overrideBuildResolvers = SettingKey[Boolean]("override-build-resolvers", "Whether or not all the build resolvers should be overridden with what's defined from the launcher.", BMinusSetting) - val bootResolvers = TaskKey[Option[Seq[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) - val appResolvers = SettingKey[Option[Seq[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) - val externalResolvers = TaskKey[Seq[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) - val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) + val bootResolvers = TaskKey[Option[Vector[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) + val appResolvers = SettingKey[Option[Vector[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) + val externalResolvers = TaskKey[Vector[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) + val resolvers = SettingKey[Vector[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask) - val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) - val otherResolvers = TaskKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) + val fullResolvers = TaskKey[Vector[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) + val otherResolvers = TaskKey[Vector[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting) val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting) val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting) @@ -400,12 +396,12 @@ object Keys { val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting) val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask) val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting) - val dependencyOverrides = SettingKey[Set[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) - val excludeDependencies = SettingKey[Seq[ExclusionRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting) + val dependencyOverrides = SettingKey[Vector[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) + val excludeDependencies = SettingKey[Seq[InclExclRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting) val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask) val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.", DTask) val ivyXML = SettingKey[NodeSeq]("ivy-xml", "Defines inline Ivy XML for configuring dependency management.", BSetting) - val ivyScala = SettingKey[Option[IvyScala]]("ivy-scala", "Configures how Scala dependencies are checked, filtered, and injected.", CSetting) + val scalaModuleInfo = SettingKey[Option[ScalaModuleInfo]]("scala-module-info", "Configures how Scala dependencies are checked, filtered, and injected.", CSetting) val ivyValidate = SettingKey[Boolean]("ivy-validate", "Enables/disables Ivy validation of module metadata.", BSetting) val ivyLoggingLevel = SettingKey[UpdateLogging]("ivy-logging-level", "The logging level for updating.", BSetting) val publishTo = TaskKey[Option[Resolver]]("publish-to", "The resolver to publish to.", ASetting) @@ -414,12 +410,12 @@ object Keys { val autoUpdate = SettingKey[Boolean]("auto-update", "", Invisible) val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.", BSetting) val retrieveManagedSync = SettingKey[Boolean]("retrieve-managed-sync", "If true, enables synchronizing the dependencies retrieved to the current build by removed unneeded files.", BSetting) - val configurationsToRetrieve = SettingKey[Option[Set[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) + val configurationsToRetrieve = SettingKey[Option[Vector[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.", BSetting) val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.", BSetting) val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.", AMinusSetting) val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.", CTask) - val checksums = SettingKey[Seq[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) + val checksums = SettingKey[Vector[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting) val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask) diff --git a/main/src/main/scala/sbt/Opts.scala b/main/src/main/scala/sbt/Opts.scala index 1293ebd36..a3100d883 100644 --- a/main/src/main/scala/sbt/Opts.scala +++ b/main/src/main/scala/sbt/Opts.scala @@ -3,7 +3,8 @@ */ package sbt -import sbt.librarymanagement.{ Credentials, MavenRepository, Resolver } +import sbt.librarymanagement.{ MavenRepository, Resolver } +import sbt.librarymanagement.ivy.Credentials import java.io.File import java.net.URL @@ -62,11 +63,12 @@ object DefaultOptions { def scaladoc(name: String, version: String): Seq[String] = doc.title(name) ++ doc.version(version) - def resolvers(snapshot: Boolean): Seq[Resolver] = { - if (snapshot) Seq(resolver.sbtSnapshots) else Nil + def resolvers(snapshot: Boolean): Vector[Resolver] = { + if (snapshot) Vector(resolver.sbtSnapshots) else Vector.empty } - def pluginResolvers(plugin: Boolean, snapshot: Boolean): Seq[Resolver] = { - if (plugin && snapshot) Seq(resolver.sbtSnapshots, resolver.sbtIvySnapshots) else Nil + def pluginResolvers(plugin: Boolean, snapshot: Boolean): Vector[Resolver] = { + if (plugin && snapshot) Vector(resolver.sbtSnapshots, resolver.sbtIvySnapshots) + else Vector.empty } def addResolvers: Setting[_] = Keys.resolvers ++= { resolvers(Keys.isSnapshot.value) } def addPluginResolvers: Setting[_] = diff --git a/main/src/main/scala/sbt/TemplateCommand.scala b/main/src/main/scala/sbt/TemplateCommand.scala index aade81a14..6db29f037 100644 --- a/main/src/main/scala/sbt/TemplateCommand.scala +++ b/main/src/main/scala/sbt/TemplateCommand.scala @@ -8,7 +8,7 @@ import sbt.util._ import sbt.internal.util.complete.{ DefaultParsers, Parser }, DefaultParsers._ import xsbti.AppConfiguration import sbt.librarymanagement._ -import sbt.internal.librarymanagement.IvyConfiguration +import sbt.librarymanagement.ivy.{ IvyConfiguration, IvyDependencyResolution } import sbt.internal.inc.classpath.ClasspathUtilities import BasicCommandStrings._, BasicKeys._ @@ -25,13 +25,13 @@ private[sbt] object TemplateCommandUtil { val extracted = (Project extract state) val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state) val globalBase = BuildPaths.getGlobalBase(state) - val ivyScala = extracted.get(Keys.ivyScala in Keys.updateSbtClassifiers) + val scalaModuleInfo = extracted.get(Keys.scalaModuleInfo in Keys.updateSbtClassifiers) val arguments = inputArg.toList ++ (state.remainingCommands match { case exec :: Nil if exec.commandLine == "shell" => Nil case xs => xs map (_.commandLine) }) - run(infos, arguments, state.configuration, ivyConf, globalBase, ivyScala, log) + run(infos, arguments, state.configuration, ivyConf, globalBase, scalaModuleInfo, log) "exit" :: s2.copy(remainingCommands = Nil) } @@ -41,11 +41,11 @@ private[sbt] object TemplateCommandUtil { config: AppConfiguration, ivyConf: IvyConfiguration, globalBase: File, - ivyScala: Option[IvyScala], + scalaModuleInfo: Option[ScalaModuleInfo], log: Logger ): Unit = infos find { info => - val loader = infoLoader(info, config, ivyConf, globalBase, ivyScala, log) + val loader = infoLoader(info, config, ivyConf, globalBase, scalaModuleInfo, log) val hit = tryTemplate(info, arguments, loader) if (hit) { runTemplate(info, arguments, loader) @@ -75,10 +75,10 @@ private[sbt] object TemplateCommandUtil { config: AppConfiguration, ivyConf: IvyConfiguration, globalBase: File, - ivyScala: Option[IvyScala], + scalaModuleInfo: Option[ScalaModuleInfo], log: Logger ): ClassLoader = { - val cp = classpathForInfo(info, ivyConf, globalBase, ivyScala, log) + val cp = classpathForInfo(info, ivyConf, globalBase, scalaModuleInfo, log) ClasspathUtilities.toLoader(cp, config.provider.loader) } @@ -103,10 +103,10 @@ private[sbt] object TemplateCommandUtil { info: TemplateResolverInfo, ivyConf: IvyConfiguration, globalBase: File, - ivyScala: Option[IvyScala], + scalaModuleInfo: Option[ScalaModuleInfo], log: Logger ): List[File] = { - val lm = new DefaultLibraryManagement(ivyConf, log) + val lm = IvyDependencyResolution(ivyConf) val templatesBaseDirectory = new File(globalBase, "templates") val templateId = s"${info.module.organization}_${info.module.name}_${info.module.revision}" val templateDirectory = new File(templatesBaseDirectory, templateId) @@ -114,8 +114,13 @@ private[sbt] object TemplateCommandUtil { if (!(info.module.revision endsWith "-SNAPSHOT") && jars.nonEmpty) jars.toList else { IO.createDirectory(templateDirectory) - val m = lm.getModule(info.module.withConfigurations(Some("component")), ivyScala) - val xs = lm.update(m, templateDirectory)(_ => true).toList.flatten + val m = lm.moduleDescriptor(info.module.withConfigurations(Some("component")), + Vector.empty, + scalaModuleInfo) + val xs = lm.retrieve(m, templateDirectory, log) match { + case Left(_) => ??? // FIXME + case Right(files) => files.toList + } xs } } diff --git a/main/src/main/scala/sbt/internal/AltLibraryManagementCodec.scala b/main/src/main/scala/sbt/internal/AltLibraryManagementCodec.scala index 5fb7ca469..b66aae741 100644 --- a/main/src/main/scala/sbt/internal/AltLibraryManagementCodec.scala +++ b/main/src/main/scala/sbt/internal/AltLibraryManagementCodec.scala @@ -3,14 +3,14 @@ package sbt.internal import sbt.internal.librarymanagement._ import sbt.internal.util.Types._ import sbt.internal.util.{ HList, HNil } -import sbt.internal.util.HListFormats._ -import sbt.io.{ Hash, IO } +import sbt.io.Hash import sbt.librarymanagement._ -import sbt.util.CacheImplicits._ +import sbt.librarymanagement.ivy._ import sbt.util._ +import sbt.internal.util.HListFormats._ import sjsonnew.JsonFormat -object AltLibraryManagementCodec extends LibraryManagementCodec { +object AltLibraryManagementCodec extends IvyLibraryManagementCodec { type In0 = ModuleSettings :+: UpdateConfiguration :+: HNil type In = IvyConfiguration :+: In0 @@ -37,33 +37,31 @@ object AltLibraryManagementCodec extends LibraryManagementCodec { SftpRepository, RawRepository] - type InlineIvyHL = (IvyPaths :+: Vector[Resolver] :+: Vector[Resolver] :+: Vector[ + type InlineIvyHL = (Option[IvyPaths] :+: Vector[Resolver] :+: Vector[Resolver] :+: Vector[ ModuleConfiguration] :+: Vector[String] :+: Boolean :+: HNil) def inlineIvyToHL(i: InlineIvyConfiguration): InlineIvyHL = ( i.paths :+: i.resolvers :+: i.otherResolvers :+: i.moduleConfigurations :+: i.checksums :+: i.managedChecksums :+: HNil ) - type ExternalIvyHL = PlainFileInfo :+: Array[Byte] :+: HNil + type ExternalIvyHL = Option[PlainFileInfo] :+: Array[Byte] :+: HNil def externalIvyToHL(e: ExternalIvyConfiguration): ExternalIvyHL = - FileInfo.exists(e.baseDirectory) :+: Hash.contentsIfLocal(e.uri) :+: HNil + e.baseDirectory.map(FileInfo.exists.apply) :+: e.uri + .map(Hash.contentsIfLocal) + .getOrElse(Array.empty) :+: HNil // Redefine to use a subset of properties, that are serialisable override lazy implicit val InlineIvyConfigurationFormat: JsonFormat[InlineIvyConfiguration] = { def hlToInlineIvy(i: InlineIvyHL): InlineIvyConfiguration = { - val (paths :+: resolvers :+: otherResolvers :+: moduleConfigurations :+: localOnly - :+: checksums :+: HNil) = i - InlineIvyConfiguration(None, - IO.createTemporaryDirectory, - NullLogger, - UpdateOptions(), - paths, - resolvers, - otherResolvers, - moduleConfigurations, - localOnly, - checksums, - None) + val (paths :+: resolvers :+: otherResolvers :+: moduleConfigurations :+: checksums + :+: managedChecksums :+: HNil) = i + InlineIvyConfiguration() + .withPaths(paths) + .withResolvers(resolvers) + .withOtherResolvers(otherResolvers) + .withModuleConfigurations(moduleConfigurations) + .withManagedChecksums(managedChecksums) + .withChecksums(checksums) } projectFormat[InlineIvyConfiguration, InlineIvyHL](inlineIvyToHL, hlToInlineIvy) @@ -76,11 +74,12 @@ object AltLibraryManagementCodec extends LibraryManagementCodec { val baseDirectory :+: _ /* uri */ :+: HNil = e ExternalIvyConfiguration( None, - baseDirectory.file, - NullLogger, + Some(NullLogger), UpdateOptions(), - IO.createTemporaryDirectory.toURI /* the original uri is destroyed.. */, - Vector.empty) + baseDirectory.map(_.file), + None /* the original uri is destroyed.. */, + Vector.empty + ) } projectFormat[ExternalIvyConfiguration, ExternalIvyHL](externalIvyToHL, hlToExternalIvy) diff --git a/main/src/main/scala/sbt/internal/ConsoleProject.scala b/main/src/main/scala/sbt/internal/ConsoleProject.scala index 17401de62..4823c095e 100644 --- a/main/src/main/scala/sbt/internal/ConsoleProject.scala +++ b/main/src/main/scala/sbt/internal/ConsoleProject.scala @@ -15,7 +15,7 @@ object ConsoleProject { val cpImports = new Imports(extracted, state) val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil val unit = extracted.currentUnit - val (_, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state) + val (_, dependencyResolution) = extracted.runTask(Keys.dependencyResolution, state) val scalaInstance = { val scalaProvider = state.configuration.provider.scalaProvider ScalaInstance(scalaProvider.version, scalaProvider.launcher) @@ -30,7 +30,7 @@ object ConsoleProject { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - ivyConfiguration = ivyConf, + dependencyResolution = dependencyResolution, compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), scalaJarsTarget = zincDir, log = log diff --git a/main/src/main/scala/sbt/internal/GlobalPlugin.scala b/main/src/main/scala/sbt/internal/GlobalPlugin.scala index 839ad7780..d69f67d7e 100644 --- a/main/src/main/scala/sbt/internal/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/internal/GlobalPlugin.scala @@ -102,7 +102,7 @@ object GlobalPlugin { final case class GlobalPluginData(projectID: ModuleID, dependencies: Seq[ModuleID], descriptors: Map[ModuleRevisionId, ModuleDescriptor], - resolvers: Seq[Resolver], + resolvers: Vector[Resolver], fullClasspath: Classpath, internalClasspath: Classpath)(val updateReport: UpdateReport) final case class GlobalPlugin(data: GlobalPluginData, diff --git a/main/src/main/scala/sbt/internal/IvyConsole.scala b/main/src/main/scala/sbt/internal/IvyConsole.scala index 53edf462d..e7170776a 100644 --- a/main/src/main/scala/sbt/internal/IvyConsole.scala +++ b/main/src/main/scala/sbt/internal/IvyConsole.scala @@ -41,7 +41,7 @@ object IvyConsole { val depSettings: Seq[Setting[_]] = Seq( libraryDependencies ++= managed.reverse, - resolvers ++= repos.reverse, + resolvers ++= repos.reverse.toVector, unmanagedJars in Compile ++= Attributed blankSeq unmanaged.reverse, logLevel in Global := Level.Warn, showSuccess in Global := false diff --git a/main/src/main/scala/sbt/internal/LibraryManagement.scala b/main/src/main/scala/sbt/internal/LibraryManagement.scala index 17474b990..8e0871d2d 100644 --- a/main/src/main/scala/sbt/internal/LibraryManagement.scala +++ b/main/src/main/scala/sbt/internal/LibraryManagement.scala @@ -7,8 +7,9 @@ import sbt.internal.util.HNil import sbt.internal.util.Types._ import sbt.internal.util.HListFormats._ import sbt.librarymanagement._ +import sbt.librarymanagement.ivy._ import sbt.librarymanagement.syntax._ -import sbt.util.CacheImplicits._ +import sbt.internal.util.HListFormats._ import sbt.util.{ CacheStore, CacheStoreFactory, Logger, Tracked } object LibraryManagement { @@ -40,7 +41,7 @@ object LibraryManagement { log.info(s"Updating $label...") val reportOrUnresolved: Either[UnresolvedWarning, UpdateReport] = //try { - IvyActions.updateEither(module, updateConfig, uwConfig, logicalClock, depDir, log) + IvyActions.updateEither(module, updateConfig, uwConfig, /*logicalClock, depDir,*/ log) // } catch { // case e: Throwable => // e.printStackTrace diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index 91f8c25c8..856c56001 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -31,13 +31,13 @@ import Keys.{ } import Project.inScope import sbt.internal.inc.classpath.ClasspathUtilities -import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths } +import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths } import sbt.internal.inc.{ ZincUtil, ScalaInstance } import sbt.internal.util.Attributed.data import sbt.internal.util.Types.const import sbt.internal.util.{ Attributed, Settings, ~> } import sbt.io.{ GlobFilter, IO, Path } -import sbt.librarymanagement.{ Configuration, Configurations, Resolver, UpdateOptions } +import sbt.librarymanagement.{ Configuration, Configurations, Resolver } import sbt.util.{ Show, Logger } import scala.annotation.tailrec import scala.tools.nsc.reporters.ConsoleReporter @@ -79,18 +79,12 @@ private[sbt] object Load { val stagingDirectory = getStagingDirectory(state, globalBase).getCanonicalFile val loader = getClass.getClassLoader val classpath = Attributed.blankSeq(provider.mainClasspath ++ scalaProvider.jars) - val ivyConfiguration = new InlineIvyConfiguration( - paths = IvyPaths(baseDirectory, bootIvyHome(state.configuration)), - resolvers = Resolver.withDefaultResolvers(Nil).toVector, - otherResolvers = Vector.empty, - moduleConfigurations = Vector.empty, - lock = None, - checksums = Vector.empty, - managedChecksums = false, - resolutionCacheDir = None, - updateOptions = UpdateOptions(), - log = log - ) + val ivyConfiguration = + InlineIvyConfiguration() + .withPaths(IvyPaths(baseDirectory, bootIvyHome(state.configuration))) + .withResolvers(Resolver.combineDefaultResolvers(Vector.empty)) + .withLog(log) + val dependencyResolution = IvyDependencyResolution(ivyConfiguration) val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher) val zincDir = BuildPaths.getZincDirectory(state, globalBase) val classpathOptions = ClasspathOptionsUtil.boot @@ -100,7 +94,7 @@ private[sbt] object Load { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - ivyConfiguration = ivyConfiguration, + dependencyResolution = dependencyResolution, compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version), scalaJarsTarget = zincDir, log = log diff --git a/main/src/main/scala/sbt/internal/PluginManagement.scala b/main/src/main/scala/sbt/internal/PluginManagement.scala index 7006bd44b..a701e6c41 100644 --- a/main/src/main/scala/sbt/internal/PluginManagement.scala +++ b/main/src/main/scala/sbt/internal/PluginManagement.scala @@ -27,7 +27,7 @@ final case class PluginManagement(overrides: Set[ModuleID], addOverrides(extractOverrides(cp)) def inject: Seq[Setting[_]] = Seq( - Keys.dependencyOverrides ++= overrides + Keys.dependencyOverrides ++= overrides.toVector ) def resetDepth: PluginManagement = diff --git a/main/src/main/scala/sbt/internal/librarymanagement/FakeRawRepository.scala b/main/src/main/scala/sbt/internal/librarymanagement/FakeRawRepository.scala index 2367d83df..f1859d11c 100644 --- a/main/src/main/scala/sbt/internal/librarymanagement/FakeRawRepository.scala +++ b/main/src/main/scala/sbt/internal/librarymanagement/FakeRawRepository.scala @@ -7,5 +7,5 @@ import sbt.librarymanagement.RawRepository object FakeRawRepository { def create(name: String): RawRepository = - new RawRepository(new FakeResolver(name, IO.createTemporaryDirectory, Map.empty)) + new RawRepository(new FakeResolver(name, IO.createTemporaryDirectory, Map.empty), name) } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7ffa7e76e..c23ec1d38 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -27,7 +27,8 @@ object Dependencies { private val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion - private val libraryManagement = "org.scala-sbt" %% "librarymanagement" % lmVersion + private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion + private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0" val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0" @@ -77,7 +78,8 @@ object Dependencies { def addSbtUtilScripted(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted) - def addSbtLm(p: Project): Project = addSbtModule(p, sbtLmPath, "lm", libraryManagement) + def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore) + def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy) def addSbtCompilerInterface(p: Project): Project = addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface) diff --git a/sbt/src/main/scala/Import.scala b/sbt/src/main/scala/Import.scala index e425dd1bc..8ade465cd 100644 --- a/sbt/src/main/scala/Import.scala +++ b/sbt/src/main/scala/Import.scala @@ -8,6 +8,8 @@ trait Import { type URI = java.net.URI type URL = java.net.URL + implicit def Seq2Vector[T](s: Seq[T]): Vector[T] = s.toVector + // sbt val StdoutOutput = sbt.OutputStrategy.StdoutOutput type BufferedOutput = sbt.OutputStrategy.BufferedOutput @@ -225,8 +227,8 @@ trait Import { type Caller = sbt.librarymanagement.Caller val ChainedResolver = sbt.librarymanagement.ChainedResolver type ChainedResolver = sbt.librarymanagement.ChainedResolver - val CircularDependencyLevel = sbt.librarymanagement.CircularDependencyLevel - type CircularDependencyLevel = sbt.librarymanagement.CircularDependencyLevel + val CircularDependencyLevel = sbt.librarymanagement.ivy.CircularDependencyLevel + type CircularDependencyLevel = sbt.librarymanagement.ivy.CircularDependencyLevel val Configuration = sbt.librarymanagement.Configuration type Configuration = sbt.librarymanagement.Configuration val ConfigurationReport = sbt.librarymanagement.ConfigurationReport @@ -236,33 +238,34 @@ trait Import { type ConflictManager = sbt.librarymanagement.ConflictManager val ConflictWarning = sbt.librarymanagement.ConflictWarning type ConflictWarning = sbt.librarymanagement.ConflictWarning - val Credentials = sbt.librarymanagement.Credentials - type Credentials = sbt.librarymanagement.Credentials + val Credentials = sbt.librarymanagement.ivy.Credentials + type Credentials = sbt.librarymanagement.ivy.Credentials val CrossVersion = sbt.librarymanagement.CrossVersion type CrossVersion = sbt.librarymanagement.CrossVersion - val DefaultMavenRepository = sbt.librarymanagement.DefaultMavenRepository + val DefaultMavenRepository = sbt.librarymanagement.Resolver.DefaultMavenRepository val Developer = sbt.librarymanagement.Developer type Developer = sbt.librarymanagement.Developer val Disabled = sbt.librarymanagement.Disabled type Disabled = sbt.librarymanagement.Disabled - type DirectCredentials = sbt.librarymanagement.DirectCredentials + type DirectCredentials = sbt.librarymanagement.ivy.DirectCredentials val EvictionPair = sbt.librarymanagement.EvictionPair type EvictionPair = sbt.librarymanagement.EvictionPair val EvictionWarning = sbt.librarymanagement.EvictionWarning type EvictionWarning = sbt.librarymanagement.EvictionWarning val EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions type EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions - val ExclusionRule = sbt.librarymanagement.ExclusionRule - type ExclusionRule = sbt.librarymanagement.ExclusionRule - type FileCredentials = sbt.librarymanagement.FileCredentials + // val ExclusionRule = sbt.librarymanagement.InclExclRule + // type ExclusionRule = sbt.librarymanagement.InclExclRule + type FileCredentials = sbt.librarymanagement.ivy.FileCredentials val FileRepository = sbt.librarymanagement.FileRepository type FileRepository = sbt.librarymanagement.FileRepository val Full = sbt.librarymanagement.Full type Full = sbt.librarymanagement.Full - val IvyScala = sbt.librarymanagement.IvyScala - type IvyScala = sbt.librarymanagement.IvyScala - val JCenterRepository = sbt.librarymanagement.JCenterRepository - val JavaNet2Repository = sbt.librarymanagement.JavaNet2Repository + val IvyScala = sbt.librarymanagement.ScalaModuleInfo + type IvyScala = sbt.librarymanagement.ScalaModuleInfo + val JCenterRepository = sbt.librarymanagement.Resolver.JCenterRepository + val JavaNet2Repository = sbt.librarymanagement.Resolver.JavaNet2Repository + type MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration val MavenCache = sbt.librarymanagement.MavenCache type MavenCache = sbt.librarymanagement.MavenCache val MavenRepo = sbt.librarymanagement.MavenRepo @@ -301,8 +304,8 @@ trait Import { val URLRepository = sbt.librarymanagement.URLRepository type URLRepository = sbt.librarymanagement.URLRepository val UpdateLogging = sbt.librarymanagement.UpdateLogging - val UpdateOptions = sbt.librarymanagement.UpdateOptions - type UpdateOptions = sbt.librarymanagement.UpdateOptions + val UpdateOptions = sbt.librarymanagement.ivy.UpdateOptions + type UpdateOptions = sbt.librarymanagement.ivy.UpdateOptions val UpdateReport = sbt.librarymanagement.UpdateReport type UpdateReport = sbt.librarymanagement.UpdateReport val UpdateStats = sbt.librarymanagement.UpdateStats @@ -312,8 +315,8 @@ trait Import { type VersionNumberCompatibility = sbt.librarymanagement.VersionNumberCompatibility // sbt.internal.librarymanagement - type IvyPaths = sbt.internal.librarymanagement.IvyPaths - val IvyPaths = sbt.internal.librarymanagement.IvyPaths + type IvyPaths = sbt.librarymanagement.ivy.IvyPaths + val IvyPaths = sbt.librarymanagement.ivy.IvyPaths type IncOptions = xsbti.compile.IncOptions } diff --git a/sbt/src/main/scala/package.scala b/sbt/src/main/scala/package.scala index f44bd7904..94603839f 100644 --- a/sbt/src/main/scala/package.scala +++ b/sbt/src/main/scala/package.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.macros + /* sbt -- Simple Build Tool * Copyright 2010, 2011 Mark Harrah */ @@ -5,8 +7,8 @@ package object sbt extends sbt.IOSyntax0 with sbt.std.TaskExtra with sbt.internal.util.Types - with sbt.internal.librarymanagement.impl.DependencyBuilders with sbt.ProjectExtra + with sbt.librarymanagement.DependencyBuilders with sbt.librarymanagement.DependencyFilterExtra with sbt.librarymanagement.LibraryManagementSyntax with sbt.BuildExtra @@ -36,15 +38,16 @@ package object sbt final val Global = Scope.Global final val GlobalScope = Scope.GlobalScope - import sbt.{ Configurations => C } - final val Compile = C.Compile - final val Test = C.Test - final val Runtime = C.Runtime - final val IntegrationTest = C.IntegrationTest - final val Default = C.Default - final val Provided = C.Provided + // import sbt.{ Configurations => C } + // final val Compile = C.Compile + // final val Test = C.Test + // final val Runtime = C.Runtime + // final val IntegrationTest = C.IntegrationTest + // final val Default = C.Default + // final val Provided = C.Provided // java.lang.System is more important, so don't alias this one // final val System = C.System - final val Optional = C.Optional - def config(s: String): Configuration = C.config(s) + // final val Optional = C.Optional + def config(name: String): Configuration = + macro sbt.librarymanagement.ConfigurationMacro.configMacroImpl } diff --git a/sbt/src/sbt-test/dependency-management/cache-classifiers/multi.sbt b/sbt/src/sbt-test/dependency-management/cache-classifiers/multi.sbt index a831ce37b..fa7e3360f 100644 --- a/sbt/src/sbt-test/dependency-management/cache-classifiers/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-classifiers/multi.sbt @@ -6,7 +6,7 @@ val b = project localCache, scalaVersion := "2.11.8", libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests"), - externalResolvers := Seq( + externalResolvers := Vector( MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")), DefaultMavenRepository ) diff --git a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt index 5afcc2440..d329b12bd 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt @@ -18,8 +18,9 @@ lazy val root = (project in file(".")) val module = ivyModule.value val config = updateConfiguration.value - import sbt.internal.librarymanagement.IvyConfiguration + import sbt.librarymanagement.ivy.IvyConfiguration import sbt.librarymanagement.{ ModuleSettings, UpdateConfiguration } + import sbt.internal.util.HListFormats._ type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil diff --git a/sbt/src/sbt-test/dependency-management/configurations-to-retrieve/build.sbt b/sbt/src/sbt-test/dependency-management/configurations-to-retrieve/build.sbt index 1cddfa1fc..e8a4aeabd 100644 --- a/sbt/src/sbt-test/dependency-management/configurations-to-retrieve/build.sbt +++ b/sbt/src/sbt-test/dependency-management/configurations-to-retrieve/build.sbt @@ -1,4 +1,4 @@ -configurationsToRetrieve := Some(Set(Compile)) +configurationsToRetrieve := Some(Vector(Compile)) retrieveManaged := true @@ -8,4 +8,4 @@ autoScalaLibrary := false managedDirectory := file("dependencies") -retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]" \ No newline at end of file +retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]" diff --git a/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt b/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt index 547dc29ff..2ef6ee3dc 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt @@ -1,6 +1,7 @@ import scala.xml.{ Node, _ } import scala.xml.Utility.trim -import sbt.internal.librarymanagement.{ IvySbt, MakePomConfiguration, MakePom } +import sbt.librarymanagement.MakePomConfiguration +import sbt.internal.librarymanagement.{ IvySbt, MakePom } lazy val check = taskKey[Unit]("check") diff --git a/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt b/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt index f6622bd2d..338b358ab 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt @@ -6,7 +6,7 @@ lazy val root = (project in file(".")). settings( libraryDependencies ++= baseDirectory(dependencies).value, scalaVersion := "2.9.2", - ivyScala := ivyScala.value map (_.withOverrideScalaVersion(sbtPlugin.value)), + scalaModuleInfo := scalaModuleInfo.value map (_.withOverrideScalaVersion(sbtPlugin.value)), autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value, scalaOverride := check("scala.App").value ) diff --git a/sbt/src/sbt-test/dependency-management/gh-1484-npe/build.sbt b/sbt/src/sbt-test/dependency-management/gh-1484-npe/build.sbt index e9cd1a4f4..f876295d2 100644 --- a/sbt/src/sbt-test/dependency-management/gh-1484-npe/build.sbt +++ b/sbt/src/sbt-test/dependency-management/gh-1484-npe/build.sbt @@ -1,7 +1,7 @@ lazy val check = taskKey[Unit]("tests update") def commonSettings: Seq[Def.Setting[_]] = Seq( - resolvers ++= Resolver.typesafeIvyRepo("releases") :: Resolver.typesafeRepo("releases") :: Resolver.sbtPluginRepo("releases") :: Nil, + resolvers ++= Vector(Resolver.typesafeIvyRepo("releases"), Resolver.typesafeRepo("releases"), Resolver.sbtPluginRepo("releases")), check := { val ur = update.value import sbinary._, Operations._, DefaultProtocol._ diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt b/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt index a8425099e..c9beeb2f3 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt @@ -1,6 +1,6 @@ lazy val commonSettings = Seq( autoScalaLibrary := false, - ivyScala := None, + scalaModuleInfo := None, unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value, publishArtifact in packageSrc := false, publishArtifact in packageDoc := false, diff --git a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt index 79f307fbf..8a6bc8c06 100644 --- a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt +++ b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt @@ -6,7 +6,10 @@ lazy val root = (project in file(".")) settings ( TaskKey[Unit]("checkExtra") := checkExtra.value, TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value, resolvers += Resolver.sonatypeRepo("snapshots"), - makePomConfiguration ~= { _.copy(extra = ) }, + makePomConfiguration := { + val p = makePomConfiguration.value + new MakePomConfiguration(p.file, p.moduleInfo, p.configurations, , p.process, p.filterRepositories, p.allRepositories, p.includeTypes) + }, libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+" ) diff --git a/sbt/src/sbt-test/dependency-management/override/build.sbt b/sbt/src/sbt-test/dependency-management/override/build.sbt index 79e59d3c1..b3def6c87 100644 --- a/sbt/src/sbt-test/dependency-management/override/build.sbt +++ b/sbt/src/sbt-test/dependency-management/override/build.sbt @@ -2,12 +2,12 @@ autoScalaLibrary := false ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")) -ivyScala := Some(IvyScala( +scalaModuleInfo := Some(sbt.librarymanagement.ScalaModuleInfo( (scalaVersion in update).value, (scalaBinaryVersion in update).value, Vector.empty, - filterImplicit = false, checkExplicit = false, + filterImplicit = false, overrideScalaVersion = false )) diff --git a/sbt/src/sbt-test/dependency-management/override/test b/sbt/src/sbt-test/dependency-management/override/test index dfcf1da95..c2a6eea44 100644 --- a/sbt/src/sbt-test/dependency-management/override/test +++ b/sbt/src/sbt-test/dependency-management/override/test @@ -1,19 +1,19 @@ > 'set libraryDependencies := Seq("junit" % "junit" % "3.8.1" % "test")' > check 3.8.1 -> 'set dependencyOverrides := Set("junit" % "junit" % "4.5")' +> 'set dependencyOverrides := Vector("junit" % "junit" % "4.5")' > check 4.5 > 'set libraryDependencies := Seq("junit" % "junit" % "4.5" % "test")' > check 4.5 -> 'set dependencyOverrides := Set("junit" % "junit" % "3.8.1")' +> 'set dependencyOverrides := Vector("junit" % "junit" % "3.8.1")' > check 3.8.1 > 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.7")' > check 0.8.7 -> 'set dependencyOverrides := Set("net.databinder" %% "dispatch-http" % "0.8.6")' +> 'set dependencyOverrides := Vector("net.databinder" %% "dispatch-http" % "0.8.6")' > check 0.8.6 > 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.6")' > check 0.8.6 -> 'set dependencyOverrides := Set("net.databinder" %% "dispatch-http" % "0.8.7")' +> 'set dependencyOverrides := Vector("net.databinder" %% "dispatch-http" % "0.8.7")' > check 0.8.7 diff --git a/sbt/src/sbt-test/dependency-management/override2/build.sbt b/sbt/src/sbt-test/dependency-management/override2/build.sbt index c3308a42a..09b877677 100644 --- a/sbt/src/sbt-test/dependency-management/override2/build.sbt +++ b/sbt/src/sbt-test/dependency-management/override2/build.sbt @@ -6,6 +6,6 @@ scalaBinaryVersion := "2.9.1" resolvers += Classpaths.typesafeReleases -dependencyOverrides := Set("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1") +dependencyOverrides := Vector("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1") autoScalaLibrary := false diff --git a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt index 6977b4fea..cafe3e5fb 100644 --- a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt @@ -1,4 +1,4 @@ -lazy val custom = config("custom") +lazy val custom = config("custom") //Configurations.config("custom") lazy val root = (project in file(".")). configs(custom). diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt b/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt index 050b1823e..4765c39d3 100644 --- a/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt +++ b/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt @@ -1,5 +1,5 @@ def configIvyScala = - ivyScala ~= (_ map (_ withCheckExplicit false)) + scalaModuleInfo ~= (_ map (_ withCheckExplicit false)) val declared = SettingKey[Boolean]("declared") lazy val a = project. diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala index 7bbf934b4..deb0503b6 100644 --- a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala +++ b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala @@ -15,8 +15,8 @@ object ScriptedPlugin extends AutoPlugin { override def requires = plugins.JvmPlugin override def trigger = allRequirements object autoImport { - def scriptedConf = config("scripted-sbt") hide - def scriptedLaunchConf = config("scripted-sbt-launch") hide + val ScriptedConf = Configurations.config("scripted-sbt") hide + val ScriptedLaunchConf = Configurations.config("scripted-sbt-launch") hide val scriptedSbt = SettingKey[String]("scripted-sbt") val sbtLauncher = TaskKey[File]("sbt-launcher") val sbtTestDirectory = SettingKey[File]("sbt-test-directory") @@ -32,26 +32,26 @@ object ScriptedPlugin extends AutoPlugin { } import autoImport._ override lazy val projectSettings = Seq( - ivyConfigurations ++= Seq(scriptedConf, scriptedLaunchConf), + ivyConfigurations ++= Seq(ScriptedConf, ScriptedLaunchConf), scriptedSbt := (sbtVersion in pluginCrossBuild).value, - sbtLauncher := getJars(scriptedLaunchConf).map(_.get.head).value, + sbtLauncher := getJars(ScriptedLaunchConf).map(_.get.head).value, sbtTestDirectory := sourceDirectory.value / "sbt-test", libraryDependencies ++= { binarySbtVersion(scriptedSbt.value) match { case "0.13" => Seq( - "org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % scriptedConf.toString, - "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString + "org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % ScriptedConf.toString, + "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf.toString ) case sv if sv startsWith "1.0." => Seq( - "org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % scriptedConf.toString, - "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString + "org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % ScriptedConf.toString, + "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf.toString ) } }, scriptedBufferLog := true, - scriptedClasspath := getJars(scriptedConf).value, + scriptedClasspath := getJars(ScriptedConf).value, scriptedTests := scriptedTestsTask.value, scriptedRun := scriptedRunTask.value, scriptedDependencies := { From f0ac6ae11cf472e6f6e1b294daa84df0a2fbaa23 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 00:51:49 -0400 Subject: [PATCH 09/34] Adjust to upstream changes --- main-actions/src/main/scala/sbt/Package.scala | 3 - .../src/main/scala/sbt/RawCompileLike.scala | 3 - .../src/test/scala/sbt/CacheIvyTest.scala | 3 +- main/src/main/scala/sbt/Defaults.scala | 74 ++++++++++--------- .../scala/sbt/internal/BuildStructure.scala | 3 +- .../scala/sbt/internal/ConsoleProject.scala | 3 +- .../sbt/internal/LibraryManagement.scala | 27 +++++++ main/src/main/scala/sbt/internal/Load.scala | 3 +- .../scala/sbt/internal/RelayAppender.scala | 2 +- .../sbt/internal/server/SettingQuery.scala | 2 +- project/ContrabandConfig.scala | 2 +- .../sbt/protocol/SettingQuerySuccess.scala | 8 +- .../codec/SettingQuerySuccessFormats.scala | 2 +- protocol/src/main/contraband/server.contra | 2 +- .../scala/sbt/protocol/Serialization.scala | 2 +- 15 files changed, 83 insertions(+), 56 deletions(-) diff --git a/main-actions/src/main/scala/sbt/Package.scala b/main-actions/src/main/scala/sbt/Package.scala index fbf211416..3e48bee13 100644 --- a/main-actions/src/main/scala/sbt/Package.scala +++ b/main-actions/src/main/scala/sbt/Package.scala @@ -120,7 +120,6 @@ object Package { def sourcesDebugString(sources: Seq[(File, String)]): String = "Input file mappings:\n\t" + (sources map { case (f, s) => s + "\n\t " + f } mkString ("\n\t")) - implicit def manifestEquiv: Equiv[Manifest] = defaultEquiv implicit def manifestFormat: JsonFormat[Manifest] = projectFormat[Manifest, Array[Byte]]( m => { val bos = new java.io.ByteArrayOutputStream() @@ -129,6 +128,4 @@ object Package { }, bs => new Manifest(new java.io.ByteArrayInputStream(bs)) ) - - implicit def stringMapEquiv: Equiv[Map[File, String]] = defaultEquiv } diff --git a/main-actions/src/main/scala/sbt/RawCompileLike.scala b/main-actions/src/main/scala/sbt/RawCompileLike.scala index 9d1bb540c..06b05100a 100644 --- a/main-actions/src/main/scala/sbt/RawCompileLike.scala +++ b/main-actions/src/main/scala/sbt/RawCompileLike.scala @@ -52,9 +52,6 @@ object RawCompileLike { val inputs : Inputs = hash(sources.toSet ++ optionFiles(options, fileInputOpts)) :+: lastModified( classpath.toSet) :+: classpath :+: outputDirectory :+: options :+: maxErrors :+: HNil - implicit val stringEquiv: Equiv[String] = defaultEquiv - implicit val fileEquiv: Equiv[File] = defaultEquiv - implicit val intEquiv: Equiv[Int] = defaultEquiv val cachedComp = inputChanged(cacheStoreFactory make "inputs") { (inChanged, in: Inputs) => inputChanged(cacheStoreFactory make "output") { (outChanged, outputs: FilesInfo[PlainFileInfo]) => diff --git a/main-actions/src/test/scala/sbt/CacheIvyTest.scala b/main-actions/src/test/scala/sbt/CacheIvyTest.scala index e8c83270f..689a86a14 100644 --- a/main-actions/src/test/scala/sbt/CacheIvyTest.scala +++ b/main-actions/src/test/scala/sbt/CacheIvyTest.scala @@ -4,6 +4,7 @@ import org.scalacheck._ import org.scalacheck.Arbitrary._ import Prop._ import sbt.librarymanagement._ +import sjsonnew.shaded.scalajson.ast.unsafe.JValue class CacheIvyTest extends Properties("CacheIvy") { import sbt.util.{ CacheStore, SingletonCache } @@ -12,8 +13,6 @@ class CacheIvyTest extends Properties("CacheIvy") { import sjsonnew._ import sjsonnew.support.scalajson.unsafe.Converter - import scalajson.ast.unsafe.JValue - private class InMemoryStore(converter: SupportConverter[JValue]) extends CacheStore { private var content: JValue = _ override def delete(): Unit = () diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 0deb94a11..402daa5a5 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -72,9 +72,10 @@ import scala.util.control.NonFatal import scala.xml.NodeSeq import Scope.{ fillTaskAxis, GlobalScope, ThisScope } import sjsonnew.{ IsoLList, JsonFormat, LList, LNil }, LList.:*: +import sjsonnew.shaded.scalajson.ast.unsafe.JValue import std.TaskExtra._ import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint } -import xsbti.compile.{ IncToolOptionsUtil, AnalysisContents } +import xsbti.compile.{ IncToolOptionsUtil, AnalysisContents, IncOptions } import xsbti.CrossValue // incremental compiler @@ -376,8 +377,8 @@ object Defaults extends BuildCommon { def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq( incOptions := incOptions.value .withClassfileManagerType( - Option(new TransactionalManagerType(crossTarget.value / "classes.bak", - sbt.util.Logger.Null): ClassFileManagerType).toOptional + Option(TransactionalManagerType + .of(crossTarget.value / "classes.bak", sbt.util.Logger.Null): ClassFileManagerType).toOptional ), scalaInstance := scalaInstanceTask.value, crossVersion := (if (crossPaths.value) CrossVersion.binary else Disabled()), @@ -413,7 +414,7 @@ object Defaults extends BuildCommon { // must be a val: duplication detected by object identity private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults( Seq( - incOptions := IncOptionsUtil.defaultIncOptions, + incOptions := IncOptions.of(), classpathOptions :== ClasspathOptionsUtil.boot, classpathOptions in console :== ClasspathOptionsUtil.repl, compileOrder :== CompileOrder.Mixed, @@ -470,7 +471,8 @@ object Defaults extends BuildCommon { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - dependencyResolution = dependencyResolution.value, + // Todo: Fix typo + depencencyResolution = dependencyResolution.value, compilerBridgeSource = scalaCompilerBridgeSource.value, scalaJarsTarget = zincDir, log = streams.value.log @@ -1417,7 +1419,7 @@ object Defaults extends BuildCommon { override def definesClass(classpathEntry: File): DefinesClass = cachedPerEntryDefinesClassLookup(classpathEntry) } - new Setup( + Setup.of( lookup, (skip in compile).value, // TODO - this is kind of a bad way to grab the cache directory for streams... @@ -1432,7 +1434,7 @@ object Defaults extends BuildCommon { } def compileInputsSettings: Seq[Setting[_]] = { Seq( - compileOptions := new CompileOptions( + compileOptions := CompileOptions.of( (classDirectory.value +: data(dependencyClasspath.value)).toArray, sources.value.toArray, classDirectory.value, @@ -1449,7 +1451,7 @@ object Defaults extends BuildCommon { foldMappers(sourcePositionMappers.value) ) }, - compileInputs := new Inputs( + compileInputs := Inputs.of( compilers.value, compileOptions.value, compileIncSetup.value, @@ -1477,8 +1479,8 @@ object Defaults extends BuildCommon { case Some(contents) => val analysis = Option(contents.getAnalysis).toOptional val setup = Option(contents.getMiniSetup).toOptional - new PreviousResult(analysis, setup) - case None => new PreviousResult(jnone[CompileAnalysis], jnone[MiniSetup]) + PreviousResult.of(analysis, setup) + case None => PreviousResult.of(jnone[CompileAnalysis], jnone[MiniSetup]) } } ) @@ -1709,7 +1711,7 @@ object Classpaths { val config = makePomConfiguration.value val publisher = Keys.publisher.value publisher.makePomFile(ivyModule.value, config, streams.value.log) - config.file + config.file.get }, packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value), deliver := deliverTask(publishConfiguration).value, @@ -1887,13 +1889,13 @@ object Classpaths { else Nil }, moduleSettings := moduleSettings0.value, - makePomConfiguration := new MakePomConfiguration(artifactPath in makePom value, - projectInfo.value, - None, - pomExtra.value, - pomPostProcess.value, - pomIncludeRepository.value, - pomAllRepositories.value), + makePomConfiguration := MakePomConfiguration() + .withFile((artifactPath in makePom).value) + .withModuleInfo(projectInfo.value) + .withExtra(pomExtra.value) + .withProcess(pomPostProcess.value) + .withFilterRepositories(pomIncludeRepository.value) + .withAllRepositories(pomAllRepositories.value), publishConfiguration := { publishConfig( publishMavenStyle.value, @@ -2136,22 +2138,24 @@ object Classpaths { val depDir = dependencyCacheDirectory.value val ivy = scalaModuleInfo.value val st = state.value - withExcludes(out, mod.classifiers, lock(app)) { excludes => - // val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) - lm.transitiveScratch( - "sbt", - GetClassifiersConfiguration( - mod, - excludes.toVector, - c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), - srcTypes, - docTypes), - uwConfig, - log - ) match { - case Left(uw) => ??? - case Right(ur) => ur - } + withExcludes(out, mod.classifiers, lock(app)) { + excludes => + // val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) + LibraryManagement.transitiveScratch( + lm, + "sbt", + GetClassifiersConfiguration(mod, + excludes.toVector, + c.withArtifactFilter(c.artifactFilter.map(af => + af.withInverted(!af.inverted))), + srcTypes, + docTypes), + uwConfig, + log + ) match { + case Left(uw) => ??? + case Right(ur) => ur + } } } tag (Tags.Update, Tags.Network)).value )) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) @@ -2197,7 +2201,7 @@ object Classpaths { f: Map[ModuleID, Vector[ConfigRef]] => UpdateReport): UpdateReport = { import sbt.librarymanagement.LibraryManagementCodec._ import sbt.util.FileBasedStore - implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] = + implicit val isoString: sjsonnew.IsoString[JValue] = sjsonnew.IsoString.iso( sjsonnew.support.scalajson.unsafe.CompactPrinter.apply, sjsonnew.support.scalajson.unsafe.Parser.parseUnsafe diff --git a/main/src/main/scala/sbt/internal/BuildStructure.scala b/main/src/main/scala/sbt/internal/BuildStructure.scala index 16ec3cf32..3fd86d4cd 100644 --- a/main/src/main/scala/sbt/internal/BuildStructure.scala +++ b/main/src/main/scala/sbt/internal/BuildStructure.scala @@ -14,6 +14,7 @@ import sbt.io.syntax._ import sbt.internal.util.{ Attributed, AttributeEntry, AttributeKey, AttributeMap, Settings } import sbt.internal.util.Attributed.data import sbt.util.Logger +import sjsonnew.shaded.scalajson.ast.unsafe.JValue final class BuildStructure(val units: Map[URI, LoadedBuildUnit], val root: URI, @@ -250,7 +251,7 @@ object BuildStreams { def mkStreams(units: Map[URI, LoadedBuildUnit], root: URI, data: Settings[Scope]): State => Streams = s => { - implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] = + implicit val isoString: sjsonnew.IsoString[JValue] = sjsonnew.IsoString.iso(sjsonnew.support.scalajson.unsafe.CompactPrinter.apply, sjsonnew.support.scalajson.unsafe.Parser.parseUnsafe) (s get Keys.stateStreams) getOrElse { diff --git a/main/src/main/scala/sbt/internal/ConsoleProject.scala b/main/src/main/scala/sbt/internal/ConsoleProject.scala index 4823c095e..b74846a85 100644 --- a/main/src/main/scala/sbt/internal/ConsoleProject.scala +++ b/main/src/main/scala/sbt/internal/ConsoleProject.scala @@ -30,7 +30,8 @@ object ConsoleProject { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - dependencyResolution = dependencyResolution, + // Todo: Fix typo + depencencyResolution = dependencyResolution, compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), scalaJarsTarget = zincDir, log = log diff --git a/main/src/main/scala/sbt/internal/LibraryManagement.scala b/main/src/main/scala/sbt/internal/LibraryManagement.scala index 8e0871d2d..29e1ee1a2 100644 --- a/main/src/main/scala/sbt/internal/LibraryManagement.scala +++ b/main/src/main/scala/sbt/internal/LibraryManagement.scala @@ -124,4 +124,31 @@ object LibraryManagement { private[this] def fileUptodate(file: File, stamps: Map[File, Long]): Boolean = stamps.get(file).forall(_ == file.lastModified) + private[sbt] def transitiveScratch( + lm: DependencyResolution, + label: String, + config: GetClassifiersConfiguration, + uwconfig: UnresolvedWarningConfiguration, + log: Logger + ): Either[UnresolvedWarning, UpdateReport] = { + import config.{ updateConfiguration => c, module => mod } + import mod.{ id, dependencies => deps, scalaModuleInfo } + val base = restrictedCopy(id, true).withName(id.name + "$" + label) + val module = lm.moduleDescriptor(base, deps, scalaModuleInfo) + val report = lm.update(module, c, uwconfig, log) match { + case Right(r) => r + case Left(w) => + throw w.resolveException + } + val newConfig = config + .withModule(mod.withDependencies(report.allModules)) + lm.updateClassifiers(newConfig, uwconfig, Vector(), log) + } + + private[sbt] def restrictedCopy(m: ModuleID, confs: Boolean) = + ModuleID(m.organization, m.name, m.revision) + .withCrossVersion(m.crossVersion) + .withExtraAttributes(m.extraAttributes) + .withConfigurations(if (confs) m.configurations else None) + .branch(m.branchName) } diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index 856c56001..f7c050d64 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -94,7 +94,8 @@ private[sbt] object Load { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - dependencyResolution = dependencyResolution, + // Todo: Fix typo + depencencyResolution = dependencyResolution, compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version), scalaJarsTarget = zincDir, log = log diff --git a/main/src/main/scala/sbt/internal/RelayAppender.scala b/main/src/main/scala/sbt/internal/RelayAppender.scala index 861ce6d3d..8f833d376 100644 --- a/main/src/main/scala/sbt/internal/RelayAppender.scala +++ b/main/src/main/scala/sbt/internal/RelayAppender.scala @@ -10,7 +10,7 @@ import sbt.util.Level import sbt.internal.util._ import sbt.protocol.LogEvent import sbt.internal.util.codec._ -import scalajson.ast.unsafe._ +import sjsonnew.shaded.scalajson.ast.unsafe._ class RelayAppender(name: String) extends AbstractAppender(name, null, PatternLayout.createDefaultLayout(), true) { diff --git a/main/src/main/scala/sbt/internal/server/SettingQuery.scala b/main/src/main/scala/sbt/internal/server/SettingQuery.scala index 667f2612e..e8c585c18 100644 --- a/main/src/main/scala/sbt/internal/server/SettingQuery.scala +++ b/main/src/main/scala/sbt/internal/server/SettingQuery.scala @@ -6,7 +6,7 @@ package internal package server import java.net.URI -import scalajson.ast.unsafe.JValue +import sjsonnew.shaded.scalajson.ast.unsafe.JValue import scala.util.{ Left, Right } import sbt.util.{ SomeJsonWriter, NoJsonWriter } import sbt.librarymanagement.LibraryManagementCodec._ diff --git a/project/ContrabandConfig.scala b/project/ContrabandConfig.scala index a3aedb44b..b13824355 100644 --- a/project/ContrabandConfig.scala +++ b/project/ContrabandConfig.scala @@ -32,7 +32,7 @@ object ContrabandConfig { case "sbt.testing.Status" => { _ => "sbt.internal.testing.StatusFormats" :: Nil } - case "scalajson.ast.unsafe.JValue" => { _ => + case "scalajson.ast.unsafe.JValue" | "sjsonnew.shaded.scalajson.ast.unsafe.JValue" => { _ => "sbt.internal.util.codec.JValueFormats" :: Nil } } diff --git a/protocol/src/main/contraband-scala/sbt/protocol/SettingQuerySuccess.scala b/protocol/src/main/contraband-scala/sbt/protocol/SettingQuerySuccess.scala index 7236cb577..95e103d6d 100644 --- a/protocol/src/main/contraband-scala/sbt/protocol/SettingQuerySuccess.scala +++ b/protocol/src/main/contraband-scala/sbt/protocol/SettingQuerySuccess.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.protocol final class SettingQuerySuccess private ( - val value: scalajson.ast.unsafe.JValue, + val value: sjsonnew.shaded.scalajson.ast.unsafe.JValue, val contentType: String) extends sbt.protocol.SettingQueryResponse() with Serializable { @@ -20,10 +20,10 @@ final class SettingQuerySuccess private ( override def toString: String = { "SettingQuerySuccess(" + value + ", " + contentType + ")" } - protected[this] def copy(value: scalajson.ast.unsafe.JValue = value, contentType: String = contentType): SettingQuerySuccess = { + protected[this] def copy(value: sjsonnew.shaded.scalajson.ast.unsafe.JValue = value, contentType: String = contentType): SettingQuerySuccess = { new SettingQuerySuccess(value, contentType) } - def withValue(value: scalajson.ast.unsafe.JValue): SettingQuerySuccess = { + def withValue(value: sjsonnew.shaded.scalajson.ast.unsafe.JValue): SettingQuerySuccess = { copy(value = value) } def withContentType(contentType: String): SettingQuerySuccess = { @@ -32,5 +32,5 @@ final class SettingQuerySuccess private ( } object SettingQuerySuccess { - def apply(value: scalajson.ast.unsafe.JValue, contentType: String): SettingQuerySuccess = new SettingQuerySuccess(value, contentType) + def apply(value: sjsonnew.shaded.scalajson.ast.unsafe.JValue, contentType: String): SettingQuerySuccess = new SettingQuerySuccess(value, contentType) } diff --git a/protocol/src/main/contraband-scala/sbt/protocol/codec/SettingQuerySuccessFormats.scala b/protocol/src/main/contraband-scala/sbt/protocol/codec/SettingQuerySuccessFormats.scala index 72a687ca2..d5db090f7 100644 --- a/protocol/src/main/contraband-scala/sbt/protocol/codec/SettingQuerySuccessFormats.scala +++ b/protocol/src/main/contraband-scala/sbt/protocol/codec/SettingQuerySuccessFormats.scala @@ -11,7 +11,7 @@ implicit lazy val SettingQuerySuccessFormat: JsonFormat[sbt.protocol.SettingQuer jsOpt match { case Some(js) => unbuilder.beginObject(js) - val value = unbuilder.readField[scalajson.ast.unsafe.JValue]("value") + val value = unbuilder.readField[sjsonnew.shaded.scalajson.ast.unsafe.JValue]("value") val contentType = unbuilder.readField[String]("contentType") unbuilder.endObject() sbt.protocol.SettingQuerySuccess(value, contentType) diff --git a/protocol/src/main/contraband/server.contra b/protocol/src/main/contraband/server.contra index 0da5afeb1..31160a694 100644 --- a/protocol/src/main/contraband/server.contra +++ b/protocol/src/main/contraband/server.contra @@ -43,7 +43,7 @@ type ExecStatusEvent implements EventMessage { interface SettingQueryResponse implements EventMessage {} type SettingQuerySuccess implements SettingQueryResponse { - value: scalajson.ast.unsafe.JValue! + value: sjsonnew.shaded.scalajson.ast.unsafe.JValue! contentType: String! } diff --git a/protocol/src/main/scala/sbt/protocol/Serialization.scala b/protocol/src/main/scala/sbt/protocol/Serialization.scala index a306b9749..422d9bb51 100644 --- a/protocol/src/main/scala/sbt/protocol/Serialization.scala +++ b/protocol/src/main/scala/sbt/protocol/Serialization.scala @@ -6,7 +6,7 @@ package protocol import sjsonnew.JsonFormat import sjsonnew.support.scalajson.unsafe.{ Parser, Converter, CompactPrinter } -import scalajson.ast.unsafe.{ JValue, JObject, JString } +import sjsonnew.shaded.scalajson.ast.unsafe.{ JValue, JObject, JString } import java.nio.ByteBuffer import scala.util.{ Success, Failure } import sbt.internal.util.StringEvent From b4e4a48208cb5d51adf538f3383cf1f95d9aaf2f Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 10:19:42 -0400 Subject: [PATCH 10/34] Fixes actions/external-doc --- notes/1.0.0.markdown | 1 + sbt/src/sbt-test/actions/external-doc/build.sbt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index 4dee0c945..789b9bc4e 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -11,6 +11,7 @@ This is the beta-2 release of sbt 1.0. The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] +- sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. #### Fixes diff --git a/sbt/src/sbt-test/actions/external-doc/build.sbt b/sbt/src/sbt-test/actions/external-doc/build.sbt index 1cabf1333..80ead271f 100644 --- a/sbt/src/sbt-test/actions/external-doc/build.sbt +++ b/sbt/src/sbt-test/actions/external-doc/build.sbt @@ -31,7 +31,7 @@ val checkApiMappings = taskKey[Unit]("Verifies that the API mappings are collect def expectedMappings = Def.task { val version = scalaVersion.value val binVersion = scalaBinaryVersion.value - val ms = update.value.configuration(Compile.name).get.modules.flatMap { mod => + val ms = update.value.configuration(Compile).get.modules.flatMap { mod => mod.artifacts.flatMap { case (a,f) => val n = a.name.stripSuffix("_" + binVersion) n match { From 99be5b25f49c7660c0c7e23e064fdfbd6ef1f611 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 13:58:51 -0400 Subject: [PATCH 11/34] Roll back Vector changes in Keys.scala Keys should Seq type since it's fairly common to use List in build.sbt, and it would cause annoying build changes. Fixes actions/cross --- main/src/main/scala/sbt/Defaults.scala | 55 +++++++++---------- main/src/main/scala/sbt/Keys.scala | 30 +++++----- .../scala/sbt/internal/GlobalPlugin.scala | 2 +- main/src/main/scala/sbt/internal/Load.scala | 2 +- notes/1.0.0.markdown | 2 + 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 402daa5a5..8f8ef109d 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1259,7 +1259,7 @@ object Defaults extends BuildCommon { } } } - def psTask: Initialize[Task[Vector[JobHandle]]] = + def psTask: Initialize[Task[Seq[JobHandle]]] = Def.task { val xs = bgList.value val s = streams.value @@ -1795,7 +1795,7 @@ object Classpaths { useJCenter.value) match { case (Some(delegated), Seq(), _, _) => delegated case (_, rs, Some(ars), uj) => ars ++ rs - case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs, uj, mavenCentral = true) + case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs.toVector, uj, mavenCentral = true) }), appResolvers := { val ac = appConfiguration.value @@ -1866,12 +1866,11 @@ object Classpaths { retrieveConfiguration := { if (retrieveManaged.value) Some( - RetrieveConfiguration( - managedDirectory.value, - retrievePattern.value, - retrieveManagedSync.value, - configurationsToRetrieve.value.getOrElse(Vector.empty).map(c => ConfigRef(c.name)) - )) + RetrieveConfiguration() + .withRetrieveDirectory(managedDirectory.value) + .withOutputPattern(retrievePattern.value) + .withSync(retrieveManagedSync.value) + .withConfigurationsToRetrieve(configurationsToRetrieve.value map { _.toVector })) else None }, dependencyResolution := IvyDependencyResolution(ivyConfiguration.value), @@ -1903,7 +1902,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publish).value.toVector, - checksums.in(publish).value, + checksums.in(publish).value.toVector, getPublishTo(publishTo.value).name, ivyLoggingLevel.value, isSnapshot.value @@ -1915,7 +1914,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publishLocal).value.toVector, - checksums.in(publishLocal).value, + checksums.in(publishLocal).value.toVector, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value ), @@ -1925,7 +1924,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publishM2).value.toVector, - checksums = checksums.in(publishM2).value, + checksums = checksums.in(publishM2).value.toVector, resolverName = Resolver.publishMavenLocal.name, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value @@ -1991,8 +1990,9 @@ object Classpaths { excludes.toVector, c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), // scalaModule, - srcTypes, - docTypes), + srcTypes.toVector, + docTypes.toVector + ), uwConfig, Vector.empty, s.log @@ -2062,19 +2062,16 @@ object Classpaths { new IvySbt(ivyConfiguration.value) } def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { - ModuleDescriptorConfiguration( - ivyValidate.value, - scalaModuleInfo.value, - projectID.value, - projectInfo.value, - allDependencies.value.toVector, - dependencyOverrides.value, - excludeDependencies.value.toVector, - ivyXML.value, - ivyConfigurations.value.toVector, - defaultConfiguration.value, - conflictManager.value - ) + ModuleDescriptorConfiguration(projectID.value, projectInfo.value) + .withValidate(ivyValidate.value) + .withScalaModuleInfo(scalaModuleInfo.value) + .withDependencies(allDependencies.value.toVector) + .withOverrides(dependencyOverrides.value.toVector) + .withExcludes(excludeDependencies.value.toVector) + .withIvyXML(ivyXML.value) + .withConfigurations(ivyConfigurations.value.toVector) + .withDefaultConfiguration(defaultConfiguration.value) + .withConflictManager(conflictManager.value) } private[this] def sbtClassifiersGlobalDefaults = @@ -2148,8 +2145,8 @@ object Classpaths { excludes.toVector, c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), - srcTypes, - docTypes), + srcTypes.toVector, + docTypes.toVector), uwConfig, log ) match { @@ -2587,7 +2584,7 @@ object Classpaths { .withOtherResolvers(other) .withModuleConfigurations(moduleConfigurations.value.toVector) .withLock(lock(appConfiguration.value)) - .withChecksums((checksums in update).value) + .withChecksums((checksums in update).value.toVector) .withResolutionCacheDir(crossTarget.value / "resolution-cache") .withUpdateOptions(updateOptions.value) .withLog(s.log) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 5fea4ca9d..c65cc6806 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -45,6 +45,7 @@ import sbt.librarymanagement.LibraryManagementCodec._ import sbt.librarymanagement.ivy.{ Credentials, UpdateOptions } import sbt.librarymanagement.{ Artifact, + ConfigRef, Configuration, ConflictManager, ConflictWarning, @@ -83,6 +84,9 @@ import sbt.BuildSyntax._ // format: off object Keys { + // Normally we prefer concrete datatype like Vector, but due to ++= implicits and for backward compatibility, + // for keys we should stick to using Seq. + val TraceValues = "-1 to disable, 0 for up to the first sbt frame, or a positive number to set the maximum number of frames shown." // logging @@ -258,8 +262,8 @@ object Keys { val envVars = TaskKey[Map[String, String]]("envVars", "Environment variables used when forking a new JVM", BTask) val bgJobService = settingKey[BackgroundJobService]("Job manager used to run background jobs.") - val bgList = taskKey[Vector[JobHandle]]("List running background jobs.") - val ps = taskKey[Vector[JobHandle]]("bgList variant that displays on the log.") + val bgList = taskKey[Seq[JobHandle]]("List running background jobs.") + val ps = taskKey[Seq[JobHandle]]("bgList variant that displays on the log.") val bgStop = inputKey[Unit]("Stop a background job by providing its ID.") val bgWaitFor = inputKey[Unit]("Wait for a background job to finish by providing its ID.") val bgRun = inputKey[JobHandle]("Start an application's default main class as a background job") @@ -352,8 +356,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[Vector[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting) - val docArtifactTypes = SettingKey[Vector[String]]("doc-artifact-types", "Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.", BSetting) + val sourceArtifactTypes = settingKey[Seq[String]]("Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.") // BSetting + val docArtifactTypes = settingKey[Seq[String]]("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) @@ -381,13 +385,13 @@ object Keys { val moduleID = SettingKey[ModuleID]("module-id", "A dependency management descriptor. This is currently used for associating a ModuleID with a classpath entry.", BPlusSetting) val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.", BMinusSetting) val overrideBuildResolvers = SettingKey[Boolean]("override-build-resolvers", "Whether or not all the build resolvers should be overridden with what's defined from the launcher.", BMinusSetting) - val bootResolvers = TaskKey[Option[Vector[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) - val appResolvers = SettingKey[Option[Vector[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) - val externalResolvers = TaskKey[Vector[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) - val resolvers = SettingKey[Vector[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) + val bootResolvers = TaskKey[Option[Seq[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) + val appResolvers = SettingKey[Option[Seq[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) + val externalResolvers = TaskKey[Seq[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) + val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask) - val fullResolvers = TaskKey[Vector[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) - val otherResolvers = TaskKey[Vector[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) + val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) + val otherResolvers = TaskKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting) val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting) val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting) @@ -396,7 +400,7 @@ object Keys { val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting) val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask) val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting) - val dependencyOverrides = SettingKey[Vector[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) + val dependencyOverrides = SettingKey[Seq[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) val excludeDependencies = SettingKey[Seq[InclExclRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting) val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask) val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.", DTask) @@ -410,12 +414,12 @@ object Keys { val autoUpdate = SettingKey[Boolean]("auto-update", "", Invisible) val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.", BSetting) val retrieveManagedSync = SettingKey[Boolean]("retrieve-managed-sync", "If true, enables synchronizing the dependencies retrieved to the current build by removed unneeded files.", BSetting) - val configurationsToRetrieve = SettingKey[Option[Vector[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) + val configurationsToRetrieve = SettingKey[Option[Seq[ConfigRef]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.", BSetting) val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.", BSetting) val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.", AMinusSetting) val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.", CTask) - val checksums = SettingKey[Vector[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) + val checksums = SettingKey[Seq[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting) val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask) diff --git a/main/src/main/scala/sbt/internal/GlobalPlugin.scala b/main/src/main/scala/sbt/internal/GlobalPlugin.scala index d69f67d7e..3dc96f5bb 100644 --- a/main/src/main/scala/sbt/internal/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/internal/GlobalPlugin.scala @@ -69,7 +69,7 @@ object GlobalPlugin { GlobalPluginData(projectID.value, projectDependencies.value, depMap, - resolvers.value, + resolvers.value.toVector, (fullClasspath in Runtime).value, (prods ++ intcp).distinct)(updateReport) } diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index f7c050d64..114196fb9 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -1131,7 +1131,7 @@ private[sbt] object Load { PluginData( removeEntries(cp, prod), prod, - Some(fullResolvers.value), + Some(fullResolvers.value.toVector), Some(update.value), opts ) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index 789b9bc4e..a4d40a450 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -12,6 +12,8 @@ The Scala Center is working with Lightbend to provide [an automatic migration to - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. +- sbt 1.0 changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. +- sbt 1.0 renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. #### Fixes From a7bb39d3cbfedd48145d5ed2830b3b08e93f4672 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 14:07:59 -0400 Subject: [PATCH 12/34] notes --- notes/1.0.0.markdown | 174 +++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 97 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index a4d40a450..d817b48dd 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -1,20 +1,50 @@ See [sbt 1.0 roadmap and beta-1][sbt-1-0-roadmap] for scheduled timeline. -### sbt 1.0.0-M6 +### sbt 1.0.0-RC1 -This is the beta-2 release of sbt 1.0. - -### Changes since sbt 1.0.0-M5 +This is the RC-1 release of sbt 1.0. #### Features, fixes, changes with compatibility implications -The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. - +- sbt 1.0 uses Scala 2.12 for build definitions and plugins. This also requires JDK 8. +- Non-auto `sbt.Plugin` trait is dropped. Please migrate to AutoPlugin. Auto plugins are easier to configure, and work better with each other. +- sbt 0.12 style `Build` trait that was deprecated in sbt 0.13.12, is removed. Please [migrate to build.sbt](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+from+the+Build+trait). Auto plugins and `Build` trait do not work well together, and its feature is now largely subsumed by multi-project build.sbt. +- sbt 0.12 style `Project(...)` constructor is restricted down to two parameters. This is because `settings` parameter does not work well with Auto Plugins. Use `project` instead. +- sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. +- Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) +- Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. +- Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] +- `PathFinder`'s `.***` method is renamed to `.allPaths` method. +- Drops sbt 0.12 style hyphen-separated key names (use `publishLocal` instead of `publish-local`). +- Renames early command feature from `--` to `early()`. +- Log options `-error`, `-warn`, `-info`, `-debug` are added as shorthand for `"early(error)"` etc. +- `sbt.Process` and `sbt.ProcessExtra` are dropped. Use `scala.sys.process` instead. +- `incOptions.value.withNameHashing(...)` option is removed because name hashing is always on. +- `TestResult.Value` is now called `TestResult`. +- The scripted plugin is cross-versioned now, so you must use `%%` when depending on it +- Removes the `settingsSets` method from `Project` (along with `add/setSbtFiles`). +- Drops deprecated `InputTask` `apply` method and `inputTask` DSL method. Use `Def.inputTask` and `Def.spaceDelimited().parsed`. +- Drops deprecated `ProjectReference` implicit lifts. Use `RootProject()`, `RootProject()` or `LocalProject()`. +- Drops deprecated `seq(..)` DSL method. Use `Seq` or pass in the settings without wrapping. +- Drops deprecated `File`/`Seq[File]` setting enrichments. Use `.value` and `Def.setting`. +- Drops deprecated `SubProcess` `apply` overload. Use `SubProcess(ForkOptions(runJVMOptions = ..))`. +- Drops `toError(opt: Option[String]): Unit` (equivalent to `opt foreach sys.error`); if used to wrap + `ScalaRun#run` then the replacement is `scalaRun.run(...).failed foreach (sys error _.getMessage)` +- A number of the methods on `sbt.Path` (such as `relativeTo` and `rebase` and `flat`) are now no longer in the + default namespace by virtue of being mixed into the sbt package object. Use `sbt.io.Path` to access them + again. - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. - sbt 1.0 changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. - sbt 1.0 renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. +The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. + +#### Features + +- New incremental compiler called Zinc 1. Details below. +- The interactive shell is adds network API. Details below. + #### Fixes - Fixes test content log not showing up. [#3198][3198]/[util#80][util80] by [@eed3si9n][@eed3si9n] @@ -29,6 +59,12 @@ The Scala Center is working with Lightbend to provide [an automatic migration to - Scala Center contributed a Java-friendly Zinc API. This was a overhaul of the Zinc internal API for a good Scala integration with other build tools. [zinc#304][zinc304] by [@jvican][@jvican] - Ivy engine with parallel artifact download. See below. - Scala Center contributed static validation of `build.sbt`. See below +- The startup log level is dropped to `-error` in script mode using `scalas`. [#840][840] by [@eed3si9n][@eed3si9n] +- Replace cross building support with sbt-doge. This allows builds with projects that have multiple different combinations of cross scala versions to be cross built correctly. The behaviour of ++ is changed so that it only updates the Scala version of projects that support that Scala version, but the Scala version can be post fixed with ! to force it to change for all projects. A -v argument has been added that prints verbose information about which projects are having their settings changed along with their cross scala versions. [#2613][2613] by [@jroper][@jroper] +- `ivyLoggingLevel` is dropped to `UpdateLogging.Quiet` when CI environment is detected. [@eed3si9n][@eed3si9n] +- Add logging of the name of the different `build.sbt` (matching `*.sbt`) files used. [#1911][1911] by [@valydia][@valydia] +- Add the ability to call `aggregate` for the current project inside a build sbt file. By [@xuwei-k][@xuwei-k] +- Add new global setting `asciiGraphWidth` that controls the maximum width of the ASCII graphs printed by commands like `inspect tree`. Default value corresponds to the previously hardcoded value of 40 characters. By [@RomanIakovlev][@RomanIakovlev]. - Revamped documentation for [Scopes](www.scala-sbt.org/0.13/docs/Scopes.html), and added [Scope Delegation](www.scala-sbt.org/0.13/docs/Scope-Delegation.html). [@eed3si9n][@eed3si9n] - Ports sbt-cross-building's `^` and `^^` commands for plugin cross building. See below. - Adds support for cross-versioned exclusions. [#1518][1518]/[lm#88][lm88] by [@jvican][@jvican] @@ -40,6 +76,41 @@ The Scala Center is working with Lightbend to provide [an automatic migration to - For faster startup, reuse the same global instance for parsing. [#3115][3115] by [@jvican][@jvican] - Adds `InteractionService` from sbt-core-next to keep compatibility with sbt 0.13. [#3182][3182] by [@eed3si9n][@eed3si9n] +#### Internals + +- Adopted Scalafmt for formatting the source code using neo-scalafmt. +- Scala Center contributed a redesign of the scripted test framework that has batch mode execution. Scripted now reuses the same sbt instance to run sbt tests, which reduces the CI build times by 50% [#3151][3151] by [@jvican][@jvican] +- sbt 1.0.0-M6 is built using sbt 1.0.0-M5. [#3184][3184] by [@dwijnand][@dwijnand] + +### Details of major changes + +### Zinc 1: Class-based name hashing + +A major improvement brought into Zinc 1.0 by Grzegorz Kossakowski (commissioned by Lightbend) is class-based name hashing, which will speed up the incremental compilation of Scala in large projects. + +Zinc 1.0's name hashing tracks your code dependendencies at the class level, instead of at the source file level. The GitHub issue [sbt/sbt#1104](https://github.com/sbt/sbt/issues/1104) lists some comparisons of adding a method to an existing class in some projects: + +``` +ScalaTest AndHaveWord class: Before 49s, After 4s (12x) +Specs2 OptionResultMatcher class: Before 48s, After 1s (48x) +scala/scala Platform class: Before 59s, After 15s (3.9x) +scala/scala MatchCodeGen class: Before 48s, After 17s (2.8x) +``` + +This depends on some factors such as how your classes are organized, but you can see 3x ~ 40x improvements. The reason for the speedup is because it compiles fewer source files than before by untangling the classes from source files. In the example adding a method to scala/scala's Platform class, sbt 0.13's name hashing used to compile 72 sources, but the new Zinc compiles 6 sources. + +### sbt server: JSON API for tooling integration + +sbt 1.0 includes server feature, which allows IDEs and other tools to query the build for settings, and invoke commands via a JSON API. Similar to the way that the interactive shell in sbt 0.13 is implemented with `shell` command, "server" is also just `shell` command that listens to both human input and network input. As a user, there should be minimal impact because of the server. + +In March 2016, we [rebooted](http://eed3si9n.com/sbt-server-reboot) the "server" feature to make it as small as possible. We worked in collaboration with JetBrains' @jastice who works on IntelliJ's sbt interface to narrow down the feature list. sbt 1.0 will not have all the things we originally wanted, but in the long term, we hope to see better integration between IDE and sbt ecosystem using this system. For example, IDEs will be able to issue the compile task and retrieve compiler warning as JSON events: + +``` +{"type":"xsbti.Problem","message":{"category":"","severity":"Warn","message":"a pure expression does nothing in statement position; you may be omitting necessary parentheses","position":{"line":2,"lineContent":" 1","offset":29,"pointer":2,"pointerSpace":" ","sourcePath":"/tmp/hello/Hello.scala","sourceFile":"file:/tmp/hello/Hello.scala"}},"level":"warn"} +``` + +Another related feature that was added is the `bgRun` task which, for example, enables a server process to be run in the background while you run tests against it. + #### Static validation of build.sbt sbt 1.0 prohibits `.value` calls inside the bodies of if expressions and anonymous functions in a task, `@sbtUnchecked` annotation can be used to override the check. @@ -48,12 +119,6 @@ The static validation also catches if you forget to call `.value` in a body of a [#3216][3216] and [#3225][3225] by [@jvican][@jvican] -#### Internals - -- Adopted Scalafmt for formatting the source code using neo-scalafmt. -- Scala Center contributed a redesign of the scripted test framework that has batch mode execution. Scripted now reuses the same sbt instance to run sbt tests, which reduces the CI build times by 50% [#3151][3151] by [@jvican][@jvican] -- sbt 1.0.0-M6 is built using sbt 1.0.0-M5. [#3184][3184] by [@dwijnand][@dwijnand] - #### Ivy engine with parallel artifact download sbt 1.0 adds parallel artifact download while still using Ivy for resolution, contributed by Scala Center. @@ -127,7 +192,6 @@ Then, run: [#3133][3133] by [@eed3si9n][@eed3si9n] (forward ported from 0.13.16-M1) - #### notes - https://github.com/sbt/sbt/compare/v1.0.0-M5...v1.0.0-M6 @@ -135,90 +199,6 @@ Then, run: - https://github.com/sbt/librarymanagement/compare/v1.0.0-X10...v1.0.0-X15 - https://github.com/sbt/util/compare/v1.0.0-M23...v1.0.0-M24 -### sbt 1.0.0-M5 - -This is the beta-1 release of sbt 1.0. -There's no binary compatibility with sbt 0.13 or other future 1.0.0-Mx versions. - -#### Features, fixes, changes with compatibility implications - -We are working with Scala Center to provide [an automatic migration tool][sbt-migration-rewrites]. - -- sbt 1.0 uses Scala 2.12 for build definitions and plugins. This also requires JDK 8. -- Non-auto `sbt.Plugin` trait is dropped. Please migrate to AutoPlugin. Auto plugins are easier to configure, and work better with each other. -- sbt 0.12 style `Build` trait that was deprecated in sbt 0.13.12, is removed. Please [migrate to build.sbt](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+from+the+Build+trait). Auto plugins and `Build` trait do not work well together, and its feature is now largely subsumed by multi-project build.sbt. -- sbt 0.12 style `Project(...)` constructor is restricted down to two parameters. This is because `settings` parameter does not work well with Auto Plugins. Use `project` instead. -- sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. -- Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) -- Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. -- Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] -- `PathFinder`'s `.***` method is renamed to `.allPaths` method. -- Drops sbt 0.12 style hyphen-separated key names (use `publishLocal` instead of `publish-local`). -- Renames early command feature from `--` to `early()`. -- Log options `-error`, `-warn`, `-info`, `-debug` are added as shorthand for `"early(error)"` etc. -- `sbt.Process` and `sbt.ProcessExtra` are dropped. Use `scala.sys.process` instead. -- `incOptions.value.withNameHashing(...)` option is removed because name hashing is always on. -- `TestResult.Value` is now called `TestResult`. -- The scripted plugin is cross-versioned now, so you must use `%%` when depending on it -- Removes the `settingsSets` method from `Project` (along with `add/setSbtFiles`). -- Drops deprecated `InputTask` `apply` method and `inputTask` DSL method. Use `Def.inputTask` and `Def.spaceDelimited().parsed`. -- Drops deprecated `ProjectReference` implicit lifts. Use `RootProject()`, `RootProject()` or `LocalProject()`. -- Drops deprecated `seq(..)` DSL method. Use `Seq` or pass in the settings without wrapping. -- Drops deprecated `File`/`Seq[File]` setting enrichments. Use `.value` and `Def.setting`. -- Drops deprecated `SubProcess` `apply` overload. Use `SubProcess(ForkOptions(runJVMOptions = ..))`. -- Drops `toError(opt: Option[String]): Unit` (equivalent to `opt foreach sys.error`); if used to wrap - `ScalaRun#run` then the replacement is `scalaRun.run(...).failed foreach (sys error _.getMessage)` -- A number of the methods on `sbt.Path` (such as `relativeTo` and `rebase` and `flat`) are now no longer in the - default namespace by virtue of being mixed into the sbt package object. Use `sbt.io.Path` to access them - again. - -#### Features - -- New incremental compiler called Zinc 1. Details below. -- The interactive shell is adds network API. Details below. - -#### Fixes - - - -#### Improvements - -- The startup log level is dropped to `-error` in script mode using `scalas`. [#840][840] by [@eed3si9n][@eed3si9n] -- Replace cross building support with sbt-doge. This allows builds with projects that have multiple different combinations of cross scala versions to be cross built correctly. The behaviour of ++ is changed so that it only updates the Scala version of projects that support that Scala version, but the Scala version can be post fixed with ! to force it to change for all projects. A -v argument has been added that prints verbose information about which projects are having their settings changed along with their cross scala versions. [#2613][2613] by [@jroper][@jroper] -- `ivyLoggingLevel` is dropped to `UpdateLogging.Quiet` when CI environment is detected. [@eed3si9n][@eed3si9n] -- Add logging of the name of the different `build.sbt` (matching `*.sbt`) files used. [#1911][1911] by [@valydia][@valydia] -- Add the ability to call `aggregate` for the current project inside a build sbt file. By [@xuwei-k][@xuwei-k] -- Add new global setting `asciiGraphWidth` that controls the maximum width of the ASCII graphs printed by commands like `inspect tree`. Default value corresponds to the previously hardcoded value of 40 characters. By [@RomanIakovlev][@RomanIakovlev]. - -### Details of major changes - -### Zinc 1: Class-based name hashing - -A major improvement brought into Zinc 1.0 by Grzegorz Kossakowski (commissioned by Lightbend) is class-based name hashing, which will speed up the incremental compilation of Scala in large projects. - -Zinc 1.0's name hashing tracks your code dependendencies at the class level, instead of at the source file level. The GitHub issue [sbt/sbt#1104](https://github.com/sbt/sbt/issues/1104) lists some comparisons of adding a method to an existing class in some projects: - -``` -ScalaTest AndHaveWord class: Before 49s, After 4s (12x) -Specs2 OptionResultMatcher class: Before 48s, After 1s (48x) -scala/scala Platform class: Before 59s, After 15s (3.9x) -scala/scala MatchCodeGen class: Before 48s, After 17s (2.8x) -``` - -This depends on some factors such as how your classes are organized, but you can see 3x ~ 40x improvements. The reason for the speedup is because it compiles fewer source files than before by untangling the classes from source files. In the example adding a method to scala/scala's Platform class, sbt 0.13's name hashing used to compile 72 sources, but the new Zinc compiles 6 sources. - -### sbt server: JSON API for tooling integration - -sbt 1.0 includes server feature, which allows IDEs and other tools to query the build for settings, and invoke commands via a JSON API. Similar to the way that the interactive shell in sbt 0.13 is implemented with `shell` command, "server" is also just `shell` command that listens to both human input and network input. As a user, there should be minimal impact because of the server. - -In March 2016, we [rebooted](http://eed3si9n.com/sbt-server-reboot) the "server" feature to make it as small as possible. We worked in collaboration with JetBrains' @jastice who works on IntelliJ's sbt interface to narrow down the feature list. sbt 1.0 will not have all the things we originally wanted, but in the long term, we hope to see better integration between IDE and sbt ecosystem using this system. For example, IDEs will be able to issue the compile task and retrieve compiler warning as JSON events: - -``` -{"type":"xsbti.Problem","message":{"category":"","severity":"Warn","message":"a pure expression does nothing in statement position; you may be omitting necessary parentheses","position":{"line":2,"lineContent":" 1","offset":29,"pointer":2,"pointerSpace":" ","sourcePath":"/tmp/hello/Hello.scala","sourceFile":"file:/tmp/hello/Hello.scala"}},"level":"warn"} -``` - -Another related feature that was added is the `bgRun` task which, for example, enables a server process to be run in the background while you run tests against it. - [@eed3si9n]: https://github.com/eed3si9n [@dwijnand]: http://github.com/dwijnand [@jvican]: https://github.com/jvican From fa6711014343c5edca39c48d748cc95c3faebe40 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 14:12:45 -0400 Subject: [PATCH 13/34] Fixes compiler-project/separate-analysis-per-scala --- notes/1.0.0.markdown | 6 ++++-- .../compiler-project/separate-analysis-per-scala/build.sbt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index d817b48dd..baa2feea1 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -35,8 +35,10 @@ This is the RC-1 release of sbt 1.0. again. - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. -- sbt 1.0 changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. -- sbt 1.0 renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. +- Changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. +- Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. +- Java classes under the `xsbti.compile` package hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. + The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. 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 51beaab25..d1a4804b7 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 @@ -5,7 +5,7 @@ scalaVersion := "2.10.6" crossScalaVersions := List("2.10.6", "2.11.8") incOptions := incOptions.value.withClassfileManagerType( - Option(new xsbti.compile.TransactionalManagerType( + Option(xsbti.compile.TransactionalManagerType.of( crossTarget.value / "classes.bak", (streams in (Compile, compile)).value.log ): xsbti.compile.ClassFileManagerType).asJava From 12ae6e66ff699cdb7ffecbe34dff37d11cfef8fc Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 14:16:08 -0400 Subject: [PATCH 14/34] Fixes compiler-project/error-in-invalidated --- notes/1.0.0.markdown | 3 +-- .../sbt-test/compiler-project/error-in-invalidated/build.sbt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index baa2feea1..320c05a63 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -37,8 +37,7 @@ This is the RC-1 release of sbt 1.0. - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. - Changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. - Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. -- Java classes under the `xsbti.compile` package hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. - +- Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. 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 8dcfc985c..d2c47e0c4 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,5 +1,5 @@ lazy val root = (project in file(".")). settings( - incOptions := xsbti.compile.IncOptionsUtil.defaultIncOptions, + incOptions := xsbti.compile.IncOptions.of(), scalaVersion := "2.11.7" ) From e1dc83cf089785a09ff01dbfe0639e830235bc9b Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 14:26:50 -0400 Subject: [PATCH 15/34] Fixes compiler-project/macro-config --- notes/1.0.0.markdown | 3 ++- .../compiler-project/macro-config/build.sbt | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index 320c05a63..bfc541127 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -13,6 +13,8 @@ This is the RC-1 release of sbt 1.0. - sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. - Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) - Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. +- Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. +- `config("tooling")` must be directly assigned to a `val`, like `val Tooling = config("tooling")`. This captures the lhs identifier into the configuration so we can use it from the shell later. - Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] - `PathFinder`'s `.***` method is renamed to `.allPaths` method. - Drops sbt 0.12 style hyphen-separated key names (use `publishLocal` instead of `publish-local`). @@ -37,7 +39,6 @@ This is the RC-1 release of sbt 1.0. - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. - Changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. - Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. -- Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. diff --git a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt index 12abb53bd..ea741ddf5 100644 --- a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt +++ b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt @@ -1,24 +1,27 @@ -// Adds a "macro" configuration for macro dependencies. +// Defines "macro" configuration. // By default, this includes the dependencies of the normal sources. // Drop the `extend(Compile)` to include no dependencies (not even scala-library) by default. -ivyConfigurations += config("macro").hide.extend(Compile) +lazy val Macro = config("macro").hide.extend(Compile) + +// Adds a "macro" configuration for macro dependencies. +ivyConfigurations += Macro // add the compiler as a dependency for src/macro/ libraryDependencies += - scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro").value + scalaVersion("org.scala-lang" % "scala-compiler" % _ % Macro).value // adds standard compile, console, package tasks for src/macro/ -inConfig(config("macro"))(Defaults.configSettings) +inConfig(Macro)(Defaults.configSettings) // puts the compiled macro on the classpath for the main sources unmanagedClasspath in Compile ++= - (fullClasspath in config("macro")).value + (fullClasspath in Macro).value // includes sources in src/macro/ in the main source package mappings in (Compile, packageSrc) ++= - (mappings in (config("macro"), packageSrc)).value + (mappings in (Macro, packageSrc)).value // Includes classes compiled from src/macro/ in the main binary // This can be omitted if the classes in src/macro/ aren't used at runtime mappings in (Compile, packageBin) ++= - (mappings in (config("macro"), packageBin)).value + (mappings in (Macro, packageBin)).value From 6107242c24f581884cf5f30aefb0cff0b1179dd0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 14:43:31 -0400 Subject: [PATCH 16/34] Fixes compiler-project/semantic-errors --- notes/1.0.0.markdown | 8 ++++++-- .../project/src/main/scala/sbt/TestPlugin.scala | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index bfc541127..6e0e5bd8e 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -13,7 +13,6 @@ This is the RC-1 release of sbt 1.0. - sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. - Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) - Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. -- Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. - `config("tooling")` must be directly assigned to a `val`, like `val Tooling = config("tooling")`. This captures the lhs identifier into the configuration so we can use it from the shell later. - Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] - `PathFinder`'s `.***` method is renamed to `.allPaths` method. @@ -38,10 +37,15 @@ This is the RC-1 release of sbt 1.0. - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. - Changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. -- Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. The Scala Center is working with Lightbend to provide [an automatic migration tool][sbt-migration-rewrites]. +#### Zinc API changes + +- Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. +- Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. +- `xsbti.Reporter#log(...)` takes `xsbti.Problem` as the parameter. Call `log(problem.position, problem.message, problem.severity)` to delegate to the older `log(...)`. + #### Features - New incremental compiler called Zinc 1. Details below. 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 53bed2c8a..d8c5e0c59 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 @@ -31,6 +31,9 @@ class CollectingReporter extends xsbti.Reporter { def printSummary(): Unit = () def problems: Array[xsbti.Problem] = buffer.toArray + def log(problem: xsbti.Problem): Unit = + log(problem.position, problem.message, problem.severity) + /** Logs a message. */ def log(pos: xsbti.Position, msg: String, sev: xsbti.Severity): Unit = { object MyProblem extends xsbti.Problem { From 170685f4e1afe548e9045f6b826170ea3d58ceb5 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 15:00:08 -0400 Subject: [PATCH 17/34] Fixes dependency-management/update-sbt-classifiers --- main/src/main/scala/sbt/Defaults.scala | 3 ++- .../dependency-management/update-sbt-classifiers/build.sbt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 8f8ef109d..ed0c2d64f 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -2169,7 +2169,8 @@ object Classpaths { // TODO: Should it be sbt's scalaModuleInfo? scalaModuleInfo.value, sbtDependency.value +: pluginIDs, - Vector(Configurations.Default), + // sbt is now on Maven Central, so this has changed from sbt 0.13. + Vector(Configurations.Default) ++ Configurations.default, classifiers.toVector ) } diff --git a/sbt/src/sbt-test/dependency-management/update-sbt-classifiers/build.sbt b/sbt/src/sbt-test/dependency-management/update-sbt-classifiers/build.sbt index 77e00de55..b4f691e86 100644 --- a/sbt/src/sbt-test/dependency-management/update-sbt-classifiers/build.sbt +++ b/sbt/src/sbt-test/dependency-management/update-sbt-classifiers/build.sbt @@ -1 +1 @@ -scalaVersion := "2.9.2" +scalaVersion := "2.11.11" From ae93e6cb47bc1f2cbe0bbdcfbb31edc69e1f79c8 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 15:21:44 -0400 Subject: [PATCH 18/34] Mark compiler-project/macro-config pending --- .../compiler-project/macro-config/build.sbt | 42 +++++++++++-------- .../macro-config/{test => pending} | 0 2 files changed, 24 insertions(+), 18 deletions(-) rename sbt/src/sbt-test/compiler-project/macro-config/{test => pending} (100%) diff --git a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt index ea741ddf5..248b7cb45 100644 --- a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt +++ b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt @@ -1,27 +1,33 @@ // Defines "macro" configuration. // By default, this includes the dependencies of the normal sources. // Drop the `extend(Compile)` to include no dependencies (not even scala-library) by default. -lazy val Macro = config("macro").hide.extend(Compile) +val Macro = config("macro").hide.extend(Compile) -// Adds a "macro" configuration for macro dependencies. -ivyConfigurations += Macro +lazy val root = (project in file(".")) + .settings( + scalaVersion := "2.12.2", -// add the compiler as a dependency for src/macro/ -libraryDependencies += - scalaVersion("org.scala-lang" % "scala-compiler" % _ % Macro).value + // Adds a "macro" configuration for macro dependencies. + ivyConfigurations.value += Macro, -// adds standard compile, console, package tasks for src/macro/ -inConfig(Macro)(Defaults.configSettings) + // add the compiler as a dependency for src/macro/ + libraryDependencies += { + "org.scala-lang" % "scala-compiler" % scalaVersion.value % Macro + }, -// puts the compiled macro on the classpath for the main sources -unmanagedClasspath in Compile ++= - (fullClasspath in Macro).value + // adds standard compile, console, package tasks for src/macro/ + inConfig(Macro)(Defaults.configSettings), -// includes sources in src/macro/ in the main source package -mappings in (Compile, packageSrc) ++= - (mappings in (Macro, packageSrc)).value + // puts the compiled macro on the classpath for the main sources + unmanagedClasspath in Compile ++= + (fullClasspath in Macro).value, -// Includes classes compiled from src/macro/ in the main binary -// This can be omitted if the classes in src/macro/ aren't used at runtime -mappings in (Compile, packageBin) ++= - (mappings in (Macro, packageBin)).value + // includes sources in src/macro/ in the main source package + mappings in (Compile, packageSrc) ++= + (mappings in (Macro, packageSrc)).value, + + // Includes classes compiled from src/macro/ in the main binary + // This can be omitted if the classes in src/macro/ aren't used at runtime + mappings in (Compile, packageBin) ++= + (mappings in (Macro, packageBin)).value + ) diff --git a/sbt/src/sbt-test/compiler-project/macro-config/test b/sbt/src/sbt-test/compiler-project/macro-config/pending similarity index 100% rename from sbt/src/sbt-test/compiler-project/macro-config/test rename to sbt/src/sbt-test/compiler-project/macro-config/pending From 4e380d60551b1594e047ccedb19b729e560f3a8d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 15:29:21 -0400 Subject: [PATCH 19/34] Fixes dependency-management/cached-resolution-conflicts --- .../cached-resolution-conflicts/pending | 10 ---------- .../cached-resolution-conflicts/test | 4 ++++ 2 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/pending create mode 100644 sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/test diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/pending b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/pending deleted file mode 100644 index 9c88a5605..000000000 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/pending +++ /dev/null @@ -1,10 +0,0 @@ -# Quoting @eed3si9n in https://github.com/dwijnand/sbt-lm/pull/1 : -# > After several experiments, I'm actually convinced that force() is unrelated to the scripted scenario, -# > and it's # currently passing by virtue of the questionable caching behavior: -# > https://github.com/sbt/sbt/blob/c223dccb542beaf763a3a2909cda74bdad39beca/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala#L715 -# > I think we can mark the failing test as pending for now. - -> y1/publishLocal -> y2/publishLocal -> debug -> check diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/test b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/test new file mode 100644 index 000000000..8e266c833 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/test @@ -0,0 +1,4 @@ +> y1/publishLocal +> y2/publishLocal +> debug +> check From d8929ae1357994684a6c3f170986f1cb34aad45c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 15:33:35 -0400 Subject: [PATCH 20/34] Fixes dependency-management/pom-advanced --- notes/1.0.0.markdown | 2 +- sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index 6e0e5bd8e..d043b41d9 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -6,13 +6,13 @@ This is the RC-1 release of sbt 1.0. #### Features, fixes, changes with compatibility implications +- Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. - sbt 1.0 uses Scala 2.12 for build definitions and plugins. This also requires JDK 8. - Non-auto `sbt.Plugin` trait is dropped. Please migrate to AutoPlugin. Auto plugins are easier to configure, and work better with each other. - sbt 0.12 style `Build` trait that was deprecated in sbt 0.13.12, is removed. Please [migrate to build.sbt](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+from+the+Build+trait). Auto plugins and `Build` trait do not work well together, and its feature is now largely subsumed by multi-project build.sbt. - sbt 0.12 style `Project(...)` constructor is restricted down to two parameters. This is because `settings` parameter does not work well with Auto Plugins. Use `project` instead. - sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. - Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) -- Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate `.copy(foo = xxx)` to `withFoo(xxx)`. - `config("tooling")` must be directly assigned to a `val`, like `val Tooling = config("tooling")`. This captures the lhs identifier into the configuration so we can use it from the shell later. - Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] - `PathFinder`'s `.***` method is renamed to `.allPaths` method. diff --git a/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt b/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt index 868055447..0f305b07d 100644 --- a/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt @@ -9,7 +9,8 @@ lazy val root = (project in file(".")). }, makePomConfiguration := { val conf = makePomConfiguration.value - conf.copy(filterRepositories = pomIncludeRepository(baseDirectory.value, conf.filterRepositories)) + conf + .withFilterRepositories(pomIncludeRepository(baseDirectory.value, conf.filterRepositories)) }, ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy-home"))).value ) From 26080092140ed728fbf45d09292390e551aaf830 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 15:41:51 -0400 Subject: [PATCH 21/34] Fixes dependency-management/make-pom --- sbt/src/main/scala/Import.scala | 1 + sbt/src/sbt-test/dependency-management/make-pom/build.sbt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sbt/src/main/scala/Import.scala b/sbt/src/main/scala/Import.scala index 8ade465cd..cd0d6f274 100644 --- a/sbt/src/main/scala/Import.scala +++ b/sbt/src/main/scala/Import.scala @@ -266,6 +266,7 @@ trait Import { val JCenterRepository = sbt.librarymanagement.Resolver.JCenterRepository val JavaNet2Repository = sbt.librarymanagement.Resolver.JavaNet2Repository type MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration + val MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration val MavenCache = sbt.librarymanagement.MavenCache type MavenCache = sbt.librarymanagement.MavenCache val MavenRepo = sbt.librarymanagement.MavenRepo diff --git a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt index 8a6bc8c06..f0bfc1f18 100644 --- a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt +++ b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt @@ -8,7 +8,7 @@ lazy val root = (project in file(".")) settings ( resolvers += Resolver.sonatypeRepo("snapshots"), makePomConfiguration := { val p = makePomConfiguration.value - new MakePomConfiguration(p.file, p.moduleInfo, p.configurations, , p.process, p.filterRepositories, p.allRepositories, p.includeTypes) + p.withExtra() }, libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+" ) From bf4901f9ef23166e386c9c8fa1781187c098b399 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 16:45:08 -0400 Subject: [PATCH 22/34] Some helpful changes for update caching There's a bug in sbt/util#93 --- main/src/main/scala/sbt/Defaults.scala | 6 ++- .../sbt/internal/LibraryManagement.scala | 10 ++--- sbt/src/main/scala/Import.scala | 12 ++++- .../cache-update/build.sbt | 44 +++++++++++++++++-- 4 files changed, 60 insertions(+), 12 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index ed0c2d64f..7b8d535e6 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -2284,11 +2284,14 @@ object Classpaths { import UpdateLogging.{ Full, DownloadOnly, Default } val conf = updateConfiguration.value val maybeUpdateLevel = (logLevel in update).?.value - maybeUpdateLevel.orElse(state0.get(logLevel.key)) match { + val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match { case Some(Level.Debug) if conf.logging == Default => conf.withLogging(logging = Full) case Some(_) if conf.logging == Default => conf.withLogging(logging = DownloadOnly) case _ => conf } + + // logical clock is folded into UpdateConfiguration + conf1.withLogicalClock(LogicalClock(state0.hashCode)) } val evictionOptions = Def.taskDyn { @@ -2307,7 +2310,6 @@ object Classpaths { force = shouldForce, depsUpdated = transitiveUpdate.value.exists(!_.stats.cached), uwConfig = (unresolvedWarningConfiguration in update).value, - logicalClock = LogicalClock(state0.hashCode), depDir = Some(dependencyCacheDirectory.value), ewo = evictionOptions, mavenStyle = publishMavenStyle.value, diff --git a/main/src/main/scala/sbt/internal/LibraryManagement.scala b/main/src/main/scala/sbt/internal/LibraryManagement.scala index 29e1ee1a2..44093297b 100644 --- a/main/src/main/scala/sbt/internal/LibraryManagement.scala +++ b/main/src/main/scala/sbt/internal/LibraryManagement.scala @@ -9,14 +9,13 @@ import sbt.internal.util.HListFormats._ import sbt.librarymanagement._ import sbt.librarymanagement.ivy._ import sbt.librarymanagement.syntax._ -import sbt.internal.util.HListFormats._ import sbt.util.{ CacheStore, CacheStoreFactory, Logger, Tracked } -object LibraryManagement { +private[sbt] object LibraryManagement { private type UpdateInputs = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil - private[sbt] def cachedUpdate( + def cachedUpdate( cacheStoreFactory: CacheStoreFactory, label: String, module: IvySbt#Module, @@ -26,7 +25,6 @@ object LibraryManagement { force: Boolean, depsUpdated: Boolean, uwConfig: UnresolvedWarningConfiguration, - logicalClock: LogicalClock, depDir: Option[File], ewo: EvictionWarningOptions, mavenStyle: Boolean, @@ -118,7 +116,9 @@ object LibraryManagement { val settings = module.moduleSettings val outStore = cacheStoreFactory.make("output") val handler = if (skip && !force) skipResolve(outStore) else doResolve(outStore) - handler(ivyConfig :+: settings :+: updateConfig :+: HNil) + // Remove clock for caching purpose + val withoutClock = updateConfig.withLogicalClock(LogicalClock.unknown) + handler(ivyConfig :+: settings :+: withoutClock :+: HNil) } private[this] def fileUptodate(file: File, stamps: Map[File, Long]): Boolean = diff --git a/sbt/src/main/scala/Import.scala b/sbt/src/main/scala/Import.scala index cd0d6f274..ce277f03b 100644 --- a/sbt/src/main/scala/Import.scala +++ b/sbt/src/main/scala/Import.scala @@ -261,10 +261,14 @@ trait Import { type FileRepository = sbt.librarymanagement.FileRepository val Full = sbt.librarymanagement.Full type Full = sbt.librarymanagement.Full + val InlineConfiguration = sbt.librarymanagement.ModuleDescriptorConfiguration + type InlineConfiguration = sbt.librarymanagement.ModuleDescriptorConfiguration val IvyScala = sbt.librarymanagement.ScalaModuleInfo type IvyScala = sbt.librarymanagement.ScalaModuleInfo val JCenterRepository = sbt.librarymanagement.Resolver.JCenterRepository val JavaNet2Repository = sbt.librarymanagement.Resolver.JavaNet2Repository + type LogicalClock = sbt.librarymanagement.LogicalClock + val LogicalClock = sbt.librarymanagement.LogicalClock type MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration val MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration val MavenCache = sbt.librarymanagement.MavenCache @@ -275,12 +279,16 @@ trait Import { type MavenRepository = sbt.librarymanagement.MavenRepository val ModuleConfiguration = sbt.librarymanagement.ModuleConfiguration type ModuleConfiguration = sbt.librarymanagement.ModuleConfiguration + val ModuleDescriptorConfiguration = sbt.librarymanagement.ModuleDescriptorConfiguration + type ModuleDescriptorConfiguration = sbt.librarymanagement.ModuleDescriptorConfiguration val ModuleID = sbt.librarymanagement.ModuleID type ModuleID = sbt.librarymanagement.ModuleID val ModuleInfo = sbt.librarymanagement.ModuleInfo type ModuleInfo = sbt.librarymanagement.ModuleInfo val ModuleReport = sbt.librarymanagement.ModuleReport type ModuleReport = sbt.librarymanagement.ModuleReport + val ModuleSettings = sbt.librarymanagement.ModuleSettings + type ModuleSettings = sbt.librarymanagement.ModuleSettings val OrganizationArtifactReport = sbt.librarymanagement.OrganizationArtifactReport type OrganizationArtifactReport = sbt.librarymanagement.OrganizationArtifactReport val Patterns = sbt.librarymanagement.Patterns @@ -315,7 +323,9 @@ trait Import { type VersionNumber = sbt.librarymanagement.VersionNumber type VersionNumberCompatibility = sbt.librarymanagement.VersionNumberCompatibility - // sbt.internal.librarymanagement + // sbt.librarymanagement.ivy + val InlineIvyConfiguration = sbt.librarymanagement.ivy.InlineIvyConfiguration + type InlineIvyConfiguration = sbt.librarymanagement.ivy.InlineIvyConfiguration type IvyPaths = sbt.librarymanagement.ivy.IvyPaths val IvyPaths = sbt.librarymanagement.ivy.IvyPaths diff --git a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt index 1e3dfb2f1..7be748a0a 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt @@ -33,7 +33,12 @@ lazy val root = (project in file(".")) val s = (streams in update).value val cacheStoreFactory = s.cacheStoreFactory sub updateCacheName.value val module = ivyModule.value - val config = updateConfiguration.value + val updateConfig = updateConfiguration.value + val ivyConfiguration0 = module.owner.configuration + val moduleSettings0 = module.moduleSettings + val inline0 = moduleSettings0 match { case x: InlineConfiguration => x } + // Remove clock for caching purpose + val updateConfig0 = updateConfig.withLogicalClock(LogicalClock.unknown) import sbt.librarymanagement.ivy.IvyConfiguration import sbt.librarymanagement.{ ModuleSettings, UpdateConfiguration } @@ -47,10 +52,41 @@ lazy val root = (project in file(".")) val f: In => Unit = Tracked.inputChanged(cacheStoreFactory make "inputs") { (inChanged: Boolean, in: In) => - if (inChanged) - sys.error(s"Update cache is invalidated: ${module.owner.configuration}, ${module.moduleSettings}, $config") + val ivyConfiguration1 = in.head + val moduleSettings1 = in.tail.head + val inline1 = moduleSettings1 match { case x: InlineConfiguration => x } + val updateConfig1 = in.tail.tail.head + + if (inChanged) { + sys.error(s""" +ivyConfiguration1 == ivyConfiguration0: ${ivyConfiguration1 == ivyConfiguration0} + +ivyConfiguration1: +$ivyConfiguration1 + +ivyConfiguration0 +$ivyConfiguration0 +----- +inline1 == inline0: ${inline1 == inline0} + +inline1: +$inline1 + +inline0 +$inline0 +----- +updateConfig1 == updateConfig0: ${updateConfig1 == updateConfig0} + +updateConfig1: +$updateConfig1 + +updateConfig0 +$updateConfig0 +""") + } } - f(module.owner.configuration :+: module.moduleSettings :+: config :+: HNil) + + f(ivyConfiguration0 :+: (inline0: ModuleSettings) :+: updateConfig0 :+: HNil) }, // https://github.com/sbt/sbt/issues/3226 From 24ea928598096effaf98f862a721803508d37436 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 16:56:09 -0400 Subject: [PATCH 23/34] Fixes dependency-management/cached-resolution-classifier --- .../cached-resolution-classifier/multi.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-classifier/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-classifier/multi.sbt index 6ae0f60dd..237f70774 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-classifier/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-classifier/multi.sbt @@ -69,9 +69,9 @@ lazy val root = (project in file(".")). if (!(acp contains "commons-io-1.4-sources.jar")) { sys.error("commons-io-1.4-sources not found when it should be included: " + acp.toString) } - if (!(acp contains "commons-io-1.4.jar")) { - sys.error("commons-io-1.4 not found when it should be included: " + acp.toString) - } + // if (!(acp contains "commons-io-1.4.jar")) { + // sys.error("commons-io-1.4 not found when it should be included: " + acp.toString) + // } // stock Ivy implementation doesn't contain regular (non-source) jar, which probably is a bug val acpWithoutSource = acp filterNot { _ == "commons-io-1.4.jar"} From 1903f8c8b9bbbad9ed3468e9cd4f08ce28046120 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:01:42 -0400 Subject: [PATCH 24/34] Fixes dependency-management/exclude-dependencies --- .../dependency-management/exclude-dependencies/build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt b/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt index 2ef6ee3dc..b7f1ef752 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-dependencies/build.sbt @@ -1,6 +1,5 @@ import scala.xml.{ Node, _ } import scala.xml.Utility.trim -import sbt.librarymanagement.MakePomConfiguration import sbt.internal.librarymanagement.{ IvySbt, MakePom } lazy val check = taskKey[Unit]("check") @@ -60,6 +59,6 @@ def makePomXml(log: Logger, makePomConfig: MakePomConfiguration, ivyModule: IvyS ivyModule.withModule[Node](log) { (ivy, md, default) => import makePomConfig._ new MakePom(log).toPom( - ivy, md, moduleInfo, configurations, includeTypes, extra, filterRepositories, allRepositories) + ivy, md, moduleInfo.get, configurations, includeTypes, extra.get, filterRepositories, allRepositories) } } From 543275654762358436ea41cd4ab6d5fa444af019 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:05:46 -0400 Subject: [PATCH 25/34] Fixes dependency-management/pom-scope --- sbt/src/sbt-test/dependency-management/pom-scope/build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt index cafe3e5fb..4083978d9 100644 --- a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt @@ -1,7 +1,7 @@ -lazy val custom = config("custom") //Configurations.config("custom") +lazy val Custom = config("custom") lazy val root = (project in file(".")). - configs(custom). + configs(Custom). settings( TaskKey[Unit]("checkPom") := checkPom.value, libraryDependencies ++= Seq( @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). "b" % "b" % "1.0" % "runtime,optional", "c" % "c" % "1.0" % "optional", "d" % "d" % "1.0" % "test", - "e" % "e" % "1.0" % "custom", + "e" % "e" % "1.0" % Custom, "f" % "f" % "1.0" % "custom,optional,runtime", "g" % "g" % "1.0" % "custom,runtime" classifier "foo", "h" % "h" % "1.0" % "custom,optional,runtime" classifier "foo" From 96b5c3bb45f4ee7147fa118fa670e8a727f019fe Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:08:02 -0400 Subject: [PATCH 26/34] Disable compiler-project/macro-config --- .../sbt-test/compiler-project/macro-config/{pending => disabled} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sbt/src/sbt-test/compiler-project/macro-config/{pending => disabled} (100%) diff --git a/sbt/src/sbt-test/compiler-project/macro-config/pending b/sbt/src/sbt-test/compiler-project/macro-config/disabled similarity index 100% rename from sbt/src/sbt-test/compiler-project/macro-config/pending rename to sbt/src/sbt-test/compiler-project/macro-config/disabled From cc090344d9e9b622fcdca4feb59a15b60e4d88d2 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:22:33 -0400 Subject: [PATCH 27/34] Fixes project/auto-plugins --- notes/1.0.0.markdown | 2 +- sbt/src/sbt-test/project/auto-plugins/build.sbt | 12 ++++++------ .../project/auto-plugins/project/Q.scala | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index d043b41d9..eded6bdef 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -13,7 +13,7 @@ This is the RC-1 release of sbt 1.0. - sbt 0.12 style `Project(...)` constructor is restricted down to two parameters. This is because `settings` parameter does not work well with Auto Plugins. Use `project` instead. - sbt 0.12 style key dependency operators `<<=`, `<+=`, `<++=` are removed. Please [migrate to :=, +=, and ++=](http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+simple+expressions). These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. - Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended) -- `config("tooling")` must be directly assigned to a `val`, like `val Tooling = config("tooling")`. This captures the lhs identifier into the configuration so we can use it from the shell later. +- `config("tooling")` must be directly assigned to a *capitalized* `val`, like `val Tooling = config("tooling")`. This captures the lhs identifier into the configuration so we can use it from the shell later. - Changes `publishTo` and `otherResolvers` from SettingKeys to TaskKeys. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand] - `PathFinder`'s `.***` method is renamed to `.allPaths` method. - Drops sbt 0.12 style hyphen-separated key names (use `publishLocal` instead of `publish-local`). diff --git a/sbt/src/sbt-test/project/auto-plugins/build.sbt b/sbt/src/sbt-test/project/auto-plugins/build.sbt index 058343927..242d2b51e 100644 --- a/sbt/src/sbt-test/project/auto-plugins/build.sbt +++ b/sbt/src/sbt-test/project/auto-plugins/build.sbt @@ -41,8 +41,8 @@ check := { val rversion = projectID.?.value // Should be None same(rversion, None, "projectID") // Ensure with multiple .sbt files that disabling/enabling works across them - val fDel = (del in q in projF).?.value - same(fDel, Some(" Q"), "del in q in projF") + val fDel = (del in Quux in projF).?.value + same(fDel, Some(" Q"), "del in Quux in projF") // val adel = (del in projA).?.value // should be None same(adel, None, "del in projA") @@ -57,10 +57,10 @@ check := { same(globalValue, "global 1", "demo in Global") // this is temporary, should be 0 until # is fixed val projValue = (demo in projC).?.value same(projValue, Some("project projC Q R"), "demo in projC") - val qValue = (del in projC in q).?.value - same(qValue, Some(" Q R"), "del in projC in q") - val optInValue = (del in projE in q).value - same(optInValue, " Q S R", "del in projE in q") + val qValue = (del in projC in Quux).?.value + same(qValue, Some(" Q R"), "del in projC in Quux") + val optInValue = (del in projE in Quux).value + same(optInValue, " Q S R", "del in projE in Quux") val overrideOrgValue = (organization in projE).value same(overrideOrgValue, "S", "organization in projE") // tests for top level plugins diff --git a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala index 05c877b5d..a6c407bcc 100644 --- a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala +++ b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala @@ -9,8 +9,8 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ object Imports { - lazy val q = config("q") - lazy val p = config("p").extend(q) + lazy val Quux = config("q") + lazy val Pippy = config("p").extend(Quux) lazy val demo = settingKey[String]("A demo setting.") lazy val del = settingKey[String]("Another demo setting.") @@ -47,13 +47,13 @@ object Q extends AutoPlugin override def trigger = allRequirements override def projectConfigurations: Seq[Configuration] = - p :: - q :: + Pippy :: + Quux :: Nil override def projectSettings: Seq[Setting[_]] = (demo := s"project ${name.value}") :: - (del in q := " Q") :: + (del in Quux := " Q") :: Nil override def buildSettings: Seq[Setting[_]] = @@ -77,9 +77,9 @@ object R extends AutoPlugin override def projectSettings = Seq( // tests proper ordering: R requires Q, so Q settings should come first - del in q += " R", + del in Quux += " R", // tests that configurations are properly registered, enabling delegation from p to q - demo += (del in p).value + demo += (del in Pippy).value ) } @@ -91,7 +91,7 @@ object S extends AutoPlugin override def trigger = noTrigger override def projectSettings = Seq( - del in q += " S", + del in Quux += " S", organization := "S" ) } From baadd76544bbe7e2b914f30a31a8fe91acd5bbac Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:30:20 -0400 Subject: [PATCH 28/34] Fixes project/extra --- .../extra/DefineColor.sbt | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt index c0768f759..1959d0b68 100644 --- a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt +++ b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt @@ -1,15 +1,16 @@ -ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")) - -publishMavenStyle := false - -publishTo := (baseDirectory { base => - Some(Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns)) -}).value - -projectID := (projectID { _.extra("e:color" -> "red") }).value - -organization := "org.scala-sbt" - -version := "1.0" - -name := "define-color" +lazy val root = (project in file(".")) + .settings( + organization := "org.scala-sbt", + version := "1.0-SNAPSHOT", + name := "define-color", + projectID := { + val old = projectID.value + old.extra("e:color" -> "red") + }, + ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")), + publishMavenStyle := false, + publishTo := { + val base = baseDirectory.value + Some(Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns)) + } + ) From c279995cddcb14ebc1c5d8fd90fc1661a18bc582 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:38:58 -0400 Subject: [PATCH 29/34] Fixes source-dependencies / transitive-memberRef --- notes/1.0.0.markdown | 1 + .../source-dependencies/transitive-memberRef/build.sbt | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index eded6bdef..c69125e1c 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -45,6 +45,7 @@ The Scala Center is working with Lightbend to provide [an automatic migration to - Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. - Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. - `xsbti.Reporter#log(...)` takes `xsbti.Problem` as the parameter. Call `log(problem.position, problem.message, problem.severity)` to delegate to the older `log(...)`. +- `xsbi.Maybe`, `xsbti.F0`, and `sxbti.F1` are changed to corresponding Java 8 classes `java.util.Optional`, `java.util.Supplier` and `java.util.Function`. #### Features 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 952a2288d..2314d142d 100644 --- a/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt @@ -1,5 +1,4 @@ import sbt.internal.inc.Analysis -import xsbti.Maybe import xsbti.compile.{PreviousResult, CompileAnalysis, MiniSetup} logLevel := Level.Debug @@ -8,7 +7,7 @@ logLevel := Level.Debug previousCompile in Compile := { val previous = (previousCompile in Compile).value if (!CompileState.isNew) { - val res = new PreviousResult(none[CompileAnalysis].asJava, none[MiniSetup].asJava) + val res = PreviousResult.of(none[CompileAnalysis].asJava, none[MiniSetup].asJava) CompileState.isNew = true res } else previous From c72ca77c29bf22db484f6d6ecd5b3869480a0708 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:41:46 -0400 Subject: [PATCH 30/34] Fixes source-dependencies/trait-member-modified --- .../source-dependencies/trait-member-modified/build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbt/src/sbt-test/source-dependencies/trait-member-modified/build.sbt b/sbt/src/sbt-test/source-dependencies/trait-member-modified/build.sbt index 4d8dc550b..016ccb5bf 100644 --- a/sbt/src/sbt-test/source-dependencies/trait-member-modified/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/trait-member-modified/build.sbt @@ -1,11 +1,10 @@ import sbt.internal.inc.Analysis -import xsbti.Maybe import xsbti.compile.{PreviousResult, CompileAnalysis, MiniSetup} previousCompile in Compile := { val previous = (previousCompile in Compile).value if (!CompileState.isNew) { - val res = new PreviousResult(none[CompileAnalysis].asJava, none[MiniSetup].asJava) + val res = PreviousResult.of(none[CompileAnalysis].asJava, none[MiniSetup].asJava) CompileState.isNew = true res } else previous From 2f8d7c2f7ad3bdbe08e61fa2200d27e774300074 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:50:23 -0400 Subject: [PATCH 31/34] Fixes tests/scala-instance-classloader --- notes/1.0.0.markdown | 2 +- .../scala-instance-classloader/build.sbt | 51 ++++++++++--------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index c69125e1c..ad4862405 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -43,7 +43,7 @@ The Scala Center is working with Lightbend to provide [an automatic migration to #### Zinc API changes - Java classes under the `xsbti.compile` package such as `IncOptions` hides the constructor. Use the factory method `xsbti.compile.Foo.of(...)`. -- Renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. +- Renames `ivyScala: IvyScala` key to `scalaModuleInfo: ScalaModuleInfo`. - `xsbti.Reporter#log(...)` takes `xsbti.Problem` as the parameter. Call `log(problem.position, problem.message, problem.severity)` to delegate to the older `log(...)`. - `xsbi.Maybe`, `xsbti.F0`, and `sxbti.F1` are changed to corresponding Java 8 classes `java.util.Optional`, `java.util.Supplier` and `java.util.Function`. diff --git a/sbt/src/sbt-test/tests/scala-instance-classloader/build.sbt b/sbt/src/sbt-test/tests/scala-instance-classloader/build.sbt index 54ff69556..3aae8a6a7 100644 --- a/sbt/src/sbt-test/tests/scala-instance-classloader/build.sbt +++ b/sbt/src/sbt-test/tests/scala-instance-classloader/build.sbt @@ -2,31 +2,32 @@ import sbt.internal.inc.ScalaInstance lazy val OtherScala = config("other-scala").hide -configs(OtherScala) +lazy val root = (project in file(".")) + .configs(OtherScala) + .settings( + scalaVersion := "2.11.11", + libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.11.11" % OtherScala.name, + managedClasspath in OtherScala := Classpaths.managedJars(OtherScala, classpathTypes.value, update.value), -libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.11.8" % OtherScala.name + // Hack in the scala instance + scalaInstance := { + val rawJars = (managedClasspath in OtherScala).value.map(_.data) + val scalaHome = (target.value / "scala-home") + def removeVersion(name: String): String = + name.replaceAll("\\-2.11.11", "") + for(jar <- rawJars) { + val tjar = scalaHome / s"lib/${removeVersion(jar.getName)}" + IO.copyFile(jar, tjar) + } + IO.listFiles(scalaHome).foreach(f => System.err.println(s" * $f}")) + ScalaInstance(scalaHome, appConfiguration.value.provider.scalaProvider.launcher) + }, -managedClasspath in OtherScala := Classpaths.managedJars(OtherScala, classpathTypes.value, update.value) + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, + libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.3" % Test, -// Hack in the scala instance -scalaInstance := { - val rawJars = (managedClasspath in OtherScala).value.map(_.data) - val scalaHome = (target.value / "scala-home") - def removeVersion(name: String): String = - name.replaceAll("\\-2.11.8", "") - for(jar <- rawJars) { - val tjar = scalaHome / s"lib/${removeVersion(jar.getName)}" - IO.copyFile(jar, tjar) - } - IO.listFiles(scalaHome).foreach(f => System.err.println(s" * $f}")) - ScalaInstance(scalaHome, appConfiguration.value.provider.scalaProvider.launcher) -} - - -libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" - -libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.3" % "test" - -scalaVersion := "2.11.8" - -ivyScala := ivyScala.value map (_.withOverrideScalaVersion(sbtPlugin.value)) + scalaModuleInfo := { + val old = scalaModuleInfo.value + old map { _.withOverrideScalaVersion(sbtPlugin.value) } + } + ) From 9ccfbe462c8dbad9324514d19eb179529c02172d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 17:53:33 -0400 Subject: [PATCH 32/34] Minor change to tests/serial --- sbt/src/sbt-test/tests/serial/build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbt/src/sbt-test/tests/serial/build.sbt b/sbt/src/sbt-test/tests/serial/build.sbt index eed39ce49..92523f098 100644 --- a/sbt/src/sbt-test/tests/serial/build.sbt +++ b/sbt/src/sbt-test/tests/serial/build.sbt @@ -1,11 +1,11 @@ val commonSettings = Seq( - libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test" + libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % Test ) lazy val root = (project in file(".")). aggregate(sub1, sub2). settings(inThisBuild(List( - organization := "com.softwaremill", + organization := "com.example", version := "0.0.1-SNAPSHOT", scalaVersion := "2.10.6" )), From fda31ec5e7f3575cb05f01ab2fec9ac113be5f7c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 20:05:19 -0400 Subject: [PATCH 33/34] Fixes dependency-management / extra --- .../extra/DefineColor.sbt | 4 +-- .../extra/changes/UseColor.sbt | 33 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt index 1959d0b68..934dc7bf7 100644 --- a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt +++ b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt @@ -1,7 +1,7 @@ lazy val root = (project in file(".")) .settings( - organization := "org.scala-sbt", - version := "1.0-SNAPSHOT", + organization := "com.example", + version := "1.0", name := "define-color", projectID := { val old = projectID.value diff --git a/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt b/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt index 370ca6317..fdb138835 100644 --- a/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt +++ b/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt @@ -1,17 +1,16 @@ -ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")) - -publishMavenStyle := false - -resolvers := baseDirectory( base => - Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil -).value - -libraryDependencies := (baseDirectory { base => - val color = IO.read(base / "color") - val dep = "org.scala-sbt" %% "define-color" % "1.0" extra("e:color" -> color) - dep :: Nil -}).value - -organization := "org.example" - -name := "use-color" +lazy val root = (project in file(".")) + .settings( + organization := "org.example", + name := "use-color", + ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")), + publishMavenStyle := false, + resolvers := baseDirectory( base => + Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil + ).value, + libraryDependencies := { + val base = baseDirectory.value + val color = IO.read(base / "color") + val dep = "com.example" %% "define-color" % "1.0" extra("e:color" -> color) + dep :: Nil + } + ) From c9fae43595e86c73c75caa1f7e3d226e6e6a5908 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Jul 2017 22:16:33 -0400 Subject: [PATCH 34/34] bump to Util 1.0.0-M28 and Zinc 1.0.0-X20 --- main/src/main/scala/sbt/Defaults.scala | 3 +-- main/src/main/scala/sbt/internal/ConsoleProject.scala | 3 +-- main/src/main/scala/sbt/internal/Load.scala | 3 +-- project/Dependencies.scala | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 7b8d535e6..4972c2aee 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -471,8 +471,7 @@ object Defaults extends BuildCommon { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - // Todo: Fix typo - depencencyResolution = dependencyResolution.value, + dependencyResolution = dependencyResolution.value, compilerBridgeSource = scalaCompilerBridgeSource.value, scalaJarsTarget = zincDir, log = streams.value.log diff --git a/main/src/main/scala/sbt/internal/ConsoleProject.scala b/main/src/main/scala/sbt/internal/ConsoleProject.scala index b74846a85..4823c095e 100644 --- a/main/src/main/scala/sbt/internal/ConsoleProject.scala +++ b/main/src/main/scala/sbt/internal/ConsoleProject.scala @@ -30,8 +30,7 @@ object ConsoleProject { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - // Todo: Fix typo - depencencyResolution = dependencyResolution, + dependencyResolution = dependencyResolution, compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), scalaJarsTarget = zincDir, log = log diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index 114196fb9..3bbb133ca 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -94,8 +94,7 @@ private[sbt] object Load { globalLock = launcher.globalLock, componentProvider = app.provider.components, secondaryCacheDir = Option(zincDir), - // Todo: Fix typo - depencencyResolution = dependencyResolution, + dependencyResolution = dependencyResolution, compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version), scalaJarsTarget = zincDir, log = log diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c23ec1d38..9c20d1657 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -13,9 +13,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.0.0-M12" - private val utilVersion = "1.0.0-M27" + private val utilVersion = "1.0.0-M28" private val lmVersion = "1.0.0-X18" - private val zincVersion = "1.0.0-X19" + private val zincVersion = "1.0.0-X20" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion