On Sep 26, 2008, at 11:31 AM, Helmut Denk wrote:


hallo hans,

i put everything in plugins and it seems to work.
build.gradle now looks like this:


subprojects {
    usePlugin('custom-groovy')
        
    sourceCompatibility = 1.4
    targetCompatibility = 1.4
    group = 'com.mycompany'
    version = '1.0'
}


for those who are interested in details:

*step 1*

i implemented a standalone project 'gradle-customizations'
with a gradle-build. this project contains following classes:

- com.mycompany.gradle.CustomPluginBase (implements Plugin)
- com.mycompany.gradle.CustomJavaPlugin (extends CustomPluginBase)
- com.mycompany.gradle.CustomGroovyPlugin (extends CustomPluginBase)
- com.mycompany.gradle.CustomWarPlugin (extends CustomPluginBase)

the customization-code defines mycompany-specific resolvers
(classpath, upload) and convention-settings.

*step 2*

i gradle-build 'gradle-customizations' and
copy the resulting jar to buildSrc/lib of
the gradle-builds, that want to use customizations.

*step 3*

i add the following lines to settings.gradle
of the gradle-builds, that want to use customizations:

addFlatDirResolver('lib', "$rootDir/buildSrc/lib")
dependencies(':gradle-customizations:1.0')

*step 4*

i add the following lines to $GRADLE_HOME/plugins.properties

custom-java=com.mycompany.gradle.CustomJavaPlugin
custom-groovy=com.mycompany.gradle.CustomGroovyPlugin
custom-war=com.mycompany.gradle.CustomWarPlugin

Just to mention it for other readers of this posting. There is also a usePlugin method where you can pass the plugin class (http:// gradle.org/api/0.4/org/gradle/api/Project.html#usePlugin (java.lang.Class)). If you use this method you don't have to add your plugin to the plugin.properties file.


this is not DRY in steps 2 and 3. a solution of
this could be, that in the $HOME/.gradle/gradle.properties
there can be declared a resolver and source for
gradle-custom-extensions (plugins).

When we are going to start the discussion on the dev list about how to implement our new plugin system you are very welcome to participate :)

Thanks for posting this

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

   http://xircles.codehaus.org/manage_email


Reply via email to