=pro #3753 Override dependency versions from command line

This commit is contained in:
Björn Antonsson 2013-12-03 09:18:26 +01:00
parent 4d05253391
commit 00a268b6b3
9 changed files with 78 additions and 45 deletions

View file

@ -10,7 +10,7 @@ import java.util.concurrent.{ TimeUnit, CountDownLatch, ConcurrentHashMap }
import java.util.concurrent.atomic.{ AtomicLong, AtomicInteger } import java.util.concurrent.atomic.{ AtomicLong, AtomicInteger }
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.scalatest.Assertions.{ fail, assert } import org.scalatest.Assertions._
import org.scalatest.junit.JUnitRunner import org.scalatest.junit.JUnitRunner
import com.typesafe.config.Config import com.typesafe.config.Config

View file

@ -7,10 +7,9 @@ import org.scalatest.prop.Checkers
import org.scalacheck._ import org.scalacheck._
import org.scalacheck.Arbitrary._ import org.scalacheck.Arbitrary._
import org.scalacheck.Prop._ import org.scalacheck.Prop._
import org.scalacheck.Gen._
import akka.actor._ import akka.actor._
import akka.testkit.{ EventFilter, filterEvents, filterException, AkkaSpec, DefaultTimeout, TestLatch } import akka.testkit.{ EventFilter, filterException, AkkaSpec, DefaultTimeout, TestLatch }
import scala.concurrent.{ Await, Awaitable, Future, Promise, ExecutionContext } import scala.concurrent.{ Await, Awaitable, Future, Promise }
import scala.util.control.NonFatal import scala.util.control.NonFatal
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.concurrent.ExecutionContext import scala.concurrent.ExecutionContext
@ -730,14 +729,14 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
val genIntAction = for { val genIntAction = for {
n arbitrary[Int] n arbitrary[Int]
a oneOf(IntAdd(n), IntSub(n), IntMul(n), IntDiv(n)) a Gen.oneOf(IntAdd(n), IntSub(n), IntMul(n), IntDiv(n))
} yield a } yield a
val genMapAction = genIntAction map (MapAction(_)) val genMapAction = genIntAction map (MapAction(_))
val genFlatMapAction = genIntAction map (FlatMapAction(_)) val genFlatMapAction = genIntAction map (FlatMapAction(_))
oneOf(genMapAction, genFlatMapAction) Gen.oneOf(genMapAction, genFlatMapAction)
} }

View file

@ -52,14 +52,16 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
"pattern.after" must { "pattern.after" must {
"be completed successfully eventually" in { "be completed successfully eventually" in {
val f = after(1 second, using = system.scheduler)(Promise.successful(5).future) // TODO after is unfortunately shadowed by ScalaTest, fix as part of #3759
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.successful(5).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f)) val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
Await.result(r, remaining) must be(5) Await.result(r, remaining) must be(5)
} }
"be completed abnormally eventually" in { "be completed abnormally eventually" in {
val f = after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future) // TODO after is unfortunately shadowed by ScalaTest, fix as part of #3759
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f)) val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage must be("Mexico") intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage must be("Mexico")

View file

@ -4,8 +4,8 @@
package akka.cluster package akka.cluster
import language.implicitConversions import language.implicitConversions
import org.scalatest.Suite import org.scalatest.{ Suite, Outcome, Canceled }
import org.scalatest.exceptions.TestFailedException import org.scalatest.exceptions.TestCanceledException
import com.typesafe.config.Config import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
import akka.remote.testconductor.RoleName import akka.remote.testconductor.RoleName
@ -162,18 +162,14 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro
// it will most likely not be possible to run next step. This ensures // it will most likely not be possible to run next step. This ensures
// fail fast of steps after the first failure. // fail fast of steps after the first failure.
private var failed = false private var failed = false
override protected def withFixture(test: NoArgTest): Unit = try { override protected def withFixture(test: NoArgTest): Outcome =
if (failed) { if (failed) {
val e = new TestFailedException("Previous step failed", 0) Canceled(new TestCanceledException("Previous step failed", 0))
// short stack trace } else {
e.setStackTrace(e.getStackTrace.take(1)) val out = super.withFixture(test)
throw e if (!out.isSucceeded)
}
super.withFixture(test)
} catch {
case t: Throwable
failed = true failed = true
throw t out
} }
def clusterView: ClusterReadView = cluster.readView def clusterView: ClusterReadView = cluster.readView

View file

@ -195,7 +195,7 @@ class AggregatorSpec extends TestKit(ActorSystem("test")) with ImplicitSender wi
case result: List[_] case result: List[_]
result should have size 1 result should have size 1
case result case result
assert(condition = false, s"Expect List, got ${result.getClass}") assert(false, s"Expect List, got ${result.getClass}")
} }
} }
@ -206,7 +206,7 @@ class AggregatorSpec extends TestKit(ActorSystem("test")) with ImplicitSender wi
case result: List[_] case result: List[_]
result should have size 3 result should have size 3
case result case result
assert(condition = false, s"Expect List, got ${result.getClass}") assert(false, s"Expect List, got ${result.getClass}")
} }
} }
} }

View file

@ -418,9 +418,10 @@ class FutureDocSpec extends AkkaSpec {
"demonstrate usage of pattern.after" in { "demonstrate usage of pattern.after" in {
//#after //#after
import akka.pattern.after // TODO after is unfortunately shadowed by ScalaTest, fix as part of #3759
// import akka.pattern.after
val delayed = after(200 millis, using = system.scheduler)(Future.failed( val delayed = akka.pattern.after(200 millis, using = system.scheduler)(Future.failed(
new IllegalStateException("OHNOES"))) new IllegalStateException("OHNOES")))
val future = Future { Thread.sleep(1000); "foo" } val future = Future { Thread.sleep(1000); "foo" }
val result = Future firstCompletedOf Seq(future, delayed) val result = Future firstCompletedOf Seq(future, delayed)

View file

@ -8,13 +8,12 @@ import org.scalatest.tools.StandardOutReporter
import org.scalatest.events._ import org.scalatest.events._
import java.lang.Boolean.getBoolean import java.lang.Boolean.getBoolean
class QuietReporter(inColor: Boolean, withDurations: Boolean = false) extends StandardOutReporter(withDurations, inColor, false, true) { class QuietReporter(inColor: Boolean, withDurations: Boolean = false) extends StandardOutReporter(withDurations, inColor, false, true, false, false, false, false, false) {
def this() = this(!getBoolean("akka.test.nocolor"), !getBoolean("akka.test.nodurations")) def this() = this(!getBoolean("akka.test.nocolor"), !getBoolean("akka.test.nodurations"))
override def apply(event: Event): Unit = event match { override def apply(event: Event): Unit = event match {
case _: RunStarting () case _: RunStarting ()
case _ super.apply(event) case _ super.apply(event)
} }
override def makeFinalReport(resourceName: String, duration: Option[Long], summaryOption: Option[Summary]) {}
} }

View file

@ -5,16 +5,14 @@ package akka.testkit
import language.{ postfixOps, reflectiveCalls } import language.{ postfixOps, reflectiveCalls }
import org.scalatest.{ WordSpecLike, BeforeAndAfterAll, Tag } import org.scalatest.{ WordSpecLike, BeforeAndAfterAll }
import org.scalatest.matchers.MustMatchers import org.scalatest.matchers.MustMatchers
import akka.actor.{ Actor, Props, ActorSystem, PoisonPill, DeadLetter, ActorSystemImpl } import akka.actor.ActorSystem
import akka.event.{ Logging, LoggingAdapter } import akka.event.{ Logging, LoggingAdapter }
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.concurrent.{ Await, Future } import scala.concurrent.Future
import com.typesafe.config.{ Config, ConfigFactory } import com.typesafe.config.{ Config, ConfigFactory }
import java.util.concurrent.TimeoutException
import akka.dispatch.Dispatchers import akka.dispatch.Dispatchers
import akka.pattern.ask
import akka.testkit.TestEvent._ import akka.testkit.TestEvent._
object AkkaSpec { object AkkaSpec {

View file

@ -43,7 +43,7 @@ object AkkaBuild extends Build {
version := "2.3-SNAPSHOT", version := "2.3-SNAPSHOT",
// Also change ScalaVersion in akka-sbt-plugin/sample/project/Build.scala // Also change ScalaVersion in akka-sbt-plugin/sample/project/Build.scala
scalaVersion := requestedScalaVersion, scalaVersion := requestedScalaVersion,
scalaBinaryVersion <<= (scalaVersion, scalaBinaryVersion)((v, bv) => System.getProperty("akka.scalaBinaryVersion", if (v contains "-") v else bv)) scalaBinaryVersion := System.getProperty("akka.scalaBinaryVersion", if (scalaVersion.value contains "-") scalaVersion.value else scalaBinaryVersion.value)
) )
lazy val akka = Project( lazy val akka = Project(
@ -83,6 +83,15 @@ object AkkaBuild extends Build {
multiNodeTestkit) multiNodeTestkit)
) )
lazy val akkaScalaNightly = Project(
id = "akka-scala-nightly",
base = file("akka-scala-nightly"),
// remove dependencies that we have to build ourselves (Scala STM, ZeroMQ Scala Bindings)
aggregate = Seq(actor, testkit, actorTests, dataflow, remote, remoteTests, camel, cluster, slf4j,
persistence, mailboxes, kernel, akkaSbtPlugin, osgi, osgiAries, contrib, samples, channels, channelsTests,
multiNodeTestkit)
)
// this detached pseudo-project is used for running the tests against a different Scala version than the one used for compilation // this detached pseudo-project is used for running the tests against a different Scala version than the one used for compilation
// usage: // usage:
// all-tests/test (or test-only) // all-tests/test (or test-only)
@ -428,7 +437,7 @@ object AkkaBuild extends Build {
publishTo <<= Publish.akkaPluginPublishTo, publishTo <<= Publish.akkaPluginPublishTo,
scalacOptions in Compile := Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"), scalacOptions in Compile := Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
scalaVersion := "2.10.2", scalaVersion := "2.10.2",
scalaBinaryVersion <<= scalaVersion, scalaBinaryVersion := "2.10",
reportBinaryIssues := () // disable bin comp check reportBinaryIssues := () // disable bin comp check
) )
) )
@ -624,18 +633,24 @@ object AkkaBuild extends Build {
base = file("akka-channels"), base = file("akka-channels"),
dependencies = Seq(actor), dependencies = Seq(actor),
settings = defaultSettings ++ scaladocSettings ++ experimentalSettings ++ Seq( settings = defaultSettings ++ scaladocSettings ++ experimentalSettings ++ Seq(
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), libraryDependencies +=("org.scala-lang" % "scala-reflect" % scalaVersion.value),
reportBinaryIssues := () // disable bin comp check reportBinaryIssues := () // disable bin comp check
) )
) )
// // this issue will be fixed in M8, for now we need to exclude M6, M7 modules used to compile the compiler
def excludeOldModules(m: ModuleID) = List("M6", "M7").foldLeft(m) { (mID, mStone) =>
val version = s"2.11.0-$mStone"
mID.exclude("org.scala-lang.modules", s"scala-parser-combinators_$version").exclude("org.scala-lang.modules", s"scala-xml_$version")
}
lazy val channelsTests = Project( lazy val channelsTests = Project(
id = "akka-channels-tests", id = "akka-channels-tests",
base = file("akka-channels-tests"), base = file("akka-channels-tests"),
dependencies = Seq(channels, testkit % "compile;test->test"), dependencies = Seq(channels, testkit % "compile;test->test"),
settings = defaultSettings ++ experimentalSettings ++ Seq( settings = defaultSettings ++ experimentalSettings ++ Seq(
publishArtifact in Compile := false, publishArtifact in Compile := false,
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _), libraryDependencies += excludeOldModules("org.scala-lang" % "scala-compiler" % scalaVersion.value),
reportBinaryIssues := () // disable bin comp check reportBinaryIssues := () // disable bin comp check
) )
) )
@ -647,7 +662,8 @@ object AkkaBuild extends Build {
buildSettings ++ buildSettings ++
Seq( Seq(
shellPrompt := { s => Project.extract(s).currentProject.id + " > " } shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
) ) ++
resolverSettings
lazy val baseSettings = Defaults.defaultSettings ++ Publish.settings lazy val baseSettings = Defaults.defaultSettings ++ Publish.settings
@ -730,7 +746,19 @@ object AkkaBuild extends Build {
(if (useOnlyTestTags.isEmpty) Seq.empty else Seq("-n", if (multiNodeEnabled) useOnlyTestTags.mkString("\"", " ", "\"") else useOnlyTestTags.mkString(" "))) (if (useOnlyTestTags.isEmpty) Seq.empty else Seq("-n", if (multiNodeEnabled) useOnlyTestTags.mkString("\"", " ", "\"") else useOnlyTestTags.mkString(" ")))
} }
lazy val defaultSettings = baseSettings ++ formatSettings ++ mimaSettings ++ lsSettings ++ lazy val resolverSettings = {
// should we be allowed to use artifacts published to the local maven repository
if(System.getProperty("akka.build.useLocalMavenResolver", "false").toBoolean)
Seq(resolvers += Resolver.mavenLocal)
else Seq.empty
} ++ {
// should we be allowed to use artifacts from sonatype snapshots
if(System.getProperty("akka.build.useSnapshotSonatypeResolver", "false").toBoolean)
Seq(resolvers += Resolver.sonatypeRepo("snapshots"))
else Seq.empty
}
lazy val defaultSettings = baseSettings ++ formatSettings ++ mimaSettings ++ lsSettings ++ resolverSettings ++
Protobuf.settings ++ Seq( Protobuf.settings ++ Seq(
// compile options // compile options
scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.6", "-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint"), scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.6", "-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint"),
@ -1053,17 +1081,27 @@ object AkkaBuild extends Build {
object Dependencies { object Dependencies {
object Versions {
val scalaStmVersion = System.getProperty("akka.build.scalaStmVersion", "0.7")
val scalaZeroMQVersion = System.getProperty("akka.build.scalaZeroMQVersion", "0.0.7")
val genJavaDocVersion = System.getProperty("akka.build.genJavaDocVersion", "0.5")
val scalaTestVersion = System.getProperty("akka.build.scalaTestVersion", "2.0")
val scalaCheckVersion = System.getProperty("akka.build.scalaCheckVersion", "1.10.1")
}
object Compile { object Compile {
import Versions._
// Compile // Compile
val camelCore = "org.apache.camel" % "camel-core" % "2.10.3" exclude("org.slf4j", "slf4j-api") // ApacheV2 val camelCore = "org.apache.camel" % "camel-core" % "2.10.3" exclude("org.slf4j", "slf4j-api") // ApacheV2
val config = "com.typesafe" % "config" % "1.0.2" // ApacheV2 val config = "com.typesafe" % "config" % "1.0.2" // ApacheV2
val netty = "io.netty" % "netty" % "3.6.6.Final" // ApacheV2 val netty = "io.netty" % "netty" % "3.6.6.Final" // ApacheV2
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.5.0" // New BSD val protobuf = "com.google.protobuf" % "protobuf-java" % "2.5.0" // New BSD
val scalaStm = "org.scala-stm" %% "scala-stm" % "0.7" // Modified BSD (Scala) val scalaStm = "org.scala-stm" %% "scala-stm" % scalaStmVersion // Modified BSD (Scala)
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.2" // MIT val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.2" // MIT
val zeroMQClient = "org.zeromq" %% "zeromq-scala-binding" % "0.0.7" // ApacheV2 val zeroMQClient = "org.zeromq" %% "zeromq-scala-binding" % scalaZeroMQVersion // ApacheV2
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2 val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2
val ariesBlueprint = "org.apache.aries.blueprint" % "org.apache.aries.blueprint" % "1.1.0" // ApacheV2 val ariesBlueprint = "org.apache.aries.blueprint" % "org.apache.aries.blueprint" % "1.1.0" // ApacheV2
val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" // ApacheV2 val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" // ApacheV2
@ -1078,7 +1116,7 @@ object Dependencies {
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2 val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
// Compiler plugins // Compiler plugins
val genjavadoc = compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.5" cross CrossVersion.full) // ApacheV2 val genjavadoc = compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % genJavaDocVersion cross CrossVersion.full) // ApacheV2
// Test // Test
@ -1090,8 +1128,8 @@ object Dependencies {
val logback = "ch.qos.logback" % "logback-classic" % "1.0.7" % "test" // EPL 1.0 / LGPL 2.1 val logback = "ch.qos.logback" % "logback-classic" % "1.0.7" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT
// changing the scalatest dependency must be reflected in akka-docs/rst/dev/multi-jvm-testing.rst // changing the scalatest dependency must be reflected in akka-docs/rst/dev/multi-jvm-testing.rst
val scalatest = "org.scalatest" %% "scalatest" % "1.9.2-SNAP2" % "test" // ApacheV2 val scalatest = "org.scalatest" %% "scalatest" % scalaTestVersion % "test" // ApacheV2
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.10.0" % "test" // New BSD val scalacheck = "org.scalacheck" %% "scalacheck" % scalaCheckVersion % "test" // New BSD
val ariesProxy = "org.apache.aries.proxy" % "org.apache.aries.proxy.impl" % "1.0.1" % "test" // ApacheV2 val ariesProxy = "org.apache.aries.proxy" % "org.apache.aries.proxy.impl" % "1.0.1" % "test" // ApacheV2
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.1.4" % "test" // ApacheV2 val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.1.4" % "test" // ApacheV2
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2 val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2