From 0165f0db9267011fcca1d986f9728943c39ae572 Mon Sep 17 00:00:00 2001 From: Max Rydahl Andersen Date: Fri, 7 Aug 2020 10:34:43 +0200 Subject: [PATCH] Add revapi as option during build Initial setup of revapi to get API change reports. Still ways to go in tuning it; but would like to have it included in master now to make coming PR's simpler to apply/manage. This adds a profile to run api check - it is not currently activated by default but should be in the future when we have the defaults tuned in to not generate unwarranted noise. Also `revapi.skip` is default true, meaning even when the profile is active no api check will be done on a module unless it defines `revapi.skip=true` in its properties. Thus for now to even have it run you need enable the api-check profile *and* the property. i.e. `mvn -Papi-check -Drevapi.skip=false` If you want to run it for everything (ignoring revapi.skip do the following:: `mvn -Papi-check -Drevapi.skip=false -DskipTests verify` If you want to see it detect changes in dependencies that quarkus exposes/uses add `-Drevapi.checkdeps=true` When run you should get a `target/revapi-results/` in every module that are included in the check. That folder will have a `.json` and `.adoc` file capturing detected API changes/issues. If you want to tweak the format of the `.adoc` file you can change that in revapi/**/*.ftl and do a `mvn install` to have changes picked up. --- build-parent/pom.xml | 137 ++++++++++++++++++ independent-projects/revapi/pom.xml | 38 +++++ .../src/main/resources/META-INF/revapi.ftl | 49 +++++++ .../resources/revapi/revapi-configuration.xml | 31 ++++ pom.xml | 1 + 5 files changed, 256 insertions(+) create mode 100644 independent-projects/revapi/pom.xml create mode 100644 independent-projects/revapi/src/main/resources/META-INF/revapi.ftl create mode 100644 independent-projects/revapi/src/main/resources/revapi/revapi-configuration.xml diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 958acdaf4d988..358a33f24d135 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -100,6 +100,21 @@ 2.0.30.Final + + 0.12.1 + 0.22.0 + 1.9.1 + 0.12.1 + 0.2.1 + + 1.6.0.Final + ${project.version} + + nonBreaking + + true + + false @@ -495,6 +510,16 @@ + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-plugin.version} + + + org.revapi + revapi-maven-plugin + ${revapi-maven-plugin.version} + @@ -818,5 +843,117 @@ + + + api-check + + false + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + parse-version + + parse-version + + validate + + + + + org.revapi + revapi-maven-plugin + + + io.quarkus + quarkus-revapi-config + ${project.version} + + + org.revapi + revapi-java + ${revapi-java-plugin.version} + + + org.revapi + revapi-reporter-json + ${revapi-reporter-json.version} + + + org.revapi + revapi-reporter-text + ${revapi-reporter-text.version} + + + + + ${project.groupId}:${project.artifactId}:${revapi.oldVersion} + + + ${project.groupId}:${project.artifactId}:${revapi.newVersion} + + + false + + \d+\.\d+\.\d+\.Final + + + + + revapi/revapi-configuration.xml + + + api-changes.xml + + versions/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} + + + + + nonBreaking + potentiallyBreaking + true + ${revapi.checkdeps} + xml + ${project.build.directory}/api-changes-suggestions.xml + true + + + + + api-check + + check + + verify + + + + api-report + + report + + package + + + + + + + diff --git a/independent-projects/revapi/pom.xml b/independent-projects/revapi/pom.xml new file mode 100644 index 0000000000000..a011f6a81837c --- /dev/null +++ b/independent-projects/revapi/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + org.jboss + jboss-parent + 36 + + + io.quarkus + quarkus-revapi-config + Quarkus revapi configuration + 999-SNAPSHOT + Contains the configuration of the Revapi API checker and the list of the API changes + in the Quarkus APIs. + + jar + + + true + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + diff --git a/independent-projects/revapi/src/main/resources/META-INF/revapi.ftl b/independent-projects/revapi/src/main/resources/META-INF/revapi.ftl new file mode 100644 index 0000000000000..cbf91b7cffb67 --- /dev/null +++ b/independent-projects/revapi/src/main/resources/META-INF/revapi.ftl @@ -0,0 +1,49 @@ +<#ftl strip_whitespace=true> +<#if reports?has_content> +# API Change analysis Results + +The summary of the API changes between artifacts <#list analysis.oldApi.archives as archive>`${archive.name}`<#sep>, and +<#list analysis.newApi.archives as archive>`${archive.name}`<#sep>, + +[cols="1,1,1,1,1", options="header"] +.Changes +|=== +|Code +|Element +|Classification +|Description +|Justification + +<#list reports as report> + +<#list report.differences as diff> + +|${diff.code} +|<#if report.newElement??>*${report.newElement}* +<#if report.oldElement??>*${report.oldElement}* +<#if diff.attachments['exampleUseChainInNewApi']??> + Example use chain in new api: +<#list diff.attachments['exampleUseChainInNewApi']?split(" <- ") as e> + <-${e} + + +<#if diff.attachments['exampleUseChainInOldApi']?? && diff.attachments['exampleUseChainInNewApi']! != diff.attachments['exampleUseChainInOldApi']> + Example use chain in old api: +<#list diff.attachments['exampleUseChainInOldApi']?split(" <- ") as e> + <-${e} + + + +<#list diff.attachments?keys as key> +<#if !['newArchive', 'newArchiveRole', 'oldArchive', 'oldArchiveRole','package','classQualifiedName','classSimpleName','elementKind','exception','methodName','exampleUseChainInNewApi','exampleUseChainInOldApi','fieldName']?seq_contains(key)> + ${key} = ${diff.attachments[key]} + + +|<#list diff.classification?keys as compat><#if diff.classification?api.get(compat) != "NON_BREAKING"> ${compat?capitalize}: ${diff.classification?api.get(compat)?capitalize?replace("_","")}${'\n'} +|${diff.description} +|${diff.justification!""} + + + +|=== + \ No newline at end of file diff --git a/independent-projects/revapi/src/main/resources/revapi/revapi-configuration.xml b/independent-projects/revapi/src/main/resources/revapi/revapi-configuration.xml new file mode 100644 index 0000000000000..8d94f2bf2aa68 --- /dev/null +++ b/independent-projects/revapi/src/main/resources/revapi/revapi-configuration.xml @@ -0,0 +1,31 @@ + + + + + + error + true + + + + true + javax\..* + + + + + + NON_BREAKING + ${project.build.directory}/revapi-results/revapi-breakages.adoc + + + + NON_BREAKING + ${project.build.directory}/revapi-results/revapi-breakages.json + true + true + + diff --git a/pom.xml b/pom.xml index d795d4614b791..0870083069602 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ independent-projects/ide-config + independent-projects/revapi independent-projects/arc independent-projects/bootstrap independent-projects/qute