aboutsummaryrefslogtreecommitdiff
path: root/examples/multi-combined-example/build/build.scala
blob: 41c03d659f05357080c8a787c5260a47ee47c3d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
}