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.
Currently, this only available from a build script, but I plan to make
it available from any script. Also, I'd like to move plugin declarations
into the apply { } section, and deprecate usePlugin():
apply {
plugin 'java'
plugin SomePluginClass
}
Then, a script is effectively just another way to implement a plugin.
Also, I'd like the script() and plugin() methods to accept a URL or a
dependency specification to declare which script/plugin to use.
Some questions:
- Anyone have any thoughts on a better DSL? Another option is to use a
map based method:
apply script: 'something.gradle', to: sourceSets.main
or to use both.
- Should we do away with the distinction between scripts and plugins?
Something like:
configure {
use 'somescript.gradle'
use JavaPlugin
}
or
apply 'some.gradle'
apply JavaPlugin
apply 'some.gradle' to: sourceSets.main
- 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)
}
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email