Skip to content

Commit

Permalink
Cleanup parameter list of ScriptedTests.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gkossakowski authored and harrah committed Dec 14, 2012
1 parent 71f12fb commit ae211ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
10 changes: 4 additions & 6 deletions project/Sbt.scala
Expand Up @@ -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 }
}
}
Expand All @@ -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")
Expand 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),
Expand Down
4 changes: 0 additions & 4 deletions scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala
Expand Up @@ -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")
Expand All @@ -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 }
Expand All @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit ae211ee

Please sign in to comment.