mirror of https://github.com/sbt/sbt.git
Merge pull request #1336 from sbt/wip/compile-with-2.11
Bump expected 2.11 module versions so we can compile with 2.11
This commit is contained in:
commit
f402f9ac9e
|
|
@ -17,8 +17,8 @@ env:
|
|||
- SCRIPTED_TEST="scripted source-dependencies/*2of3"
|
||||
- SCRIPTED_TEST="scripted source-dependencies/*3of3"
|
||||
- SCRIPTED_TEST="scripted tests/*"
|
||||
- SCRIPTED_TEST="all launcher/test main-settings/test main/test ivy/test logic/test completion/test"
|
||||
- SCRIPTED_TEST="all actions/test classpath/test collections/test incremental-compiler/test logging/test run/test task-system/test"
|
||||
- SCRIPTED_TEST="safeUnitTests"
|
||||
- SCRIPTED_TEST="checkBuildScala211"
|
||||
# TODO - we'd like to actually test everything, but the process library has a deadlock right now
|
||||
jdk:
|
||||
- openjdk6
|
||||
|
|
|
|||
|
|
@ -165,14 +165,14 @@ class NameHashingSpecification extends Specification {
|
|||
}
|
||||
|
||||
private def assertNameHashEqualForRegularName(name: String, nameHashes1: _internalOnly_NameHashes,
|
||||
nameHashes2: _internalOnly_NameHashes): Unit = {
|
||||
nameHashes2: _internalOnly_NameHashes) = {
|
||||
val nameHash1 = nameHashForRegularName(nameHashes1, name)
|
||||
val nameHash2 = nameHashForRegularName(nameHashes1, name)
|
||||
nameHash1 === nameHash2
|
||||
}
|
||||
|
||||
private def assertNameHashNotEqualForRegularName(name: String, nameHashes1: _internalOnly_NameHashes,
|
||||
nameHashes2: _internalOnly_NameHashes): Unit = {
|
||||
nameHashes2: _internalOnly_NameHashes) = {
|
||||
val nameHash1 = nameHashForRegularName(nameHashes1, name)
|
||||
val nameHash2 = nameHashForRegularName(nameHashes2, name)
|
||||
nameHash1 !=== nameHash2
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ object ComponentManagerTest extends Specification {
|
|||
"return the files for a multi-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a", "b")
|
||||
checksum(manager.files(TestID)(Fail)) must haveTheSameElementsAs(hashes)
|
||||
checksum(manager.files(TestID)(Fail)) must containTheSameElementsAs(hashes)
|
||||
}
|
||||
}
|
||||
"return the files for a single-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a")
|
||||
checksum(manager.files(TestID)(Fail)) must haveTheSameElementsAs(hashes)
|
||||
checksum(manager.files(TestID)(Fail)) must containTheSameElementsAs(hashes)
|
||||
}
|
||||
}
|
||||
"throw an exception if 'files' is called for a non-existing component" in {
|
||||
|
|
|
|||
|
|
@ -51,8 +51,12 @@ object LocksTest extends Properties("Locks") {
|
|||
(true /: forkWait(n)(impl))(_ && _)
|
||||
private def forkWait(n: Int)(impl: Int => Boolean): Iterable[Boolean] =
|
||||
{
|
||||
import scala.concurrent.ops.future
|
||||
val futures = (0 until n).map { i => future { impl(i) } }
|
||||
futures.toList.map(_())
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.Await
|
||||
import scala.concurrent.duration.Duration.Inf
|
||||
// TODO - Don't wait forever...
|
||||
val futures = (0 until n).map { i => Future { impl(i) } }
|
||||
futures.toList.map(f => Await.result(f, Inf))
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +59,8 @@ object ScalaProviderTest extends Specification {
|
|||
testResources.foreach(resource => touch(new File(resourceDirectory, resource.replace('/', File.separatorChar))))
|
||||
Array(resourceDirectory)
|
||||
}
|
||||
private def checkScalaLoader(version: String): Unit = withLauncher(checkLauncher(version, mapScalaVersion(version)))
|
||||
private def checkLauncher(version: String, versionValue: String)(launcher: Launcher): Unit =
|
||||
private def checkScalaLoader(version: String) = withLauncher(checkLauncher(version, mapScalaVersion(version)))
|
||||
private def checkLauncher(version: String, versionValue: String)(launcher: Launcher) =
|
||||
{
|
||||
val provider = launcher.getScala(version)
|
||||
val loader = provider.loader
|
||||
|
|
@ -68,7 +68,7 @@ object ScalaProviderTest extends Specification {
|
|||
tryScala(loader)
|
||||
getScalaVersion(loader) must beEqualTo(versionValue)
|
||||
}
|
||||
private def tryScala(loader: ClassLoader): Unit = Class.forName("scala.Product", false, loader).getClassLoader must be(loader)
|
||||
private def tryScala(loader: ClassLoader) = Class.forName("scala.Product", false, loader).getClassLoader must be(loader)
|
||||
}
|
||||
object LaunchTest {
|
||||
def testApp(main: String): Application = testApp(main, Array[File]())
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ val p = {
|
|||
|
||||
property("explicit import") = forAll(testImport("import math.abs" :: Nil))
|
||||
property("wildcard import") = forAll(testImport("import math._" :: Nil))
|
||||
property("comma-separated imports") = forAll(testImport("import util._, math._, xml._" :: Nil))
|
||||
property("multiple imports") = forAll(testImport("import util._" :: "import math._" :: "import xml._" :: Nil))
|
||||
property("comma-separated imports") = forAll(testImport("import annotation._, math._, meta._" :: Nil))
|
||||
property("multiple imports") = forAll(testImport("import annotation._" :: "import math._" :: "import meta._" :: Nil))
|
||||
|
||||
private[this] def testImport(imports: Seq[String]): Int => Prop = i =>
|
||||
value(eval.eval("abs(" + i + ")", new EvalImports(imports.zipWithIndex, "imp"))) == math.abs(i)
|
||||
|
|
|
|||
|
|
@ -106,17 +106,30 @@ object ParseKey extends Properties("Key parser test") {
|
|||
f(parsed)
|
||||
}
|
||||
|
||||
def genStructure(implicit genEnv: Gen[Env]): Gen[Structure] =
|
||||
// Here we're shadowing the in-scope implicit called `mkEnv` for this method
|
||||
// so that it will use the passed-in `Gen` rather than the one imported
|
||||
// from TestBuild.
|
||||
def genStructure(implicit mkEnv: Gen[Env]): Gen[Structure] =
|
||||
structureGenF { (scopes: Seq[Scope], env: Env, current: ProjectRef) =>
|
||||
val settings = for (scope <- scopes; t <- env.tasks) yield Def.setting(ScopedKey(scope, t.key), Def.value(""))
|
||||
val settings =
|
||||
for {
|
||||
scope <- scopes
|
||||
t <- env.tasks
|
||||
} yield Def.setting(ScopedKey(scope, t.key), Def.value(""))
|
||||
TestBuild.structure(env, settings, current)
|
||||
}
|
||||
|
||||
def structureGenF(f: (Seq[Scope], Env, ProjectRef) => Structure)(implicit genEnv: Gen[Env]): Gen[Structure] =
|
||||
// Here we're shadowing the in-scope implicit called `mkEnv` for this method
|
||||
// so that it will use the passed-in `Gen` rather than the one imported
|
||||
// from TestBuild.
|
||||
def structureGenF(f: (Seq[Scope], Env, ProjectRef) => Structure)(implicit mkEnv: Gen[Env]): Gen[Structure] =
|
||||
structureGen((s, e, p) => Gen.value(f(s, e, p)))
|
||||
def structureGen(f: (Seq[Scope], Env, ProjectRef) => Gen[Structure])(implicit genEnv: Gen[Env]): Gen[Structure] =
|
||||
// Here we're shadowing the in-scope implicit called `mkEnv` for this method
|
||||
// so that it will use the passed-in `Gen` rather than the one imported
|
||||
// from TestBuild.
|
||||
def structureGen(f: (Seq[Scope], Env, ProjectRef) => Gen[Structure])(implicit mkEnv: Gen[Env]): Gen[Structure] =
|
||||
for {
|
||||
env <- genEnv
|
||||
env <- mkEnv
|
||||
loadFactor <- choose(0.0, 1.0)
|
||||
scopes <- pickN(loadFactor, env.allFullScopes)
|
||||
current <- oneOf(env.allProjects.unzip._1)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,20 @@ object Sbt extends Build {
|
|||
concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
||||
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||
incOptions := incOptions.value.withNameHashing(true)
|
||||
incOptions := incOptions.value.withNameHashing(true),
|
||||
commands += Command.command("checkBuildScala211") { state =>
|
||||
"""set scalaVersion in ThisBuild := "2.11.0" """ ::
|
||||
"set Util.includeTestDependencies in ThisBuild := true" ::
|
||||
// First compile everything before attempting to test
|
||||
"all compile test:compile" ::
|
||||
// Now run known working tests.
|
||||
"safeUnitTests" ::
|
||||
state
|
||||
},
|
||||
commands += Command.command("safeUnitTests") { state =>
|
||||
"all launcher/test main-settings/test main/test ivy/test logic/test completion/test actions/test classpath/test collections/test incremental-compiler/test logging/test run/test task-system/test" ::
|
||||
state
|
||||
}
|
||||
)
|
||||
|
||||
lazy val myProvided = config("provided") intransitive;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ object Util {
|
|||
)
|
||||
def commonSettings(nameString: String) = Seq(
|
||||
crossVersion in update <<= (crossVersion, nightly211) { (cv, n) => if (n) CrossVersion.full else cv },
|
||||
name := nameString
|
||||
name := nameString,
|
||||
resolvers += Resolver.typesafeIvyRepo("releases")
|
||||
)
|
||||
def minProject(path: File, nameString: String) = Project(normalize(nameString), path) settings (commonSettings(nameString) ++ publishPomSettings: _*)
|
||||
def baseProject(path: File, nameString: String) = minProject(path, nameString) settings (base: _*)
|
||||
|
|
@ -49,8 +50,8 @@ object Util {
|
|||
|
||||
def testDependencies = libraryDependencies <++= includeTestDependencies { incl =>
|
||||
if (incl) Seq(
|
||||
"org.scalacheck" %% "scalacheck" % "1.11.1" % "test",
|
||||
"org.specs2" %% "specs2" % "1.12.3" % "test",
|
||||
"org.scalacheck" %% "scalacheck" % "1.11.4" % "test",
|
||||
"org.specs2" %% "specs2" % "2.3.11" % "test",
|
||||
"junit" % "junit" % "4.11" % "test"
|
||||
)
|
||||
else Seq()
|
||||
|
|
@ -169,7 +170,7 @@ object Common {
|
|||
lazy val ivy = lib("org.scala-sbt.ivy" % "ivy" % "2.4.0-sbt-d6fca11d63402c92e4167cdf2da91a660d043392")
|
||||
lazy val httpclient = lib("commons-httpclient" % "commons-httpclient" % "3.1")
|
||||
lazy val jsch = lib("com.jcraft" % "jsch" % "0.1.46" intransitive ())
|
||||
lazy val sbinary = libraryDependencies <+= Util.nightly211(n => "org.scala-tools.sbinary" % "sbinary" % "0.4.2" cross (if (n) CrossVersion.full else CrossVersion.binary))
|
||||
lazy val sbinary = libraryDependencies += "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
|
||||
lazy val scalaCompiler = libraryDependencies <+= scalaVersion(sv => "org.scala-lang" % "scala-compiler" % sv)
|
||||
lazy val testInterface = lib("org.scala-sbt" % "test-interface" % "1.0")
|
||||
private def scala211Module(name: String, moduleVersion: String) =
|
||||
|
|
@ -177,8 +178,8 @@ object Common {
|
|||
if (scalaVersion startsWith "2.11.") ("org.scala-lang.modules" %% name % moduleVersion) :: Nil
|
||||
else Nil
|
||||
)
|
||||
lazy val scalaXml = scala211Module("scala-xml", "1.0.0-RC7")
|
||||
lazy val scalaParsers = scala211Module("scala-parser-combinators", "1.0.0-RC5")
|
||||
lazy val scalaXml = scala211Module("scala-xml", "1.0.1")
|
||||
lazy val scalaParsers = scala211Module("scala-parser-combinators", "1.0.1")
|
||||
}
|
||||
object Licensed {
|
||||
lazy val notice = SettingKey[File]("notice")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ object CheckStash extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
def checkRestore(seq: Seq[File]) {
|
||||
def checkRestore(seq: Seq[File]) = {
|
||||
allCorrect(seq)
|
||||
|
||||
stash0(seq, throw new TestRuntimeException) must beFalse
|
||||
|
|
@ -38,7 +38,7 @@ object CheckStash extends Specification {
|
|||
stash0(seq, throw new TestError) must beFalse
|
||||
noneExist(seq)
|
||||
}
|
||||
def checkMove(seq: Seq[File]) {
|
||||
def checkMove(seq: Seq[File]) = {
|
||||
allCorrect(seq)
|
||||
stash0(seq, ()) must beTrue
|
||||
noneExist(seq)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ object Escape {
|
|||
def pad(s: String, minLength: Int, extra: Char) =
|
||||
{
|
||||
val diff = minLength - s.length
|
||||
if (diff <= 0) s else List.make(diff, extra).mkString("", "", s)
|
||||
if (diff <= 0) s else List.fill(diff)(extra).mkString("", "", s)
|
||||
}
|
||||
/** Replaces a \n character at the end of a string `s` with `nl`.*/
|
||||
def newline(s: String, nl: String): String =
|
||||
|
|
|
|||
Loading…
Reference in New Issue