aboutsummaryrefslogtreecommitdiff
path: root/examples/multi-combined-example/build/build.scala
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-02-13 10:39:40 -0500
committerGitHub <noreply@github.com>2017-02-13 10:39:40 -0500
commite0fb6ec75286c695b7e4c5ed9189714d40f9b672 (patch)
tree3cf36e22305cc1da608667cfef85afcf682cc21a /examples/multi-combined-example/build/build.scala
parent0a295c21d3379117e661fdbf586ecb6222c3602b (diff)
parentd1cbc1efffd5c2a6511f1ccca43ccfb37a7f1af8 (diff)
downloadcbt-e0fb6ec75286c695b7e4c5ed9189714d40f9b672.tar.gz
cbt-e0fb6ec75286c695b7e4c5ed9189714d40f9b672.tar.bz2
cbt-e0fb6ec75286c695b7e4c5ed9189714d40f9b672.zip
Merge pull request #303 from cvogt/nested-builds
Add support for nested builds and use it to replace cross compilation command which was previously hard-coded
Diffstat (limited to 'examples/multi-combined-example/build/build.scala')
-rw-r--r--examples/multi-combined-example/build/build.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/multi-combined-example/build/build.scala b/examples/multi-combined-example/build/build.scala
new file mode 100644
index 0000000..41c03d6
--- /dev/null
+++ b/examples/multi-combined-example/build/build.scala
@@ -0,0 +1,44 @@
+import cbt._
+import cbt._
+trait SharedCbtBuild extends BaseBuild{
+ override def defaultScalaVersion = "2.10.6"
+}
+
+
+class Shared(val context: Context) extends SharedCbtBuild
+
+class Sub(val context:Context) extends SharedCbtBuild{
+ override def dependencies = Seq(new Shared(
+ context.copy(
+ projectDirectory = projectDirectory ++ "/../shared"
+ )
+ ))
+}
+
+class Build(val context: Context) extends BaseBuild{
+ /*
+ Currently each sub build nested into the main build needs to be an instance
+ of a top-level class taking a Context as the sole parameter, similar to the
+ Build class itself. This restriction may be lifted for more flexibility at
+ some point, see https://github.com/cvogt/cbt/issues/306
+ */
+ def sub1 = new Sub(
+ context.copy(
+ projectDirectory = projectDirectory ++ "/sub1"
+ )
+ )
+ def sub2 = new Sub(
+ context.copy(
+ projectDirectory = projectDirectory ++ "/sub2"
+ )
+ )
+
+ def sub3 = // DON'T DO THIS, anonymous classes are currently not supported here.
+ new SharedCbtBuild{
+ def context = Build.this.context.copy(
+ projectDirectory = Build.this.projectDirectory ++ "/sub3"
+ )
+ }
+
+ override def dependencies = Seq( sub1, sub2 ) // assembles all projects
+}