You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/05/13 14:49:04 UTC

[commons-rng] 01/02: Add revapi plugin for binary compatibility check

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

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit f98554ff3968838f8e815a4ddf05fafd3ea9c9bf
Author: aherbert <ah...@apache.org>
AuthorDate: Fri May 13 15:07:42 2022 +0100

    Add revapi plugin for binary compatibility check
---
 commons-rng-examples/pom.xml               |  8 ++++
 pom.xml                                    | 68 ++++++++++++++++++++++++++++++
 src/main/resources/revapi/api-changes.json | 17 ++++++++
 3 files changed, 93 insertions(+)

diff --git a/commons-rng-examples/pom.xml b/commons-rng-examples/pom.xml
index 80cba49c..3d09c04a 100644
--- a/commons-rng-examples/pom.xml
+++ b/commons-rng-examples/pom.xml
@@ -96,6 +96,14 @@
           <failOnViolation>false</failOnViolation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.revapi</groupId>
+        <artifactId>revapi-maven-plugin</artifactId>
+        <version>${rng.revapi.version}</version>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/pom.xml b/pom.xml
index 1dab181b..1a97d6c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,8 @@
     <maven.compiler.target>1.8</maven.compiler.target>
     <rng.pmd.version>3.14.0</rng.pmd.version>
     <rng.pmd.dep.version>6.37.0</rng.pmd.dep.version>
+    <rng.revapi.version>0.14.6</rng.revapi.version>
+    <rng.revapi.java.version>0.26.1</rng.revapi.java.version>
     <rng.checkstyle.version>3.1.2</rng.checkstyle.version>
     <rng.checkstyle.dep.version>8.45</rng.checkstyle.dep.version>
     <rng.mathjax.url>https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js</rng.mathjax.url>
@@ -297,6 +299,43 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.revapi</groupId>
+        <artifactId>revapi-maven-plugin</artifactId>
+        <version>${rng.revapi.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.revapi</groupId>
+            <artifactId>revapi-java</artifactId>
+            <version>${rng.revapi.java.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <analysisConfiguration>
+            <revapi.differences id="intentional-api-changes">
+              <ignore>true</ignore>
+            </revapi.differences>
+          </analysisConfiguration>
+          <analysisConfigurationFiles>
+            <configurationFile>
+              <path>${rng.parent.dir}/src/main/resources/revapi/api-changes.json</path>
+              <roots>
+                <!-- Path to configuration in the JSON config file -->
+                <root>1.5</root>
+              </roots>
+            </configurationFile>
+          </analysisConfigurationFiles>
+        </configuration>
+        <executions>
+          <execution>
+            <configuration>
+            </configuration>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
@@ -323,6 +362,7 @@
             <exclude>dist-archive/**</exclude>
             <exclude>**/*.patch</exclude>
             <exclude>**/pdf.*.txt</exclude>
+            <exclude>src/main/resources/revapi/api-changes.json</exclude>
           </excludes>
         </configuration>
       </plugin>
@@ -433,6 +473,34 @@
           </reportSet>
         </reportSets>
       </plugin>
+      <plugin>
+        <groupId>org.revapi</groupId>
+        <artifactId>revapi-maven-plugin</artifactId>
+        <version>${rng.revapi.version}</version>
+        <configuration>
+          <!-- For reporting do not ignore the "intentional-api-changes" so they are included -->
+          <analysisConfigurationFiles>
+            <configurationFile>
+              <path>${rng.parent.dir}/src/main/resources/revapi/api-changes.json</path>
+              <roots>
+                <!-- Path(s) to configuration in the JSON config file -->
+                <root>1.5</root>
+              </roots>
+            </configurationFile>
+          </analysisConfigurationFiles>
+          <!-- Note: Property 'reportSeverity' is deprecated but newer 'reportCriticality'
+               does work as documented. -->
+          <reportSeverity>equivalent</reportSeverity>
+          <reportCriticality>allowed</reportCriticality>
+        </configuration>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>report</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
       <plugin>
         <!-- NOTE: javadoc config must also be set under <build> -->
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/resources/revapi/api-changes.json b/src/main/resources/revapi/api-changes.json
new file mode 100644
index 00000000..f979bc87
--- /dev/null
+++ b/src/main/resources/revapi/api-changes.json
@@ -0,0 +1,17 @@
+{
+  "1.5": [
+    {
+      "extension": "revapi.differences",
+      "id": "intentional-api-changes",
+      "configuration": {
+        "differences": [
+          {
+            "code": "java.method.abstractMethodAdded",
+            "new": "method java.lang.Object org.apache.commons.rng.simple.internal.NativeSeedType::createSeed(int, int, int)",
+            "justification": "Abstract method added to enum; all implementations are within this class. This is an internal package with no compatibility enforcement."
+          }
+        ]
+      }
+    }
+  ]
+}