From 2c64c0c9b59778526ffe2f303f0e44d4370665a3 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Mon, 27 Aug 2018 19:16:15 +0900 Subject: [PATCH 01/28] Add scalaCompilerBridgeBinaryJar task The end goal is to rewrite Dotty's compiler-bridge in Java (this is easy since the zinc-specific phases are in the compiler itself) to simplify the bootstrapping process. --- main/src/main/scala/sbt/Defaults.scala | 35 +++++++++++------- main/src/main/scala/sbt/Keys.scala | 3 +- .../scala/sbt/internal/ConsoleProject.scala | 36 ++++++++++++------- .../compiler-bridge-binary/A.scala | 1 + .../compiler-bridge-binary/build.sbt | 16 +++++++++ .../compiler-bridge-binary/test | 1 + 6 files changed, 67 insertions(+), 25 deletions(-) create mode 100644 sbt/src/sbt-test/dependency-management/compiler-bridge-binary/A.scala create mode 100644 sbt/src/sbt-test/dependency-management/compiler-bridge-binary/build.sbt create mode 100644 sbt/src/sbt-test/dependency-management/compiler-bridge-binary/test diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index b00579121..dfa6b499e 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -450,7 +450,8 @@ object Defaults extends BuildCommon { val _ = clean.value IvyActions.cleanCachedResolutionCache(ivyModule.value, streams.value.log) }, - scalaCompilerBridgeSource := ZincUtil.getDefaultBridgeModule(scalaVersion.value) + scalaCompilerBridgeBinaryJar := None, + scalaCompilerBridgeSource := ZincUtil.getDefaultBridgeModule(scalaVersion.value), ) // must be a val: duplication detected by object identity private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults( @@ -503,17 +504,27 @@ object Defaults extends BuildCommon { val zincDir = BuildPaths.getZincDirectory(st, g) val app = appConfiguration.value val launcher = app.provider.scalaProvider.launcher - val scalac = ZincUtil.scalaCompiler( - scalaInstance = scalaInstance.value, - classpathOptions = classpathOptions.value, - globalLock = launcher.globalLock, - componentProvider = app.provider.components, - secondaryCacheDir = Option(zincDir), - dependencyResolution = dependencyResolution.value, - compilerBridgeSource = scalaCompilerBridgeSource.value, - scalaJarsTarget = zincDir, - log = streams.value.log - ) + val scalac = + scalaCompilerBridgeBinaryJar.value match { + case Some(jar) => + ZincUtil.scalaCompiler( + scalaInstance = scalaInstance.value, + classpathOptions = classpathOptions.value, + compilerBridgeJar = jar + ) + case _ => + ZincUtil.scalaCompiler( + scalaInstance = scalaInstance.value, + classpathOptions = classpathOptions.value, + globalLock = launcher.globalLock, + componentProvider = app.provider.components, + secondaryCacheDir = Option(zincDir), + dependencyResolution = dependencyResolution.value, + compilerBridgeSource = scalaCompilerBridgeSource.value, + scalaJarsTarget = zincDir, + log = streams.value.log + ) + } val compilers = ZincUtil.compilers( instance = scalaInstance.value, classpathOptions = classpathOptions.value, diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 10dfa7361..7abd4e9fc 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -220,7 +220,8 @@ object Keys { val crossSbtVersions = settingKey[Seq[String]]("The versions of Sbt used when cross-building an sbt plugin.") val printWarnings = taskKey[Unit]("Shows warnings from compilation, including ones that weren't printed initially.").withRank(BPlusTask) val fileInputOptions = settingKey[Seq[String]]("Options that take file input, which may invalidate the cache.").withRank(CSetting) - val scalaCompilerBridgeSource = settingKey[ModuleID]("Configures the module ID of the sources of the compiler bridge.").withRank(CSetting) + val scalaCompilerBridgeBinaryJar = taskKey[Option[File]]("Optionally, the jar of the compiler bridge. When not None, this takes precedence over scalaCompilerBridgeSource").withRank(CSetting) + val scalaCompilerBridgeSource = settingKey[ModuleID]("Configures the module ID of the sources of the compiler bridge when scalaCompilerBridgeBinaryJar is None").withRank(CSetting) val scalaArtifacts = settingKey[Seq[String]]("Configures the list of artifacts which should match the Scala binary version").withRank(CSetting) val enableBinaryCompileAnalysis = settingKey[Boolean]("Writes the analysis file in binary format") val crossJavaVersions = settingKey[Seq[String]]("The java versions used during JDK cross testing").withRank(BPlusSetting) diff --git a/main/src/main/scala/sbt/internal/ConsoleProject.scala b/main/src/main/scala/sbt/internal/ConsoleProject.scala index bb1279d8f..61f1362bf 100644 --- a/main/src/main/scala/sbt/internal/ConsoleProject.scala +++ b/main/src/main/scala/sbt/internal/ConsoleProject.scala @@ -21,7 +21,10 @@ object ConsoleProject { val cpImports = new Imports(extracted, state) val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil val unit = extracted.currentUnit - val (_, dependencyResolution) = extracted.runTask(Keys.dependencyResolution, state) + val (state1, dependencyResolution) = + extracted.runTask(Keys.dependencyResolution, state) + val (_, scalaCompilerBridgeBinaryJar) = + extracted.runTask(Keys.scalaCompilerBridgeBinaryJar, state1) val scalaInstance = { val scalaProvider = state.configuration.provider.scalaProvider ScalaInstance(scalaProvider.version, scalaProvider.launcher) @@ -30,17 +33,26 @@ object ConsoleProject { val zincDir = BuildPaths.getZincDirectory(state, g) val app = state.configuration val launcher = app.provider.scalaProvider.launcher - val compiler = ZincUtil.scalaCompiler( - scalaInstance = scalaInstance, - classpathOptions = ClasspathOptionsUtil.repl, - globalLock = launcher.globalLock, - componentProvider = app.provider.components, - secondaryCacheDir = Option(zincDir), - dependencyResolution = dependencyResolution, - compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), - scalaJarsTarget = zincDir, - log = log - ) + val compiler = scalaCompilerBridgeBinaryJar match { + case Some(jar) => + ZincUtil.scalaCompiler( + scalaInstance = scalaInstance, + classpathOptions = ClasspathOptionsUtil.repl, + compilerBridgeJar = jar + ) + case None => + ZincUtil.scalaCompiler( + scalaInstance = scalaInstance, + classpathOptions = ClasspathOptionsUtil.repl, + globalLock = launcher.globalLock, + componentProvider = app.provider.components, + secondaryCacheDir = Option(zincDir), + dependencyResolution = dependencyResolution, + compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), + scalaJarsTarget = zincDir, + log = log + ) + } val imports = BuildUtil.getImports(unit.unit) ++ BuildUtil.importAll(bindings.map(_._1)) val importString = imports.mkString("", ";\n", ";\n\n") val initCommands = importString + extra diff --git a/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/A.scala b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/A.scala new file mode 100644 index 000000000..69c493db2 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/A.scala @@ -0,0 +1 @@ +object A diff --git a/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/build.sbt b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/build.sbt new file mode 100644 index 000000000..a3b3bf1f4 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/build.sbt @@ -0,0 +1,16 @@ +scalaVersion := "2.12.6" + +// We can't use "%%" here without breaking the "== bridgeModule" check below +val bridgeModule = "org.scala-sbt" % s"compiler-bridge_2.12" % "1.2.1" + +libraryDependencies += bridgeModule % Configurations.ScalaTool + +scalaCompilerBridgeSource := "shouldnotbeused" % "dummy" % "dummy" + +scalaCompilerBridgeBinaryJar := { + for { + toolReport <- update.value.configuration(Configurations.ScalaTool) + m <- toolReport.modules.find(m => m.module == bridgeModule) + (_, file) <- m.artifacts.find(art => art._1.`type` == Artifact.DefaultType) + } yield file +} diff --git a/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/test b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/test new file mode 100644 index 000000000..5df2af1f3 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/compiler-bridge-binary/test @@ -0,0 +1 @@ +> compile From a7b04329bd08117d1d95508be0ab803d6accd1c5 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 5 Sep 2018 18:29:13 +0200 Subject: [PATCH 02/28] Fix second part of #4091: server responses should not be broadcasted Change CommandExchange#publishEvent to not broadcast ExecStatusEvent and instead check the channelName, this matches what was already done in CommandExchange#publishEventMessage --- .../scala/sbt/internal/CommandExchange.scala | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/main/src/main/scala/sbt/internal/CommandExchange.scala b/main/src/main/scala/sbt/internal/CommandExchange.scala index 9474a83b6..be989e5e2 100644 --- a/main/src/main/scala/sbt/internal/CommandExchange.scala +++ b/main/src/main/scala/sbt/internal/CommandExchange.scala @@ -195,6 +195,10 @@ private[sbt] final class CommandExchange { } } + private def tryTo(x: => Unit, c: CommandChannel, toDel: ListBuffer[CommandChannel]): Unit = + try x + catch { case _: IOException => toDel += c } + def publishEvent[A: JsonFormat](event: A): Unit = { val broadcastStringMessage = true val toDel: ListBuffer[CommandChannel] = ListBuffer.empty @@ -207,21 +211,31 @@ private[sbt] final class CommandExchange { if (broadcastStringMessage || (entry.channelName forall (_ == c.name))) c.publishEvent(event) case c: NetworkChannel => - try { - // Note that language server's LogMessageParams does not hold the execid, - // so this is weaker than the StringMessage. We might want to double-send - // in case we have a better client that can utilize the knowledge. - import sbt.internal.langserver.codec.JsonProtocol._ - if (broadcastStringMessage || (entry.channelName contains c.name)) - c.jsonRpcNotify("window/logMessage", params) - } catch { case _: IOException => toDel += c } + tryTo( + { + // Note that language server's LogMessageParams does not hold the execid, + // so this is weaker than the StringMessage. We might want to double-send + // in case we have a better client that can utilize the knowledge. + import sbt.internal.langserver.codec.JsonProtocol._ + if (broadcastStringMessage || (entry.channelName contains c.name)) + c.jsonRpcNotify("window/logMessage", params) + }, + c, + toDel + ) + } + case entry: ExecStatusEvent => + channels collect { + case c: ConsoleChannel => + if (entry.channelName forall (_ == c.name)) c.publishEvent(event) + case c: NetworkChannel => + if (entry.channelName contains c.name) tryTo(c.publishEvent(event), c, toDel) } case _ => channels foreach { case c: ConsoleChannel => c.publishEvent(event) case c: NetworkChannel => - try c.publishEvent(event) - catch { case _: IOException => toDel += c } + tryTo(c.publishEvent(event), c, toDel) } } toDel.toList match { @@ -280,10 +294,6 @@ private[sbt] final class CommandExchange { def publishEventMessage(event: EventMessage): Unit = { val toDel: ListBuffer[CommandChannel] = ListBuffer.empty - def tryTo(x: => Unit, c: CommandChannel): Unit = - try x - catch { case _: IOException => toDel += c } - event match { // Special treatment for ConsolePromptEvent since it's hand coded without codec. case entry: ConsolePromptEvent => @@ -299,12 +309,12 @@ private[sbt] final class CommandExchange { case c: ConsoleChannel => if (entry.channelName forall (_ == c.name)) c.publishEventMessage(event) case c: NetworkChannel => - if (entry.channelName contains c.name) tryTo(c.publishEventMessage(event), c) + if (entry.channelName contains c.name) tryTo(c.publishEventMessage(event), c, toDel) } case _ => channels collect { case c: ConsoleChannel => c.publishEventMessage(event) - case c: NetworkChannel => tryTo(c.publishEventMessage(event), c) + case c: NetworkChannel => tryTo(c.publishEventMessage(event), c, toDel) } } From b472d5d2b63394b9ee8449279353ca95ee63b972 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 13 Sep 2018 14:26:16 -0400 Subject: [PATCH 03/28] Bump modules --- project/Dependencies.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 936f975c3..195344883 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,9 +9,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.1" - private val utilVersion = "1.2.0" - private val lmVersion = "1.2.0" - private val zincVersion = "1.2.1" + private val utilVersion = "1.2.2" + private val lmVersion = "1.2.1" + private val zincVersion = "1.2.2" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From 48418408b3b03e176a4674763696753f070f29b0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 14 Sep 2018 00:02:02 -0400 Subject: [PATCH 04/28] Follow up on Position extension https://github.com/sbt/util/pull/173 added the ability to carry range position. This exposes it to the sbt server. --- .../internal/server/LanguageServerReporter.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala b/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala index 28551be7c..644e01024 100644 --- a/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala +++ b/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala @@ -111,8 +111,19 @@ class LanguageServerReporter( } yield { val line = line0.toLong - 1L val pointer = pointer0.toLong + val r = ( + pos.startLine.toOption, + pos.startColumn.toOption, + pos.endLine.toOption, + pos.endColumn.toOption + ) match { + case (Some(sl), Some(sc), Some(el), Some(ec)) => + Range(Position(sl.toLong - 1, sc.toLong), Position(el.toLong - 1, ec.toLong)) + case _ => + Range(Position(line, pointer), Position(line, pointer + 1)) + } Diagnostic( - Range(start = Position(line, pointer), end = Position(line, pointer + 1)), + r, Option(toDiagnosticSeverity(problem.severity)), None, Option("sbt"), From 4e00a3e9f03aa93b285dc71a35faa0000949cdd9 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 27 Sep 2018 12:38:39 -0400 Subject: [PATCH 05/28] Scala 2.12.7 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 195344883..5faec1605 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,7 +4,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too - val scala212 = "2.12.6" + val scala212 = "2.12.7" val baseScalaVersion = scala212 // sbt modules From cd7a5c6f6b9bbdcb51e8eb4a25659bb9c7218158 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 27 Sep 2018 12:41:47 -0400 Subject: [PATCH 06/28] Use linesIterator for JDK 11 compat --- .../src/main/scala/sbt/InputTask.scala | 4 ++-- .../sbt/internal/LibraryManagement.scala | 2 +- .../sbt/internal/parser/SbtRefactorings.scala | 2 +- .../sbt/internal/parser/EmbeddedXmlSpec.scala | 2 +- .../scala/sbt/internal/parser/ErrorSpec.scala | 19 ++++++++++--------- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/main-settings/src/main/scala/sbt/InputTask.scala b/main-settings/src/main/scala/sbt/InputTask.scala index c10315d0c..a21f4edbe 100644 --- a/main-settings/src/main/scala/sbt/InputTask.scala +++ b/main-settings/src/main/scala/sbt/InputTask.scala @@ -27,7 +27,7 @@ final class InputTask[T] private (val parser: State => Parser[Task[T]]) { Parser.parse(in, parser(s)) match { case Right(v) => Parser.success(v) case Left(msg) => - val indented = msg.lines.map(" " + _).mkString("\n") + val indented = msg.linesIterator.map(" " + _).mkString("\n") Parser.failure(s"Invalid programmatic input:\n$indented") } ) @@ -47,7 +47,7 @@ object InputTask { Parser.parse(in, it.parser(s)) match { case Right(t) => Def.value(t) case Left(msg) => - val indented = msg.lines.map(" " + _).mkString("\n") + val indented = msg.linesIterator.map(" " + _).mkString("\n") sys.error(s"Invalid programmatic input:\n$indented") } ) diff --git a/main/src/main/scala/sbt/internal/LibraryManagement.scala b/main/src/main/scala/sbt/internal/LibraryManagement.scala index 28a40c5c7..cc94e9cb6 100644 --- a/main/src/main/scala/sbt/internal/LibraryManagement.scala +++ b/main/src/main/scala/sbt/internal/LibraryManagement.scala @@ -99,7 +99,7 @@ private[sbt] object LibraryManagement { val culprit = t.getClass.getSimpleName log.warn(s"Update task caching failed due to $culprit.") log.warn("Report the following output to sbt:") - resolvedAgain.toString.lines.foreach(log.warn(_)) + resolvedAgain.toString.linesIterator.foreach(log.warn(_)) log.trace(t) resolvedAgain } diff --git a/main/src/main/scala/sbt/internal/parser/SbtRefactorings.scala b/main/src/main/scala/sbt/internal/parser/SbtRefactorings.scala index a82eb971e..628688f55 100644 --- a/main/src/main/scala/sbt/internal/parser/SbtRefactorings.scala +++ b/main/src/main/scala/sbt/internal/parser/SbtRefactorings.scala @@ -36,7 +36,7 @@ private[sbt] object SbtRefactorings { val sortedRecordedCommands = recordedCommands.sortBy(_._1)(reverseOrderingInt) val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands) - (file, newContent.lines.toList) + (file, newContent.linesIterator.toList) } private def replaceFromBottomToTop( diff --git a/main/src/test/scala/sbt/internal/parser/EmbeddedXmlSpec.scala b/main/src/test/scala/sbt/internal/parser/EmbeddedXmlSpec.scala index bc2c78d38..523d7d6bd 100644 --- a/main/src/test/scala/sbt/internal/parser/EmbeddedXmlSpec.scala +++ b/main/src/test/scala/sbt/internal/parser/EmbeddedXmlSpec.scala @@ -38,7 +38,7 @@ class EmbeddedXmlSpec extends CheckIfParsedSpec { split(buildSbt) must throwA[MessageOnlyException].like { case exception => - val index = buildSbt.lines.indexWhere(line => line.contains(errorLine)) + 1 + val index = buildSbt.linesIterator.indexWhere(line => line.contains(errorLine)) + 1 val numberRegex = """(\d+)""".r val message = exception.getMessage val list = numberRegex.findAllIn(message).toList diff --git a/main/src/test/scala/sbt/internal/parser/ErrorSpec.scala b/main/src/test/scala/sbt/internal/parser/ErrorSpec.scala index 77641efcc..9e56d471a 100644 --- a/main/src/test/scala/sbt/internal/parser/ErrorSpec.scala +++ b/main/src/test/scala/sbt/internal/parser/ErrorSpec.scala @@ -10,9 +10,7 @@ package internal package parser import java.io.File - import sbt.internal.util.MessageOnlyException - import scala.io.Source class ErrorSpec extends AbstractSpec { @@ -26,12 +24,13 @@ class ErrorSpec extends AbstractSpec { foreach(new File(rootPath).listFiles) { file => print(s"Processing ${file.getName}: ") val buildSbt = Source.fromFile(file).getLines().mkString("\n") - SbtParser(file, buildSbt.lines.toSeq) must throwA[MessageOnlyException].like { - case exp => - val message = exp.getMessage - println(s"${exp.getMessage}") - message must contain(file.getName) - } + SbtParser(file, buildSbt.linesIterator.toSeq) must throwA[MessageOnlyException] + .like { + case exp => + val message = exp.getMessage + println(s"${exp.getMessage}") + message must contain(file.getName) + } containsLineNumber(buildSbt) } } @@ -60,7 +59,9 @@ class ErrorSpec extends AbstractSpec { |val a = |val s = ' """.stripMargin - SbtParser(SbtParser.FAKE_FILE, buildSbt.lines.toSeq) must throwA[MessageOnlyException].like { + SbtParser(SbtParser.FAKE_FILE, buildSbt.linesIterator.toSeq) must throwA[ + MessageOnlyException + ].like { case exp => val message = exp.getMessage println(s"${exp.getMessage}") From 3ea7533d4f0c20374021397308697dd67d5ba32f Mon Sep 17 00:00:00 2001 From: Ignasi Marimon-Clos Date: Tue, 4 Sep 2018 18:15:30 +0200 Subject: [PATCH 07/28] Duplicate reports for backwards-compat adding a name-compliant copy --- testing/src/main/scala/sbt/JUnitXmlTestsListener.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala index a59e44ee7..41ab2c5a7 100644 --- a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala +++ b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala @@ -226,9 +226,11 @@ class JUnitXmlTestsListener(val outputDir: String, logger: Logger) extends Tests d.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) private def writeSuite() = { - val file = new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val legacyFile = new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val file = new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath // TODO would be nice to have a logger and log this with level debug // System.err.println("Writing JUnit XML test report: " + file) + XML.save(legacyFile, withTestSuite(_.stop()), "UTF-8", true, null) XML.save(file, withTestSuite(_.stop()), "UTF-8", true, null) testSuite.remove() } From 48726a0d6041ff62aca426d2c4f81e14cfdeab6b Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 5 Oct 2018 02:25:21 -0400 Subject: [PATCH 08/28] Formatting --- testing/src/main/scala/sbt/JUnitXmlTestsListener.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala index 41ab2c5a7..731ab2211 100644 --- a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala +++ b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala @@ -226,8 +226,10 @@ class JUnitXmlTestsListener(val outputDir: String, logger: Logger) extends Tests d.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) private def writeSuite() = { - val legacyFile = new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath - val file = new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val legacyFile = + new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val file = + new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath // TODO would be nice to have a logger and log this with level debug // System.err.println("Writing JUnit XML test report: " + file) XML.save(legacyFile, withTestSuite(_.stop()), "UTF-8", true, null) From 1f0680efbf560bd1ae05d46cd519729701ba3d4a Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 5 Oct 2018 02:25:36 -0400 Subject: [PATCH 09/28] Bump modules --- project/Dependencies.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 5faec1605..91ab0bde8 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,10 +8,10 @@ object Dependencies { val baseScalaVersion = scala212 // sbt modules - private val ioVersion = "1.2.1" + private val ioVersion = "1.2.2" private val utilVersion = "1.2.2" private val lmVersion = "1.2.1" - private val zincVersion = "1.2.2" + private val zincVersion = "1.2.3" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From ce9aa0c920958d6d9bd8b936f083cda5f89bc459 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 5 Oct 2018 13:32:40 -0400 Subject: [PATCH 10/28] check PluginCross.scala consisntency --- build.sbt | 6 ++++++ main/src/main/scala/sbt/PluginCross.scala | 2 +- project/Dependencies.scala | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9570bd29b..55cf3ccfe 100644 --- a/build.sbt +++ b/build.sbt @@ -545,6 +545,12 @@ lazy val mainProj = (project in file("main")) .settings( testedBaseSettings, name := "Main", + checkPluginCross := { + val sv = scalaVersion.value + val xs = IO.readLines(baseDirectory.value / "src" / "main" / "scala" / "sbt" / "PluginCross.scala") + if (xs exists { s => s.contains(s""""$sv"""") }) () + else sys.error("PluginCross.scala does not match up with the scalaVersion " + sv) + }, libraryDependencies ++= scalaXml.value ++ Seq(launcherInterface) ++ log4jDependencies ++ Seq(scalaCacheCaffeine), managedSourceDirectories in Compile += baseDirectory.value / "src" / "main" / "contraband-scala", diff --git a/main/src/main/scala/sbt/PluginCross.scala b/main/src/main/scala/sbt/PluginCross.scala index fca253cc1..ef6ca4a44 100644 --- a/main/src/main/scala/sbt/PluginCross.scala +++ b/main/src/main/scala/sbt/PluginCross.scala @@ -96,7 +96,7 @@ private[sbt] object PluginCross { VersionNumber(sv) match { case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2" case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7" - case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.6" + case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.7" case _ => sys.error(s"Unsupported sbt binary version: $sv") } } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 91ab0bde8..4c2873c55 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,6 +5,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too val scala212 = "2.12.7" + lazy val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val baseScalaVersion = scala212 // sbt modules From 4c6e421d591c726594c62ac60da09715daf17e22 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 5 Oct 2018 03:04:22 -0400 Subject: [PATCH 11/28] add onLoadMessage --- build.sbt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.sbt b/build.sbt index 55cf3ccfe..765505308 100644 --- a/build.sbt +++ b/build.sbt @@ -107,6 +107,20 @@ lazy val sbtRoot: Project = (project in file(".")) .settings( buildLevelSettings, minimalSettings, + onLoadMessage := { + """ __ __ + | _____/ /_ / /_ + | / ___/ __ \/ __/ + | (__ ) /_/ / /_ + | /____/_.___/\__/ + |Welcome to the build for sbt. + |""".stripMargin + + (if (sys.props("java.specification.version") != "1.8") + s"""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + | Java versions is ${sys.props("java.specification.version")}. We recommend 1.8. + |!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""".stripMargin + else "") + }, Util.baseScalacOptions, Docs.settings, Sxr.settings, From ed765036296f0748a5718b3b79fba5b46315b74d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 24 Aug 2018 06:25:40 -0400 Subject: [PATCH 12/28] Fix single repo emulation script Fixes #4330 Ref https://github.com/sbt/zinc/commit/5b179a2611c48ac928239d1ec003b536e5c5e02a#diff-fdc3abdfd754eeb24090dbd90aeec2ce --- project/Dependencies.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 4c2873c55..38a7507a2 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -82,13 +82,13 @@ object Dependencies { def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy) def addSbtCompilerInterface(p: Project): Project = - addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface) + addSbtModule(p, sbtZincPath, "compilerInterface212", compilerInterface) def addSbtCompilerClasspath(p: Project): Project = - addSbtModule(p, sbtZincPath, "zincClasspath", compilerClasspath) + addSbtModule(p, sbtZincPath, "zincClasspath212", compilerClasspath) def addSbtCompilerApiInfo(p: Project): Project = - addSbtModule(p, sbtZincPath, "zincApiInfo", compilerApiInfo) + addSbtModule(p, sbtZincPath, "zincApiInfo212", compilerApiInfo) def addSbtCompilerBridge(p: Project): Project = - addSbtModule(p, sbtZincPath, "compilerBridge", compilerBridge) + addSbtModule(p, sbtZincPath, "compilerBridge212", compilerBridge) def addSbtCompilerIvyIntegration(p: Project): Project = addSbtModule(p, sbtZincPath, "zincIvyIntegration", compilerIvyIntegration) def addSbtZinc(p: Project): Project = addSbtModule(p, sbtZincPath, "zinc", zinc) From 608c6fb990185b3b08411766fcff54dca3f37480 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 15 Oct 2018 03:26:39 -0400 Subject: [PATCH 13/28] Set withMetadataDirectory by default This partly fixes cached resolution. Ref https://github.com/sbt/sbt/issues/3761 --- main/src/main/scala/sbt/Defaults.scala | 58 ++++++++++++++------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index dfa6b499e..0b4b26b86 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -2168,7 +2168,10 @@ object Classpaths { val is = ivySbt.value val lm = new DependencyResolution(new IvyDependencyResolution(is)) val mod = (classifiersModule in updateClassifiers).value - val c = updateConfiguration.value + val updateConfig0 = updateConfiguration.value + val updateConfig = updateConfig0 + .withMetadataDirectory(dependencyCacheDirectory.value) + .withArtifactFilter(updateConfig0.artifactFilter.map(af => af.withInverted(!af.inverted))) val app = appConfiguration.value val srcTypes = sourceArtifactTypes.value val docTypes = docArtifactTypes.value @@ -2179,7 +2182,7 @@ object Classpaths { GetClassifiersConfiguration( mod, excludes.toVector, - c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), + updateConfig, // scalaModule, srcTypes.toVector, docTypes.toVector @@ -2333,35 +2336,36 @@ object Classpaths { val s = streams.value val is = ivySbt.value val mod = classifiersModule.value - val c = updateConfiguration.value + val updateConfig0 = updateConfiguration.value + val updateConfig = updateConfig0 + .withMetadataDirectory(dependencyCacheDirectory.value) + .withArtifactFilter( + updateConfig0.artifactFilter.map(af => af.withInverted(!af.inverted)) + ) val app = appConfiguration.value val srcTypes = sourceArtifactTypes.value val docTypes = docArtifactTypes.value val log = s.log val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir) val uwConfig = (unresolvedWarningConfiguration in update).value - 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)) - LibraryManagement.transitiveScratch( - lm, - "sbt", - GetClassifiersConfiguration( - mod, - excludes.toVector, - c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), - srcTypes.toVector, - docTypes.toVector - ), - uwConfig, - log - ) match { - case Left(_) => ??? - 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, + updateConfig, + srcTypes.toVector, + docTypes.toVector + ), + uwConfig, + log + ) match { + case Left(_) => ??? + case Right(ur) => ur + } } } tag (Tags.Update, Tags.Network)).value ) @@ -2515,7 +2519,9 @@ object Classpaths { } // logical clock is folded into UpdateConfiguration - conf1.withLogicalClock(LogicalClock(state0.hashCode)) + conf1 + .withLogicalClock(LogicalClock(state0.hashCode)) + .withMetadataDirectory(dependencyCacheDirectory.value) } val evictionOptions = Def.taskDyn { From ede82b4709156ffa15366c79055cb3ae088aabf5 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 15 Oct 2018 11:24:44 -0400 Subject: [PATCH 14/28] Adjust the tests --- sbt/src/sbt-test/dependency-management/cache-update/build.sbt | 4 +++- .../cached-resolution-conflicts/multi.sbt | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 b0f3eec0b..db7eead25 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt @@ -38,7 +38,9 @@ lazy val root = (project in file(".")) val moduleSettings0 = module.moduleSettings val inline0 = moduleSettings0 match { case x: InlineConfiguration => x } // Remove clock for caching purpose - val updateConfig0 = updateConfig.withLogicalClock(LogicalClock.unknown) + val updateConfig0 = updateConfig + .withLogicalClock(LogicalClock.unknown) + .withMetadataDirectory(dependencyCacheDirectory.value) import sbt.librarymanagement.{ ModuleSettings, UpdateConfiguration, LibraryManagementCodec } type In = (Long, ModuleSettings, UpdateConfiguration) diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt index 61a573e18..44b759549 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt @@ -43,8 +43,8 @@ TaskKey[Unit]("check") := { val x1cp = (externalDependencyClasspath in Compile in x1).value.map(_.data.getName).sorted def x1cpStr = x1cp.mkString("\n* ", "\n* ", "") - if (!(x1cp contains "slf4j-api-1.6.6.jar")) - sys.error(s"slf4j-api-1.6.6.jar is not found on X1:$x1cpStr") + // if (!(x1cp contains "slf4j-api-1.6.6.jar")) + // sys.error(s"slf4j-api-1.6.6.jar is not found on X1:$x1cpStr") if (x1cp contains "servlet-api-2.3.jar") sys.error(s"servlet-api-2.3.jar is found when it should be evicted:$x1cpStr") From 4e6352179b93e3d40fc2b5e3922fb70daf5f9b53 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 15 Oct 2018 12:46:40 -0400 Subject: [PATCH 15/28] lm 1.2.2 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 38a7507a2..375461c05 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,7 +11,7 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.2" private val utilVersion = "1.2.2" - private val lmVersion = "1.2.1" + private val lmVersion = "1.2.2" private val zincVersion = "1.2.3" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From 137c746ac0e1145627504762e8613928fefbb557 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 15 Oct 2018 12:48:47 -0400 Subject: [PATCH 16/28] util 1.2.3, zinc 1.2.4 --- project/Dependencies.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 375461c05..a604741d0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,9 +10,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.2" - private val utilVersion = "1.2.2" + private val utilVersion = "1.2.3" private val lmVersion = "1.2.2" - private val zincVersion = "1.2.3" + private val zincVersion = "1.2.4" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From fd2ec7adc372bb89dbc40dcebcd69e0370d50adb Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sat, 10 Nov 2018 17:21:59 -0800 Subject: [PATCH 17/28] Fix '~' for dependent projects with a broken parent In #4446, @japgolly reported that in some projects, if a parent project was broken, then '~' would immediately exit upon startup. I tracked it down to this managed sources filter. The idea of this filter is to avoid getting stuck in a build loop if managedSources writes into an unmanaged source directory. If the (managedSources in ThisScope).value line failed, however, it would cause the watchSources, and by delegation, watchTransitiveSources task to fail. The fix is to only create this filter if the managedSources task succeeds. I'm not 100% sure if we shouldn't just get rid of this filter entirely and just document that '~' will probably loop if a build writes the result of managedSources into an unmanaged source directory. --- .travis.yml | 2 +- main/src/main/scala/sbt/Defaults.scala | 21 ++++++++++++------- .../sbt-test/watch/watch-sources/build.sbt | 3 +++ .../watch/watch-sources/changes/Foo.scala | 1 + .../child/src/main/scala/Bar.scala | 1 + .../parent/src/main/scala/Foo.scala | 1 + .../watch/watch-sources/project/plugin.sbt | 1 + sbt/src/sbt-test/watch/watch-sources/test | 9 ++++++++ 8 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 sbt/src/sbt-test/watch/watch-sources/build.sbt create mode 100644 sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala create mode 100644 sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala create mode 100644 sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala create mode 100644 sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt create mode 100644 sbt/src/sbt-test/watch/watch-sources/test diff --git a/.travis.yml b/.travis.yml index d17c5e546..1db7df73b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ env: - SBT_CMD="scripted source-dependencies/*1of3" - SBT_CMD="scripted source-dependencies/*2of3" - SBT_CMD="scripted source-dependencies/*3of3" - - SBT_CMD="scripted tests/*" + - SBT_CMD="scripted tests/* watch/*" - SBT_CMD="repoOverrideTest:scripted dependency-management/*" notifications: diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 0b4b26b86..f4663c5ab 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -361,14 +361,19 @@ object Defaults extends BuildCommon { val include = (includeFilter in unmanagedSources).value val exclude = (excludeFilter in unmanagedSources).value match { case e => - (managedSources in ThisScope).value match { - case l if l.nonEmpty => - e || new FileFilter { - private val files = l.toSet - override def accept(pathname: File): Boolean = files.contains(pathname) - override def toString = s"ManagedSourcesFilter($files)" - } - case _ => e + val s = state.value + try { + Project.extract(s).runTask(managedSources in Compile in ThisScope, s) match { + case (_, l) if l.nonEmpty => + e || new FileFilter { + private val files = l.toSet + override def accept(pathname: File): Boolean = files.contains(pathname) + override def toString = s"ManagedSourcesFilter($files)" + } + case _ => e + } + } catch { + case NonFatal(_) => e } } val baseSources = diff --git a/sbt/src/sbt-test/watch/watch-sources/build.sbt b/sbt/src/sbt-test/watch/watch-sources/build.sbt new file mode 100644 index 000000000..16a193e6f --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/build.sbt @@ -0,0 +1,3 @@ +lazy val root = (project in file(".")).aggregate(parent, child) +lazy val parent = project +lazy val child = project.enablePlugins(JmhPlugin).dependsOn(parent) diff --git a/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala b/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala new file mode 100644 index 000000000..c389887ee --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala @@ -0,0 +1 @@ +class Foo diff --git a/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala b/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala new file mode 100644 index 000000000..f6673f853 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala @@ -0,0 +1 @@ +class Bar diff --git a/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala b/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala new file mode 100644 index 000000000..970bfef8a --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala @@ -0,0 +1 @@ +class Foo { diff --git a/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt b/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt new file mode 100644 index 000000000..a12e17f90 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt @@ -0,0 +1 @@ +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4") diff --git a/sbt/src/sbt-test/watch/watch-sources/test b/sbt/src/sbt-test/watch/watch-sources/test new file mode 100644 index 000000000..50a9e2b19 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/test @@ -0,0 +1,9 @@ +> watchTransitiveSources + +-> compile + +$ copy-file changes/Foo.scala parent/src/main/scala/Foo.scala + +> watchTransitiveSources + +> compile From 5f562aa7a81b6d49428d7aea0bdad3fd90ea0232 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 22 Nov 2018 15:48:51 +0000 Subject: [PATCH 18/28] Ignore files in scripted group dirs Scripted tests, in src/sbt-test// blow up if is a plain file. Filter them out. --- .../src/main/scala/sbt/scriptedtest/ScriptedTests.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala index 85cf73764..5435364e8 100644 --- a/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala +++ b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala @@ -53,7 +53,11 @@ final class ScriptedTests( ): Seq[TestRunner] = { // Test group and names may be file filters (like '*') - for (groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get) yield { + for { + groupDir <- (resourceBaseDirectory * group).get + nme <- (groupDir * name).get + if !(nme.isFile) + } yield { val g = groupDir.getName val n = nme.getName val label = s"$g / $n" @@ -110,7 +114,7 @@ final class ScriptedTests( type TestInfo = ((String, String), File) - val labelsAndDirs = groupAndNameDirs.map { + val labelsAndDirs = groupAndNameDirs.filterNot(_._2.isFile).map { case (groupDir, nameDir) => val groupName = groupDir.getName val testName = nameDir.getName From 5558ca5c702f92b1fc5b4133b1d133befc27d8d7 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Tue, 27 Nov 2018 18:25:32 -0500 Subject: [PATCH 19/28] drop notification override --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1db7df73b..40a1265d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,10 +44,6 @@ env: - SBT_CMD="scripted tests/* watch/*" - SBT_CMD="repoOverrideTest:scripted dependency-management/*" -notifications: - email: - - sbt-dev-bot@googlegroups.com - # Undo _JAVA_OPTIONS environment variable before_script: - unset _JAVA_OPTIONS From 94aa8591e62190e10cf7871db21ec184bd914cd3 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Wed, 28 Nov 2018 20:41:44 +0100 Subject: [PATCH 20/28] Bump log4j2 to 2.11.1 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index a604741d0..d1a6a6049 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -113,7 +113,7 @@ object Dependencies { val scalaXml = scala211Module("scala-xml", "1.0.6") val scalaParsers = scala211Module("scala-parser-combinators", "1.0.5") - def log4jVersion = "2.8.1" + def log4jVersion = "2.11.1" val log4jApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion val log4jCore = "org.apache.logging.log4j" % "log4j-core" % log4jVersion val log4jSlf4jImpl = "org.apache.logging.log4j" % "log4j-slf4j-impl" % log4jVersion From 9e4e16b7f09ae978518a9e5d1d53705e7e4b7c2c Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Wed, 28 Nov 2018 20:43:35 +0100 Subject: [PATCH 21/28] Bump scalatest to 3.0.6-SNAP5 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d1a6a6049..fcabd9292 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -100,7 +100,7 @@ object Dependencies { } val jline = "jline" % "jline" % "2.14.6" - val scalatest = "org.scalatest" %% "scalatest" % "3.0.4" + val scalatest = "org.scalatest" %% "scalatest" % "3.0.6-SNAP5" val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4" val specs2 = "org.specs2" %% "specs2-junit" % "4.0.1" val junit = "junit" % "junit" % "4.11" From 172a3c824716e6e545347b2648c85602c1bd955a Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 30 Nov 2018 08:35:00 -0500 Subject: [PATCH 22/28] bump util, lm, and zinc --- project/Dependencies.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index fcabd9292..befe0586c 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,9 +10,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.2" - private val utilVersion = "1.2.3" - private val lmVersion = "1.2.2" - private val zincVersion = "1.2.4" + private val utilVersion = "1.2.4" + private val lmVersion = "1.2.3" + private val zincVersion = "1.2.5" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From 76f0e2de6bbeb7e913185eb3a822424d19ce235a Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 30 Nov 2018 13:06:29 -0500 Subject: [PATCH 23/28] implement TestConsoleLogger This avoids the mixup of log4j versions. --- .../sbt/scriptedtest/ScriptedTests.scala | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala index 5435364e8..777b62ed0 100644 --- a/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala +++ b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala @@ -19,11 +19,11 @@ import scala.collection.parallel.ForkJoinTaskSupport import scala.util.control.NonFatal import sbt.internal.scripted._ import sbt.internal.io.Resources -import sbt.internal.util.{ BufferedLogger, ConsoleLogger, FullLogger } +import sbt.internal.util.{ BufferedLogger, FullLogger, ConsoleOut } import sbt.io.syntax._ import sbt.io.{ DirectoryFilter, HiddenFileFilter, IO } import sbt.io.FileFilter._ -import sbt.util.{ AbstractLogger, Logger } +import sbt.util.{ AbstractLogger, Level, Logger } final class ScriptedTests( resourceBaseDirectory: File, @@ -449,7 +449,7 @@ object ScriptedTests extends ScriptedRunner { // val buildScalaVersions = args(4) val bootProperties = new File(args(5)) val tests = args.drop(6) - val logger = ConsoleLogger() + val logger = TestConsoleLogger() run(directory, buffer, tests, logger, bootProperties, Array(), emptyCallback) } @@ -467,7 +467,7 @@ class ScriptedRunner { launchOpts: Array[String], prescripted: java.util.List[File], ): Unit = { - val logger = ConsoleLogger() + val logger = new TestConsoleLogger() val addTestFile = (f: File) => { prescripted.add(f); () } run(resourceBaseDirectory, bufferLog, tests, logger, bootProperties, launchOpts, addTestFile) //new FullLogger(Logger.xlog2Log(log))) @@ -481,7 +481,7 @@ class ScriptedRunner { bootProperties: File, launchOpts: Array[String], ): Unit = { - val logger = ConsoleLogger() + val logger = TestConsoleLogger() val prescripted = ScriptedTests.emptyCallback run(resourceBaseDirectory, bufferLog, tests, logger, bootProperties, launchOpts, prescripted) } @@ -529,7 +529,7 @@ class ScriptedRunner { prescripted: java.util.List[File], instances: Int ): Unit = { - val logger = ConsoleLogger() + val logger = TestConsoleLogger() val addTestFile = (f: File) => { prescripted.add(f); () } runInParallel(baseDir, bufferLog, tests, logger, bootProps, launchOpts, addTestFile, instances) } @@ -652,3 +652,32 @@ class PendingTestSuccessException(label: String) extends Exception { override def getMessage: String = s"The pending test $label succeeded. Mark this test as passing to remove this failure." } + +private[sbt] object TestConsoleLogger { + def apply() = new TestConsoleLogger() +} + +// Remove dependencies to log4j to avoid mixup. +private[sbt] class TestConsoleLogger extends AbstractLogger { + val out = ConsoleOut.systemOut + def trace(t: => Throwable): Unit = { + out.println(t.toString) + // out.flush() + } + def success(message: => String): Unit = { + out.println(message) + // out.flush() + } + def log(level: Level.Value, message: => String): Unit = { + out.println(s"[$level] $message") + // out.flush() + } + def control(event: sbt.util.ControlEvent.Value, message: => String): Unit = () + def getLevel: sbt.util.Level.Value = Level.Info + def getTrace: Int = Int.MaxValue + def logAll(events: Seq[sbt.util.LogEvent]): Unit = () + def setLevel(newLevel: sbt.util.Level.Value): Unit = () + def setSuccessEnabled(flag: Boolean): Unit = () + def setTrace(flag: Int): Unit = () + def successEnabled: Boolean = true +} From 3b63524c1001a769cba5f03020bef227f91b6aa7 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 30 Nov 2018 13:06:41 -0500 Subject: [PATCH 24/28] 1.2.7-SNAPSHOT --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 765505308..95fec0428 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,7 @@ def buildLevelSettings: Seq[Setting[_]] = inThisBuild( Seq( organization := "org.scala-sbt", - version := "1.2.1-SNAPSHOT", + version := "1.2.7-SNAPSHOT", description := "sbt is an interactive build tool", bintrayOrganization := Some("sbt"), bintrayRepository := { From 4c720bffc338943498fb43e68b824dbda85c66f9 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 28 Dec 2018 23:10:27 -0500 Subject: [PATCH 25/28] lm 1.2.4 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index befe0586c..3711b961d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,7 +11,7 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.2" private val utilVersion = "1.2.4" - private val lmVersion = "1.2.3" + private val lmVersion = "1.2.4" private val zincVersion = "1.2.5" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion From ffcf9cd08509f39d6c23bda09baeefc71bf678d9 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 13 Dec 2018 19:31:56 -0500 Subject: [PATCH 26/28] define whitesourceOnPush whitesourceOnPush calls whitesourceCheckPolicies and whitesourceUpdate on push. Since Travis CI secrets are not available during PR from a fork, there's no point in calling these during the PR validation. --- .travis.yml | 3 ++- build.sbt | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40a1265d1..81b40f20e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,9 +26,10 @@ matrix: env: global: + # WHITESOURCE_PASSWORD= - secure: d3bu2KNwsVHwfhbGgO+gmRfDKBJhfICdCJFGWKf2w3Gv86AJZX9nuTYRxz0KtdvEHO5Xw8WTBZLPb2thSJqhw9OCm4J8TBAVqCP0ruUj4+aqBUFy4bVexQ6WKE6nWHs4JPzPk8c6uC1LG3hMuzlC8RGETXtL/n81Ef1u7NjyXjs= matrix: - - SBT_CMD=";mimaReportBinaryIssues ;scalafmt::test ;test:scalafmt::test ;sbt:scalafmt::test ;headerCheck ;test:headerCheck ;whitesourceCheckPolicies ;test:compile ;mainSettingsProj/test ;safeUnitTests ;otherUnitTests; doc" + - SBT_CMD=";mimaReportBinaryIssues ;scalafmt::test ;test:scalafmt::test ;sbt:scalafmt::test ;headerCheck ;test:headerCheck ;whitesourceOnPush ;test:compile ;mainSettingsProj/test ;safeUnitTests ;otherUnitTests; doc" - SBT_CMD="scripted actions/*" - SBT_CMD="scripted apiinfo/* compiler-project/* ivy-deps-management/*" - SBT_CMD="scripted dependency-management/*1of4" diff --git a/build.sbt b/build.sbt index 95fec0428..14f28d9f1 100644 --- a/build.sbt +++ b/build.sbt @@ -796,6 +796,15 @@ def customCommands: Seq[Setting[_]] = Seq( otherUnitTests := { test.all(otherProjects).value }, + commands += Command.command("whitesourceOnPush") { state => + sys.env.get("TRAVIS_EVENT_TYPE") match { + case Some("push") => + "whitesourceCheckPolicies" :: + "whitesourceUpdate" :: + state + case _ => state + } + }, commands += Command.command("release-sbt-local") { state => "clean" :: "so compile" :: @@ -856,11 +865,23 @@ def customCommands: Seq[Setting[_]] = Seq( } ) -inThisBuild(Seq( - whitesourceProduct := "Lightbend Reactive Platform", - whitesourceAggregateProjectName := "sbt-master", - whitesourceAggregateProjectToken := "e7a1e55518c0489a98e9c7430c8b2ccd53d9f97c12ed46148b592ebe4c8bf128", - whitesourceIgnoredScopes ++= Seq("plugin", "scalafmt", "sxr"), - whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD"), // fail if pwd is present - whitesourceForceCheckAllDependencies := true, -)) +ThisBuild / whitesourceProduct := "Lightbend Reactive Platform" +ThisBuild / whitesourceAggregateProjectName := { + // note this can get detached on tag build etc + val b = (ThisBuild / git.gitCurrentBranch).value + val Stable = """1\.([0-9]+)\.x""".r + b match { + case Stable(y) => "sbt-1." + y.toString + "-stable" + case _ => "sbt-master" + } +} +ThisBuild / whitesourceAggregateProjectToken := { + (ThisBuild / whitesourceAggregateProjectName).value match { + case "sbt-master" => "e7a1e55518c0489a98e9c7430c8b2ccd53d9f97c12ed46148b592ebe4c8bf128" + case "sbt-1.2-stable" => "54f2313767aa47198971e65595670ee16e1ad0000d20458588e72d3ac2c34763" + case _ => "" // it's ok to fail here + } +} +ThisBuild / whitesourceIgnoredScopes ++= Seq("plugin", "scalafmt", "sxr") +ThisBuild / whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD") // fail if pwd is present +ThisBuild / whitesourceForceCheckAllDependencies := true From 0b103c57015d06e1cd3432d157741db881407de8 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Wed, 16 Jan 2019 22:26:22 +0100 Subject: [PATCH 27/28] Bump the 2.12 version to 2.12.8 in 1.2.x --- main/src/main/scala/sbt/PluginCross.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/PluginCross.scala b/main/src/main/scala/sbt/PluginCross.scala index ef6ca4a44..d84b5d251 100644 --- a/main/src/main/scala/sbt/PluginCross.scala +++ b/main/src/main/scala/sbt/PluginCross.scala @@ -96,7 +96,7 @@ private[sbt] object PluginCross { VersionNumber(sv) match { case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2" case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7" - case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.7" + case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.8" case _ => sys.error(s"Unsupported sbt binary version: $sv") } } From 6b3ec4e1d0e21c2f3ea49979b0c9f20d416fa92a Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Thu, 17 Jan 2019 11:21:52 +0100 Subject: [PATCH 28/28] More bumping up the 2.12 version to 2.12.8 in 1.2.x --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3711b961d..d91be8306 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,7 +4,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too - val scala212 = "2.12.7" + val scala212 = "2.12.8" lazy val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val baseScalaVersion = scala212