2011-11-25 11:01:03 +01:00
/* *
2012-01-19 18:21:06 +01:00
* Copyright ( C ) 2009 - 2012 Typesafe Inc . < http : //www.typesafe.com>
2011-11-25 11:01:03 +01:00
*/
2011-09-23 10:21:03 +02:00
package akka
2011-07-04 19:16:43 +12:00
import sbt._
2011-12-08 17:05:01 +13:00
import sbt.Keys._
2011-09-23 10:21:03 +02:00
import com.typesafe.sbtmultijvm.MultiJvmPlugin
2012-05-31 14:02:36 +02:00
import com.typesafe.sbtmultijvm.MultiJvmPlugin. { MultiJvm , extraOptions , jvmOptions , scalatestOptions , multiNodeExecuteTests }
2011-09-23 10:21:03 +02:00
import com.typesafe.sbtscalariform.ScalariformPlugin
2011-12-08 17:05:01 +13:00
import com.typesafe.sbtscalariform.ScalariformPlugin.ScalariformKeys
2012-05-28 17:55:59 +02:00
import com.typesafe.sbtosgi.OsgiPlugin. { OsgiKeys , osgiSettings }
2012-05-25 10:02:35 +02:00
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
2011-08-04 16:49:05 +12:00
import java.lang.Boolean.getBoolean
2012-05-31 14:02:36 +02:00
import sbt.Tests
2012-07-28 10:43:31 +12:00
import Sphinx. { sphinxDocs , sphinxHtml , sphinxLatex , sphinxPdf , sphinxPygments , sphinxTags }
2011-07-04 19:16:43 +12:00
object AkkaBuild extends Build {
2011-07-11 15:38:22 -06:00
System . setProperty ( "akka.mode" , "test" ) // Is there better place for this?
2012-07-27 13:15:51 +02:00
val enableMiMa = false
2012-06-28 15:33:49 +02:00
2011-07-08 18:01:19 +12:00
lazy val buildSettings = Seq (
2011-10-06 15:44:15 +02:00
organization : = "com.typesafe.akka" ,
2012-03-05 10:50:54 +13:00
version : = "2.1-SNAPSHOT" ,
2012-08-20 15:21:44 +02:00
scalaVersion : = "2.10.0-SNAPSHOT" ,
scalaVersion in update <<= ( scalaVersion ) apply {
case "2.10.0-SNAPSHOT" => "2.10.0-M6"
case x => x
}
2011-07-08 18:01:19 +12:00
)
2011-07-04 19:16:43 +12:00
lazy val akka = Project (
id = "akka" ,
base = file ( "." ) ,
2012-07-28 10:43:31 +12:00
settings = parentSettings ++ Release . settings ++ Unidoc . settings ++ Sphinx . settings ++ Publish . versionSettings ++
2012-05-25 10:02:35 +02:00
Dist . settings ++ mimaSettings ++ Seq (
2012-02-26 19:57:05 +01:00
testMailbox in GlobalScope : = System . getProperty ( "akka.testMailbox" , "false" ) . toBoolean ,
2012-01-01 11:33:20 +01:00
parallelExecution in GlobalScope : = System . getProperty ( "akka.parallelExecution" , "false" ) . toBoolean ,
2011-12-09 21:55:49 +13:00
Publish . defaultPublishTo in ThisBuild <<= crossTarget / "repository" ,
2012-08-21 08:56:22 +02:00
Unidoc . unidocExclude : = Seq ( samples . id ) ,
2012-05-10 11:03:43 +12:00
Dist . distExclude : = Seq ( actorTests . id , akkaSbtPlugin . id , docs . id ) ,
2012-07-04 11:30:02 +02:00
initialCommands in ThisBuild : =
2012-07-27 13:58:55 +02:00
"" " | import language.postfixOps
| import akka.actor._
2012-08-08 22:38:50 +02:00
| import ActorDSL._
| import scala.concurrent._
2012-07-04 11:30:02 +02:00
| import com.typesafe.config.ConfigFactory
2012-07-20 16:01:18 +02:00
| import scala.concurrent.util.duration._
2012-07-04 11:30:02 +02:00
| import akka.util.Timeout
2012-07-04 14:57:59 +02:00
| val config = ConfigFactory . parseString ( "akka.stdout-loglevel=INFO,akka.loglevel=DEBUG" )
2012-07-04 11:30:02 +02:00
| val remoteConfig = ConfigFactory . parseString ( "akka.remote.netty{port=0,use-dispatcher-for-io=akka.actor.default-dispatcher,execution-pool-size=0},akka.actor.provider=RemoteActorRefProvider" ) . withFallback ( config )
| var system : ActorSystem = null
2012-08-08 22:38:50 +02:00
| implicit def _system = system
2012-07-04 14:57:59 +02:00
| def startSystem ( remoting : Boolean = false ) { system = ActorSystem ( "repl" , if ( remoting ) remoteConfig else config ) ; println ( "don’ t forget to system.shutdown()!" ) }
2012-07-04 11:30:02 +02:00
| implicit def ec = system . dispatcher
| implicit val timeout = Timeout ( 5 seconds )
| "" " . stripMargin ,
2012-07-28 10:43:31 +12:00
initialCommands in Test in ThisBuild += "import akka.testkit._" ,
2012-07-28 08:52:23 +02:00
/*
* online version of docs : the main docs are generated by
* akka - docs / sphinx and its dependencies , but we need to run the HTML
* part twice , so add it also as akka / sphinx . The trick is to reroute the
2012-07-28 09:05:52 +02:00
* dependencies of that one to their akka - docs brothers , for which the
2012-07-28 08:52:23 +02:00
* “ map identity ” is crucial ; if anybody knows how / why , please drop RK a
* line ( without it , the pygments task would run twice in parallel for
* the same directory , wreaking the expected amount of havoc ) .
*/
2012-07-28 10:43:31 +12:00
sphinxDocs <<= baseDirectory / "akka-docs" ,
sphinxTags in sphinxHtml += "online" ,
2012-07-28 10:50:51 +12:00
sphinxPygments <<= sphinxPygments in LocalProject ( docs . id ) map identity ,
sphinxLatex <<= sphinxLatex in LocalProject ( docs . id ) map identity ,
sphinxPdf <<= sphinxPdf in LocalProject ( docs . id ) map identity
2011-07-08 10:20:10 +12:00
) ,
2012-08-21 08:56:22 +02:00
aggregate = Seq ( actor , testkit , actorTests , dataflow , remote , remoteTests , camel , cluster , slf4j , agent , transactor , mailboxes , zeroMQ , kernel , akkaSbtPlugin , samples , osgi , osgiAries , docs )
2011-07-04 19:16:43 +12:00
)
lazy val actor = Project (
id = "akka-actor" ,
base = file ( "akka-actor" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . actor ++ Seq (
2012-02-28 10:14:40 +01:00
autoCompilerPlugins : = true ,
2012-05-28 17:55:59 +02:00
packagedArtifact in ( Compile , packageBin ) <<= ( artifact in ( Compile , packageBin ) , OsgiKeys . bundle ) . identityMap ,
artifact in ( Compile , packageBin ) ~= ( _ . copy ( `type` = "bundle" ) ) ,
2011-10-06 15:44:15 +02:00
// to fix scaladoc generation
2012-05-29 02:13:25 +02:00
fullClasspath in doc in Compile <<= fullClasspath in Compile ,
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . actor ,
previousArtifact : = akkaPreviousArtifact ( "akka-actor" )
2011-07-04 19:16:43 +12:00
)
)
2012-08-07 14:30:16 +02:00
lazy val dataflow = Project (
id = "akka-dataflow" ,
base = file ( "akka-dataflow" ) ,
dependencies = Seq ( actor , testkit % "test->test" ) ,
settings = defaultSettings ++ OSGi . dataflow ++ Seq (
libraryDependencies <+= scalaVersion { v => compilerPlugin ( "org.scala-lang.plugins" % "continuations" % v ) } ,
scalacOptions += "-P:continuations:enable"
)
)
2011-07-04 19:16:43 +12:00
lazy val testkit = Project (
id = "akka-testkit" ,
base = file ( "akka-testkit" ) ,
dependencies = Seq ( actor ) ,
settings = defaultSettings ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . testkit ,
2012-07-04 11:30:02 +02:00
initialCommands += "import akka.testkit._" ,
2012-05-25 10:02:35 +02:00
previousArtifact : = akkaPreviousArtifact ( "akka-testkit" )
2011-07-04 19:16:43 +12:00
)
)
lazy val actorTests = Project (
id = "akka-actor-tests" ,
base = file ( "akka-actor-tests" ) ,
2011-10-10 15:45:55 +02:00
dependencies = Seq ( testkit % "compile;test->test" ) ,
2011-07-04 19:16:43 +12:00
settings = defaultSettings ++ Seq (
2012-02-28 10:14:40 +01:00
autoCompilerPlugins : = true ,
2011-07-04 19:16:43 +12:00
libraryDependencies ++= Dependencies . actorTests
)
)
2011-09-09 13:46:36 +02:00
lazy val remote = Project (
id = "akka-remote" ,
base = file ( "akka-remote" ) ,
2011-12-14 12:39:27 +01:00
dependencies = Seq ( actor , actorTests % "test->test" , testkit % "test->test" ) ,
2012-05-29 08:28:54 +02:00
settings = defaultSettings ++ OSGi . remote ++ Seq (
2012-01-16 14:31:41 +01:00
libraryDependencies ++= Dependencies . remote ,
2011-12-19 16:30:15 +01:00
// disable parallel tests
2012-05-29 08:28:54 +02:00
parallelExecution in Test : = false
2011-09-09 13:46:36 +02:00
)
2012-05-29 08:28:54 +02:00
)
2011-09-09 13:46:36 +02:00
2012-05-10 10:24:05 +02:00
lazy val remoteTests = Project (
id = "akka-remote-tests" ,
base = file ( "akka-remote-tests" ) ,
2012-05-29 08:28:54 +02:00
dependencies = Seq ( remote , actorTests % "test->test" , testkit % "test->test" ) ,
2012-05-22 16:22:10 +02:00
settings = defaultSettings ++ multiJvmSettings ++ Seq (
2012-05-10 10:24:05 +02:00
// disable parallel tests
parallelExecution in Test : = false ,
extraOptions in MultiJvm <<= ( sourceDirectory in MultiJvm ) { src =>
( name : String ) => ( src ** ( name + ".conf" ) ) . get . headOption . map ( "-Dakka.config=" + _ . absolutePath ) . toSeq
} ,
2012-05-27 19:20:30 +02:00
scalatestOptions in MultiJvm : = defaultMultiJvmScalatestOptions ,
2012-05-25 10:02:35 +02:00
jvmOptions in MultiJvm : = defaultMultiJvmOptions ,
previousArtifact : = akkaPreviousArtifact ( "akka-remote" )
2012-05-10 10:24:05 +02:00
)
) configs ( MultiJvm )
2012-02-06 17:29:17 +01:00
lazy val cluster = Project (
2012-01-31 13:33:04 +01:00
id = "akka-cluster" ,
base = file ( "akka-cluster" ) ,
2012-05-23 16:35:42 +02:00
dependencies = Seq ( remote , remoteTests % "compile;test->test;multi-jvm->multi-jvm" , testkit % "test->test" ) ,
2012-05-24 23:34:20 +02:00
settings = defaultSettings ++ multiJvmSettings ++ OSGi . cluster ++ Seq (
2012-01-31 13:33:04 +01:00
libraryDependencies ++= Dependencies . cluster ,
// disable parallel tests
parallelExecution in Test : = false ,
extraOptions in MultiJvm <<= ( sourceDirectory in MultiJvm ) { src =>
( name : String ) => ( src ** ( name + ".conf" ) ) . get . headOption . map ( "-Dakka.config=" + _ . absolutePath ) . toSeq
} ,
2012-05-27 19:20:30 +02:00
scalatestOptions in MultiJvm : = defaultMultiJvmScalatestOptions ,
2012-05-25 10:02:35 +02:00
jvmOptions in MultiJvm : = defaultMultiJvmOptions ,
previousArtifact : = akkaPreviousArtifact ( "akka-remote" )
2012-01-31 13:33:04 +01:00
)
2012-02-06 17:29:17 +01:00
) configs ( MultiJvm )
2012-01-31 13:33:04 +01:00
2011-07-04 19:16:43 +12:00
lazy val slf4j = Project (
id = "akka-slf4j" ,
base = file ( "akka-slf4j" ) ,
2011-10-12 11:34:35 +02:00
dependencies = Seq ( actor , testkit % "test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . slf4j ++ Seq (
2011-07-04 19:16:43 +12:00
libraryDependencies ++= Dependencies . slf4j
)
)
2011-12-19 15:46:06 +13:00
lazy val agent = Project (
id = "akka-agent" ,
base = file ( "akka-agent" ) ,
dependencies = Seq ( actor , testkit % "test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . agent ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . agent ,
previousArtifact : = akkaPreviousArtifact ( "akka-agent" )
2011-12-19 15:46:06 +13:00
)
)
2011-12-21 13:40:32 +13:00
lazy val transactor = Project (
id = "akka-transactor" ,
base = file ( "akka-transactor" ) ,
dependencies = Seq ( actor , testkit % "test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . transactor ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . transactor ,
previousArtifact : = akkaPreviousArtifact ( "akka-transactor" )
2011-12-21 13:40:32 +13:00
)
)
2012-02-23 17:13:40 +01:00
val testMailbox = SettingKey [ Boolean ] ( "test-mailbox" )
2011-11-01 09:45:57 +01:00
lazy val mailboxes = Project (
id = "akka-durable-mailboxes" ,
base = file ( "akka-durable-mailboxes" ) ,
settings = parentSettings ,
2012-05-08 15:07:05 +02:00
aggregate = Seq ( mailboxesCommon , fileMailbox )
2011-11-01 09:45:57 +01:00
)
2011-07-04 19:16:43 +12:00
2011-11-01 09:45:57 +01:00
lazy val mailboxesCommon = Project (
id = "akka-mailboxes-common" ,
base = file ( "akka-durable-mailboxes/akka-mailboxes-common" ) ,
dependencies = Seq ( remote , testkit % "compile;test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . mailboxesCommon ++ Seq (
2012-05-15 16:01:32 +02:00
libraryDependencies ++= Dependencies . mailboxes ,
2012-05-25 10:02:35 +02:00
previousArtifact : = akkaPreviousArtifact ( "akka-mailboxes-common" ) ,
// DurableMailboxSpec published in akka-mailboxes-common-test
2012-05-15 16:01:32 +02:00
publishArtifact in Test : = true
2011-11-01 09:45:57 +01:00
)
)
2011-07-04 19:16:43 +12:00
2011-11-01 09:45:57 +01:00
lazy val fileMailbox = Project (
id = "akka-file-mailbox" ,
base = file ( "akka-durable-mailboxes/akka-file-mailbox" ) ,
dependencies = Seq ( mailboxesCommon % "compile;test->test" , testkit % "test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . fileMailbox ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . fileMailbox ,
previousArtifact : = akkaPreviousArtifact ( "akka-file-mailbox" )
2011-11-01 09:45:57 +01:00
)
)
2011-07-04 19:16:43 +12:00
2012-01-14 03:16:39 +01:00
lazy val zeroMQ = Project (
id = "akka-zeromq" ,
base = file ( "akka-zeromq" ) ,
dependencies = Seq ( actor , testkit % "test;test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . zeroMQ ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . zeroMQ ,
previousArtifact : = akkaPreviousArtifact ( "akka-zeromq" )
2012-01-14 03:16:39 +01:00
)
)
2011-12-14 16:19:16 +13:00
lazy val kernel = Project (
id = "akka-kernel" ,
base = file ( "akka-kernel" ) ,
2011-12-14 17:15:06 +13:00
dependencies = Seq ( actor , testkit % "test->test" ) ,
2011-12-14 16:19:16 +13:00
settings = defaultSettings ++ Seq (
2012-05-25 10:02:35 +02:00
libraryDependencies ++= Dependencies . kernel ,
previousArtifact : = akkaPreviousArtifact ( "akka-kernel" )
2011-12-14 16:19:16 +13:00
)
)
2012-04-24 10:19:36 +02:00
2012-01-19 14:38:44 +00:00
lazy val camel = Project (
id = "akka-camel" ,
base = file ( "akka-camel" ) ,
dependencies = Seq ( actor , slf4j , testkit % "test->test" ) ,
2012-05-16 23:49:42 +02:00
settings = defaultSettings ++ OSGi . camel ++ Seq (
2012-01-19 14:38:44 +00:00
libraryDependencies ++= Dependencies . camel
)
)
2011-07-04 19:16:43 +12:00
2012-05-29 12:41:09 +02:00
lazy val osgi = Project (
id = "akka-osgi" ,
base = file ( "akka-osgi" ) ,
dependencies = Seq ( actor ) ,
settings = defaultSettings ++ OSGi . osgi ++ Seq (
2012-07-03 11:43:59 +02:00
libraryDependencies ++= Dependencies . osgi ,
parallelExecution in Test : = false
2012-05-29 12:41:09 +02:00
)
)
2012-06-26 22:07:57 +02:00
lazy val osgiAries = Project (
id = "akka-osgi-aries" ,
base = file ( "akka-osgi-aries" ) ,
dependencies = Seq ( osgi % "compile;test->test" ) ,
settings = defaultSettings ++ OSGi . osgiAries ++ Seq (
2012-07-03 11:43:59 +02:00
libraryDependencies ++= Dependencies . osgiAries ,
parallelExecution in Test : = false
2012-06-26 22:07:57 +02:00
)
)
2011-10-21 08:53:00 +02:00
lazy val akkaSbtPlugin = Project (
id = "akka-sbt-plugin" ,
base = file ( "akka-sbt-plugin" ) ,
settings = defaultSettings ++ Seq (
2012-03-19 13:10:11 +13:00
sbtPlugin : = true ,
2012-07-30 16:19:26 +02:00
scalacOptions in Compile : = Seq ( "-encoding" , "UTF-8" , "-deprecation" , "-unchecked" ) ,
2012-03-19 13:10:11 +13:00
scalaVersion : = "2.9.1"
2011-10-21 08:53:00 +02:00
)
)
2011-07-04 19:16:43 +12:00
lazy val samples = Project (
id = "akka-samples" ,
base = file ( "akka-samples" ) ,
2011-07-08 18:01:19 +12:00
settings = parentSettings ,
2012-08-16 14:48:15 +02:00
aggregate = Seq ( camelSample , fsmSample , helloSample , helloKernelSample , remoteSample , clusterSample )
2012-08-09 19:30:32 +02:00
)
lazy val camelSample = Project (
id = "akka-sample-camel" ,
base = file ( "akka-samples/akka-sample-camel" ) ,
dependencies = Seq ( actor , camel ) ,
settings = defaultSettings ++ Seq (
libraryDependencies ++= Dependencies . camelSample
)
2011-07-04 19:16:43 +12:00
)
lazy val fsmSample = Project (
id = "akka-sample-fsm" ,
base = file ( "akka-samples/akka-sample-fsm" ) ,
dependencies = Seq ( actor ) ,
settings = defaultSettings
)
2011-12-08 17:05:01 +13:00
2011-11-25 14:49:09 +01:00
lazy val helloSample = Project (
id = "akka-sample-hello" ,
base = file ( "akka-samples/akka-sample-hello" ) ,
dependencies = Seq ( actor ) ,
settings = defaultSettings
)
2011-12-08 17:05:01 +13:00
2011-12-14 16:19:16 +13:00
lazy val helloKernelSample = Project (
id = "akka-sample-hello-kernel" ,
base = file ( "akka-samples/akka-sample-hello-kernel" ) ,
dependencies = Seq ( kernel ) ,
settings = defaultSettings
)
2011-12-22 15:12:41 +01:00
lazy val remoteSample = Project (
id = "akka-sample-remote" ,
base = file ( "akka-samples/akka-sample-remote" ) ,
dependencies = Seq ( actor , remote , kernel ) ,
settings = defaultSettings
)
2012-08-16 14:48:15 +02:00
lazy val clusterSample = Project (
id = "akka-sample-cluster" ,
base = file ( "akka-samples/akka-sample-cluster" ) ,
dependencies = Seq ( cluster ) ,
settings = defaultSettings
)
2011-10-05 17:41:00 +02:00
lazy val docs = Project (
id = "akka-docs" ,
base = file ( "akka-docs" ) ,
2012-05-15 16:01:32 +02:00
dependencies = Seq ( actor , testkit % "test->test" , mailboxesCommon % "compile;test->test" ,
2012-07-01 13:31:11 +02:00
remote , cluster , slf4j , agent , transactor , fileMailbox , zeroMQ , camel , osgi , osgiAries ) ,
2012-05-10 11:03:43 +12:00
settings = defaultSettings ++ Sphinx . settings ++ Seq (
2011-10-05 17:41:00 +02:00
unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get } ,
libraryDependencies ++= Dependencies . docs ,
2012-06-25 19:30:13 +02:00
unmanagedSourceDirectories in ScalariformKeys . format in Test <<= unmanagedSourceDirectories in Test ,
2012-07-28 10:43:31 +12:00
testOptions += Tests . Argument ( TestFrameworks . JUnit , "-v" )
2011-10-05 17:41:00 +02:00
)
)
2011-07-04 19:16:43 +12:00
// Settings
2012-02-24 11:50:23 +01:00
override lazy val settings = super . settings ++ buildSettings ++ Seq (
2012-08-20 15:21:44 +02:00
resolvers += "Scala Community 2.10.0-SNAPSHOT" at "https://scala-webapps.epfl.ch/jenkins/job/community-nightly/ws/target/repositories/8e83577d99af1d718fe369c4a4ee92737b9cf669" ,
2012-02-29 13:55:09 +01:00
resolvers += "Sonatype Snapshot Repo" at "https://oss.sonatype.org/content/repositories/snapshots/" ,
2012-07-27 13:15:51 +02:00
resolvers += "Sonatype Releases Repo" at "https://oss.sonatype.org/content/repositories/releases/" ,
2012-04-23 11:57:13 +02:00
shellPrompt : = { s => Project . extract ( s ) . currentProject . id + " > " }
2012-02-24 11:50:23 +01:00
)
2011-07-08 18:01:19 +12:00
2011-07-26 17:49:08 +12:00
lazy val baseSettings = Defaults . defaultSettings ++ Publish . settings
2011-07-08 18:01:19 +12:00
lazy val parentSettings = baseSettings ++ Seq (
publishArtifact in Compile : = false
2011-07-04 19:16:43 +12:00
)
2011-11-28 13:02:11 +13:00
val excludeTestNames = SettingKey [ Seq [ String ] ] ( "exclude-test-names" )
2012-05-29 09:05:46 +02:00
val excludeTestTags = SettingKey [ Set [ String ] ] ( "exclude-test-tags" )
val includeTestTags = SettingKey [ Set [ String ] ] ( "include-test-tags" )
val onlyTestTags = SettingKey [ Set [ String ] ] ( "only-test-tags" )
2011-07-14 14:10:37 +12:00
2012-05-29 09:05:46 +02:00
val defaultExcludedTags = Set ( "timing" , "long-running" )
2011-07-14 14:10:37 +12:00
2012-05-27 19:20:30 +02:00
lazy val defaultMultiJvmOptions : Seq [ String ] = {
2012-06-28 11:32:11 +02:00
import scala.collection.JavaConverters._
val akkaProperties = System . getProperties . propertyNames . asScala . toList . collect {
case key : String if key . startsWith ( " akka . " ) => "-D" + key + "=" + System . getProperty ( key )
}
akkaProperties : :: ( if ( getBoolean ( " sbt . log . noformat " ) ) List ( " - Dakka . test . nocolor = true " ) else Nil )
2012-05-24 10:00:35 +02:00
}
2012-05-28 18:37:41 +02:00
// for excluding tests by name use system property: -Dakka.test.names.exclude=TimingSpec
// not supported by multi-jvm tests
lazy val useExcludeTestNames : Seq [ String ] = systemPropertyAsSeq ( "akka.test.names.exclude" )
// for excluding tests by tag use system property: -Dakka.test.tags.exclude=<tag name>
// note that it will not be used if you specify -Dakka.test.tags.only
2012-05-29 09:05:46 +02:00
lazy val useExcludeTestTags : Set [ String ] = {
if ( useOnlyTestTags . isEmpty ) defaultExcludedTags ++ systemPropertyAsSeq ( "akka.test.tags.exclude" ) . toSet
else Set . empty
2012-05-27 19:20:30 +02:00
}
2012-05-28 18:37:41 +02:00
// for including tests by tag use system property: -Dakka.test.tags.include=<tag name>
// note that it will not be used if you specify -Dakka.test.tags.only
2012-05-29 09:05:46 +02:00
lazy val useIncludeTestTags : Set [ String ] = {
if ( useOnlyTestTags . isEmpty ) systemPropertyAsSeq ( "akka.test.tags.include" ) . toSet
else Set . empty
2012-05-27 19:20:30 +02:00
}
2012-05-28 18:37:41 +02:00
// for running only tests by tag use system property: -Dakka.test.tags.only=<tag name>
2012-05-29 09:05:46 +02:00
lazy val useOnlyTestTags : Set [ String ] = systemPropertyAsSeq ( "akka.test.tags.only" ) . toSet
2012-05-28 18:37:41 +02:00
2012-06-07 13:32:12 +02:00
def executeMultiJvmTests : Boolean = {
useOnlyTestTags . contains ( "long-running" ) ||
! ( useExcludeTestTags -- useIncludeTestTags ) . contains ( "long-running" )
}
2012-05-29 09:05:46 +02:00
def systemPropertyAsSeq ( name : String ) : Seq [ String ] = {
2012-05-28 18:37:41 +02:00
val prop = System . getProperty ( name , "" )
2012-05-29 09:05:46 +02:00
if ( prop . isEmpty ) Seq . empty else prop . split ( "," ) . toSeq
2012-05-27 19:20:30 +02:00
}
2012-05-29 17:16:28 +02:00
val multiNodeEnabled = java . lang . Boolean . getBoolean ( "akka.test.multi-node" )
2012-05-27 19:20:30 +02:00
lazy val defaultMultiJvmScalatestOptions : Seq [ String ] = {
2012-05-29 09:05:46 +02:00
val excludeTags = ( useExcludeTestTags -- useIncludeTestTags ) . toSeq
2012-08-13 11:29:42 +02:00
Seq ( "-C" , "org.scalatest.akka.QuietReporter" ) ++
2012-05-29 17:16:28 +02:00
( if ( excludeTags . isEmpty ) Seq . empty else Seq ( "-l" , if ( multiNodeEnabled ) excludeTags . mkString ( "\"" , " " , "\"" ) else excludeTags . mkString ( " " ) ) ) ++
( if ( useOnlyTestTags . isEmpty ) Seq . empty else Seq ( "-n" , if ( multiNodeEnabled ) useOnlyTestTags . mkString ( "\"" , " " , "\"" ) else useOnlyTestTags . mkString ( " " ) ) )
2012-05-27 19:20:30 +02:00
}
2012-05-25 10:02:35 +02:00
lazy val defaultSettings = baseSettings ++ formatSettings ++ mimaSettings ++ Seq (
2011-07-04 19:16:43 +12:00
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/" ,
// compile options
2012-07-27 13:15:51 +02:00
scalacOptions in Compile ++= Seq ( "-encoding" , "UTF-8" , "-target:jvm-1.6" , "-deprecation" , "-feature" , "-unchecked" , "-Xlog-reflective-calls" , "-Ywarn-adapted-args" ) ,
2012-08-10 11:12:39 +02:00
javacOptions in Compile ++= Seq ( "-source" , "1.6" , "-target" , "1.6" , "-Xlint:unchecked" , "-Xlint:deprecation" ) ,
2011-07-04 19:16:43 +12:00
2012-01-12 13:45:53 +01:00
ivyLoggingLevel in ThisBuild : = UpdateLogging . Quiet ,
2012-01-01 11:33:20 +01:00
parallelExecution in Test : = System . getProperty ( "akka.parallelExecution" , "false" ) . toBoolean ,
2012-07-03 11:19:40 +02:00
logBuffered in Test : = System . getProperty ( "akka.logBufferedTests" , "false" ) . toBoolean ,
2011-07-14 14:10:37 +12:00
2012-05-28 18:37:41 +02:00
excludeTestNames : = useExcludeTestNames ,
excludeTestTags : = useExcludeTestTags ,
includeTestTags : = useIncludeTestTags ,
onlyTestTags : = useOnlyTestTags ,
2011-11-28 13:02:11 +13:00
// add filters for tests excluded by name
testOptions in Test <++= excludeTestNames map { _ . map ( exclude => Tests . Filter ( test => ! test . contains ( exclude ) ) ) } ,
// add arguments for tests excluded by tag - includes override excludes (opposite to scalatest)
testOptions in Test <++= ( excludeTestTags , includeTestTags ) map { ( excludes , includes ) =>
2012-05-29 09:05:46 +02:00
val tags = ( excludes -- includes )
2012-05-29 15:31:57 +02:00
if ( tags . isEmpty ) Seq . empty else Seq ( Tests . Argument ( "-l" , tags . mkString ( " " ) ) )
2011-11-28 13:02:11 +13:00
} ,
2012-05-28 18:37:41 +02:00
// add arguments for running only tests by tag
testOptions in Test <++= onlyTestTags map { tags =>
2012-05-29 15:31:57 +02:00
if ( tags . isEmpty ) Seq . empty else Seq ( Tests . Argument ( "-n" , tags . mkString ( " " ) ) )
2011-11-28 13:02:11 +13:00
} ,
2011-09-16 13:54:50 +02:00
2012-06-26 11:58:04 +02:00
// show full stack traces and test case durations
testOptions in Test += Tests . Argument ( "-oDF" )
2011-07-04 19:16:43 +12:00
)
2011-07-08 12:53:36 +12:00
2011-12-08 17:05:01 +13:00
lazy val formatSettings = ScalariformPlugin . scalariformSettings ++ Seq (
ScalariformKeys . preferences in Compile : = formattingPreferences ,
ScalariformKeys . preferences in Test : = formattingPreferences
2011-07-26 17:49:08 +12:00
)
def formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences ( )
. setPreference ( RewriteArrowSymbols , true )
. setPreference ( AlignParameters , true )
. setPreference ( AlignSingleLineCaseStatements , true )
}
2011-12-08 17:05:01 +13:00
lazy val multiJvmSettings = MultiJvmPlugin . settings ++ inConfig ( MultiJvm ) ( ScalariformPlugin . scalariformSettings ) ++ Seq (
compileInputs in MultiJvm <<= ( compileInputs in MultiJvm ) dependsOn ( ScalariformKeys . format in MultiJvm ) ,
2012-06-07 13:32:12 +02:00
ScalariformKeys . preferences in MultiJvm : = formattingPreferences ) ++
2012-06-07 14:12:13 +02:00
( ( executeMultiJvmTests , multiNodeEnabled ) match {
case ( true , true ) =>
executeTests in Test <<= ( ( executeTests in Test ) , ( multiNodeExecuteTests in MultiJvm ) ) map {
case ( ( _ , testResults ) , ( _ , multiNodeResults ) ) =>
val results = testResults ++ multiNodeResults
( Tests . overall ( results . values ) , results )
}
case ( true , false ) =>
executeTests in Test <<= ( ( executeTests in Test ) , ( executeTests in MultiJvm ) ) map {
case ( ( _ , testResults ) , ( _ , multiNodeResults ) ) =>
val results = testResults ++ multiNodeResults
( Tests . overall ( results . values ) , results )
}
case ( false , _ ) => Seq . empty
} )
2012-05-25 10:02:35 +02:00
lazy val mimaSettings = mimaDefaultSettings ++ Seq (
// MiMa
previousArtifact : = None
)
2012-07-27 13:15:51 +02:00
def akkaPreviousArtifact ( id : String , organization : String = "com.typesafe.akka" , version : String = "2.0" ) : Option [ sbt . ModuleID ] =
if ( enableMiMa ) Some ( organization % id % version ) // the artifact to compare binary compatibility with
else None
2012-08-13 19:23:43 +02:00
// OSGi settings
object OSGi {
val actor = exports ( Seq ( "akka*" ) )
val agent = exports ( Seq ( "akka.agent.*" ) )
val camel = exports ( Seq ( "akka.camel.*" ) )
val cluster = exports ( Seq ( "akka.cluster.*" ) )
val fileMailbox = exports ( Seq ( "akka.actor.mailbox.*" ) )
val mailboxesCommon = exports ( Seq ( "akka.actor.mailbox.*" ) )
val osgi = exports ( Seq ( "akka.osgi" ) ) ++ Seq ( OsgiKeys . privatePackage : = Seq ( "akka.osgi.impl" ) )
val osgiAries = exports ( ) ++ Seq ( OsgiKeys . privatePackage : = Seq ( "akka.osgi.aries.*" ) )
val remote = exports ( Seq ( "akka.remote.*" , "akka.routing.*" , "akka.serialization.*" ) )
val slf4j = exports ( Seq ( "akka.event.slf4j.*" ) )
val dataflow = exports ( Seq ( "akka.dataflow.*" ) )
val transactor = exports ( Seq ( "akka.transactor.*" ) )
val zeroMQ = exports ( Seq ( "akka.zeromq.*" ) )
def exports ( packages : Seq [ String ] = Seq ( ) ) = osgiSettings ++ Seq (
OsgiKeys . importPackage : = defaultImports ,
OsgiKeys . exportPackage : = packages ,
packagedArtifact in ( Compile , packageBin ) <<= ( artifact in ( Compile , packageBin ) , OsgiKeys . bundle ) . identityMap ,
artifact in ( Compile , packageBin ) ~= ( _ . copy ( `type` = "bundle" ) )
)
def defaultImports = Seq ( "!sun.misc" , akkaImport ( ) , configImport ( ) , scalaImport ( ) , "*" )
def akkaImport ( packageName : String = "akka.*" ) = "%s;version=\"[2.1,2.2)\"" . format ( packageName )
def configImport ( packageName : String = "com.typesafe.config.*" ) = "%s;version=\"[0.4.1,0.5)\"" . format ( packageName )
def scalaImport ( packageName : String = "scala.*" ) = "%s;version=\"[2.10,2.11)\"" . format ( packageName )
}
2011-07-04 19:16:43 +12:00
}
// Dependencies
object Dependencies {
import Dependency._
2012-06-28 15:33:49 +02:00
val actor = Seq ( config )
2012-05-29 02:13:25 +02:00
2011-10-20 23:37:54 +02:00
val testkit = Seq ( Test . scalatest , Test . junit )
2011-07-04 19:16:43 +12:00
2012-06-15 13:04:10 +02:00
val actorTests = Seq ( Test . junit , Test . scalatest , Test . commonsMath , Test . mockito , Test . scalacheck , protobuf )
2011-07-04 19:16:43 +12:00
2012-06-20 11:28:40 +02:00
val remote = Seq ( netty , protobuf , uncommonsMath , Test . junit , Test . scalatest )
2011-07-04 19:16:43 +12:00
2012-04-24 10:19:36 +02:00
val cluster = Seq ( Test . junit , Test . scalatest )
2012-01-16 14:31:41 +01:00
2012-02-07 11:21:49 +01:00
val slf4j = Seq ( slf4jApi , Test . logback )
2011-07-04 19:16:43 +12:00
2012-07-27 19:17:06 +02:00
val agent = Seq ( scalaStm , Test . scalatest , Test . junit )
2011-12-19 15:46:06 +13:00
2012-07-27 19:17:06 +02:00
val transactor = Seq ( scalaStm , Test . scalatest , Test . junit )
2011-12-21 13:40:32 +13:00
2011-11-01 09:45:57 +01:00
val mailboxes = Seq ( Test . scalatest , Test . junit )
2011-11-25 11:01:03 +01:00
2012-05-08 15:07:05 +02:00
val fileMailbox = Seq ( Test . commonsIo , Test . scalatest , Test . junit )
2011-07-04 19:16:43 +12:00
2012-05-18 16:46:31 +02:00
val kernel = Seq ( Test . scalatest , Test . junit )
2011-07-16 10:38:17 +02:00
2012-04-24 10:19:36 +02:00
val camel = Seq ( camelCore , Test . scalatest , Test . junit , Test . mockito )
2012-01-19 14:38:44 +00:00
2012-08-09 19:30:32 +02:00
val camelSample = Seq ( CamelSample . camelJetty )
2012-06-26 22:07:57 +02:00
val osgi = Seq ( osgiCore , Test . logback , Test . commonsIo , Test . pojosr , Test . tinybundles , Test . scalatest , Test . junit )
val osgiAries = Seq ( osgiCore , ariesBlueprint , Test . ariesProxy )
2012-05-29 12:41:09 +02:00
2012-07-21 18:09:20 +02:00
val docs = Seq ( Test . scalatest , Test . junit , Test . junitIntf )
2012-01-14 03:16:39 +01:00
2012-07-27 13:15:51 +02:00
val zeroMQ = Seq ( protobuf , zeroMQClient , Test . scalatest , Test . junit )
2011-07-04 19:16:43 +12:00
}
object Dependency {
// Compile
2012-08-20 09:43:51 +02:00
val camelCore = "org.apache.camel" % "camel-core" % "2.10.0" exclude ( "org.slf4j" , "slf4j-api" ) // ApacheV2
val config = "com.typesafe" % "config" % "0.5.0" // ApacheV2
2012-08-18 11:26:00 +03:00
val netty = "io.netty" % "netty" % "3.5.4.Final" // ApacheV2
2012-07-22 16:09:00 +02:00
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.4.1" // New BSD
2012-08-20 15:21:44 +02:00
// TODO FIXME use live version
// val scalaStm = "org.scala-tools" %% "scala-stm" % "0.6" // Modified BSD (Scala)
val scalaStm = "org.scala-tools" % "scala-stm" % "0.7-SNAPSHOT" // Modified BSD (Scala)
2012-07-22 16:09:00 +02:00
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.6.4" // MIT
2012-08-20 09:43:51 +02:00
val zeroMQClient = "org.zeromq" % "zeromq-scala-binding" % "0.0.6" cross CrossVersion . full // ApacheV2
2012-07-22 16:09:00 +02:00
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" // ApacheV2
val ariesBlueprint = "org.apache.aries.blueprint" % "org.apache.aries.blueprint" % "0.3.2" // ApacheV2
val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" // ApacheV2
2011-07-04 19:16:43 +12:00
// Test
object Test {
2012-07-22 16:09:00 +02:00
val commonsMath = "org.apache.commons" % "commons-math" % "2.1" % "test" // ApacheV2
val commonsIo = "commons-io" % "commons-io" % "2.0.1" % "test" // ApacheV2
val junit = "junit" % "junit" % "4.10" % "test" // Common Public License 1.0
val logback = "ch.qos.logback" % "logback-classic" % "1.0.4" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT
2012-08-20 09:43:51 +02:00
val scalatest = "org.scalatest" % "scalatest" % "1.9-2.10.0-M6-B2" % "test" cross CrossVersion . full // ApacheV2
val scalacheck = "org.scalacheck" % "scalacheck" % "1.10.0" % "test" cross CrossVersion . full // New BSD
2012-07-27 13:15:51 +02:00
val ariesProxy = "org.apache.aries.proxy" % "org.apache.aries.proxy.impl" % "0.3" % "test" // ApacheV2
2012-07-22 16:09:00 +02:00
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 log4j = "log4j" % "log4j" % "1.2.14" % "test" // ApacheV2
val junitIntf = "com.novocode" % "junit-interface" % "0.8" % "test" // MIT
2011-07-04 19:16:43 +12:00
}
2012-08-09 19:30:32 +02:00
// Camel Sample
object CamelSample {
val camelJetty = "org.apache.camel" % "camel-jetty" % "2.10.0" // ApacheV2
}
2011-07-04 19:16:43 +12:00
}