=pro load sample builds with project dependencies

* load sample builds from their definitions and replace library dependencies with project ones
* remove redefined sample build definitions
* test osgi sample by running a maven command
This commit is contained in:
Martynas Mickevičius 2014-11-13 18:56:02 +02:00
parent 6800c51e56
commit 2f321d12b3
14 changed files with 125 additions and 257 deletions

View file

@ -11,4 +11,3 @@ libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.2",
"ch.qos.logback" % "logback-classic" % "1.0.7"
)

View file

@ -5,10 +5,10 @@ version := "2.4-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
"com.typesafe.akka" %% "akka-camel" % "2.4-SNAPSHOT",
"org.apache.camel" % "camel-jetty" % "2.10.3",
"org.apache.camel" % "camel-quartz" % "2.10.3",
"org.slf4j" % "slf4j-api" % "1.7.2",
"ch.qos.logback" % "logback-classic" % "1.0.7"
)

View file

@ -12,11 +12,13 @@ val project = Project(
scalaVersion := "2.10.4",
scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.6", "-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint"),
javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6", "-Xlint:unchecked", "-Xlint:deprecation"),
javacOptions in doc in Compile := Seq("-source", "1.6"), // javadoc does not support -target and -Xlint flags
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
"org.scalatest" %% "scalatest" % "2.0" % "test",
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.fusesource" % "sigar" % "1.6.4"),
javaOptions in run ++= Seq(
"-Djava.library.path=./sigar",

View file

@ -13,10 +13,11 @@ val project = Project(
scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.6", "-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint"),
javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6", "-Xlint:unchecked", "-Xlint:deprecation"),
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
"org.scalatest" %% "scalatest" % "2.0" % "test",
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.fusesource" % "sigar" % "1.6.4"),
javaOptions in run ++= Seq(
"-Djava.library.path=./sigar",

View file

@ -7,4 +7,3 @@ scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT"
)

View file

@ -13,7 +13,7 @@ val project = Project(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
"org.scalatest" %% "scalatest" % "2.0" % "test"),
"org.scalatest" %% "scalatest" % "2.2.1" % "test"),
// make sure that MultiJvm test are compiled by the default test compilation
compile in MultiJvm <<= (compile in MultiJvm) triggeredBy (compile in Test),
// disable parallel tests

View file

@ -5,6 +5,6 @@ version := "2.3-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
"com.typesafe.akka" %% "akka-persistence-experimental" % "2.4-SNAPSHOT"
)

View file

@ -5,6 +5,6 @@ version := "2.4-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
"com.typesafe.akka" %% "akka-remote" % "2.4-SNAPSHOT"
)

View file

@ -5,6 +5,6 @@ version := "2.4-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
"com.typesafe.akka" %% "akka-remote" % "2.4-SNAPSHOT"
)

View file

@ -27,6 +27,8 @@ object AkkaBuild extends Build {
// Load system properties from a file to make configuration from Jenkins easier
loadSystemProperties("project/akka-build.properties")
override def buildLoaders = BuildLoader.transform(Sample.buildTransformer) :: Nil
val enableMiMa = false
lazy val buildSettings = Seq(
@ -157,86 +159,6 @@ object AkkaBuild extends Build {
dependencies = Seq(actor)
)
lazy val samples = Project(
id = "akka-samples",
base = file("akka-samples"),
settings = parentSettings ++ ActivatorDist.settings,
aggregate = Seq(camelSampleJava, camelSampleScala, mainSampleJava, mainSampleScala,
remoteSampleJava, remoteSampleScala, clusterSampleJava, clusterSampleScala,
fsmSampleScala, persistenceSampleJava, persistenceSampleScala,
multiNodeSampleScala, helloKernelSample, osgiDiningHakkersSample)
)
lazy val camelSampleJava = Project(
id = "akka-sample-camel-java",
base = file("akka-samples/akka-sample-camel-java"),
dependencies = Seq(actor, camel),
settings = sampleSettings ++ Seq(libraryDependencies ++= Dependencies.camelSample)
)
lazy val camelSampleScala = Project(
id = "akka-sample-camel-scala",
base = file("akka-samples/akka-sample-camel-scala"),
dependencies = Seq(actor, camel),
settings = sampleSettings ++ Seq(libraryDependencies ++= Dependencies.camelSample)
)
lazy val fsmSampleScala = Project(
id = "akka-sample-fsm-scala",
base = file("akka-samples/akka-sample-fsm-scala"),
dependencies = Seq(actor),
settings = sampleSettings
)
lazy val mainSampleJava = Project(
id = "akka-sample-main-java",
base = file("akka-samples/akka-sample-main-java"),
dependencies = Seq(actor),
settings = sampleSettings
)
lazy val mainSampleScala = Project(
id = "akka-sample-main-scala",
base = file("akka-samples/akka-sample-main-scala"),
dependencies = Seq(actor),
settings = sampleSettings
)
lazy val helloKernelSample = Project(
id = "akka-sample-hello-kernel",
base = file("akka-samples/akka-sample-hello-kernel"),
dependencies = Seq(kernel),
settings = sampleSettings
)
lazy val remoteSampleJava = Project(
id = "akka-sample-remote-java",
base = file("akka-samples/akka-sample-remote-java"),
dependencies = Seq(actor, remote),
settings = sampleSettings
)
lazy val remoteSampleScala = Project(
id = "akka-sample-remote-scala",
base = file("akka-samples/akka-sample-remote-scala"),
dependencies = Seq(actor, remote),
settings = sampleSettings
)
lazy val persistenceSampleJava = Project(
id = "akka-sample-persistence-java",
base = file("akka-samples/akka-sample-persistence-java"),
dependencies = Seq(actor, persistence),
settings = sampleSettings
)
lazy val persistenceSampleScala = Project(
id = "akka-sample-persistence-scala",
base = file("akka-samples/akka-sample-persistence-scala"),
dependencies = Seq(actor, persistence),
settings = sampleSettings
)
lazy val docs = Project(
id = "akka-docs",
base = file("akka-docs"),
@ -251,123 +173,55 @@ object AkkaBuild extends Build {
dependencies = Seq(remote, remoteTests % "test->test", cluster, persistence)
) configs (MultiJvm)
lazy val clusterSampleJava = Project(
id = "akka-sample-cluster-java",
base = file("akka-samples/akka-sample-cluster-java"),
dependencies = Seq(cluster, contrib, remoteTests % "test", testkit % "test"),
settings = sampleSettings ++ Seq(
libraryDependencies ++= Dependencies.clusterSample,
javaOptions in run ++= Seq(
"-Djava.library.path=./sigar",
"-Xms128m", "-Xmx1024m"),
Keys.fork in run := true,
// 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
}
) ++ multiJvmSettings
) configs (MultiJvm)
lazy val clusterSampleScala = Project(
id = "akka-sample-cluster-scala",
base = file("akka-samples/akka-sample-cluster-scala"),
dependencies = Seq(cluster, contrib, remoteTests % "test", testkit % "test"),
settings = sampleSettings ++ Seq(
libraryDependencies ++= Dependencies.clusterSample,
javaOptions in run ++= Seq(
"-Djava.library.path=./sigar",
"-Xms128m", "-Xmx1024m"),
Keys.fork in run := true,
// 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
}
) ++ multiJvmSettings
) configs (MultiJvm)
lazy val multiNodeSampleScala = Project(
id = "akka-sample-multi-node-scala",
base = file("akka-samples/akka-sample-multi-node-scala"),
dependencies = Seq(multiNodeTestkit % "test", testkit % "test"),
settings = sampleSettings ++ experimentalSettings ++ Seq(
libraryDependencies ++= Dependencies.multiNodeSample,
// 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
}
) ++ multiJvmSettings
) configs (MultiJvm)
lazy val osgiDiningHakkersSample = Project(id = "akka-sample-osgi-dining-hakkers",
base = file("akka-samples/akka-sample-osgi-dining-hakkers"),
settings = parentSettings ++ osgiSampleSettings
) aggregate(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore,
osgiDiningHakkersSampleIntegrationTest, uncommons)
lazy val osgiDiningHakkersSampleApi = Project(id = "akka-sample-osgi-dining-hakkers-api",
base = file("akka-samples/akka-sample-osgi-dining-hakkers/api"),
settings = sampleSettings ++ osgiSampleSettings ++ OSGi.osgiDiningHakkersSampleApi
)dependsOn(actor)
lazy val osgiDiningHakkersSampleCommand = Project(id = "akka-sample-osgi-dining-hakkers-command",
base = file("akka-samples/akka-sample-osgi-dining-hakkers/command"),
settings = sampleSettings ++ osgiSampleSettings ++ OSGi.osgiDiningHakkersSampleCommand ++ Seq(
libraryDependencies ++= Dependencies.osgiDiningHakkersSampleCommand
)
) dependsOn (osgiDiningHakkersSampleApi, actor)
lazy val osgiDiningHakkersSampleCore = Project(id = "akka-sample-osgi-dining-hakkers-core",
base = file("akka-samples/akka-sample-osgi-dining-hakkers/core"),
settings = sampleSettings ++ osgiSampleSettings ++ OSGi.osgiDiningHakkersSampleCore ++ Seq(
libraryDependencies ++= Dependencies.osgiDiningHakkersSampleCore
)
) dependsOn (osgiDiningHakkersSampleApi, actor, remote, cluster, persistence, osgi)
lazy val osgiDiningHakkersSampleTest = Project(id = "akka-sample-osgi-dining-hakkers-test",
base = file("akka-samples/akka-sample-osgi-dining-hakkers/integration-test"),
settings = sampleSettings ++ osgiSampleSettings ++ OSGi.osgiDiningHakkersSampleCore ++ Seq(
libraryDependencies ++= Dependencies.osgiDiningHakkersSampleTest
)
) dependsOn (osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, testkit )
//TODO to remove it as soon as the uncommons gets OSGified, see ticket #2990
lazy val uncommons = Project(id = "akka-sample-osgi-dining-hakkers-uncommons",
base = file("akka-samples/akka-sample-osgi-dining-hakkers/uncommons"),
settings = sampleSettings ++ osgiSampleSettings ++ OSGi.osgiDiningHakkersSampleUncommons ++ Seq(
libraryDependencies ++= Dependencies.uncommons,
// allow publishLocal/publishM2 to overwrite
isSnapshot := true,
version := "1.2.0"
)
lazy val samples = Project(
id = "akka-samples",
base = file("akka-samples"),
settings = parentSettings ++ ActivatorDist.settings,
aggregate = Seq(sampleCamelJava, sampleCamelScala, sampleClusterJava, sampleClusterScala, sampleFsmScala,
sampleHelloKernel, sampleMainJava, sampleMainScala, sampleMultiNodeScala, osgiDiningHakkersSampleMavenTest,
samplePersistenceJava, samplePersistenceScala, sampleRemoteJava, sampleRemoteScala)
)
def executeMvnCommands(failureMessage: String, commands: String*) = {
if ({List("sh", "-c", commands.mkString("cd akka-samples/akka-sample-osgi-dining-hakkers; mvn ", " ", "")) !} != 0)
throw new Exception(failureMessage)
}
lazy val sampleCamelJava = Sample.project("akka-sample-camel-java")
lazy val sampleCamelScala = Sample.project("akka-sample-camel-scala")
lazy val osgiDiningHakkersSampleIntegrationTest = Project(id = "akka-sample-osgi-dining-hakkers-integration",
base = file("akka-samples/akka-sample-osgi-dining-hakkers-integration"),
settings = sampleSettings ++ osgiSampleSettings ++ (
if (System.getProperty("akka.osgi.sample.test", "true").toBoolean) Seq(
test in Test ~= { x => {
executeMvnCommands("Osgi sample Dining hakkers test failed", "clean", "install")
}},
// force publication of artifacts to local maven repo
compile in Compile <<=
(publishM2 in actor, publishM2 in testkit, publishM2 in remote, publishM2 in cluster, publishM2 in osgi,
publishM2 in slf4j, publishM2 in persistence, compile in Compile) map
((_, _, _, _, _, _, _, c) => c))
else Seq.empty
)
) dependsOn(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, uncommons)
lazy val sampleClusterJava = Sample.project("akka-sample-cluster-java")
lazy val sampleClusterScala = Sample.project("akka-sample-cluster-scala")
lazy val osgiSampleSettings: Seq[Setting[_]] = Seq(target := baseDirectory.value / "target-sbt")
lazy val sampleFsmScala = Sample.project("akka-sample-fsm-scala")
// Settings
lazy val sampleHelloKernel = Sample.project("akka-sample-hello-kernel")
lazy val sampleMainJava = Sample.project("akka-sample-main-java")
lazy val sampleMainScala = Sample.project("akka-sample-main-scala")
lazy val sampleMultiNodeScala = Sample.project("akka-sample-multi-node-scala")
lazy val samplePersistenceJava = Sample.project("akka-sample-persistence-java")
lazy val samplePersistenceScala = Sample.project("akka-sample-persistence-scala")
lazy val sampleRemoteJava = Sample.project("akka-sample-remote-java")
lazy val sampleRemoteScala = Sample.project("akka-sample-remote-scala")
lazy val osgiDiningHakkersSampleMavenTest = Project(id = "akka-sample-osgi-dining-hakkers-maven-test",
base = file("akka-samples/akka-sample-osgi-dining-hakkers-maven-test"),
settings = Seq(
publishArtifact := false,
reportBinaryIssues := (), // disable bin comp check
// force publication of artifacts to local maven repo, so latest versions can be used when running maven tests
compile in Compile <<=
(publishM2 in actor, publishM2 in testkit, publishM2 in remote, publishM2 in cluster, publishM2 in osgi,
publishM2 in slf4j, publishM2 in persistence, compile in Compile) map
((_, _, _, _, _, _, _, c) => c),
test in Test ~= { x => {
def executeMvnCommands(failureMessage: String, commands: String*) = {
if ({List("sh", "-c", commands.mkString("cd akka-samples/akka-sample-osgi-dining-hakkers; mvn ", " ", "")) !} != 0)
throw new Exception(failureMessage)
}
executeMvnCommands("Osgi sample Dining hakkers test failed", "clean", "install")
}}
)
)
override lazy val settings =
super.settings ++
@ -384,11 +238,6 @@ object AkkaBuild extends Build {
reportBinaryIssues := () // disable bin comp check
)
lazy val sampleSettings = defaultSettings ++ docFormatSettings ++ Seq(
publishArtifact := false,
reportBinaryIssues := () // disable bin comp check
)
lazy val experimentalSettings = Seq(
description := """|This module of Akka is marked as
|experimental, which means that it is in early

View file

@ -18,40 +18,23 @@ object Dependencies {
object Compile {
import Versions._
// Several dependencies are mirrored in the OSGi Dining Hackers maven project
// They need to be changed in this file as well:
// akka-samples/akka-sample-osgi-dining-hakkers/pom.xml
// Compile
val camelCore = "org.apache.camel" % "camel-core" % "2.13.0" exclude("org.slf4j", "slf4j-api") // ApacheV2
// when updating config version, update links ActorSystem ScalaDoc to link to the updated version
val config = "com.typesafe" % "config" % "1.2.1" // ApacheV2
// mirrored in OSGi sample
val netty = "io.netty" % "netty" % "3.8.0.Final" // ApacheV2
// mirrored in OSGi sample
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.5.0" // New BSD
val scalaStm = "org.scala-stm" %% "scala-stm" % scalaStmVersion // Modified BSD (Scala)
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.5" // MIT
val zeroMQClient = "org.zeromq" %% "zeromq-scala-binding" % scalaZeroMQVersion // ApacheV2
// mirrored in OSGi sample
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2
// mirrored in OSGi sample
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2
val osgiCompendium= "org.osgi" % "org.osgi.compendium" % "4.3.1" // ApacheV2
// mirrored in OSGi sample
val levelDB = "org.iq80.leveldb" % "leveldb" % "0.7" // ApacheV2
// mirrored in OSGi sample
val levelDBNative = "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.7" // New BSD
// Camel Sample
val camelJetty = "org.apache.camel" % "camel-jetty" % camelCore.revision // ApacheV2
// Cluster Sample
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
// Test
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
object Test {
val commonsMath = "org.apache.commons" % "commons-math" % "2.1" % "test" // ApacheV2
@ -61,18 +44,12 @@ object Dependencies {
val logback = "ch.qos.logback" % "logback-classic" % "1.0.13" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-all" % "1.9.5" % "test" // MIT
// changing the scalatest dependency must be reflected in akka-docs/rst/dev/multi-jvm-testing.rst
// mirrored in OSGi sample
val scalatest = "org.scalatest" %% "scalatest" % scalaTestVersion % "test" // ApacheV2
val scalacheck = "org.scalacheck" %% "scalacheck" % scalaCheckVersion % "test" // New BSD
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % "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
// dining hakkers integration test using pax-exam
// mirrored in OSGi sample
val karafExam = "org.apache.karaf.tooling.exam" % "org.apache.karaf.tooling.exam.container" % "2.3.1" % "test" // ApacheV2
// mirrored in OSGi sample
val paxExam = "org.ops4j.pax.exam" % "pax-exam-junit4" % "2.6.0" % "test" // ApacheV2
val scalaXml = post210Dependency("org.scala-lang.modules" %% "scala-xml" % "1.0.1" % "test")
// metrics, measurements, perf testing
@ -110,27 +87,13 @@ object Dependencies {
val camel = Seq(camelCore, Test.scalatest, Test.junit, Test.mockito, Test.logback, Test.commonsIo, Test.junitIntf)
val camelSample = Seq(camelJetty)
val osgi = Seq(osgiCore, osgiCompendium, Test.logback, Test.commonsIo, Test.pojosr, Test.tinybundles, Test.scalatest, Test.junit)
val osgiDiningHakkersSampleCore = Seq(config, osgiCore, osgiCompendium)
val osgiDiningHakkersSampleCommand = Seq(osgiCore, osgiCompendium)
val osgiDiningHakkersSampleTest = Seq(osgiCore, osgiCompendium, Test.karafExam, Test.paxExam, Test.junit, Test.scalatest)
val uncommons = Seq(uncommonsMath)
val docs = Seq(Test.scalatest, Test.junit, Test.junitIntf)
val zeroMQ = Seq(protobuf, zeroMQClient, Test.scalatest, Test.junit)
val clusterSample = Seq(Test.scalatest, sigar)
val contrib = Seq(Test.junitIntf, Test.commonsIo)
val multiNodeSample = Seq(Test.scalatest)
}
object DependencyHelpers {

View file

@ -32,14 +32,6 @@ object OSGi {
val osgi = exports(Seq("akka.osgi.*"))
val osgiDiningHakkersSampleApi = exports(Seq("akka.sample.osgi.api"))
val osgiDiningHakkersSampleCommand = osgiSettings ++ Seq(OsgiKeys.bundleActivator := Option("akka.sample.osgi.command.Activator"), OsgiKeys.privatePackage := Seq("akka.sample.osgi.command"))
val osgiDiningHakkersSampleCore = exports(Seq("")) ++ Seq(OsgiKeys.bundleActivator := Option("akka.sample.osgi.activation.Activator"), OsgiKeys.privatePackage := Seq("akka.sample.osgi.internal", "akka.sample.osgi.activation", "akka.sample.osgi.service"))
val osgiDiningHakkersSampleUncommons = exports(Seq("org.uncommons.maths.random")) ++ Seq(OsgiKeys.privatePackage := Seq("org.uncommons.maths.binary", "org.uncommons.maths", "org.uncommons.maths.number"))
val remote = exports(Seq("akka.remote.*"), imports = Seq(protobufImport()))
val slf4j = exports(Seq("akka.event.slf4j.*"))

67
project/Sample.scala Normal file
View file

@ -0,0 +1,67 @@
package akka
import sbt._
import sbt.Keys._
object Sample {
final val akkaOrganization = "com.typesafe.akka"
def buildTransformer = (ti: BuildLoader.TransformInfo) => ti.base.name match {
case s if s.startsWith("akka-sample") =>
ti.unit.copy(
loadedDefinitions = ti.unit.definitions.copy(
projects = libraryToProjectDeps(ti.unit.definitions.projects)))
case _ => ti.unit
}
def project(name: String) =
ProjectRef(file(s"akka-samples/$name"), name)
private def libraryToProjectDeps(projects: Seq[Project]) =
projects.map(addProjectDependencies andThen excludeLibraryDependencies)
private val addProjectDependencies = (project: Project) => {
project.settings(
buildDependencies := {
val projectDependencies = libraryDependencies.value.collect {
case module if module.organization == akkaOrganization => ProjectRef(file("").toURI, module.name)
}
val dependencies = buildDependencies.value
val classpathWithProjectDependencies = dependencies.classpath.map {
case (proj, deps) if proj.project == project.id =>
// add project dependency for every akka library dependnecy
(proj, deps ++ projectDependencies.map(ResolvedClasspathDependency(_, None)))
case (project, deps) => (project, deps)
}
BuildDependencies(classpathWithProjectDependencies, dependencies.aggregate)
}
)
}
private val excludeLibraryDependencies = (project: Project) => {
project.settings(
libraryDependencies := libraryDependencies.value.map {
case module if module.organization == akkaOrganization =>
/**
* Exclude self, so it is still possible to know what project dependencies to add.
* This leaves all transitive dependencies (such as typesafe-config library).
* However it means that if a sample uses typesafe-config library it must have a
* library dependency which has a direct transitive dependency to typesafe-config.
*/
module.excludeAll(ExclusionRule(organization=module.organization))
case module => module
}
)
}
private implicit class RichLoadedDefinitions(ld: LoadedDefinitions) {
def copy(projects: Seq[Project]) =
new LoadedDefinitions(ld.base, ld.target, ld.loader, ld.builds, projects, ld.buildNames)
}
private implicit class RichBuildUnit(bu: BuildUnit) {
def copy(loadedDefinitions: LoadedDefinitions) =
new BuildUnit(bu.uri, bu.localBase, loadedDefinitions, bu.plugins)
}
}

View file

@ -15,7 +15,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.6.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-s3" % "0.5")
@ -23,9 +23,5 @@ addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2")
// needed for the akka-sample-hello-kernel
// it is also defined in akka-samples/akka-sample-hello-kernel/project/plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2")
// stats reporting
libraryDependencies += "com.timgroup" % "java-statsd-client" % "2.0.0"