You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sm...@apache.org on 2020/05/04 22:12:26 UTC

[geode] 01/07: Enable japicmp tool in Geode

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

smgoller pushed a commit to branch japicmp-gradle
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 56f028b157ca1f3cfc1cee5c2264e42905b0a888
Author: Robert Houghton <rh...@pivotal.io>
AuthorDate: Fri Mar 6 13:49:04 2020 -0800

    Enable japicmp tool in Geode
---
 build.gradle                      |  1 +
 geode-assembly/build.gradle       | 72 ++++++++++++++++++++++++++++++---------
 geode-common/build.gradle         |  6 ++++
 geode-web-api/build.gradle        |  7 ++++
 geode-web-management/build.gradle |  7 ++++
 geode-web/build.gradle            |  7 ++++
 gradle/japicmp.gradle             | 29 ++++++++++++++++
 7 files changed, 113 insertions(+), 16 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8b66008..8481092 100755
--- a/build.gradle
+++ b/build.gradle
@@ -29,6 +29,7 @@ plugins {
   id "org.ajoberstar.grgit" version "4.0.1" apply false
   id "org.nosphere.apache.rat" version "0.6.0" apply false
   id "org.sonarqube" version "2.8" apply false
+  id "me.champeau.gradle.japicmp" version "0.2.6"
 }
 
 
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index ef34390..edbf8db 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+import me.champeau.gradle.japicmp.JapicmpTask
+
 apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
 apply from: "${rootDir}/${scriptDir}/warnings.gradle"
 
@@ -22,6 +24,7 @@ apply from: "${rootDir}/${scriptDir}/warnings.gradle"
 import org.apache.geode.gradle.plugins.DependencyConstraints
 
 import java.nio.file.Paths
+import org.gradle.api.file.FileCollection
 
 // This project aggressively reaches into many other projects and must wait for those configurations
 // to be evaluated and resolved.  Evaluation depends on each of these subprojects.
@@ -184,9 +187,9 @@ dependencies {
   geodeArchives project(':geode-serialization')
   geodeArchives project(':geode-tcp-server')
   geodeArchives project(':geode-wan')
-  geodeArchives project(':geode-web')
-  geodeArchives project(':geode-web-api')
-  geodeArchives project(':geode-web-management')
+  geodeArchives project(path: ':geode-web', configuration: 'war')
+  geodeArchives project(path: ':geode-web-api', configuration: 'war')
+  geodeArchives project(path: ':geode-web-management', configuration: 'war')
 
   javadocOnly project(':extensions:geode-modules')
   javadocOnly project(':extensions:geode-modules-session')
@@ -566,11 +569,13 @@ distributions {
 
       with copySpec {
         into('config')
-        from defaultCacheConfig
-        from defaultDistributionConfig
-        from(project(':geode-log4j').sourceSets.main.resources.files.find {
-          it.name == 'log4j2.xml'
-        })
+        from {defaultCacheConfig}
+        from {defaultDistributionConfig}
+        from {
+          (project(':geode-log4j').sourceSets.main.resources.files.find {
+            it.name == 'log4j2.xml'
+          })
+        }
       }
 
       with copySpec {
@@ -587,8 +592,8 @@ distributions {
 
         //These tasks are included as closures (wrapped in {}) because gradle may evaluate
         //this CopySpec before it evaluates the geode-core build file.
-        from project(':geode-core').tasks.named('raJar')
-        from project(':geode-core').tasks.named('jcaJar')
+        from {project(':geode-core').tasks.named('raJar')}
+        from {project(':geode-core').tasks.named('jcaJar')}
 
         // dependency jars
         from tasks.named('depsJar')
@@ -598,16 +603,16 @@ distributions {
       with copySpec {
         into('tools/Extensions')
 
-        from project(':geode-web').configurations.archives.allArtifacts.files
-        from project(':geode-web-api').configurations.archives.allArtifacts.files
-        from project(':geode-web-management').configurations.archives.allArtifacts.files
+        from {project(':geode-web').configurations.archives.allArtifacts.files}
+        from {project(':geode-web-api').configurations.archives.allArtifacts.files}
+        from {project(':geode-web-management').configurations.archives.allArtifacts.files}
 
         exclude '*.jar'
       }
 
       with copySpec {
         into('tools/ClientProtocol')
-        from project(':geode-protobuf-messages').zip.outputs.files
+        from {project(':geode-protobuf-messages').zip.outputs.files}
       }
 
       with copySpec {
@@ -617,7 +622,7 @@ distributions {
 
       with copySpec {
         into('tools/Pulse')
-        from project(':geode-pulse').configurations.archives.allArtifacts.files
+        from {project(':geode-pulse').configurations.archives.allArtifacts.files}
       }
 
       with copySpec {
@@ -707,4 +712,39 @@ docker {
 
 acceptanceTest {
   dependsOn(tasks.docker)
-}
\ No newline at end of file
+}
+
+tasks.register('japicmp', me.champeau.gradle.japicmp.JapicmpTask) {
+  dependsOn(distTar)
+  dependsOn(project(':geode-old-versions:1.11.0').tasks.named('downloadAndUnzipFile'))
+  def d = Paths.get(project(':geode-old-versions:1.11.0').buildDir.path.toString(), 'apache-geode-1.11.0', 'lib')
+  oldClasspath = files(file(d).listFiles())
+  oldArchives = files(file(d).listFiles(new FilenameFilter() {
+    public boolean accept(File dir, String name) {
+      return name.toLowerCase().startsWith("geode-") && name.toLowerCase().endsWith(".jar");
+    };
+  }))
+
+  newClasspath = configurations.geodeArchives
+  newArchives = configurations.geodeArchives.filter { File f ->
+    f.toString().contains("geode-") && f.toString().endsWith(".jar")
+  }
+
+  ignoreMissingClasses = true
+  onlyModified = true
+  failOnModification = true
+  failOnSourceIncompatibility = true
+  accessModifier = "protected"
+
+  def reportFileName = "japi-v1.11.0-${version}" 
+  txtOutputFile = file("$buildDir/reports/${reportFileName}.txt")
+  htmlOutputFile = file("$buildDir/reports/${reportFileName}.html")
+  packageExcludes = ["*internal*"]
+  packageIncludes = ["org.apache.geode.*"]
+  annotationExcludes = ["@Experimental"]
+
+//  richReport {
+//    title = "Geode API Compatibility Report"
+//    description = "Comparing current ${version} against downloaded v1.11.0."
+//  }
+}
diff --git a/geode-common/build.gradle b/geode-common/build.gradle
index 52007bd..7060b5b 100755
--- a/geode-common/build.gradle
+++ b/geode-common/build.gradle
@@ -15,11 +15,17 @@
  * limitations under the License.
  */
 
+
 apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
 
 apply from: "${project.projectDir}/../gradle/publish-java.gradle"
 apply from: "${project.projectDir}/../gradle/warnings.gradle"
 
+
+
+
+
+
 dependencies {
   implementation(platform(project(':boms:geode-all-bom')))
   implementation('com.fasterxml.jackson.core:jackson-databind')
diff --git a/geode-web-api/build.gradle b/geode-web-api/build.gradle
index 40afbef..b3d8c56 100644
--- a/geode-web-api/build.gradle
+++ b/geode-web-api/build.gradle
@@ -24,6 +24,10 @@ apply from: "${project.projectDir}/../gradle/warnings.gradle"
 
 jar.enabled = false
 
+configurations {
+  war {}
+}
+
 dependencies {
   compile(platform(project(':boms:geode-all-bom'))){
     exclude module: "jackson-annotations"
@@ -121,3 +125,6 @@ war {
   classpath configurations.runtimeClasspath
 }
 
+artifacts {
+  war tasks.war
+}
diff --git a/geode-web-management/build.gradle b/geode-web-management/build.gradle
index ceb95b4..1c13702 100644
--- a/geode-web-management/build.gradle
+++ b/geode-web-management/build.gradle
@@ -44,6 +44,9 @@ sourceSets {
   }
 }
 
+configurations {
+  war {}
+}
 dependencies {
   compile(platform(project(':boms:geode-all-bom'))) {
     exclude module: "jackson-annotations"
@@ -164,3 +167,7 @@ war {
   // from the runtime classpath
   classpath configurations.runtimeClasspath
 }
+
+artifacts {
+  war tasks.war
+}
diff --git a/geode-web/build.gradle b/geode-web/build.gradle
index e2fa7a8..7c28069 100644
--- a/geode-web/build.gradle
+++ b/geode-web/build.gradle
@@ -24,6 +24,9 @@ apply from: "${project.projectDir}/../gradle/warnings.gradle"
 
 jar.enabled = false
 
+configurations {
+  war {}
+}
 dependencies {
   api(platform(project(':boms:geode-all-bom')))
 
@@ -75,3 +78,7 @@ war {
   enabled = true
   duplicatesStrategy = DuplicatesStrategy.EXCLUDE
 }
+
+artifacts {
+  war tasks.war
+}
\ No newline at end of file
diff --git a/gradle/japicmp.gradle b/gradle/japicmp.gradle
new file mode 100644
index 0000000..f1a11cb
--- /dev/null
+++ b/gradle/japicmp.gradle
@@ -0,0 +1,29 @@
+
+
+
+
+import me.champeau.gradle.japicmp.JapicmpTask
+
+
+//apply plugin: 'me.champeau.gradle.japicmp'
+
+
+//tasks.register('japicmp', Class.forName('me.champeau.gradle.japicmp.JapicmpTask')) {
+//  oldClasspath = files('path/to/reference.jar')
+//  newClasspath = files(jar.archivePath)
+//  onlyModified = true
+//  failOnModification = true
+//  txtOutputFile = file("$buildDir/reports/japi.txt")
+//}
+
+task japicmp(type: JapicmpTask, dependsOn: 'jar') {
+  onlyIf { core_baseline != "SKIP" }
+  oldClasspath = configurations.baseline
+  newClasspath = files(jar.archivePath)
+  onlyBinaryIncompatibleModified = true
+  failOnModification = true
+  includeSynthetic = true
+  txtOutputFile = file("${project.buildDir}/reports/japi/japi.txt")
+  htmlOutputFile = file("${project.buildDir}/reports/japi/japi.html")
+}
+