From ae211ee33ed9f12480460b4bed0c131af4ccb0c0 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Thu, 13 Dec 2012 22:18:10 -0800 Subject: [PATCH] Cleanup parameter list of `ScriptedTests`. All of `sbtVersion`, `defScalaVersion` and `buildScalaVersions` were not used anymore. According to @harrah they are coming from really old days of sbt and are not needed because of changes to how sbt interacts with different Scala versions. --- project/Sbt.scala | 10 ++++------ .../plugin/src/main/scala/sbt/ScriptedPlugin.scala | 4 ---- .../sbt/src/main/scala/sbt/test/ScriptedTests.scala | 12 ++++++------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/project/Sbt.scala b/project/Sbt.scala index 00c3bea84..93dbd5dd9 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -150,13 +150,13 @@ object Sbt extends Build ) def scriptedTask: Initialize[InputTask[Unit]] = InputTask(scriptedSource(dir => (s: State) => scriptedParser(dir))) { result => - (proguard in Proguard, fullClasspath in scriptedSbtSub in Test, scalaInstance in scriptedSbtSub, publishAll, version, scalaVersion, scriptedScalaVersion, scriptedSource, result) map { - (launcher, scriptedSbtClasspath, scriptedSbtInstance, _, v, sv, ssv, sourcePath, args) => + (proguard in Proguard, fullClasspath in scriptedSbtSub in Test, scalaInstance in scriptedSbtSub, publishAll, scriptedSource, result) map { + (launcher, scriptedSbtClasspath, scriptedSbtInstance, _, sourcePath, args) => val loader = classpath.ClasspathUtilities.toLoader(scriptedSbtClasspath.files, scriptedSbtInstance.loader) val m = ModuleUtilities.getObject("sbt.test.ScriptedTests", loader) - val r = m.getClass.getMethod("run", classOf[File], classOf[Boolean], classOf[String], classOf[String], classOf[String], classOf[Array[String]], classOf[File], classOf[Array[String]]) + val r = m.getClass.getMethod("run", classOf[File], classOf[Boolean], classOf[Array[String]], classOf[File], classOf[Array[String]]) val launcherVmOptions = Array("-XX:MaxPermSize=256M") // increased after a failure in scripted source-dependencies/macro - try { r.invoke(m, sourcePath, true: java.lang.Boolean, v, sv, ssv, args.toArray[String], launcher, launcherVmOptions) } + try { r.invoke(m, sourcePath, true: java.lang.Boolean, args.toArray[String], launcher, launcherVmOptions) } catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause } } } @@ -178,7 +178,6 @@ object Sbt extends Build (token(Space) ~> matched(testID)).* } - lazy val scriptedScalaVersion = SettingKey[String]("scripted-scala-version") lazy val scripted = InputKey[Unit]("scripted") lazy val scriptedSource = SettingKey[File]("scripted-source") lazy val publishAll = TaskKey[Unit]("publish-all") @@ -197,7 +196,6 @@ object Sbt extends Build def rootSettings = releaseSettings ++ Docs.settings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchSub) ++ Sxr.settings ++ docSetting ++ Util.publishPomSettings ++ otherRootSettings def otherRootSettings = Seq( - scriptedScalaVersion <<= scalaVersion.identity, scripted <<= scriptedTask, scriptedSource <<= (sourceDirectory in sbtSub) / "sbt-test", sources in sxr <<= deepTasks(sources in Compile), diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala index 3204fa3fa..b59e813dc 100644 --- a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala +++ b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala @@ -16,8 +16,6 @@ object ScriptedPlugin extends Plugin { val sbtLauncher = SettingKey[File]("sbt-launcher") val sbtTestDirectory = SettingKey[File]("sbt-test-directory") val scriptedBufferLog = SettingKey[Boolean]("scripted-buffer-log") - final case class ScriptedScalas(build: String, versions: String) - val scriptedScalas = SettingKey[ScriptedScalas]("scripted-scalas") val scriptedClasspath = TaskKey[PathFinder]("scripted-classpath") val scriptedTests = TaskKey[AnyRef]("scripted-tests") @@ -43,7 +41,6 @@ object ScriptedPlugin extends Plugin { try { scriptedRun.value.invoke( scriptedTests.value, sbtTestDirectory.value, scriptedBufferLog.value: java.lang.Boolean, - scriptedSbt.value.toString, scriptedScalas.value.build, scriptedScalas.value.versions, args.toArray, sbtLauncher.value, scriptedLaunchOpts.value.toArray) } catch { case e: java.lang.reflect.InvocationTargetException => throw e.getCause } @@ -52,7 +49,6 @@ object ScriptedPlugin extends Plugin { val scriptedSettings = Seq( ivyConfigurations += scriptedConf, scriptedSbt <<= (appConfiguration)(_.provider.id.version), - scriptedScalas <<= (scalaVersion) { (scala) => ScriptedScalas(scala, scala) }, libraryDependencies <<= (libraryDependencies, scriptedSbt) {(deps, version) => deps :+ "org.scala-sbt" % "scripted-sbt" % version % scriptedConf.toString }, sbtLauncher <<= (appConfiguration)(app => IO.classLocationFile(app.provider.scalaProvider.launcher.getClass)), sbtTestDirectory <<= sourceDirectory / "sbt-test", diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index 915069d4a..66615ad9b 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -12,7 +12,7 @@ import xsbt.IPC import xsbt.test.{CommentHandler, FileCommands, ScriptRunner, TestScriptParser} import IO.wrapNull -final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, sbtVersion: String, defScalaVersion: String, buildScalaVersions: String, launcher: File, launchOpts: Seq[String]) +final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launcher: File, launchOpts: Seq[String]) { private val testResources = new Resources(resourceBaseDirectory) @@ -102,14 +102,14 @@ object ScriptedTests val bootProperties = new File(args(5)) val tests = args.drop(6) val logger = ConsoleLogger() - run(directory, buffer, sbtVersion, defScalaVersion, buildScalaVersions, tests, logger, bootProperties, Array()) + run(directory, buffer, tests, logger, bootProperties, Array()) } - def run(resourceBaseDirectory: File, bufferLog: Boolean, sbtVersion: String, defScalaVersion: String, buildScalaVersions: String, tests: Array[String], bootProperties: File, launchOpts: Array[String]): Unit = - run(resourceBaseDirectory, bufferLog, sbtVersion, defScalaVersion, buildScalaVersions, tests, ConsoleLogger(), bootProperties, launchOpts)//new FullLogger(Logger.xlog2Log(log))) + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], bootProperties: File, launchOpts: Array[String]): Unit = + run(resourceBaseDirectory, bufferLog, tests, ConsoleLogger(), bootProperties, launchOpts)//new FullLogger(Logger.xlog2Log(log))) - def run(resourceBaseDirectory: File, bufferLog: Boolean, sbtVersion: String, defScalaVersion: String, buildScalaVersions: String, tests: Array[String], logger: AbstractLogger, bootProperties: File, launchOpts: Array[String]) + def run(resourceBaseDirectory: File, bufferLog: Boolean, tests: Array[String], logger: AbstractLogger, bootProperties: File, launchOpts: Array[String]) { - val runner = new ScriptedTests(resourceBaseDirectory, bufferLog, sbtVersion, defScalaVersion, buildScalaVersions, bootProperties, launchOpts) + val runner = new ScriptedTests(resourceBaseDirectory, bufferLog, bootProperties, launchOpts) for( ScriptedTest(group, name) <- get(tests, resourceBaseDirectory, logger) ) runner.scriptedTest(group, name, logger) }