diff --git a/compile/src/test/scala/CheckBasic.scala b/compile/src/test/scala/CheckBasic.scala index dc7ecbafb..0195706ca 100644 --- a/compile/src/test/scala/CheckBasic.scala +++ b/compile/src/test/scala/CheckBasic.scala @@ -7,7 +7,7 @@ package compiler object CheckBasic extends Specification { val basicName = new File("Basic.scala") - val basicSource = "package org.example { object Basic }" + val basicSource = "package org.example { /** A comment */ object Basic }" "Compiling basic file should succeed" in { WithFiles(basicName -> basicSource){ files => diff --git a/compile/src/test/scala/CompileTest.scala b/compile/src/test/scala/CompileTest.scala index f30d600f7..9abda2df7 100644 --- a/compile/src/test/scala/CompileTest.scala +++ b/compile/src/test/scala/CompileTest.scala @@ -9,8 +9,6 @@ object CompileTest extends Specification { "Analysis compiler" should { "compile basic sources" in { - WithCompiler( "2.7.2" )(testCompileAnalysis) - WithCompiler( "2.7.3" )(testCompileAnalysis) WithCompiler( "2.7.4" )(testCompileAnalysis) WithCompiler( "2.7.5" )(testCompileAnalysis) WithCompiler( "2.7.7" )(testCompileAnalysis) @@ -21,7 +19,7 @@ object CompileTest extends Specification "Raw compiler" should { "Properly handle classpaths" in { - testClasspath("2.7.2") + testClasspath("2.7.4") testClasspath("2.7.7") testClasspath("2.8.0") testClasspath("2.8.1") @@ -53,6 +51,9 @@ object CompileTest extends Specification case t if isMissingRequirementError(t) => true case _ => false } + private def shouldSucceed(act: => Unit) = + try { act } catch { case c: xsbti.CompileFailed => error(c.toString) } + private def isMissingRequirementError(t: Throwable) = t.getClass.getName == "scala.tools.nsc.MissingRequirementError" private def testClasspath(scalaVersion: String) = WithCompiler.launcher { (launch, log) => @@ -67,26 +68,25 @@ object CompileTest extends Specification val fullBoot = "-bootclasspath" :: fullExplicit.compilerArguments.createBootClasspath :: Nil val withCompiler = noCompiler.scalaInstance.compilerJar :: Nil + val withLibrary = noCompiler.scalaInstance.libraryJar :: Nil + val withLibraryCompiler = withLibrary ++ withCompiler WithFiles( new File("Test.scala") -> "object Test", new File("Test2.scala") -> UsingCompiler ) { case Seq(plain, useCompiler) => val plainSrcs = Seq[File](plain) val compSrcs = Seq[File](useCompiler) withTemporaryDirectory { out => - standard(plainSrcs, Nil, out, Nil) //success - standard(compSrcs, Nil, out, Nil) //success + shouldSucceed( standard(plainSrcs, Nil, out, Nil) )//success + shouldSucceed( standard(compSrcs, Nil, out, Nil) )//success - noCompiler(plainSrcs, Nil, out, Nil) //success + shouldSucceed( noCompiler(plainSrcs, Nil, out, Nil) )//success shouldFail( noCompiler(compSrcs, Nil, out, Nil) ) - noCompiler(compSrcs, withCompiler, out, Nil) //success + shouldSucceed( noCompiler(compSrcs, withCompiler, out, Nil) )//success shouldFail( fullExplicit(plainSrcs, Nil, out, Nil) )// failure shouldFail( fullExplicit(compSrcs, Nil, out, Nil) )// failure - fullExplicit(plainSrcs, Nil, out, fullBoot) // success - fullExplicit(compSrcs, withCompiler, out, fullBoot) // success - - // specs now marks something as skipped if there are no matchers - // this test throws exceptions on failure, so use a dummy check here - true must be equalTo(true) + shouldSucceed( fullExplicit(plainSrcs, withLibrary, out, fullBoot) )// success + shouldSucceed( fullExplicit(compSrcs, withLibraryCompiler, out, fullBoot) )// success + true must beTrue } } } diff --git a/compile/src/test/scala/TestCompile.scala b/compile/src/test/scala/TestCompile.scala index 1babe0453..1dd3f7f0f 100644 --- a/compile/src/test/scala/TestCompile.scala +++ b/compile/src/test/scala/TestCompile.scala @@ -8,8 +8,7 @@ package compiler object TestCompile { - // skip 2.7.3 and 2.7.4 for speed - def allVersions = List("2.8.0")//List("2.7.2", "2.7.5", "2.7.7", "2.8.0", "2.8.1.RC1") + def allVersions = List("2.7.4", "2.8.1", "2.9.0.RC1")//List("2.7.4", "2.7.7", "2.8.0", "2.8.1", "2.9.0.RC1") /** Tests running the compiler interface with the analyzer plugin with a test callback. The test callback saves all information * that the plugin sends it for post-compile analysis by the provided function.*/ def apply[T](scalaVersion: String, sources: Seq[File], outputDirectory: File, options: Seq[String]) diff --git a/launch/BootConfiguration.scala b/launch/BootConfiguration.scala index ab5f8b5ce..4d56f7308 100644 --- a/launch/BootConfiguration.scala +++ b/launch/BootConfiguration.scala @@ -29,6 +29,7 @@ private object BootConfiguration /** The Ivy pattern used for the local Ivy repository.*/ def LocalIvyPattern = LocalPattern + val FjbgPackage = "ch.epfl.lamp.fjbg." /** The class name prefix used to hide the Scala classes used by this loader from the application */ val ScalaPackage = "scala." /** The class name prefix used to hide the Ivy classes used by this loader from the application*/ diff --git a/launch/FilteredLoader.scala b/launch/FilteredLoader.scala index 6b318066e..35bd23ebb 100644 --- a/launch/FilteredLoader.scala +++ b/launch/FilteredLoader.scala @@ -3,7 +3,7 @@ */ package xsbt.boot -import BootConfiguration.{IvyPackage, JLinePackagePath, SbtBootPackage, ScalaPackage} +import BootConfiguration.{FjbgPackage, IvyPackage, JLinePackagePath, SbtBootPackage, ScalaPackage} import scala.collection.immutable.Stream /** A custom class loader to ensure the main part of sbt doesn't load any Scala or @@ -14,7 +14,7 @@ private[boot] final class BootFilteredLoader(parent: ClassLoader) extends ClassL override final def loadClass(className: String, resolve: Boolean): Class[_] = { // note that we allow xsbti.* and jline.* - if(className.startsWith(ScalaPackage) || className.startsWith(IvyPackage) || className.startsWith(SbtBootPackage)) + if(className.startsWith(ScalaPackage) || className.startsWith(IvyPackage) || className.startsWith(SbtBootPackage) || className.startsWith(FjbgPackage)) throw new ClassNotFoundException(className) else super.loadClass(className, resolve) diff --git a/launch/Locks.scala b/launch/Locks.scala index eb4ced7b6..2be63b4e4 100644 --- a/launch/Locks.scala +++ b/launch/Locks.scala @@ -25,12 +25,16 @@ object Locks extends xsbti.GlobalLock { private[this] val locks = new Cache[File, GlobalLock](new GlobalLock(_)) def apply[T](file: File, action: Callable[T]): T = - synchronized - { - file.getParentFile.mkdirs() - file.createNewFile() - locks(file.getCanonicalFile).withLock(action) - } + { + val lock = + synchronized + { + file.getParentFile.mkdirs() + file.createNewFile() + locks(file.getCanonicalFile) + } + lock.withLock(action) + } private[this] class GlobalLock(file: File) { diff --git a/launch/src/test/scala/ScalaProviderTest.scala b/launch/src/test/scala/ScalaProviderTest.scala index 08c550821..06104b29d 100644 --- a/launch/src/test/scala/ScalaProviderTest.scala +++ b/launch/src/test/scala/ScalaProviderTest.scala @@ -11,12 +11,12 @@ object ScalaProviderTest extends Specification { def provide = addToSusVerb("provide") "Launch" should provide { - "ClassLoader for Scala 2.7.2" in { checkScalaLoader("2.7.2") } - "ClassLoader for Scala 2.7.3" in { checkScalaLoader("2.7.3") } "ClassLoader for Scala 2.7.4" in { checkScalaLoader("2.7.4") } "ClassLoader for Scala 2.7.5" in { checkScalaLoader("2.7.5") } "ClassLoader for Scala 2.7.6" in { checkScalaLoader("2.7.6") } "ClassLoader for Scala 2.7.7" in { checkScalaLoader("2.7.7") } + "ClassLoader for Scala 2.8.0" in { checkScalaLoader("2.8.0") } + "ClassLoader for Scala 2.8.1" in { checkScalaLoader("2.8.1") } } "Launch" should { @@ -74,7 +74,7 @@ object LaunchTest def mapScalaVersion(versionNumber: String) = scalaVersionMap.find(_._2 == versionNumber).getOrElse { error("Scala version number " + versionNumber + " from library.properties has no mapping")}._1 - val scalaVersionMap = List("2.7.2", "2.8.0.RC4").map(x => (x,x)).toMap ++ List("2.7.3", "2.7.4", "2.7.5", "2.7.6", "2.7.7").map(v => (v, v + ".final")) + val scalaVersionMap = List("2.8.0", "2.8.1", "2.9.0.RC1").map(x => (x,x)).toMap ++ List("2.7.4", "2.7.5", "2.7.6", "2.7.7").map(v => (v, v + ".final")) def getScalaVersion: String = getScalaVersion(getClass.getClassLoader) def getScalaVersion(loader: ClassLoader): String = loadProperties(loader, "library.properties").getProperty("version.number") lazy val AppVersion = loadProperties(getClass.getClassLoader, "xsbt.version.properties").getProperty("version") diff --git a/scripted/plugin/Scripted.scala b/scripted/plugin/Scripted.scala index a59bf1976..6c414759c 100644 --- a/scripted/plugin/Scripted.scala +++ b/scripted/plugin/Scripted.scala @@ -120,10 +120,10 @@ object CompatibilityLevel extends Enumeration def defaultVersions(level: Value) = level match { - case Full => "2.7.2 2.7.3 2.7.5 2.7.7 2.8.0.Beta1 2.8.0.RC1 2.8.0.RC2 2.8.0-SNAPSHOT" - case Basic => "2.7.7 2.7.2 2.8.0.RC2" - case Minimal => "2.7.7 2.8.0.RC2" + case Full => "2.7.4 2.7.7 2.8.0 2.8.1 2.9.0.RC1" + case Basic => "2.7.7 2.7.4 2.8.1" + case Minimal => "2.7.7 2.8.1" case Minimal27 => "2.7.7" - case Minimal28 => "2.8.0.RC2" + case Minimal28 => "2.8.1" } } \ No newline at end of file diff --git a/scripted/sbt/ScriptedTests.scala b/scripted/sbt/ScriptedTests.scala index 2538f2e81..62741dc57 100644 --- a/scripted/sbt/ScriptedTests.scala +++ b/scripted/sbt/ScriptedTests.scala @@ -164,10 +164,10 @@ object CompatibilityLevel extends Enumeration def defaultVersions(level: Value) = level match { - case Full => "2.7.2 2.7.3 2.7.5 2.7.7 2.8.0.Beta1 2.8.0.RC1 2.8.0.RC2 2.8.0-SNAPSHOT" - case Basic => "2.7.7 2.7.2 2.8.0.RC2" - case Minimal => "2.7.7 2.8.0.RC2" + case Full => "2.7.4 2.7.7 2.9.0.RC1 2.8.0 2.8.1" + case Basic => "2.7.7 2.7.4 2.8.1 2.8.0" + case Minimal => "2.7.7 2.8.1" case Minimal27 => "2.7.7" - case Minimal28 => "2.8.0.RC2" + case Minimal28 => "2.8.1" } } \ No newline at end of file