You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by cc...@apache.org on 2017/12/11 19:25:22 UTC

[08/13] groovy git commit: Use skipIndy to allow skipping build of indy jars

Use skipIndy to allow skipping build of indy jars


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7127f059
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7127f059
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7127f059

Branch: refs/heads/master
Commit: 7127f059d517ca6be4ccc217a6ca36c090d82689
Parents: e94d43e
Author: Cedric Champeau <cc...@apache.org>
Authored: Mon Dec 11 08:33:42 2017 +0100
Committer: Cedric Champeau <cc...@apache.org>
Committed: Mon Dec 11 19:17:11 2017 +0100

----------------------------------------------------------------------
 build.gradle           | 16 +++++++++-------
 gradle/assemble.gradle | 25 +++++++++++++++++--------
 gradle/indy.gradle     |  2 +-
 gradle/upload.gradle   | 13 +++++++++++--
 4 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7127f059/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index a50b24b..22aedeb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -435,13 +435,15 @@ allprojects {
         options.encoding = 'UTF-8'
     }
 
-    task compileGroovyWithIndy(type:GroovyCompile) {
-        source = sourceSets.main.groovy
-        classpath = compileGroovy.classpath
-        sourceCompatibility = 1.8
-        targetCompatibility = 1.8
-        groovyOptions.optimizationOptions['indy'] = true
-        destinationDir = file("$buildDir/classes/indy")
+    if (rootProject.indyCapable()) {
+        task compileGroovyWithIndy(type: GroovyCompile) {
+            source = sourceSets.main.groovy
+            classpath = compileGroovy.classpath
+            sourceCompatibility = 1.8
+            targetCompatibility = 1.8
+            groovyOptions.optimizationOptions['indy'] = true
+            destinationDir = file("$buildDir/classes/indy")
+        }
     }
 
     tasks.withType(GroovyCompile) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/7127f059/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 470c8aa..836659a 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -133,17 +133,21 @@ ext.subprojectOsgiManifest = {
 }
 
 allprojects {
+    def producedJars = [jar]
     jar {
         appendix = 'raw'
     }
-    task jarWithIndy(type: Jar) {
-        dependsOn compileGroovyWithIndy
-        classifier = 'indy'
-        appendix = 'raw'
-        from sourceSets.main.java.outputDir
-        from compileGroovyWithIndy.destinationDir
+    if (rootProject.indyCapable()) {
+        task jarWithIndy(type: Jar) {
+            dependsOn compileGroovyWithIndy
+            classifier = 'indy'
+            appendix = 'raw'
+            from sourceSets.main.java.outputDir
+            from compileGroovyWithIndy.destinationDir
+        }
+        producedJars << jarWithIndy
     }
-    [jar, jarWithIndy].each { arch ->
+    producedJars.each { arch ->
         arch.metaInf {
             from("$projectDir/licenses/LICENSE-JARJAR")
             from("$projectDir/licenses") {
@@ -280,7 +284,12 @@ allprojects {
     }
 }
 
-[jar, jarWithIndy].each {
+def producedJars = [jar]
+if (rootProject.indyCapable()) {
+    producedJars << jarWithIndy
+}
+
+producedJars.each {
     it.dependsOn('dgmConverter')
     it.from files(dgmConverter.outputDir)
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/7127f059/gradle/indy.gradle
----------------------------------------------------------------------
diff --git a/gradle/indy.gradle b/gradle/indy.gradle
index f2262c1..70968ad 100644
--- a/gradle/indy.gradle
+++ b/gradle/indy.gradle
@@ -21,5 +21,5 @@
 // with regards to invoke dynamic support (indy)
 
 rootProject.ext.indyCapable = {
-    !rootProject.hasProperty('skipIndy')
+    !rootProject.hasProperty('skipIndy') && JavaVersion.current().java7Compatible
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/7127f059/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 683a6d3..8588346 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -105,9 +105,14 @@ allprojects {
         }
 
         [uploadArchives, install]*.with {
-            dependsOn([jar, jarjarWithIndy, sourceJar, javadocJar, groovydocJar])
+            dependsOn([jar, sourceJar, javadocJar, groovydocJar])
+            if (rootProject.indyCapable()) {
+                dependsOn jarjarWithIndy
+            }
             doFirst {
-                project.artifacts.add('archives', jarjarWithIndy)
+                if (rootProject.indyCapable()) {
+                    project.artifacts.add('archives', jarjarWithIndy)
+                }
                 def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
                 if (grooidJar.exists()) {
                     project.artifacts.add('archives', grooidJar)
@@ -142,6 +147,10 @@ allprojects {
 [uploadArchives, install]*.with {
     dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin, distDoc, dist, distBin])
     doFirst {
+        if (!rootProject.indyCapable()) {
+            throw new GradleException("You must run with JDK 7+ to upload archives")
+        }
+
         project.artifacts.add('archives', distBin) {
             name = 'groovy-binary'
         }