This is an automated email from the ASF dual-hosted git repository.

cchampeau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 56c219eca0c028c95713a3abd74f14fa40cb0e6c
Author: Cedric Champeau <cchamp...@apache.org>
AuthorDate: Tue Mar 19 19:41:53 2019 +0100

    Fix binary compatibility report
    
    This commit fixes the binary compatibility report, that didn't work
    anymore. It replaces the old mechanism with a subproject which goal
    is _just_ to generate binary compatibility reports. This way we can
    avoid the dark magic around detached configurations.
---
 build.gradle                                      |  2 +-
 gradle/binarycompatibility.gradle                 | 87 -----------------------
 gradle/jacoco/jacoco.gradle                       |  2 +-
 gradle/quality.gradle                             |  2 -
 settings.gradle                                   |  3 +-
 subprojects/binary-compatibility/build.gradle.kts | 69 ++++++++++++++++++
 6 files changed, 73 insertions(+), 92 deletions(-)

diff --git a/build.gradle b/build.gradle
index 216bbd6..e9afdf6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -68,7 +68,7 @@ buildScanRecipes {
 }
 
 ext.modules = {
-    subprojects.findAll{ !['performance'].contains(it.name) }
+    subprojects.findAll{ !['performance', 
'binary-compatibility'].contains(it.name) }
 }
 ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
 
diff --git a/gradle/binarycompatibility.gradle 
b/gradle/binarycompatibility.gradle
deleted file mode 100644
index aa4d1fb..0000000
--- a/gradle/binarycompatibility.gradle
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-import me.champeau.gradle.japicmp.JapicmpTask
-
-buildscript {
-    repositories {
-        maven {
-            url 'https://plugins.gradle.org/m2/'
-        }
-    }
-    dependencies {
-        classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.2.6'
-    }
-}
-
-task checkBinaryCompatibility {
-    description = 'Generates binary compatibility reports'
-}
-check.dependsOn(checkBinaryCompatibility)
-
-// for comparing between versions with different modules, set excludeModules 
to differing modules, e.g.
-def excludeModules = [
-        'groovy-cli-picocli', 'groovy-cli-commons', 'groovy-dateutil', 
'groovy-datetime', 'groovy-jaxb',
-        'groovy-macro', 'groovy-json-direct', 'groovy-test-junit5', 
'groovy-yaml', 'performance', 'tests-vm8'
-]
-//def excludeModules = []
-
-Set projectsToCheck = allprojects.findAll{ !(it.name in excludeModules) }
-
-def compatibilityBaselineVersion = '2.4.15'
-
-allprojects {
-    if (project in projectsToCheck) {
-        // Use a detached configuration, otherwise the current version's jar 
will take precedence over the baseline jar.
-        // A necessary hack, the intuitive thing does NOT work:
-        // 
https://discuss.gradle.org/t/is-the-default-configuration-leaking-into-independent-configurations/2088/6
-        def saveGroup = project.group
-        def detachedConf
-        try {
-            project.group = 'virtual_group_for_japicmp'
-            String depModule = 
"org.codehaus.groovy:${project.name}:${compatibilityBaselineVersion}@jar"
-            String depJar = 
"${project.name}-${compatibilityBaselineVersion}.jar"
-            detachedConf = configurations.detachedConfiguration(
-                    dependencies.create(depModule)
-            )
-        } finally {
-            project.group = saveGroup
-        }
-        task japicmp(type: JapicmpTask, dependsOn: jarjar) {
-            oldClasspath = files({
-                files(detachedConf.files).filter {
-                it.name.equals(depJar)
-            }.singleFile})
-            newArchives = files(jarjar.outputFile)
-            newClasspath = configurations.runtimeClasspath
-            accessModifier = 'protected'
-            onlyModified = true
-            failOnModification = false
-            ignoreMissingClasses = true
-            classExcludes = 
['**_closure**','org.codehaus.groovy.runtime.dgm$**']
-            packageExcludes = ['**internal**','groovyjarjar**']
-            htmlOutputFile = file("$buildDir/reports/japi.html")
-        }
-    }
-}
-
-allprojects {
-    tasks.withType(JapicmpTask) { task ->
-        checkBinaryCompatibility.dependsOn(task)
-    }
-}
diff --git a/gradle/jacoco/jacoco.gradle b/gradle/jacoco/jacoco.gradle
index c483005..64cb666 100644
--- a/gradle/jacoco/jacoco.gradle
+++ b/gradle/jacoco/jacoco.gradle
@@ -22,7 +22,7 @@ if (rootProject.hasProperty('coverage') && 
Boolean.valueOf(rootProject.getProper
     // are not specifically asking for code coverage
 
     allprojects {
-        if (!['performance'].contains(it.name)) {
+        if (!['performance', 'binary-compatibility'].contains(it.name)) {
             apply plugin: 'jacoco'
         }
 
diff --git a/gradle/quality.gradle b/gradle/quality.gradle
index cdff674..fb93553 100644
--- a/gradle/quality.gradle
+++ b/gradle/quality.gradle
@@ -188,5 +188,3 @@ rat {
 }
 
 apply from: 'gradle/jacoco/jacoco.gradle'
-// Temporarily disabled because of conflict
-apply from: 'gradle/binarycompatibility.gradle'
diff --git a/settings.gradle b/settings.gradle
index ca4cab3..bfc3abe 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -41,7 +41,8 @@ def subprojects = ['groovy-ant',
         'groovy-xml',
         'groovy-macro',
         'groovy-yaml',
-        'performance'
+        'performance',
+        'binary-compatibility'
 ]
 
 if (hasProperty('stressTests')) {
diff --git a/subprojects/binary-compatibility/build.gradle.kts 
b/subprojects/binary-compatibility/build.gradle.kts
new file mode 100644
index 0000000..f31790f
--- /dev/null
+++ b/subprojects/binary-compatibility/build.gradle.kts
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+import me.champeau.gradle.japicmp.JapicmpTask
+
+plugins {
+    id("me.champeau.gradle.japicmp") version "0.2.6"
+}
+
+val checkBinaryCompatibility = tasks.register("checkBinaryCompatibility") {
+    description = "Generates binary compatibility reports"
+}
+
+tasks.named("check").configure {
+    dependsOn(checkBinaryCompatibility)
+}
+
+// for comparing between versions with different modules, set excludeModules 
to differing modules, e.g.
+val excludeModules = setOf(
+        "groovy-cli-picocli", "groovy-cli-commons", "groovy-dateutil", 
"groovy-datetime", "groovy-jaxb",
+        "groovy-macro", "groovy-json-direct", "groovy-test-junit5", 
"groovy-yaml", "performance", "tests-vm8",
+        "binary-compatibility"
+)
+
+val compatibilityBaselineVersion = "2.4.15"
+
+val binaryCompatProject = project
+
+rootProject.allprojects {
+    if (!(name in excludeModules)) {
+        val baseline = 
binaryCompatProject.configurations.create("${getJapiTaskName()}Baseline") {
+            
dependencies.add(binaryCompatProject.dependencies.create("org.codehaus.groovy:${project.name}:${compatibilityBaselineVersion}@jar"))
+        }
+        val singleProjectCheck = 
binaryCompatProject.tasks.register<JapicmpTask>(getJapiTaskName()) {
+            oldArchives = baseline
+            newArchives = files(tasks.named("jarjar"))
+            oldClasspath = files()
+            newClasspath = files()
+            accessModifier = "protected"
+            onlyModified = true
+            failOnModification = false
+            ignoreMissingClasses = true
+            classExcludes = listOf("**_closure**", 
"org.codehaus.groovy.runtime.dgm$**")
+            packageExcludes = listOf("**internal**", "groovyjarjar**")
+            htmlOutputFile = 
file("${binaryCompatProject.buildDir}/reports/${getJapiTaskName()}.html")
+        }
+        checkBinaryCompatibility.configure {
+            dependsOn(singleProjectCheck)
+        }
+    }
+}
+
+fun Project.getJapiTaskName() =
+        "japicmp${name.split('-').joinToString(separator = "", transform = 
String::capitalize)}"
\ No newline at end of file

Reply via email to