Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Remove ant support #103

Merged
merged 1 commit into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ Test categories (subdirectories under `test/files`)
As partest links directly against the compiler being tested, it's cross-versioned against
the compiler version that it's intended for.

There are three ways of invoking partest:

- ant (see https://github.com/scala/scala/blob/2.11.x/test/build-partest.xml and https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/PartestTask.scala)
- sbt (details below)
- the [test/partest script](https://github.com/scala/scala/blob/2.11.x/test/partest), which uses ant to set up the classpath in the same way as the ant task, but then launches [ConsoleRunner](https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/nest/ConsoleRunner.scala) directly.
Partest is invoked from sbt.

The compiler to be tested must be on the classpath.
The corresponding jar or class directory is detected by [FileManager::findArtifact](https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/nest/FileManager.scala#L123).
Expand Down
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ enableOptimizer

// dependencies
// versions involved in integration builds / that change frequently should be keys, set above!
libraryDependencies += "org.apache.ant" % "ant" % "1.8.4" % "provided"
libraryDependencies += "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0"
libraryDependencies += "org.scala-sbt" % "test-interface" % "1.0"
// mark all scala dependencies as provided which means one has to explicitly provide them when depending on partest
Expand Down
4 changes: 0 additions & 4 deletions src/main/resources/scala/tools/partest/antlib.xml

This file was deleted.

160 changes: 0 additions & 160 deletions src/main/scala/scala/tools/partest/PartestTask.scala

This file was deleted.

64 changes: 0 additions & 64 deletions src/main/scala/scala/tools/partest/nest/AntRunner.scala

This file was deleted.

44 changes: 2 additions & 42 deletions src/main/scala/scala/tools/partest/nest/Runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import scala.concurrent.duration.Duration
import scala.reflect.internal.FatalError
import scala.reflect.internal.util.ScalaClassLoader
import scala.sys.process.{Process, ProcessLogger}
import scala.tools.nsc.Properties.{envOrNone, isWin, javaHome, javaVmInfo, javaVmName, javaVmVersion, propOrEmpty, versionMsg}
import scala.tools.nsc.Properties.{isWin, javaHome, javaVmInfo, javaVmName, javaVmVersion, propOrEmpty, versionMsg}
import scala.tools.nsc.{CompilerCommand, Global, Settings}
import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.util.stackTraceString
Expand Down Expand Up @@ -89,9 +89,6 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU

lazy val outDir = { outFile.mkdirs() ; outFile }

// oh boy...
private lazy val antLauncher = SFile(Path(envOrNone("ANT_HOME") getOrElse "/opt/ant/") / "lib/ant-launcher.jar")

type RanOneTest = (Boolean, LogContext)

def showCrashInfo(t: Throwable) {
Expand Down Expand Up @@ -594,42 +591,6 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
compilationRounds(testFile).forall(x => nextTestActionExpectTrue("compilation failed", x.isOk)) && andAlso
}

// Apache Ant 1.6 or newer
def ant(args: Seq[String], output: File): Boolean = {
val antOptions =
if (nestUI.verbose) List("-verbose", "-noinput")
else List("-noinput")
val cmd = javaCmdPath +: (
suiteRunner.javaOpts.split(' ').map(_.trim).filter(_ != "") ++ Seq(
"-classpath",
antLauncher.path,
"org.apache.tools.ant.launch.Launcher"
) ++ antOptions ++ args
)

runCommand(cmd.toIndexedSeq, output)
}

def runAntTest(): (Boolean, LogContext) = {
val (swr, wr) = newTestWriters()

val succeeded = try {
val binary = "-Dbinary="+ fileManager.distKind
val args = Array(binary, "-logfile", logFile.getPath, "-file", testFile.getPath)
nestUI.verbose("ant "+args.mkString(" "))

pushTranscript(s"ant ${args.mkString(" ")}")
nextTestActionExpectTrue("ant failed", ant(args.toIndexedSeq, logFile)) && diffIsOk
}
catch { // *catch-all*
case e: Exception =>
nestUI.warning("caught "+e)
false
}

(succeeded, LogContext(logFile, swr, wr))
}

def extraClasspath = kind match {
case "specialized" => List(PathSettings.srcSpecLib.fold(sys.error, identity))
case _ => Nil
Expand Down Expand Up @@ -714,7 +675,6 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
if (kind == "neg" || (kind endsWith "-neg")) runNegTest()
else kind match {
case "pos" => runTestCommon(true)
case "ant" => runAntTest()
case "res" => runResidentTest()
case "scalap" => runScalapTest()
case "script" => runScriptTest()
Expand Down Expand Up @@ -792,7 +752,7 @@ object Properties extends scala.util.PropertiesTrait {
protected def pickJarBasedOn = classOf[SuiteRunner]
}

/** Extended by Ant- and ConsoleRunner for running a set of tests. */
/** Used by SBT- and ConsoleRunner for running a set of tests. */
class SuiteRunner(
val testSourcePath: String, // relative path, like "files", or "pending"
val fileManager: FileManager,
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/scala/tools/partest/nest/RunnerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ trait RunnerSpec extends Spec with Meta.StdOpts with Interpolation {
val optRun = "run" / "run interpreter and backend tests" --?
val optJvm = "jvm" / "run JVM backend tests" --?
val optRes = "res" / "run resident compiler tests" --?
val optAnt = "ant" / "run Ant tests" --?
val optScalap = "scalap" / "run scalap tests" --?
val optSpecialized = "specialized" / "run specialization tests" --?
val optInstrumented = "instrumented" / "run instrumented tests" --?
Expand Down