diff options
Diffstat (limited to 'examples/dynamic-overrides-example/build')
-rw-r--r-- | examples/dynamic-overrides-example/build/build.scala | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/dynamic-overrides-example/build/build.scala b/examples/dynamic-overrides-example/build/build.scala new file mode 100644 index 0000000..6cab975 --- /dev/null +++ b/examples/dynamic-overrides-example/build/build.scala @@ -0,0 +1,31 @@ +import cbt._ +class Build(val context: Context) extends DynamicOverrides with CommandLineOverrides{ + def foo2 = "Build" + def bar2: String = + newBuild[Build]{""" + override def foo2 = "Bar2: "+Option(getClass.getName) + """}.foo2 + + def baz2: String = + newBuild[Build]{""" + override def foo2 = "Baz2: "+Option(getClass.getName) + override def baz2 = bar2 + """}.baz2 + def foo = "Build" + + def bar: String = newBuild[Bar].bar + def baz: String = newBuild[Baz].baz + def bam: String = newBuild[Bam].baz +} +trait Bar extends Build{ + override def bar: String = foo + override def foo = "Bar: "+getClass.getName +} +trait Baz extends Build{ + override def foo = "Baz: "+getClass.getName + override def baz = bar +} +trait Bam extends Bar{ + override def foo = "Baz: "+getClass.getName + override def baz = bar +} |