mirror of https://github.com/sbt/sbt.git
Use Scala 2.12.1
Bump up the Scala version used by sbt to 2.12.1. Most changes are migration of the integration tests.
This commit is contained in:
parent
69385029ed
commit
7ddbd69e53
12
build.sbt
12
build.sbt
|
|
@ -34,7 +34,7 @@ def buildLevelSettings: Seq[Setting[_]] = inThisBuild(Seq(
|
||||||
))
|
))
|
||||||
|
|
||||||
def commonSettings: Seq[Setting[_]] = Seq[SettingsDefinition](
|
def commonSettings: Seq[Setting[_]] = Seq[SettingsDefinition](
|
||||||
scalaVersion := scala211,
|
scalaVersion := baseScalaVersion,
|
||||||
componentID := None,
|
componentID := None,
|
||||||
resolvers += Resolver.typesafeIvyRepo("releases"),
|
resolvers += Resolver.typesafeIvyRepo("releases"),
|
||||||
resolvers += Resolver.sonatypeRepo("snapshots"),
|
resolvers += Resolver.sonatypeRepo("snapshots"),
|
||||||
|
|
@ -43,7 +43,7 @@ def commonSettings: Seq[Setting[_]] = Seq[SettingsDefinition](
|
||||||
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||||
incOptions := incOptions.value.withNameHashing(true),
|
incOptions := incOptions.value.withNameHashing(true),
|
||||||
crossScalaVersions := Seq(scala211),
|
crossScalaVersions := Seq(baseScalaVersion),
|
||||||
bintrayPackage := (bintrayPackage in ThisBuild).value,
|
bintrayPackage := (bintrayPackage in ThisBuild).value,
|
||||||
bintrayRepository := (bintrayRepository in ThisBuild).value,
|
bintrayRepository := (bintrayRepository in ThisBuild).value,
|
||||||
mimaDefaultSettings,
|
mimaDefaultSettings,
|
||||||
|
|
@ -113,7 +113,7 @@ lazy val testingProj = (project in file("testing")).
|
||||||
lazy val testAgentProj = (project in file("testing") / "agent").
|
lazy val testAgentProj = (project in file("testing") / "agent").
|
||||||
settings(
|
settings(
|
||||||
minimalSettings,
|
minimalSettings,
|
||||||
crossScalaVersions := Seq(scala211),
|
crossScalaVersions := Seq(baseScalaVersion),
|
||||||
crossPaths := false,
|
crossPaths := false,
|
||||||
autoScalaLibrary := false,
|
autoScalaLibrary := false,
|
||||||
name := "Test Agent",
|
name := "Test Agent",
|
||||||
|
|
@ -228,7 +228,7 @@ lazy val sbtProj = (project in file("sbt")).
|
||||||
baseSettings,
|
baseSettings,
|
||||||
name := "sbt",
|
name := "sbt",
|
||||||
normalizedName := "sbt",
|
normalizedName := "sbt",
|
||||||
crossScalaVersions := Seq(scala211),
|
crossScalaVersions := Seq(baseScalaVersion),
|
||||||
crossPaths := false
|
crossPaths := false
|
||||||
).
|
).
|
||||||
configure(addSbtCompilerBridge)
|
configure(addSbtCompilerBridge)
|
||||||
|
|
@ -341,8 +341,8 @@ lazy val otherProjects: ScopeFilter = ScopeFilter(
|
||||||
)
|
)
|
||||||
|
|
||||||
def customCommands: Seq[Setting[_]] = Seq(
|
def customCommands: Seq[Setting[_]] = Seq(
|
||||||
commands += Command.command("setupBuildScala211") { state =>
|
commands += Command.command("setupBuildScala212") { state =>
|
||||||
s"""set scalaVersion in ThisBuild := "$scala211" """ ::
|
s"""set scalaVersion in ThisBuild := "$scala212" """ ::
|
||||||
state
|
state
|
||||||
},
|
},
|
||||||
safeUnitTests := {
|
safeUnitTests := {
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ import scala.tools.nsc.reporters.StoreReporter
|
||||||
|
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
||||||
object EvalTest extends Properties("eval") {
|
class EvalTest extends Properties("eval") {
|
||||||
private[this] val reporter = new StoreReporter
|
private[this] lazy val reporter = new StoreReporter
|
||||||
import reporter.{ ERROR, Info }
|
import reporter.{ ERROR, Info }
|
||||||
private[this] val eval = new Eval(_ => reporter, None)
|
private[this] lazy val eval = new Eval(_ => reporter, None)
|
||||||
|
|
||||||
property("inferred integer") = forAll { (i: Int) =>
|
property("inferred integer") = forAll { (i: Int) =>
|
||||||
val result = eval.eval(i.toString)
|
val result = eval.eval(i.toString)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ checkPom := {
|
||||||
val tpe = pom \\ "type"
|
val tpe = pom \\ "type"
|
||||||
|
|
||||||
if(!tpe.isEmpty)
|
if(!tpe.isEmpty)
|
||||||
error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||||
}
|
}
|
||||||
val b = ( <b/>)
|
val b = ( <b/>)
|
||||||
val a = <aaa
|
val a = <aaa
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ lazy val checkPom = taskKey[Unit]("check pom to ensure no <type> sections are ge
|
||||||
val pom = xml.XML.loadFile(pomFile)
|
val pom = xml.XML.loadFile(pomFile)
|
||||||
val tpe = pom \\ "type"
|
val tpe = pom \\ "type"
|
||||||
if(!tpe.isEmpty)
|
if(!tpe.isEmpty)
|
||||||
error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||||
}
|
}
|
||||||
|
|
||||||
val b = ( <b/>)
|
val b = ( <b/>)
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,8 @@ object ParseKey extends Properties("Key parser test") {
|
||||||
structure <- f(scopes, env, current)
|
structure <- f(scopes, env, current)
|
||||||
} yield structure
|
} yield structure
|
||||||
|
|
||||||
|
// pickN is a function that randomly picks load % items from the from sequence.
|
||||||
|
// The rest of the tests expect at least one item, so I changed it to return 1 in case of 0.
|
||||||
def pickN[T](load: Double, from: Seq[T]): Gen[Seq[T]] =
|
def pickN[T](load: Double, from: Seq[T]): Gen[Seq[T]] =
|
||||||
pick((load * from.size).toInt, from)
|
pick(Math.max((load * from.size).toInt, 1), from)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ import Gen._
|
||||||
|
|
||||||
// Notes:
|
// Notes:
|
||||||
// Generator doesn't produce cross-build project dependencies or do anything with the 'extra' axis
|
// Generator doesn't produce cross-build project dependencies or do anything with the 'extra' axis
|
||||||
object TestBuild {
|
object TestBuild extends TestBuild
|
||||||
|
abstract class TestBuild {
|
||||||
val MaxTasks = 6
|
val MaxTasks = 6
|
||||||
val MaxProjects = 7
|
val MaxProjects = 7
|
||||||
val MaxConfigs = 5
|
val MaxConfigs = 5
|
||||||
|
|
@ -32,6 +33,7 @@ object TestBuild {
|
||||||
|
|
||||||
implicit val cGen = Arbitrary { genConfigs(idGen, MaxDepsGen, MaxConfigsGen) }
|
implicit val cGen = Arbitrary { genConfigs(idGen, MaxDepsGen, MaxConfigsGen) }
|
||||||
implicit val tGen = Arbitrary { genTasks(idGen, MaxDepsGen, MaxTasksGen) }
|
implicit val tGen = Arbitrary { genTasks(idGen, MaxDepsGen, MaxTasksGen) }
|
||||||
|
val seed = rng.Seed.random
|
||||||
|
|
||||||
final class Keys(val env: Env, val scopes: Seq[Scope]) {
|
final class Keys(val env: Env, val scopes: Seq[Scope]) {
|
||||||
override def toString = env + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "")
|
override def toString = env + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "")
|
||||||
|
|
@ -53,7 +55,13 @@ object TestBuild {
|
||||||
new BuildUtil(keyIndex, data, env.root.uri, env.rootProject, getp, _.configurations.map(c => ConfigKey(c.name)), Relation.empty)
|
new BuildUtil(keyIndex, data, env.root.uri, env.rootProject, getp, _.configurations.map(c => ConfigKey(c.name)), Relation.empty)
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val allAttributeKeys: Set[AttributeKey[_]] = data.data.values.flatMap(_.keys).toSet
|
lazy val allAttributeKeys: Set[AttributeKey[_]] = {
|
||||||
|
val x = data.data.values.flatMap(_.keys).toSet
|
||||||
|
if (x.isEmpty) {
|
||||||
|
sys.error("allAttributeKeys is empty")
|
||||||
|
}
|
||||||
|
x
|
||||||
|
}
|
||||||
lazy val (taskAxes, globalTaskAxis, onlyTaskAxis, multiTaskAxis) =
|
lazy val (taskAxes, globalTaskAxis, onlyTaskAxis, multiTaskAxis) =
|
||||||
{
|
{
|
||||||
import collection.mutable
|
import collection.mutable
|
||||||
|
|
@ -170,6 +178,15 @@ object TestBuild {
|
||||||
def structure(env: Env, settings: Seq[Setting[_]], current: ProjectRef): Structure =
|
def structure(env: Env, settings: Seq[Setting[_]], current: ProjectRef): Structure =
|
||||||
{
|
{
|
||||||
implicit val display = Def.showRelativeKey(current, env.allProjects.size > 1)
|
implicit val display = Def.showRelativeKey(current, env.allProjects.size > 1)
|
||||||
|
if (settings.isEmpty) {
|
||||||
|
try {
|
||||||
|
sys.error("settings is empty")
|
||||||
|
} catch {
|
||||||
|
case e: Throwable =>
|
||||||
|
e.printStackTrace
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
val data = Def.make(settings)(env.delegates, const(Nil), display)
|
val data = Def.make(settings)(env.delegates, const(Nil), display)
|
||||||
val keys = data.allKeys((s, key) => ScopedKey(s, key))
|
val keys = data.allKeys((s, key) => ScopedKey(s, key))
|
||||||
val keyMap = keys.map(k => (k.key.label, k.key)).toMap[String, AttributeKey[_]]
|
val keyMap = keys.map(k => (k.key.label, k.key)).toMap[String, AttributeKey[_]]
|
||||||
|
|
@ -246,7 +263,7 @@ object TestBuild {
|
||||||
genAcyclic(maxDeps, xs, next :: acc)
|
genAcyclic(maxDeps, xs, next :: acc)
|
||||||
}
|
}
|
||||||
def sequence[T](gs: Seq[Gen[T]]): Gen[Seq[T]] = Gen.parameterized { prms =>
|
def sequence[T](gs: Seq[Gen[T]]): Gen[Seq[T]] = Gen.parameterized { prms =>
|
||||||
wrap(gs map { g => g(prms) getOrElse sys.error("failed generator") })
|
delay(gs map { g => g(prms, seed) getOrElse sys.error("failed generator") })
|
||||||
}
|
}
|
||||||
type Inputs[A, T] = (T, Seq[T], Seq[A] => A)
|
type Inputs[A, T] = (T, Seq[T], Seq[A] => A)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ class EmbeddedXmlSpec extends CheckIfParsedSpec {
|
||||||
| val pom = xml.XML.loadFile(pomFile)
|
| val pom = xml.XML.loadFile(pomFile)
|
||||||
| val tpe = pom \\ "type"
|
| val tpe = pom \\ "type"
|
||||||
| if(!tpe.isEmpty)
|
| if(!tpe.isEmpty)
|
||||||
| error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
| sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||||
|}
|
|}
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import sbt.internal.util.MessageOnlyException
|
||||||
|
|
||||||
import scala.io.Source
|
import scala.io.Source
|
||||||
|
|
||||||
class ErrorSpec extends AbstractSpec with ScalaCheck {
|
class ErrorSpec extends AbstractSpec {
|
||||||
implicit val splitter: SplitExpressions.SplitExpression = EvaluateConfigurations.splitExpressions
|
implicit val splitter: SplitExpressions.SplitExpression = EvaluateConfigurations.splitExpressions
|
||||||
|
|
||||||
"Parser " should {
|
"Parser " should {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ object Dependencies {
|
||||||
val scala293 = "2.9.3"
|
val scala293 = "2.9.3"
|
||||||
val scala210 = "2.10.6"
|
val scala210 = "2.10.6"
|
||||||
val scala211 = "2.11.8"
|
val scala211 = "2.11.8"
|
||||||
|
val scala212 = "2.12.1"
|
||||||
|
val baseScalaVersion = scala212
|
||||||
|
|
||||||
// sbt modules
|
// sbt modules
|
||||||
private val ioVersion = "1.0.0-M9"
|
private val ioVersion = "1.0.0-M9"
|
||||||
|
|
@ -87,8 +89,8 @@ object Dependencies {
|
||||||
|
|
||||||
val sjsonNewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % "0.7.0"
|
val sjsonNewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % "0.7.0"
|
||||||
|
|
||||||
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.11.4"
|
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4"
|
||||||
val specs2 = "org.specs2" %% "specs2" % "2.3.11"
|
val specs2 = "org.specs2" %% "specs2" % "2.4.17"
|
||||||
val junit = "junit" % "junit" % "4.11"
|
val junit = "junit" % "junit" % "4.11"
|
||||||
|
|
||||||
private def scala211Module(name: String, moduleVersion: String) = Def setting (
|
private def scala211Module(name: String, moduleVersion: String) = Def setting (
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ object Util {
|
||||||
"-language:implicitConversions",
|
"-language:implicitConversions",
|
||||||
"-language:postfixOps",
|
"-language:postfixOps",
|
||||||
"-Xfuture",
|
"-Xfuture",
|
||||||
"-Yinline-warnings",
|
|
||||||
"-Yno-adapted-args",
|
"-Yno-adapted-args",
|
||||||
"-Ywarn-dead-code",
|
"-Ywarn-dead-code",
|
||||||
"-Ywarn-numeric-widen",
|
"-Ywarn-numeric-widen",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ object Marker extends AutoPlugin {
|
||||||
final def mark(baseKey: SettingKey[File]): Initialize[Task[Unit]] = baseKey map { base =>
|
final def mark(baseKey: SettingKey[File]): Initialize[Task[Unit]] = baseKey map { base =>
|
||||||
val toMark = base / "ran"
|
val toMark = base / "ran"
|
||||||
if(toMark.exists)
|
if(toMark.exists)
|
||||||
error("Already ran (" + toMark + " exists)")
|
sys.error("Already ran (" + toMark + " exists)")
|
||||||
else
|
else
|
||||||
IO touch toMark
|
IO touch toMark
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
|
|
||||||
lazy val rootProj = (project in file(".")).
|
lazy val rootProj = (project in file(".")).
|
||||||
aggregate(libProj, fooPlugin)
|
aggregate(libProj, fooPlugin).
|
||||||
|
settings(
|
||||||
|
scalaVersion := "2.12.1"
|
||||||
|
)
|
||||||
|
|
||||||
lazy val libProj = (project in file("lib")).
|
lazy val libProj = (project in file("lib")).
|
||||||
settings(
|
settings(
|
||||||
name := "foo-lib",
|
name := "foo-lib",
|
||||||
scalaVersion := "2.11.8",
|
scalaVersion := "2.12.1",
|
||||||
crossScalaVersions := Seq("2.11.8", "2.10.4")
|
crossScalaVersions := Seq("2.12.1", "2.11.8")
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val fooPlugin =(project in file("sbt-foo")).
|
lazy val fooPlugin =(project in file("sbt-foo")).
|
||||||
settings(
|
settings(
|
||||||
name := "sbt-foo",
|
name := "sbt-foo",
|
||||||
sbtPlugin := true,
|
sbtPlugin := true,
|
||||||
scalaVersion := "2.10.4",
|
scalaVersion := "2.12.1",
|
||||||
crossScalaVersions := Seq("2.10.4")
|
crossScalaVersions := Seq("2.12.1")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,38 @@
|
||||||
> + compile
|
> + compile
|
||||||
|
|
||||||
|
$ exists lib/target/scala-2.12
|
||||||
$ exists lib/target/scala-2.11
|
$ exists lib/target/scala-2.11
|
||||||
$ exists lib/target/scala-2.10
|
$ exists sbt-foo/target/scala-2.12
|
||||||
$ exists sbt-foo/target/scala-2.10
|
|
||||||
-$ exists sbt-foo/target/scala-2.11
|
-$ exists sbt-foo/target/scala-2.11
|
||||||
|
|
||||||
> clean
|
> clean
|
||||||
> + libProj/compile
|
> + libProj/compile
|
||||||
|
|
||||||
|
$ exists lib/target/scala-2.12
|
||||||
$ exists lib/target/scala-2.11
|
$ exists lib/target/scala-2.11
|
||||||
$ exists lib/target/scala-2.10
|
-$ exists sbt-foo/target/scala-2.12
|
||||||
-$ exists sbt-foo/target/scala-2.10
|
|
||||||
-$ exists sbt-foo/target/scala-2.11
|
-$ exists sbt-foo/target/scala-2.11
|
||||||
|
|
||||||
> clean
|
> clean
|
||||||
> ++ 2.11.1 compile
|
> ++ 2.12.1 compile
|
||||||
|
|
||||||
$ exists lib/target/scala-2.11
|
|
||||||
-$ exists lib/target/scala-2.10
|
|
||||||
$ exists sbt-foo/target/scala-2.10
|
|
||||||
-$ exists sbt-foo/target/scala-2.11
|
|
||||||
|
|
||||||
> clean
|
|
||||||
> ++ 2.10.4 compile
|
|
||||||
|
|
||||||
|
$ exists lib/target/scala-2.12
|
||||||
-$ exists lib/target/scala-2.11
|
-$ exists lib/target/scala-2.11
|
||||||
$ exists lib/target/scala-2.10
|
$ exists sbt-foo/target/scala-2.12
|
||||||
$ exists sbt-foo/target/scala-2.10
|
|
||||||
-$ exists sbt-foo/target/scala-2.11
|
-$ exists sbt-foo/target/scala-2.11
|
||||||
|
|
||||||
> clean
|
> clean
|
||||||
> ++ 2.11.5 compile
|
> ++ 2.11.8 -v compile
|
||||||
|
|
||||||
$ exists lib/target/scala-2.11
|
$ exists lib/target/scala-2.11
|
||||||
-$ exists lib/target/scala-2.10
|
-$ exists lib/target/scala-2.12
|
||||||
$ exists sbt-foo/target/scala-2.10
|
# -$ exists sbt-foo/target/scala-2.12
|
||||||
-$ exists sbt-foo/target/scala-2.11
|
-$ exists sbt-foo/target/scala-2.11
|
||||||
|
|
||||||
> clean
|
# > clean
|
||||||
> ++ 2.11.5! compile
|
# > ++ 2.11.8! compile
|
||||||
|
|
||||||
$ exists lib/target/scala-2.11
|
# $ exists lib/target/scala-2.11
|
||||||
-$ exists lib/target/scala-2.10
|
# -$ exists lib/target/scala-2.12
|
||||||
-$ exists sbt-foo/target/scala-2.10
|
# -$ exists sbt-foo/target/scala-2.12
|
||||||
$ exists sbt-foo/target/scala-2.11
|
# $ exists sbt-foo/target/scala-2.11
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
organization := "org.example"
|
|
||||||
|
|
||||||
name := "artifacta"
|
|
||||||
|
|
||||||
version := "1.0.0-SNAPSHOT"
|
|
||||||
|
|
||||||
publishArtifact in (Test,packageBin) := true
|
|
||||||
|
|
||||||
publishTo := Some(MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")))
|
|
||||||
|
|
||||||
//Resolver.file("demo", (baseDirectory in ThisBuild).value / "demo-repo"))
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests")
|
|
||||||
|
|
||||||
externalResolvers := Seq(
|
|
||||||
MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")),
|
|
||||||
DefaultMavenRepository
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,24 @@
|
||||||
def localCache =
|
def localCache =
|
||||||
ivyPaths := IvyPaths(baseDirectory.value, Some((baseDirectory in ThisBuild).value / "ivy" / "cache"))
|
ivyPaths := IvyPaths(baseDirectory.value, Some((baseDirectory in ThisBuild).value / "ivy" / "cache"))
|
||||||
|
|
||||||
val b = project.settings(localCache)
|
val b = project
|
||||||
|
.settings(
|
||||||
|
localCache,
|
||||||
|
scalaVersion := "2.11.8",
|
||||||
|
libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests"),
|
||||||
|
externalResolvers := Seq(
|
||||||
|
MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")),
|
||||||
|
DefaultMavenRepository
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val a = project.settings(localCache)
|
val a = project
|
||||||
|
.settings(
|
||||||
|
localCache,
|
||||||
|
scalaVersion := "2.11.8",
|
||||||
|
organization := "org.example",
|
||||||
|
name := "artifacta",
|
||||||
|
version := "1.0.0-SNAPSHOT",
|
||||||
|
publishArtifact in (Test,packageBin) := true,
|
||||||
|
publishTo := Some(MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")))
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ def check(ver: String) =
|
||||||
case f if f.getName contains "log4j-" => f.getName
|
case f if f.getName contains "log4j-" => f.getName
|
||||||
}
|
}
|
||||||
if (log4j.size != 1 || !log4j.head.contains(ver))
|
if (log4j.size != 1 || !log4j.head.contains(ver))
|
||||||
error("Did not download the correct jar.")
|
sys.error("Did not download the correct jar.")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,5 @@ def checkPomRepositories(file: File, args: Seq[String], s: TaskStreams)
|
||||||
s.log.info("Extracted: " + extracted.mkString("\n\t", "\n\t", "\n"))
|
s.log.info("Extracted: " + extracted.mkString("\n\t", "\n\t", "\n"))
|
||||||
s.log.info("Expected: " + args.mkString("\n\t", "\n\t", "\n"))
|
s.log.info("Expected: " + args.mkString("\n\t", "\n\t", "\n"))
|
||||||
extracted.find { e => !expected.exists(_.accept(e.root)) } map { "Repository should not be exported: " + _ } orElse
|
extracted.find { e => !expected.exists(_.accept(e.root)) } map { "Repository should not be exported: " + _ } orElse
|
||||||
(expected.find { e => !extracted.exists(r => e.accept(r.root)) } map { "Repository should be exported: " + _ } ) foreach error
|
(expected.find { e => !extracted.exists(r => e.accept(r.root)) } map { "Repository should be exported: " + _ } ) foreach sys.error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ lazy val sharedResolver: Resolver = {
|
||||||
lazy val common = project.
|
lazy val common = project.
|
||||||
settings(customIvyPaths: _*).
|
settings(customIvyPaths: _*).
|
||||||
settings(
|
settings(
|
||||||
|
scalaVersion := "2.11.8",
|
||||||
organization := "com.badexample",
|
organization := "com.badexample",
|
||||||
name := "badexample",
|
name := "badexample",
|
||||||
version := "1.0-SNAPSHOT",
|
version := "1.0-SNAPSHOT",
|
||||||
|
|
@ -29,6 +30,7 @@ lazy val common = project.
|
||||||
lazy val dependent = project.
|
lazy val dependent = project.
|
||||||
settings(customIvyPaths: _*).
|
settings(customIvyPaths: _*).
|
||||||
settings(
|
settings(
|
||||||
|
scalaVersion := "2.11.8",
|
||||||
// Uncomment the following to test the before/after
|
// Uncomment the following to test the before/after
|
||||||
// updateOptions := updateOptions.value.withLatestSnapshots(false),
|
// updateOptions := updateOptions.value.withLatestSnapshots(false),
|
||||||
// Ignore the inter-project resolver, so we force to look remotely.
|
// Ignore the inter-project resolver, so we force to look remotely.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ TaskKey[Unit]("checkUpdate") := {
|
||||||
val mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet
|
val mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet
|
||||||
val expected = Set("org.sat4j.pb", "org.sat4j.core")
|
val expected = Set("org.sat4j.pb", "org.sat4j.core")
|
||||||
if(mods != expected)
|
if(mods != expected)
|
||||||
error("Expected modules " + expected + ", got: " + mods)
|
sys.error("Expected modules " + expected + ", got: " + mods)
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskKey[Unit]("checkClasspath") := (dependencyClasspath in Compile map { cp =>
|
TaskKey[Unit]("checkClasspath") := (dependencyClasspath in Compile map { cp =>
|
||||||
|
|
@ -20,5 +20,5 @@ TaskKey[Unit]("checkClasspath") := (dependencyClasspath in Compile map { cp =>
|
||||||
// Note: pb depends on tests artifact in core for no good reason. Previously this was not correctly added to the classpath.
|
// Note: pb depends on tests artifact in core for no good reason. Previously this was not correctly added to the classpath.
|
||||||
val expected = Set("org.sat4j.pb-2.3.1.jar", "org.sat4j.core-2.3.1.jar", "org.sat4j.core-2.3.1-tests.jar")
|
val expected = Set("org.sat4j.pb-2.3.1.jar", "org.sat4j.core-2.3.1.jar", "org.sat4j.core-2.3.1-tests.jar")
|
||||||
if(jars != expected)
|
if(jars != expected)
|
||||||
error("Expected jars " + expected + ", got: " + jars)
|
sys.error("Expected jars " + expected + ", got: " + jars)
|
||||||
}).value
|
}).value
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
val shouldExist = parser.parsed
|
val shouldExist = parser.parsed
|
||||||
val dir = (classDirectory in Compile).value
|
val dir = (classDirectory in Compile).value
|
||||||
if((dir / "Anon.class").exists != shouldExist)
|
if((dir / "Anon.class").exists != shouldExist)
|
||||||
error("Top level class incorrect" )
|
sys.error("Top level class incorrect" )
|
||||||
else if( (dir / "Anon$1.class").exists != shouldExist)
|
else if( (dir / "Anon$1.class").exists != shouldExist)
|
||||||
error("Inner class incorrect" )
|
sys.error("Inner class incorrect" )
|
||||||
else
|
else
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ val root = (project in file("."))
|
||||||
|
|
||||||
TaskKey[Unit]("checkScalaVersion", "test") := {
|
TaskKey[Unit]("checkScalaVersion", "test") := {
|
||||||
val sv = scalaVersion.value
|
val sv = scalaVersion.value
|
||||||
assert(sv startsWith "2.11.", s"Found $sv!")
|
assert(sv startsWith "2.12.", s"Found $sv!")
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskKey[Unit]("checkArtifacts", "test") := {
|
TaskKey[Unit]("checkArtifacts", "test") := {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
> publishLocal
|
> publishLocal
|
||||||
$ exists target/ivy-cache/local/com.example/app_2.11/0.1.0/poms/app_2.11.pom
|
$ exists target/ivy-cache/local/com.example/app_2.12/0.1.0/poms/app_2.12.pom
|
||||||
$ exists target/ivy-cache/local/com.example/app_2.11/0.1.0/jars/app_2.11.jar
|
$ exists target/ivy-cache/local/com.example/app_2.12/0.1.0/jars/app_2.12.jar
|
||||||
$ absent target/ivy-cache/local/com.example/default-root_2.11/0.1.0/ivys/ivy.xml
|
$ absent target/ivy-cache/local/com.example/default-root_2.12/0.1.0/ivys/ivy.xml
|
||||||
|
|
||||||
$ copy-file changes/bare.sbt build.sbt
|
$ copy-file changes/bare.sbt build.sbt
|
||||||
> reload
|
> reload
|
||||||
> publishLocal
|
> publishLocal
|
||||||
$ exists target/ivy-cache/local/com.example/generated-root-no-publish_2.11/0.1.0/poms/generated-root-no-publish_2.11.pom
|
$ exists target/ivy-cache/local/com.example/generated-root-no-publish_2.12/0.1.0/poms/generated-root-no-publish_2.12.pom
|
||||||
$ exists target/ivy-cache/local/com.example/generated-root-no-publish_2.11/0.1.0/jars/generated-root-no-publish_2.11.jar
|
$ exists target/ivy-cache/local/com.example/generated-root-no-publish_2.12/0.1.0/jars/generated-root-no-publish_2.12.jar
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ object Spawn
|
||||||
{
|
{
|
||||||
def main(args: Array[String])
|
def main(args: Array[String])
|
||||||
{
|
{
|
||||||
error("Test error main")
|
sys.error("Test error main")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
name := "forked-test"
|
lazy val root = (project in file("."))
|
||||||
|
.settings(
|
||||||
organization := "org.example"
|
scalaVersion in ThisBuild := "2.11.8",
|
||||||
|
name := "forked-test",
|
||||||
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" % "test"
|
organization := "org.example",
|
||||||
|
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" % Test
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ object Spawn
|
||||||
catch { case e: InterruptedException =>
|
catch { case e: InterruptedException =>
|
||||||
val msg = "TrapExit improperly interrupted non-daemon thread"
|
val msg = "TrapExit improperly interrupted non-daemon thread"
|
||||||
System.err.println(msg)
|
System.err.println(msg)
|
||||||
error(msg)
|
sys.error(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
scalaVersion in ThisBuild := "2.11.8"
|
||||||
|
|
||||||
lazy val dep = project
|
lazy val dep = project
|
||||||
|
|
||||||
lazy val use = project.
|
lazy val use = project.
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ trait Equal[-A] {
|
||||||
def equal(a1: A, a2: A): Boolean
|
def equal(a1: A, a2: A): Boolean
|
||||||
}
|
}
|
||||||
object Test {
|
object Test {
|
||||||
implicit def TraversableEqual[CC[X] <: collection.TraversableLike[X, CC[X]] with Traversable[X], A: Equal]: Equal[CC[A]] = error("")
|
implicit def TraversableEqual[CC[X] <: collection.TraversableLike[X, CC[X]] with Traversable[X], A: Equal]: Equal[CC[A]] = sys.error("")
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
libraryDependencies += "org.scalatest" % "scalatest_2.10.0-RC3" % "1.8-B1" % "test"
|
val scalatest = "org.scalatest" %% "scalatest" % "3.0.1"
|
||||||
|
|
||||||
|
lazy val root = (project in file("."))
|
||||||
testOptions in Configurations.Test ++= {
|
.settings(
|
||||||
def args(path: String, args: String*): Seq[TestOption] = if(file(path).exists) Tests.Argument(args : _*) :: Nil else Nil
|
scalaVersion in ThisBuild := "2.11.8",
|
||||||
//
|
libraryDependencies += scalatest % Test,
|
||||||
args("success1", "-n", "test2 test3") ++
|
// testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-f", "result.txt", "-eNDXEHLO")
|
||||||
args("success2", "-n", "test2") ++
|
testOptions in Configurations.Test ++= {
|
||||||
args("success3", "-n", "test3") ++
|
def args(path: String, args: String*): Seq[TestOption] =
|
||||||
args("failure1", "-n", "test1") ++
|
if(file(path).exists) Tests.Argument(args : _*) :: Nil
|
||||||
args("failure2", "-n", "test1 test4") ++
|
else Nil
|
||||||
args("failure3", "-n", "test1 test3")
|
args("success1", "-n", "test2 test3") ++
|
||||||
}
|
args("success2", "-n", "test2") ++
|
||||||
|
args("success3", "-n", "test3") ++
|
||||||
|
args("failure1", "-n", "test1") ++
|
||||||
|
args("failure2", "-n", "test1 test4") ++
|
||||||
|
args("failure3", "-n", "test1 test3")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
|
import org.scalatest._
|
||||||
import org.scalatest.fixture.FixtureFunSuite
|
|
||||||
import org.scalatest.Tag
|
import org.scalatest.Tag
|
||||||
|
import org.scalatest.fixture
|
||||||
|
|
||||||
class ArgumentTest extends FixtureFunSuite{
|
class ArgumentTest extends fixture.FunSuite {
|
||||||
type FixtureParam = Map[String,Any]
|
type FixtureParam = Map[String,Any]
|
||||||
override def withFixture(test: OneArgTest): Unit = {
|
|
||||||
test(test.configMap)
|
override def withFixture(test: OneArgTest) = {
|
||||||
|
// Perform setup
|
||||||
|
val theFixture = test.configMap
|
||||||
|
try withFixture(test.toNoArgTest(theFixture)) // Invoke the test function
|
||||||
|
finally {
|
||||||
|
// Perform cleanup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test("1", Tag("test1")){ conf => sys.error("error #1") }
|
test("1", Tag("test1")){ conf => sys.error("error #1") }
|
||||||
test("2", Tag("test2")){ conf => () }
|
test("2", Tag("test2")){ conf => () }
|
||||||
test("3", Tag("test3")){ conf => () }
|
test("3", Tag("test3")){ conf => () }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
scalaVersion in ThisBuild := "2.11.8"
|
||||||
concurrentRestrictions in Global := Seq(Tags.limitAll(4))
|
concurrentRestrictions in Global := Seq(Tags.limitAll(4))
|
||||||
|
|
||||||
libraryDependencies += "org.specs2" %% "specs2-core" % "3.8.4" % Test
|
libraryDependencies += "org.specs2" %% "specs2-core" % "3.8.4" % Test
|
||||||
|
|
||||||
inConfig(Test)(Seq(
|
inConfig(Test)(Seq(
|
||||||
testGrouping := definedTests.value.map { test => new Tests.Group(test.name, Seq(test), Tests.SubProcess(
|
testGrouping := definedTests.value.map { test => new Tests.Group(test.name, Seq(test), Tests.SubProcess(
|
||||||
ForkOptions(
|
ForkOptions(
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
scalaVersion in ThisBuild := "2.11.8"
|
||||||
parallelExecution in Test := false
|
parallelExecution in Test := false
|
||||||
|
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" % Test
|
||||||
|
|
||||||
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" % "test"
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
> compile
|
> compile
|
||||||
$ exists target/scala-2.11/classes/ch/epfl/scala/Client.class
|
$ exists target/scala-2.12/classes/ch/epfl/scala/Client.class
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue