John Murph wrote:
On Mon, Nov 23, 2009 at 4:20 PM, Adam Murdoch <[email protected]
<mailto:[email protected]>> wrote:
BTW, I'm not suggesting you do all this work, as you really only
need the equivalent of configure(object, scriptPath). I'm just
trying to figure out a direction for this stuff.
LOL, thanks Adam. I was worried about 2 seconds, then realized that
there was no way you wanted me to do all that. I think I like the
unification of these items, they are obviously very related. What
class would have the configure(*) methods? This would need to be
available to almost everything. Your unification thoughts almost
relegate init/settings/build scripts to different flavors of a single
thing. Maybe a common base class for the delegate objects for these
scripts? Or maybe composition? I think I prefer composition here,
but there are several methods that will need to be delegated. Maybe a
"ConfigurableScript" interface to describe the method signatures, a
"ScriptExecutor" class that contains the implementation (and
implements the "ConfigurableScript" interface). Then each of the
appropriate classes can implement the interface and delegate those
methods to the class. Seems inelegant, but reasonable.
This is a good plan. Every script that Gradle compiles ends up as a
subclass of org.gradle.groovy.scripts.Script, so you could change that
to implement ConfigurableScript. This means that the configure(*)
methods will be available from every script. Then, you could perhaps
just change Project or Gradle to implement ConfigurableScript as well,
so that the configure(*) methods are available outside the scripts (eg
plugins, java classes, etc).
--
Adam Murdoch
Gradle Developer
http://www.gradle.org