Hi Helmut,
On Sep 19, 2008, at 1:39 PM, Helmut Denk wrote:
hi gradle users,
to share common resolver-setup across multiple gradle-builds
i implemented a class 'ResolverSetup' and use it like this:
*** schnipp ***
subprojects {
usePlugin('groovy')
sourceCompatibility = 1.4
targetCompatibility = 1.4
group = 'com.mycompany'
version = '1.0'
type = 'jar'
The type property is not in use any longer, unless you use it as a
custom property. The plugins 'java' and 'groovy' create a jar by
default, 'war' a war.
test.stopAtFailuresOrErrors=false
// ResolverSetup ist custom-BuildLogik -> buildSrc und
// dient als temporäre Lösung zur einheitlichen Definition
// der Resolver (classpath, upload).
ResolverSetup resolverSetup = new ResolverSetup(project)
dependencies {
resolverSetup.setupClasspathResolvers(classpathResolvers);
}
uploadLibs {
resolverSetup.setupUploadResolvers(uploadResolvers);
}
}
*** schnapp ***
i put the class ResolverSetup into buildSrc/main/java
of each project. but this is not dry.
may be a custom-plugin is what i need here ... ?
An alternative is to create a separate project for what is now in the
buildSrc. The artifact produced by this project might be: resolver-
setup-1.0.jar
Now you can add the jar to the build script classpath:
In the settings.gradle file of each of your gradle build you can define:
dependencies 'org:resolver-setup-1.0.jar'
See http://www.gradle.org/api/0.4/org/gradle/api/initialization/
Settings.html on how to define resolvers.
Now you can leave either the rest as they are or you use a plugin.
Your resolver set-up project might contain a plugin. Then in your
build.gradle file you can say
usePlugin('com.helmutcomp.resolversetup.ResolverPlugin')
instead of doing the stuff in your snippet below
test.stopAtFailuresOrErrors.
I think the easiest way to learn about our plugin system is to look
at a simple plugin like War plugin. In general our plugin system is
very simple at the moment. Making it more powerful is one of the
major steps towards 1.0.
- Hans
--
Hans Dockter
Gradle Project lead
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email