Merge pull request #2030 from akka/wip-activator-build-patriknw
=sam Switch to build.sbt in activator templates
This commit is contained in:
commit
8094774b79
10 changed files with 145 additions and 108 deletions
|
|
@ -17,13 +17,13 @@ You can add it as a plugin by adding the following to your project/plugins.sbt:
|
||||||
|
|
||||||
.. includecode:: ../../../project/plugins.sbt#sbt-multi-jvm
|
.. includecode:: ../../../project/plugins.sbt#sbt-multi-jvm
|
||||||
|
|
||||||
You can then add multi-JVM testing to ``project/Build.scala`` by including the ``MultiJvm``
|
You can then add multi-JVM testing to ``build.sbt`` or ``project/Build.scala`` by including the ``MultiJvm``
|
||||||
settings and config. Please note that MultiJvm test sources are located in ``src/multi-jvm/...``,
|
settings and config. Please note that MultiJvm test sources are located in ``src/multi-jvm/...``,
|
||||||
and not in ``src/test/...``.
|
and not in ``src/test/...``.
|
||||||
|
|
||||||
Here is an example Build.scala file for sbt 0.13 that uses the MultiJvm plugin:
|
Here is an example ``build.sbt`` file for sbt 0.13 that uses the MultiJvm plugin:
|
||||||
|
|
||||||
.. includecode:: ../../../akka-samples/akka-sample-multi-node-scala/project/Build.scala
|
.. includecode:: ../../../akka-samples/akka-sample-multi-node-scala/build.sbt
|
||||||
|
|
||||||
You can specify JVM options for the forked JVMs::
|
You can specify JVM options for the forked JVMs::
|
||||||
|
|
||||||
|
|
|
||||||
44
akka-samples/akka-sample-cluster-java/build.sbt
Normal file
44
akka-samples/akka-sample-cluster-java/build.sbt
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
||||||
|
|
||||||
|
val akkaVersion = "2.3-SNAPSHOT"
|
||||||
|
|
||||||
|
val project = Project(
|
||||||
|
id = "akka-sample-cluster-java",
|
||||||
|
base = file("."),
|
||||||
|
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
||||||
|
name := "akka-sample-cluster-java",
|
||||||
|
version := "1.0",
|
||||||
|
scalaVersion := "2.10.3",
|
||||||
|
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-cluster" % akkaVersion,
|
||||||
|
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
|
||||||
|
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
||||||
|
"org.scalatest" %% "scalatest" % "2.0" % "test",
|
||||||
|
"org.fusesource" % "sigar" % "1.6.4"),
|
||||||
|
javaOptions in run ++= Seq(
|
||||||
|
"-Djava.library.path=./sigar",
|
||||||
|
"-Xms128m", "-Xmx1024m"),
|
||||||
|
Keys.fork in run := true,
|
||||||
|
mainClass in (Compile, run) := Some("sample.cluster.simple.SimpleClusterApp"),
|
||||||
|
// 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
|
||||||
|
parallelExecution in Test := false,
|
||||||
|
// make sure that MultiJvm tests are executed by the default test target,
|
||||||
|
// and combine the results from ordinary test and multi-jvm tests
|
||||||
|
executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
|
||||||
|
case (testResults, multiNodeResults) =>
|
||||||
|
val overall =
|
||||||
|
if (testResults.overall.id < multiNodeResults.overall.id)
|
||||||
|
multiNodeResults.overall
|
||||||
|
else
|
||||||
|
testResults.overall
|
||||||
|
Tests.Output(overall,
|
||||||
|
testResults.events ++ multiNodeResults.events,
|
||||||
|
testResults.summaries ++ multiNodeResults.summaries)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) configs (MultiJvm)
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
import sbt._
|
|
||||||
import sbt.Keys._
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
|
||||||
|
|
||||||
object AkkaSampleClusterBuild extends Build {
|
|
||||||
|
|
||||||
val akkaVersion = "2.3-SNAPSHOT"
|
|
||||||
|
|
||||||
lazy val akkaSampleCluster = Project(
|
|
||||||
id = "akka-sample-cluster-java",
|
|
||||||
base = file("."),
|
|
||||||
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
|
||||||
name := "akka-sample-cluster-java",
|
|
||||||
version := "1.0",
|
|
||||||
scalaVersion := "2.10.3",
|
|
||||||
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-cluster" % akkaVersion,
|
|
||||||
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
|
|
||||||
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
|
||||||
"org.scalatest" %% "scalatest" % "2.0" % "test",
|
|
||||||
"org.fusesource" % "sigar" % "1.6.4"),
|
|
||||||
javaOptions in run ++= Seq(
|
|
||||||
"-Djava.library.path=./sigar",
|
|
||||||
"-Xms128m", "-Xmx1024m"),
|
|
||||||
Keys.fork in run := true,
|
|
||||||
mainClass in (Compile, run) := Some("sample.cluster.simple.SimpleClusterApp")
|
|
||||||
)
|
|
||||||
) configs (MultiJvm)
|
|
||||||
}
|
|
||||||
|
|
@ -476,6 +476,15 @@ interesting to run them in separate processes. Stop the application in the
|
||||||
Press ctrl-c in the terminal window of the frontend to stop the factorial calculations.
|
Press ctrl-c in the terminal window of the frontend to stop the factorial calculations.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2>Tests</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Tests can be found in <a href="#code/src/multi-jvm/scala/sample/cluster" class="shortcut">src/multi-jvm</a>.
|
||||||
|
You can run them from the <a href="#test" class="shortcut">Test</a> tab.
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
44
akka-samples/akka-sample-cluster-scala/build.sbt
Normal file
44
akka-samples/akka-sample-cluster-scala/build.sbt
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
||||||
|
|
||||||
|
val akkaVersion = "2.3-SNAPSHOT"
|
||||||
|
|
||||||
|
val project = Project(
|
||||||
|
id = "akka-sample-cluster-scala",
|
||||||
|
base = file("."),
|
||||||
|
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
||||||
|
name := "akka-sample-cluster-scala",
|
||||||
|
version := "1.0",
|
||||||
|
scalaVersion := "2.10.3",
|
||||||
|
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-cluster" % akkaVersion,
|
||||||
|
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
|
||||||
|
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
||||||
|
"org.scalatest" %% "scalatest" % "2.0" % "test",
|
||||||
|
"org.fusesource" % "sigar" % "1.6.4"),
|
||||||
|
javaOptions in run ++= Seq(
|
||||||
|
"-Djava.library.path=./sigar",
|
||||||
|
"-Xms128m", "-Xmx1024m"),
|
||||||
|
Keys.fork in run := true,
|
||||||
|
mainClass in (Compile, run) := Some("sample.cluster.simple.SimpleClusterApp"),
|
||||||
|
// 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
|
||||||
|
parallelExecution in Test := false,
|
||||||
|
// make sure that MultiJvm tests are executed by the default test target,
|
||||||
|
// and combine the results from ordinary test and multi-jvm tests
|
||||||
|
executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
|
||||||
|
case (testResults, multiNodeResults) =>
|
||||||
|
val overall =
|
||||||
|
if (testResults.overall.id < multiNodeResults.overall.id)
|
||||||
|
multiNodeResults.overall
|
||||||
|
else
|
||||||
|
testResults.overall
|
||||||
|
Tests.Output(overall,
|
||||||
|
testResults.events ++ multiNodeResults.events,
|
||||||
|
testResults.summaries ++ multiNodeResults.summaries)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) configs (MultiJvm)
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
import sbt._
|
|
||||||
import sbt.Keys._
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
|
||||||
|
|
||||||
object AkkaSampleClusterBuild extends Build {
|
|
||||||
|
|
||||||
val akkaVersion = "2.3-SNAPSHOT"
|
|
||||||
|
|
||||||
lazy val akkaSampleCluster = Project(
|
|
||||||
id = "akka-sample-cluster-scala",
|
|
||||||
base = file("."),
|
|
||||||
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
|
||||||
name := "akka-sample-cluster-scala",
|
|
||||||
version := "1.0",
|
|
||||||
scalaVersion := "2.10.3",
|
|
||||||
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-cluster" % akkaVersion,
|
|
||||||
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
|
|
||||||
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
|
||||||
"org.scalatest" %% "scalatest" % "2.0" % "test",
|
|
||||||
"org.fusesource" % "sigar" % "1.6.4"),
|
|
||||||
javaOptions in run ++= Seq(
|
|
||||||
"-Djava.library.path=./sigar",
|
|
||||||
"-Xms128m", "-Xmx1024m"),
|
|
||||||
Keys.fork in run := true,
|
|
||||||
mainClass in (Compile, run) := Some("sample.cluster.simple.SimpleClusterApp")
|
|
||||||
)
|
|
||||||
) configs (MultiJvm)
|
|
||||||
}
|
|
||||||
|
|
@ -475,6 +475,15 @@ interesting to run them in separate processes. Stop the application in the
|
||||||
Press ctrl-c in the terminal window of the frontend to stop the factorial calculations.
|
Press ctrl-c in the terminal window of the frontend to stop the factorial calculations.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2>Tests</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Tests can be found in <a href="#code/src/multi-jvm/scala/sample/cluster" class="shortcut">src/multi-jvm</a>.
|
||||||
|
You can run them from the <a href="#test" class="shortcut">Test</a> tab.
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
35
akka-samples/akka-sample-multi-node-scala/build.sbt
Normal file
35
akka-samples/akka-sample-multi-node-scala/build.sbt
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm
|
||||||
|
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
||||||
|
|
||||||
|
val akkaVersion = "2.3-SNAPSHOT"
|
||||||
|
|
||||||
|
val project = Project(
|
||||||
|
id = "akka-sample-multi-node-scala",
|
||||||
|
base = file("."),
|
||||||
|
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
||||||
|
name := "akka-sample-multi-node-scala",
|
||||||
|
version := "1.0",
|
||||||
|
scalaVersion := "2.10.3",
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
|
||||||
|
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
||||||
|
"org.scalatest" %% "scalatest" % "2.0" % "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
|
||||||
|
parallelExecution in Test := false,
|
||||||
|
// make sure that MultiJvm tests are executed by the default test target,
|
||||||
|
// and combine the results from ordinary test and multi-jvm tests
|
||||||
|
executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
|
||||||
|
case (testResults, multiNodeResults) =>
|
||||||
|
val overall =
|
||||||
|
if (testResults.overall.id < multiNodeResults.overall.id)
|
||||||
|
multiNodeResults.overall
|
||||||
|
else
|
||||||
|
testResults.overall
|
||||||
|
Tests.Output(overall,
|
||||||
|
testResults.events ++ multiNodeResults.events,
|
||||||
|
testResults.summaries ++ multiNodeResults.summaries)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) configs (MultiJvm)
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
import sbt._
|
|
||||||
import sbt.Keys._
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm
|
|
||||||
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
|
|
||||||
|
|
||||||
object AkkaSampleMultiNodeBuild extends Build {
|
|
||||||
|
|
||||||
val akkaVersion = "2.3-SNAPSHOT"
|
|
||||||
|
|
||||||
lazy val akkaSampleMultiNode = Project(
|
|
||||||
id = "akka-sample-multi-node-scala",
|
|
||||||
base = file("."),
|
|
||||||
settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
|
|
||||||
name := "akka-sample-multi-node-scala",
|
|
||||||
version := "1.0",
|
|
||||||
scalaVersion := "2.10.3",
|
|
||||||
libraryDependencies ++= Seq(
|
|
||||||
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
|
|
||||||
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
|
|
||||||
"org.scalatest" %% "scalatest" % "2.0" % "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
|
|
||||||
parallelExecution in Test := false,
|
|
||||||
// make sure that MultiJvm tests are executed by the default test target,
|
|
||||||
// and combine the results from ordinary test and multi-jvm tests
|
|
||||||
executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
|
|
||||||
case (testResults, multiNodeResults) =>
|
|
||||||
val overall =
|
|
||||||
if (testResults.overall.id < multiNodeResults.overall.id)
|
|
||||||
multiNodeResults.overall
|
|
||||||
else
|
|
||||||
testResults.overall
|
|
||||||
Tests.Output(overall,
|
|
||||||
testResults.events ++ multiNodeResults.events,
|
|
||||||
testResults.summaries ++ multiNodeResults.summaries)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
) configs (MultiJvm)
|
|
||||||
}
|
|
||||||
|
|
@ -35,7 +35,7 @@ It adds the <a href="http://github.com/typesafehub/sbt-multi-jvm" target="_blank
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Open <a href="#code/project/Build.scala" class="shortcut">project/Build.scala</a>
|
Open <a href="#code/build.sbt" class="shortcut">build.sbt</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue