From 618ac5236a7e38da09dae36a395fd093d2e39715 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 19 Jun 2015 13:40:10 -0400 Subject: [PATCH 1/3] Bumping up Scala version to 2.10.5/2.11.6. Fixes #1980 To pass File => Unit callback across the classloader boundary I am encoding it as a java.util.List[File] by overriding method. This was needed since Java didn't allow me to cast from one classloader to the other. --- build.sbt | 4 +-- project/Dependencies.scala | 4 +-- project/Scripted.scala | 27 ++++++++++++++----- project/p.sbt | 2 ++ .../main/scala/sbt/test/ScriptedTests.scala | 23 +++++++++++----- 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index fb6db259f..fe699f27c 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,7 @@ def buildLevelSettings: Seq[Setting[_]] = Seq( ) def commonSettings: Seq[Setting[_]] = Seq( - scalaVersion := "2.10.4", + scalaVersion := scala210, publishArtifact in packageDoc := false, publishMavenStyle := false, componentID := None, @@ -387,7 +387,7 @@ lazy val scriptedBaseProj = (project in scriptedPath / "base"). ) lazy val scriptedSbtProj = (project in scriptedPath / "sbt"). - dependsOn (ioProj, logProj, processProj, scriptedBaseProj). + dependsOn (ioProj, logProj, processProj, scriptedBaseProj, interfaceProj). settings( baseSettings, name := "Scripted sbt", diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 079fb3a53..efb98ec27 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,8 +5,8 @@ object Dependencies { lazy val scala282 = "2.8.2" lazy val scala292 = "2.9.2" lazy val scala293 = "2.9.3" - lazy val scala210 = "2.10.4" - lazy val scala211 = "2.11.1" + lazy val scala210 = "2.10.5" + lazy val scala211 = "2.11.6" lazy val jline = "jline" % "jline" % "2.11" lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f" diff --git a/project/Scripted.scala b/project/Scripted.scala index 7bc462f6b..17a5459e1 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -57,15 +57,30 @@ object Scripted { (token(Space) ~> (PagedIds | testIdAsGroup)).* map (_.flatten) } + // Interface to cross class loader + type SbtScriptedRunner = { + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, + launchOpts: Array[String], prescripted: java.util.List[File]): Unit + } + def doScripted(launcher: File, scriptedSbtClasspath: Seq[Attributed[File]], scriptedSbtInstance: ScalaInstance, sourcePath: File, args: Seq[String], prescripted: File => Unit) { System.err.println(s"About to run tests: ${args.mkString("\n * ", "\n * ", "\n")}") val noJLine = new classpath.FilteredLoader(scriptedSbtInstance.loader, "jline." :: Nil) val loader = classpath.ClasspathUtilities.toLoader(scriptedSbtClasspath.files, noJLine) - val m = ModuleUtilities.getObject("sbt.test.ScriptedTests", loader) - val r = m.getClass.getMethod("run", classOf[File], classOf[Boolean], classOf[Array[String]], classOf[File], classOf[Array[String]], classOf[File => Unit]) + val bridgeClass = Class.forName("sbt.test.ScriptedRunner", true, loader) + val bridge = bridgeClass.newInstance.asInstanceOf[SbtScriptedRunner] val launcherVmOptions = Array("-XX:MaxPermSize=256M") // increased after a failure in scripted source-dependencies/macro - try { r.invoke(m, sourcePath, true: java.lang.Boolean, args.toArray[String], launcher, launcherVmOptions, prescripted) } - catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause } + try { + // Using java.util.List to encode File => Unit. + val callback = new java.util.AbstractList[File] { + override def add(x: File): Boolean = { + prescripted(x) + false + } + def get(x: Int): sbt.File = ??? + def size(): Int = 0 + } + bridge.run(sourcePath, true, args.toArray, launcher, launcherVmOptions, callback) + } catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause } } - -} \ No newline at end of file +} diff --git a/project/p.sbt b/project/p.sbt index 1524ca243..b2b8e4830 100644 --- a/project/p.sbt +++ b/project/p.sbt @@ -1,3 +1,5 @@ +scalaVersion := "2.10.5" + libraryDependencies ++= Seq( "net.databinder" %% "dispatch-http" % "0.8.9", "org.jsoup" % "jsoup" % "1.7.1" diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index 0e14c80be..a3954659c 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -13,7 +13,7 @@ import xsbt.test.{ CommentHandler, FileCommands, ScriptRunner, TestScriptParser import IO.wrapNull final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launcher: File, launchOpts: Seq[String]) { - import ScriptedTests.emptyCallback + import ScriptedTests._ private val testResources = new Resources(resourceBaseDirectory) val ScriptFilename = "test" @@ -46,6 +46,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc } } } + private def scriptedTest(label: String, testDirectory: File, prescripted: File => Unit, log: Logger): Unit = { val buffered = new BufferedLogger(new FullLogger(log)) @@ -94,9 +95,9 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc } finally { buffered.clear() } } } -object ScriptedTests { - val emptyCallback: File => Unit = { _ => () } +object ScriptedTests extends ScriptedRunner { + val emptyCallback: File => Unit = { _ => () } def main(args: Array[String]) { val directory = new File(args(0)) val buffer = args(1).toBoolean @@ -108,19 +109,27 @@ object ScriptedTests { val logger = ConsoleLogger() run(directory, buffer, tests, logger, bootProperties, Array(), emptyCallback) } +} + +class ScriptedRunner { + import ScriptedTests._ + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, launchOpts: Array[String]): Unit = run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, emptyCallback) //new FullLogger(Logger.xlog2Log(log))) + // This is called by project/Scripted.scala + // Using java.util.List[File] to encode File => Unit def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, - launchOpts: Array[String], prescripted: File => Unit): Unit = - run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, prescripted) //new FullLogger(Logger.xlog2Log(log))) + launchOpts: Array[String], prescripted: java.util.List[File]): Unit = + run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, + { f: File => prescripted.add(f); () }) //new FullLogger(Logger.xlog2Log(log))) - def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: AbstractLogger, bootProperties: File, + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: xsbti.Logger, bootProperties: File, launchOpts: Array[String]): Unit = run(resourceBaseDirectory, bufferLog, tests, logger, bootProperties, launchOpts, emptyCallback) - def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: AbstractLogger, bootProperties: File, + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: xsbti.Logger, bootProperties: File, launchOpts: Array[String], prescripted: File => Unit) { val runner = new ScriptedTests(resourceBaseDirectory, bufferLog, bootProperties, launchOpts) val allTests = get(tests, resourceBaseDirectory, logger) flatMap { From 6fc13d0308ba50d3195852586213eeb081502d3d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 19 Jun 2015 23:05:01 -0400 Subject: [PATCH 2/3] Try to keep bincompat --- .../sbt/src/main/scala/sbt/test/ScriptedTests.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index a3954659c..de9983068 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -114,6 +114,7 @@ object ScriptedTests extends ScriptedRunner { class ScriptedRunner { import ScriptedTests._ + @deprecated("No longer used", "0.13.9") def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, launchOpts: Array[String]): Unit = run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, emptyCallback) //new FullLogger(Logger.xlog2Log(log))) @@ -125,11 +126,17 @@ class ScriptedRunner { run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, { f: File => prescripted.add(f); () }) //new FullLogger(Logger.xlog2Log(log))) - def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: xsbti.Logger, bootProperties: File, + @deprecated("No longer used", "0.13.9") + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, + launchOpts: Array[String], prescripted: File => Unit): Unit = + run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts, prescripted) + + @deprecated("No longer used", "0.13.9") + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: AbstractLogger, bootProperties: File, launchOpts: Array[String]): Unit = run(resourceBaseDirectory, bufferLog, tests, logger, bootProperties, launchOpts, emptyCallback) - def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: xsbti.Logger, bootProperties: File, + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: AbstractLogger, bootProperties: File, launchOpts: Array[String], prescripted: File => Unit) { val runner = new ScriptedTests(resourceBaseDirectory, bufferLog, bootProperties, launchOpts) val allTests = get(tests, resourceBaseDirectory, logger) flatMap { From 81f175ddbf5e60888bb9f67f8e4320eda18ae7e2 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 20 Jun 2015 00:51:42 -0400 Subject: [PATCH 3/3] Fixes #1666 --- main/src/test/resources/old-format/15.sbt.txt | 7 ++----- main/src/test/resources/old-format/22.sbt.txt | 2 -- main/src/test/resources/session-settings-quick/3.sbt.txt | 4 ++-- .../resources/session-settings-quick/3.sbt.txt_1/1.set | 2 +- .../session-settings-quick/3.sbt.txt_1/1.set.result | 2 +- notes/0.13.9.markdown | 5 ++++- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/main/src/test/resources/old-format/15.sbt.txt b/main/src/test/resources/old-format/15.sbt.txt index 9feb4f5a4..fc7f76e75 100644 --- a/main/src/test/resources/old-format/15.sbt.txt +++ b/main/src/test/resources/old-format/15.sbt.txt @@ -3,7 +3,7 @@ name := "play-html-compressor" scalaVersion := "2.11.1" -val pom = +val pom = git@github.com:mohiva/play-html-compressor.git scm:git:git@github.com:mohiva/play-html-compressor.git @@ -13,9 +13,6 @@ val pom = Christian Kaps http://mohiva.com - + publishMavenStyle := true - - - diff --git a/main/src/test/resources/old-format/22.sbt.txt b/main/src/test/resources/old-format/22.sbt.txt index 2372c91de..4b6e131ae 100644 --- a/main/src/test/resources/old-format/22.sbt.txt +++ b/main/src/test/resources/old-format/22.sbt.txt @@ -22,7 +22,6 @@ parallelExecution in Test := false // publishing pomExtra := - http://nbronson.github.com/scala-stm/ @@ -42,7 +41,6 @@ pomExtra := ngbronson@gmail.com - publishMavenStyle := true diff --git a/main/src/test/resources/session-settings-quick/3.sbt.txt b/main/src/test/resources/session-settings-quick/3.sbt.txt index 8a36f7432..6db83e79c 100644 --- a/main/src/test/resources/session-settings-quick/3.sbt.txt +++ b/main/src/test/resources/session-settings-quick/3.sbt.txt @@ -2,7 +2,7 @@ import sbt._ val scmpom = taskKey[xml.NodeBuffer]("Node buffer") -scmpom := +scmpom := git@github.com:mohiva/play-html-compressor.git scm:git:git@github.com:mohiva/play-html-compressor.git @@ -13,4 +13,4 @@ scmpom := http://mohiva.com - \ No newline at end of file + \ No newline at end of file diff --git a/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set b/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set index 9e7c59124..3e2aa8d48 100644 --- a/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set +++ b/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set @@ -1 +1 @@ -scmpom := OK \ No newline at end of file +scmpom := OK \ No newline at end of file diff --git a/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set.result b/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set.result index 2eab3cd5a..f4763bc5f 100644 --- a/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set.result +++ b/main/src/test/resources/session-settings-quick/3.sbt.txt_1/1.set.result @@ -2,4 +2,4 @@ import sbt._ val scmpom = taskKey[xml.NodeBuffer]("Node buffer") -scmpom := OK \ No newline at end of file +scmpom := OK \ No newline at end of file diff --git a/notes/0.13.9.markdown b/notes/0.13.9.markdown index 83482b18c..3bd93a625 100644 --- a/notes/0.13.9.markdown +++ b/notes/0.13.9.markdown @@ -11,7 +11,7 @@ [@PanAeon]: https://github.com/PanAeon [@asflierl]: http://github.com/asflierl [@matthewfarwell]: http://github.com/matthewfarwell - + [SI9027]: https://issues.scala-lang.org/browse/SI-9027 [1950]: https://github.com/sbt/sbt/pull/1950 [1987]: https://github.com/sbt/sbt/pull/1987 [1970]: https://github.com/sbt/sbt/pull/1970 @@ -40,11 +40,14 @@ [2035]: https://github.com/sbt/sbt/pull/2035 [2001]: https://github.com/sbt/sbt/issues/2001 [2027]: https://github.com/sbt/sbt/pull/2027 + [1666]: https://github.com/sbt/sbt/issues/1666 + [2068]: https://github.com/sbt/sbt/pull/2068 ### Fixes with compatibility implications - Starting 0.13.9, `crossScalaVersions` default value is fixed back to the older 0.12.x behavior. See below for details. - Starting 0.13.9, the generated POM files no longer include dependencies on source or javadoc jars obtained via `withSources()` or `withJavadoc()`. See below for details. +- Scala version is bumped to 2.10.5. This brings in the fix for [SI-9027][SI9027]: XML node sequence literal bug. [#1666][1666]/[#2068][2068] by [@eed3si9n][@eed3si9n] ### Improvements