From 5f6a393808cd983206a209ed2436a5738f3be7e4 Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Mon, 4 Jul 2011 19:16:43 +1200 Subject: [PATCH] Basis for sbt 0.10 build --- project/AkkaBuild.scala | 379 +++++++++++++++++++++++++++++++++++++++ project/build.properties | 1 + 2 files changed, 380 insertions(+) create mode 100644 project/AkkaBuild.scala create mode 100644 project/build.properties diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala new file mode 100644 index 0000000000..b5a07aef15 --- /dev/null +++ b/project/AkkaBuild.scala @@ -0,0 +1,379 @@ +import sbt._ +import Keys._ + +object AkkaBuild extends Build { + val Organization = "se.scalablesolutions.akka" + val Version = "2.0-SNAPSHOT" + val ScalaVersion = "2.9.0-1" + + lazy val akka = Project( + id = "akka", + base = file("."), + settings = buildSettings, + aggregate = Seq(actor, testkit, actorTests, stm, cluster, http, slf4j, mailboxes, camel, camelTyped, samples, tutorials) + ) + + lazy val actor = Project( + id = "akka-actor", + base = file("akka-actor"), + settings = defaultSettings ++ Seq( + autoCompilerPlugins := true, + addCompilerPlugin("org.scala-lang.plugins" % "continuations" % ScalaVersion), + scalacOptions += "-P:continuations:enable" + ) + ) + + lazy val testkit = Project( + id = "akka-testkit", + base = file("akka-testkit"), + dependencies = Seq(actor), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.testkit + ) + ) + + lazy val actorTests = Project( + id = "akka-actor-tests", + base = file("akka-actor-tests"), + dependencies = Seq(testkit), + settings = defaultSettings ++ Seq( + autoCompilerPlugins := true, + addCompilerPlugin("org.scala-lang.plugins" % "continuations" % ScalaVersion), + scalacOptions += "-P:continuations:enable", + libraryDependencies ++= Dependencies.actorTests + ) + ) + + lazy val stm = Project( + id = "akka-stm", + base = file("akka-stm"), + dependencies = Seq(actor), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.stm + ) + ) + + lazy val cluster = Project( + id = "akka-cluster", + base = file("akka-cluster"), + dependencies = Seq(stm, actorTests % "test->test"), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.cluster, + testOptions in Test += Tests.Filter(s => !s.contains("MultiJvm")) + ) + ) + + lazy val http = Project( + id = "akka-http", + base = file("akka-http"), + dependencies = Seq(actor), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.http + ) + ) + + lazy val slf4j = Project( + id = "akka-slf4j", + base = file("akka-slf4j"), + dependencies = Seq(actor), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.slf4j + ) + ) + + lazy val mailboxes = Project( + id = "akka-durable-mailboxes", + base = file("akka-durable-mailboxes"), + settings = buildSettings, + aggregate = Seq(mailboxesCommon, beanstalkMailbox, fileMailbox, redisMailbox, zookeeperMailbox) + ) + + lazy val mailboxesCommon = Project( + id = "akka-mailboxes-common", + base = file("akka-durable-mailboxes/akka-mailboxes-common"), + dependencies = Seq(cluster), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.mailboxes + ) + ) + + val testBeanstalkMailbox = SettingKey[Boolean]("test-beanstalk-mailbox") + + lazy val beanstalkMailbox = Project( + id = "akka-beanstalk-mailbox", + base = file("akka-durable-mailboxes/akka-beanstalk-mailbox"), + dependencies = Seq(mailboxesCommon % "compile;test->test"), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.beanstalkMailbox, + testBeanstalkMailbox := false, + testOptions in Test <+= testBeanstalkMailbox map { test => Tests.Filter(s => test) } + ) + ) + + lazy val fileMailbox = Project( + id = "akka-file-mailbox", + base = file("akka-durable-mailboxes/akka-file-mailbox"), + dependencies = Seq(mailboxesCommon % "compile;test->test"), + settings = defaultSettings + ) + + val testRedisMailbox = SettingKey[Boolean]("test-redis-mailbox") + + lazy val redisMailbox = Project( + id = "akka-redis-mailbox", + base = file("akka-durable-mailboxes/akka-redis-mailbox"), + dependencies = Seq(mailboxesCommon % "compile;test->test"), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.redisMailbox, + testRedisMailbox := false, + testOptions in Test <+= testRedisMailbox map { test => Tests.Filter(s => test) } + ) + ) + + lazy val zookeeperMailbox = Project( + id = "akka-zookeeper-mailbox", + base = file("akka-durable-mailboxes/akka-zookeeper-mailbox"), + dependencies = Seq(mailboxesCommon % "compile;test->test"), + settings = defaultSettings + ) + + lazy val camel = Project( + id = "akka-camel", + base = file("akka-camel"), + dependencies = Seq(actor, slf4j), + settings = defaultSettings ++ Seq( + libraryDependencies ++= Dependencies.camel + ) + ) + + // can be merged back into akka-camel + lazy val camelTyped = Project( + id = "akka-camel-typed", + base = file("akka-camel-typed"), + dependencies = Seq(camel % "compile;test->test"), + settings = defaultSettings + ) + + // lazy val spring = Project( + // id = "akka-spring", + // base = file("akka-spring"), + // dependencies = Seq(cluster, camel), + // settings = defaultSettings ++ Seq( + // libraryDependencies ++= Dependencies.spring + // ) + // ) + + // lazy val kernel = Project( + // id = "akka-kernel", + // base = file("akka-kernel"), + // dependencies = Seq(cluster, http, slf4j, spring), + // settings = defaultSettings ++ Seq( + // libraryDependencies ++= Dependencies.kernel + // ) + // ) + + lazy val samples = Project( + id = "akka-samples", + base = file("akka-samples"), + settings = buildSettings, + aggregate = Seq(fsmSample) + ) + + // lazy val antsSample = Project( + // id = "akka-sample-ants", + // base = file("akka-samples/akka-sample-ants"), + // dependencies = Seq(stm), + // settings = defaultSettings + // ) + + // lazy val chatSample = Project( + // id = "akka-sample-chat", + // base = file("akka-samples/akka-sample-chat"), + // dependencies = Seq(cluster), + // settings = defaultSettings + // ) + + lazy val fsmSample = Project( + id = "akka-sample-fsm", + base = file("akka-samples/akka-sample-fsm"), + dependencies = Seq(actor), + settings = defaultSettings + ) + + // lazy val helloSample = Project( + // id = "akka-sample-hello", + // base = file("akka-samples/akka-sample-hello"), + // dependencies = Seq(kernel), + // settings = defaultSettings + // ) + + // lazy val remoteSample = Project( + // id = "akka-sample-remote", + // base = file("akka-samples/akka-sample-remote"), + // dependencies = Seq(cluster), + // settings = defaultSettings + // ) + + lazy val tutorials = Project( + id = "akka-tutorials", + base = file("akka-tutorials"), + settings = buildSettings, + aggregate = Seq(firstTutorial, secondTutorial) + ) + + lazy val firstTutorial = Project( + id = "akka-tutorial-first", + base = file("akka-tutorials/akka-tutorial-first"), + dependencies = Seq(actor), + settings = defaultSettings + ) + + lazy val secondTutorial = Project( + id = "akka-tutorial-second", + base = file("akka-tutorials/akka-tutorial-second"), + dependencies = Seq(actor), + settings = defaultSettings + ) + + // Settings + + lazy val buildSettings = Defaults.defaultSettings ++ Seq( + organization := Organization, + version := Version, + scalaVersion := ScalaVersion + ) + + lazy val defaultSettings = buildSettings ++ Seq( + resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/", + + // compile options + scalacOptions ++= Seq("-encoding", "UTF-8", "-optimise", "-deprecation", "-unchecked"), + javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), + + // add config dir to classpaths + unmanagedClasspath in Runtime <+= (baseDirectory in LocalProject("akka")) map { base => Attributed.blank(base / "config") }, + unmanagedClasspath in Test <+= (baseDirectory in LocalProject("akka")) map { base => Attributed.blank(base / "config") }, + + // disable parallel tests + parallelExecution in Test := false + ) +} + +// Dependencies + +object Dependencies { + import Dependency._ + + val testkit = Seq(Test.scalatest) + + val actorTests = Seq(Test.junit, Test.scalatest, Test.multiverse, protobuf, jacksonMapper, sjson) + + val stm = Seq(multiverse, Test.junit, Test.scalatest) + + val cluster = Seq(bookkeeper, commonsCodec, commonsIo, guice, h2Lzf, jacksonCore, jacksonMapper, + log4j, netty, protobuf, sjson, zkClient, zookeeper, zookeeperLock, + Test.junit, Test.scalatest) + + val http = Seq(jsr250, Provided.javaxServlet, Provided.jetty, Provided.jerseyServer, jsr311, commonsCodec, + Test.junit, Test.scalatest, Test.mockito) + + val slf4j = Seq(slf4jApi) + + val mailboxes = Seq(Test.scalatest) + + val beanstalkMailbox = Seq(beanstalk) + + val redisMailbox = Seq(redis) + + val camel = Seq(camelCore, Test.junit, Test.scalatest, Test.logback) + + val spring = Seq(springBeans, springContext, Test.camelSpring, Test.junit, Test.scalatest) + + val kernel = Seq(jettyUtil, jettyXml, jettyServlet, jerseyCore, jerseyJson, jerseyScala, + jacksonCore, staxApi, Provided.jerseyServer) +} + +object Dependency { + + // Versions + + object V { + val Camel = "2.7.1" + val CamelPatch = "2.7.1.1" + val Jackson = "1.8.0" + val JavaxServlet = "3.0" + val Jersey = "1.3" + val Jetty = "7.4.0.v20110414" + val Logback = "0.9.28" + val Multiverse = "0.6.2" + val Netty = "3.2.4.Final" + val Protobuf = "2.4.1" + val Scalatest = "1.4.1" + val Slf4j = "1.6.0" + val Spring = "3.0.5.RELEASE" + val Zookeeper = "3.4.0" + } + + // Compile + + val beanstalk = "beanstalk" % "beanstalk_client" % "1.4.5" // New BSD + val bookkeeper = "org.apache.hadoop.zookeeper" % "bookkeeper" % V.Zookeeper // ApacheV2 + val camelCore = "org.apache.camel" % "camel-core" % V.CamelPatch // ApacheV2 + val commonsCodec = "commons-codec" % "commons-codec" % "1.4" // ApacheV2 + val commonsIo = "commons-io" % "commons-io" % "2.0.1" // ApacheV2 + val guice = "org.guiceyfruit" % "guice-all" % "2.0" // ApacheV2 + val h2Lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" // ApacheV2 + val jacksonCore = "org.codehaus.jackson" % "jackson-core-asl" % V.Jackson // ApacheV2 + val jacksonMapper = "org.codehaus.jackson" % "jackson-mapper-asl" % V.Jackson // ApacheV2 + val jerseyCore = "com.sun.jersey" % "jersey-core" % V.Jersey // CDDL v1 + val jerseyJson = "com.sun.jersey" % "jersey-json" % V.Jersey // CDDL v1 + val jerseyScala = "com.sun.jersey.contribs" % "jersey-scala" % V.Jersey // CDDL v1 + val jettyUtil = "org.eclipse.jetty" % "jetty-util" % V.Jetty // Eclipse license + val jettyXml = "org.eclipse.jetty" % "jetty-xml" % V.Jetty // Eclipse license + val jettyServlet = "org.eclipse.jetty" % "jetty-servlet" % V.Jetty // Eclipse license + val jsr250 = "javax.annotation" % "jsr250-api" % "1.0" // CDDL v1 + val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1" // CDDL v1 + val log4j = "log4j" % "log4j" % "1.2.15" // ApacheV2 + val multiverse = "org.multiverse" % "multiverse-alpha" % V.Multiverse // ApacheV2 + val netty = "org.jboss.netty" % "netty" % V.Netty // ApacheV2 + val osgi = "org.osgi" % "org.osgi.core" % "4.2.0" // ApacheV2 + val protobuf = "com.google.protobuf" % "protobuf-java" % V.Protobuf // New BSD + val redis = "net.debasishg" % "redisclient_2.9.0" % "2.3.1" // ApacheV2 + val sjson = "net.debasishg" % "sjson_2.9.0" % "0.11" // ApacheV2 + val slf4jApi = "org.slf4j" % "slf4j-api" % V.Slf4j // MIT + val springBeans = "org.springframework" % "spring-beans" % V.Spring // ApacheV2 + val springContext = "org.springframework" % "spring-context" % V.Spring // ApacheV2 + val staxApi = "javax.xml.stream" % "stax-api" % "1.0-2" // ApacheV2 + val zkClient = "zkclient" % "zkclient" % "0.3" // ApacheV2 + val zookeeper = "org.apache.hadoop.zookeeper" % "zookeeper" % V.Zookeeper // ApacheV2 + val zookeeperLock = "org.apache.hadoop.zookeeper" % "zookeeper-recipes-lock" % V.Zookeeper // ApacheV2 + + // Runtime + + object Runtime { + val logback = "ch.qos.logback" % "logback-classic" % V.Logback % "runtime" // MIT + } + + // Provided + + object Provided { + val javaxServlet = "org.glassfish" % "javax.servlet" % V.JavaxServlet % "provided" // CDDL v1 + val jerseyServer = "com.sun.jersey" % "jersey-server" % V.Jersey % "provided" // CDDL v1 + val jetty = "org.eclipse.jetty" % "jetty-server" % V.Jetty % "provided" // Eclipse license + } + + // Test + + object Test { + val camelSpring = "org.apache.camel" % "camel-spring" % V.Camel % "test" // ApacheV2 + val commonsColl = "commons-collections" % "commons-collections" % "3.2.1" % "test" // ApacheV2 + val jetty = "org.eclipse.jetty" % "jetty-server" % V.Jetty % "test" // Eclipse license + val jettyWebapp = "org.eclipse.jetty" % "jetty-webapp" % V.Jetty % "test" // Eclipse license + val junit = "junit" % "junit" % "4.5" % "test" // Common Public License 1.0 + val logback = "ch.qos.logback" % "logback-classic" % V.Logback % "test" // EPL 1.0 / LGPL 2.1 + val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT + val multiverse = "org.multiverse" % "multiverse-alpha" % V.Multiverse % "test" // ApacheV2 + val scalatest = "org.scalatest" % "scalatest_2.9.0" % V.Scalatest % "test" // ApacheV2 + val sjsonTest = "net.debasishg" %% "sjson" % "0.11" % "test" // ApacheV2 + } +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000000..35e164f667 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=0.10.0