groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cchamp...@apache.org
Subject [04/20] groovy git commit: Use skipIndy to allow skipping build of indy jars
Date Tue, 12 Dec 2017 22:07:47 GMT
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/f62fd09c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f62fd09c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f62fd09c

Branch: refs/heads/GROOVY_2_5_X
Commit: f62fd09c0354487f7337e8c533123015a6bac48c
Parents: f5b0959
Author: Cedric Champeau <cchampeau@apache.org>
Authored: Mon Dec 11 08:33:42 2017 +0100
Committer: Cedric Champeau <cchampeau@apache.org>
Committed: Tue Dec 12 22:08:42 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/f62fd09c/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index cbfe9af..e72d044 100644
--- a/build.gradle
+++ b/build.gradle
@@ -432,13 +432,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/f62fd09c/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 4b35ac0..e70a189 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/f62fd09c/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/f62fd09c/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'
         }


Mime
View raw message