diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-08 00:58:30 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-08 00:58:30 -0500 |
commit | 47a93993a84c572b4a2cd4562b52ec552f36879a (patch) | |
tree | b21c25f2f4b593101d47dd7ddf178b2624fef10b /examples/dynamic-overrides-example | |
parent | 8ccefab7f8a09579087626fe75911115e8f6f483 (diff) | |
download | cbt-47a93993a84c572b4a2cd4562b52ec552f36879a.tar.gz cbt-47a93993a84c572b4a2cd4562b52ec552f36879a.tar.bz2 cbt-47a93993a84c572b4a2cd4562b52ec552f36879a.zip |
Add support for dynamic re-configuration.
The exact precedence rule of override code vs original code may still
need to be tweaked as we go along.
Diffstat (limited to 'examples/dynamic-overrides-example')
-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 +} |