Hi,

I've just checked in a bunch of changes to the DSL for how we use plugins and scripts. I'd appreciate feedback, particularly on terminology.

The basic idea is that scripts and things that implement Plugin are more or less the same thing: They contain build logic which configures or extends the project in some way. So, to reflect this, they are used in exactly the same way from the build script.

Here's how it currently looks in trunk:

* To apply a plugin by id:

apply id: 'java'
apply { id 'java' }

This replaces usePlugin 'java'

* To apply a plugin by type:

apply type: JavaPlugin
apply { type JavaPlugin }

This replaces usePlugin JavaPlugin

* To apply a plugin by URL

apply url: '../shared/repositories.gradle'
apply { url 'http://some.org/shared/repositories.gradle' }

The url can be anything which file() accepts, or an arbitrary URL (as a String, GString, URI, URL instance)

* To apply a plugin to an arbitrary object:

apply url: 'something.gradle' to: [compileJava, compileTestJava]
apply {
    url 'something.gradle'
    to [compileJava, compileTestJava]
}

Some notes:

* The apply() methods are available in every script which Gradle executes: init scripts, settings scripts, build scripts, and plugin scripts.

* This stuff replaces Project.usePlugin(), which has been deprecated (but still works)

* Plugin discovery now determines plugin ids by looking for META-INF/gradle-plugins.properties resources in the classpath. This replaces $gradleHome/plugin.properties. This approach means that you can provide ids for your custom plugins, by including a resource with this name in your plugin jar.

Some bits that aren't finished yet:

* You can only apply a plugin by type or id to a Project. The plan is that a Plugin impl can be applied to any type of object.

* You can only apply a script plugin by url. You should be able to also provide a URL to a jar.

* You should be able to package up a script in a jar and give it an id, so that you can apply it by id.

* You should be able to use the dependency DSL to point to a plugin (whether packaged as a jar or script):

apply group: 'myorg', name: 'standard-java-project', version: '1.3'


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to