Skip to content

Commit

Permalink
[build] Simplified management of Groovy jar WRT grails/groovy joint b…
Browse files Browse the repository at this point in the history
…uild.

There is one functional change here in that the build will now always use the groovy compiler from the version of groovy that we are compiling against. Previously, the joint build would always use the Groovy 1.8.2 compiler though I think this was unintended and just misconfiguration.
  • Loading branch information
ldaley committed Dec 23, 2011
1 parent 96b8927 commit 6f0c9bc
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions build.gradle
Expand Up @@ -57,16 +57,19 @@ homeSrcDir = file("src")
// configurations, so place the dependency in a shared variable. The
// 'compile' is required so that Groovy appears as a dependency in the
// artifacts' POMs.
if(System.getProperty('groovy.jar')) {
groovyDependency = files(System.getProperty('groovy.jar'))
if(!groovyDependency?.singleFile?.exists()) {
def msg = "The groovy.jar system property points to ${System.getProperty('groovy.jar')} which does not exist."
throw new GradleException(msg)
jointBuildGroovyJarProperty = System.getProperty('groovy.jar')
if (jointBuildGroovyJarProperty) {
jointBuildGroovyJar = file(jointBuildGroovyJarProperty)
if (jointBuildGroovyJar.exists()) {
groovyDependency = dependencies.create(files(jointBuildGroovyJar))
} else {
throw new GradleException("The groovy.jar system property points to ${jointBuildGroovyJar.absolutePath} which does not exist.")
}
gradleGroovyDependency = "org.codehaus.groovy:groovy-all:${gradleGroovyVersion}"
} else {
groovyDependency = "org.codehaus.groovy:groovy-all:${groovyVersion}"
gradleGroovyDependency = "org.codehaus.groovy:groovy-all:${gradleGroovyVersion}"
groovyDependency = dependencies.create("org.codehaus.groovy:groovy-all:${groovyVersion}") {
exclude module:"commons-cli"
exclude module:"ant"
}
}

// Prevent multiple repositories being used, commented out as currently doesn't work.
Expand Down Expand Up @@ -143,18 +146,7 @@ subprojects { project ->
}

dependencies {
// Groovy
if(System.getProperty('groovy.jar')) {
// use the jar specified in the system property (the joint build specifies its own groovy jar)...
groovy gradleGroovyDependency
} else {
// resolve the dependency from a repo...
groovy( gradleGroovyDependency ) {
exclude module:"commons-cli"
exclude module:"ant"
}
}
compile groovyDependency
groovy groovyDependency

if (project.name != "grails-docs") {
// Logging
Expand Down

0 comments on commit 6f0c9bc

Please sign in to comment.