Working on making the bootstrap process transparent and consistent.
And removed a bunch of what is now cruft in partest. No review. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@20990 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
1a6adc2409
commit
51136ada46
30
build.xml
30
build.xml
|
@ -257,10 +257,10 @@ INITIALISATION
|
|||
<!-- Define tasks that can be run with Starr -->
|
||||
<path id="starr.classpath">
|
||||
<pathelement location="${lib.starr.jar}"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${comp.starr.jar}"/>
|
||||
<pathelement location="${lib.dir}/fjbg.jar"/>
|
||||
<pathelement location="${lib.dir}/msil.jar"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
</path>
|
||||
<taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.classpath"/>
|
||||
|
@ -342,12 +342,12 @@ LOCAL REFERENCE BUILD (LOCKER)
|
|||
<include name="**/*.scala"/>
|
||||
<compilationpath>
|
||||
<pathelement location="${build-locker.dir}/classes/library"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${build-locker.dir}/classes/compiler"/>
|
||||
<pathelement location="${lib.dir}/fjbg.jar"/>
|
||||
<pathelement location="${lib.dir}/msil.jar"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
</compilationpath>
|
||||
</scalacfork>
|
||||
<propertyfile file="${build-locker.dir}/classes/compiler/compiler.properties">
|
||||
|
@ -374,10 +374,10 @@ LOCAL REFERENCE BUILD (LOCKER)
|
|||
<touch file="${build-locker.dir}/all.complete" verbose="no"/>
|
||||
<path id="locker.classpath">
|
||||
<pathelement location="${build-locker.dir}/classes/library"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${build-locker.dir}/classes/compiler"/>
|
||||
<pathelement location="${lib.dir}/fjbg.jar"/>
|
||||
<pathelement location="${lib.dir}/msil.jar"/>
|
||||
<pathelement location="${lib.dir}/forkjoin.jar"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
</path>
|
||||
</target>
|
||||
|
@ -570,12 +570,12 @@ QUICK BUILD (QUICK)
|
|||
<include name="**/*.scala"/>
|
||||
<compilationpath>
|
||||
<pathelement location="${build-quick.dir}/classes/library"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${build-quick.dir}/classes/compiler"/>
|
||||
<!-- <pathelement location="${build-quick.dir}/classes/compiler"/> -->
|
||||
<pathelement location="${fjbg.jar}"/>
|
||||
<pathelement location="${msil.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
</compilationpath>
|
||||
</scalacfork>
|
||||
<propertyfile file="${build-quick.dir}/classes/compiler/compiler.properties">
|
||||
|
@ -616,8 +616,8 @@ QUICK BUILD (QUICK)
|
|||
<compilationpath>
|
||||
<pathelement location="${build-quick.dir}/classes/library"/>
|
||||
<pathelement location="${build-quick.dir}/classes/compiler"/>
|
||||
<pathelement location="${build-quick.dir}/classes/partest"/>
|
||||
<pathelement location="${build-quick.dir}/classes/scalap"/>
|
||||
<pathelement location="${build-quick.dir}/classes/partest"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
</compilationpath>
|
||||
</scalacfork>
|
||||
|
@ -684,11 +684,11 @@ QUICK BUILD (QUICK)
|
|||
<target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available">
|
||||
<path id="quick.bin.classpath">
|
||||
<pathelement location="${build-quick.dir}/classes/library"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${build-quick.dir}/classes/compiler"/>
|
||||
<pathelement location="${build-quick.dir}/classes/scalap"/>
|
||||
<pathelement location="${fjbg.jar}"/>
|
||||
<pathelement location="${msil.jar}"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
</path>
|
||||
<taskdef name="quick-bin" classname="scala.tools.ant.ScalaTool" classpathref="quick.bin.classpath"/>
|
||||
|
@ -729,10 +729,10 @@ QUICK BUILD (QUICK)
|
|||
<target name="quick.done" depends="quick.bin">
|
||||
<path id="quick.classpath">
|
||||
<pathelement location="${build-quick.dir}/classes/library"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${build-quick.dir}/classes/compiler"/>
|
||||
<pathelement location="${fjbg.jar}"/>
|
||||
<pathelement location="${msil.jar}"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
</path>
|
||||
</target>
|
||||
|
@ -1013,12 +1013,12 @@ BOOTSTRAPPING BUILD (STRAP)
|
|||
<include name="**/*.scala"/>
|
||||
<compilationpath>
|
||||
<pathelement location="${build-strap.dir}/classes/library"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${build-strap.dir}/classes/compiler"/>
|
||||
<!-- <pathelement location="${build-strap.dir}/classes/compiler"/> -->
|
||||
<pathelement location="${fjbg.jar}"/>
|
||||
<pathelement location="${msil.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
<pathelement location="${forkjoin.jar}"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
<pathelement location="${jline.jar}"/>
|
||||
</compilationpath>
|
||||
</scalacfork>
|
||||
<propertyfile file="${build-strap.dir}/classes/compiler/compiler.properties">
|
||||
|
@ -1059,8 +1059,8 @@ BOOTSTRAPPING BUILD (STRAP)
|
|||
<compilationpath>
|
||||
<pathelement location="${build-strap.dir}/classes/library"/>
|
||||
<pathelement location="${build-strap.dir}/classes/compiler"/>
|
||||
<pathelement location="${build-strap.dir}/classes/partest"/>
|
||||
<pathelement location="${build-strap.dir}/classes/scalap"/>
|
||||
<pathelement location="${build-strap.dir}/classes/partest"/>
|
||||
<pathelement location="${ant.jar}"/>
|
||||
</compilationpath>
|
||||
</scalacfork>
|
||||
|
@ -1587,9 +1587,9 @@ STABLE REFERENCE (STARR)
|
|||
<target name="starr.libs" depends="starr.src" if="libs.outdated">
|
||||
<copy toDir="${lib.dir}" overwrite="yes">
|
||||
<fileset dir="${build-libs.dir}">
|
||||
<include name="forkjoin.jar"/>
|
||||
<include name="fjbg.jar"/>
|
||||
<include name="msil.jar"/>
|
||||
<include name="forkjoin.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
|
|
@ -19,7 +19,6 @@ class AntRunner extends DirectRunner {
|
|||
var JAVACMD: String = "java"
|
||||
var JAVAC_CMD: String = "javac"
|
||||
var CLASSPATH: String = _
|
||||
var EXT_CLASSPATH: String = _
|
||||
var LATEST_LIB: String = _
|
||||
val TESTROOT: String = ""
|
||||
}
|
||||
|
|
|
@ -21,10 +21,6 @@ import ClassPath.{ join }
|
|||
import PathResolver.{ Environment, Defaults }
|
||||
import RunnerUtils._
|
||||
|
||||
object ConsoleFileManager {
|
||||
def testRootPropDir = Option(propOrElse("scalatest.root", null)) map (x => Directory(x))
|
||||
}
|
||||
import ConsoleFileManager._
|
||||
|
||||
class ConsoleFileManager extends FileManager {
|
||||
implicit private def temporaryPath2File(x: Path): File = x.jfile
|
||||
|
@ -61,46 +57,18 @@ class ConsoleFileManager extends FileManager {
|
|||
|
||||
NestUI.verbose("CLASSPATH: "+CLASSPATH)
|
||||
|
||||
val prefixDir = PartestDefaults.prefixDir getOrElse error("user.dir property not set")
|
||||
val srcDirName = PartestDefaults.srcDirName
|
||||
val prefixDir = PathSettings.prefixDir
|
||||
val PREFIX = prefixDir.toAbsolute.path
|
||||
|
||||
/*
|
||||
if [ -d "$PREFIX/test" ]; then
|
||||
TESTROOT="$PREFIX/test";
|
||||
elif [ -d "$PREFIX/misc/scala-test" ]; then
|
||||
TESTROOT="$PREFIX/misc/scala-test";
|
||||
else
|
||||
abort "Test directory not found";
|
||||
*/
|
||||
|
||||
val testRootDir = {
|
||||
def isTestDir(d: Directory) = d.name == "test" && (d / "files" isDirectory)
|
||||
|
||||
(
|
||||
testRootPropDir orElse (
|
||||
if (isTestDir(prefixDir)) Some(prefixDir) else None // cwd is `test`
|
||||
) orElse (
|
||||
(prefixDir / "test") ifDirectory (x => x) // cwd is `test/..`
|
||||
) orElse (
|
||||
(prefixDir / "misc" / "scala-test") ifDirectory (x => x)
|
||||
) getOrElse (
|
||||
error("Test directory not found")
|
||||
)
|
||||
).normalize
|
||||
}
|
||||
val testRootDir = PathSettings.testRoot
|
||||
val TESTROOT = testRootDir.toAbsolute.path
|
||||
|
||||
def testParent = testRootDir.parent
|
||||
|
||||
val srcDir = (testRootDir / srcDirName).toDirectory
|
||||
val srcDir = PathSettings.srcDir
|
||||
|
||||
if (!srcDir.isDirectory) {
|
||||
NestUI.failure("Source directory \"" + srcDir.path + "\" not found")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
||||
LIB_DIR = (testParent / "lib").normalize.toAbsolute.path
|
||||
|
||||
CLASSPATH = {
|
||||
|
@ -195,21 +163,10 @@ else
|
|||
latestFjbgFile = prefixFile("lib/fjbg.jar")
|
||||
}
|
||||
|
||||
BIN_DIR = latestFile.getAbsolutePath
|
||||
LATEST_LIB = latestLibFile.getAbsolutePath
|
||||
LATEST_COMP = latestCompFile.getAbsolutePath
|
||||
LATEST_PARTEST = latestPartestFile.getAbsolutePath
|
||||
|
||||
SCALA = (latestFile / scalaCmd).toAbsolute.path
|
||||
SCALAC_CMD = (latestFile / scalacCmd).toAbsolute.path
|
||||
}
|
||||
|
||||
var BIN_DIR: String = ""
|
||||
var LATEST_LIB: String = ""
|
||||
var LATEST_COMP: String = ""
|
||||
var LATEST_PARTEST: String = ""
|
||||
var SCALA: String = ""
|
||||
var SCALAC_CMD: String = ""
|
||||
|
||||
var latestFile: File = _
|
||||
var latestLibFile: File = _
|
||||
|
|
|
@ -48,6 +48,7 @@ class ConsoleRunner extends DirectRunner {
|
|||
private var testFiles: List[File] = List()
|
||||
private val errors = PartestDefaults.errorCount
|
||||
|
||||
private val testSetKinds = testSets map (_.kind)
|
||||
private val testSetArgMap = testSets map (x => ("--" + x.loc) -> x) toMap
|
||||
private val testSetArgs = testSets map ("--" + _.loc)
|
||||
def denotesTestSet(arg: String) = testSetArgs contains arg
|
||||
|
@ -175,25 +176,15 @@ class ConsoleRunner extends DirectRunner {
|
|||
*/
|
||||
def testCheckAll(enabledSets: List[TestSet]): (Int, Int) = {
|
||||
def runTestsFiles = if (!testFiles.isEmpty) {
|
||||
def absName(f: File): String = f.getAbsoluteFile.getCanonicalPath
|
||||
def kindOf(f: File) = {
|
||||
val srcDirSegments = PathSettings.srcDir.segments
|
||||
val segments = Path(f).normalize.toAbsolute.segments
|
||||
lazy val kind = (segments drop srcDirSegments.size).head
|
||||
|
||||
def kindOf(f: File): String = {
|
||||
val firstName = absName(f)
|
||||
val len = fileManager.srcDirName.length
|
||||
val filesPos = firstName.indexOf(fileManager.srcDirName)
|
||||
if (filesPos == -1) {
|
||||
NestUI.failure("invalid test file: "+firstName+"\n")
|
||||
if ((segments startsWith srcDirSegments) && (testSetKinds contains kind)) kind
|
||||
else {
|
||||
NestUI.failure("invalid test file: "+f.getPath+"\n")
|
||||
Predef.exit(1)
|
||||
} else {
|
||||
val short = firstName drop (filesPos + len + 1) take 3
|
||||
val shortKinds = List("pos", "neg", "run", "jvm", "res")
|
||||
if (shortKinds contains short) short
|
||||
else short match {
|
||||
case "sho" => "shootout"
|
||||
case "scr" => "script"
|
||||
case "sca" => "scalacheck"
|
||||
case "bui" => "buildmanager"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/* NEST (New Scala Test)
|
||||
* Copyright 2007-2010 LAMP/EPFL
|
||||
*/
|
||||
|
||||
package scala.tools.partest
|
||||
package nest
|
||||
|
||||
import scala.tools.nsc.Properties.{ setProp, propOrEmpty, propOrNone, propOrElse }
|
||||
import scala.tools.nsc.util.ClassPath
|
||||
import scala.tools.nsc.io
|
||||
import io.{ Path, File, Directory }
|
||||
import RunnerUtils._
|
||||
import java.net.URLClassLoader
|
||||
|
||||
object PathSettings {
|
||||
private def isTestDirectory(d: Path) =
|
||||
d.isDirectory && (d.name == "test") && (d / srcDirProperty isDirectory)
|
||||
|
||||
def testRootProperty = propOrNone("scalatest.root") map (x => Directory(x))
|
||||
def srcDirProperty = propOrElse("partest.srcdir", "files")
|
||||
|
||||
// XXX temp
|
||||
def prefixDir = Directory.Current getOrElse error("user.dir property not set")
|
||||
|
||||
lazy val testRoot: Directory = testRootProperty getOrElse {
|
||||
// val cwd = Directory.Current getOrElse error("user.dir property not set")
|
||||
val cwd = prefixDir
|
||||
val candidates = (cwd :: cwd.parents) flatMap (d => List(d, d / "test"))
|
||||
|
||||
candidates find isTestDirectory map (_.toDirectory) getOrElse error("Directory 'test' not found.")
|
||||
}
|
||||
|
||||
lazy val srcDir = Directory((testRoot / srcDirProperty).normalize.toAbsolute)
|
||||
}
|
||||
|
||||
class PathSettings() {
|
||||
// def classpathAsURLs: List[URL]
|
||||
}
|
Loading…
Reference in New Issue