On 15/12/09 7:13 AM, John Murph wrote:
On Fri, Dec 11, 2009 at 8:11 PM, Adam Murdoch <[email protected]
<mailto:[email protected]>> wrote:
Hi,
I've just checked in a first pass at providing a way to configure
the project using an external build script. The DSL currently
looks like this:
apply {
// apply the script to the project
script 'somepath.gradle'
}
You can also configure any set of arbitrary objects:
apply {
// apply the script to main and test sourcesets
script 'somepath.gradle'
to sourceSets.main, sourceSets.test
}
You would also be able to, for example, use apply { } in a
subprojects { } section.
Adam, this looks great and is exactly what I was looking for! I will
try it as soon as I can (see note below)...
Currently, this only available from a build script, but I plan to
make it available from any script.
My problem is I need it from the settings.gradle. Any idea on when
that might be done? That's when I'll know if it really works for me.
You can use apply { } from any script, now. I haven't sorted out the
classloaders for external scripts yet, but the buildSrc classes should
be available to them, if you need them.
- Should we allow plugins to be applied to anything? This would
mean changing the plugin interface to something like:
public interface Plugin<T> {
void use(T target)
}
I don't understand what you are getting at here. Could you give an
example, or maybe just describe the idea a bit more
My question is: should you be able to apply a plugin to any arbitrary
object, rather than just to Project instances? We've talked about, for
example, being able to apply a plugin to a SourceSet. Do we want to do
this as part of this refactor? I think we should.
If we do, then the Plugin interface will need to change to reflect the
fact that plugins can be applied to anything, and to allow the plugin
impl to declare which types of objects it will accept.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org