diff --git a/eng/code-quality-reports/src/main/resources/revapi/revapi.json b/eng/code-quality-reports/src/main/resources/revapi/revapi.json new file mode 100644 index 000000000000..02f850424869 --- /dev/null +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -0,0 +1,89 @@ +[ + { + "extension": "revapi.java", + "configuration": { + "filter": { + "packages": { + "regex": true, + "exclude": [ "com\\.azure\\..+\\.implementation(\\..+)?" ] + } + } + } + }, + { + "extension": "revapi.semver.ignore", + "configuration": { + "enabled": true, + "versionIncreaseAllows": { + "major": "breaking", + "minor": "nonBreaking", + "patch": "equivalent" + }, + "passThroughDifferences": [ "java.class.nonPublicPartOfAPI" ] + } + }, + { + "extension": "revapi.ignore", + "configuration": [ + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class org\\.reactivestreams\\.Publisher", + "justification": "This class is part of the reactive streams initiative in Java." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class reactor\\.util\\.context\\.Context", + "justification": "Reactor is allowed in the public API. Since we don't analyze dependencies, these show up as being unresolved." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class com\\.fasterxml\\.jackson\\.databind\\.ObjectMapper", + "exampleUseChainInNewApi": ".*com\\.azure\\.core\\.util\\.serializer\\.JacksonAdapter.*", + "justification": "We allow this in com.azure.core.util.serializer.JacksonAdapter." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class reactor\\.core(\\..+)?", + "justification": "Reactor is allowed in the public API. Since we don't analyze dependencies, these show up as being unresolved." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class com\\.azure\\.core(?!\\.implementation)(\\..+)?", + "justification": "com.azure.core.* classes are allowed in the public API. Since we don't analyze dependencies, these show up as being unresolved." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class (io|reactor)\\.netty\\..+", + "exampleUseChainInOldApi": ".*com\\.azure\\.core\\.http\\.netty\\.NettyAsyncHttpClientBuilder.*", + "justification": "Dependencies are not checked. io.netty and reactor.netty are allowed in azure-core-http-netty." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class okhttp3\\..+", + "exampleUseChainInOldApi": ".*com\\.azure\\.core\\.http\\.okhttp\\.OkHttpAsyncHttpClientBuilder.*", + "justification": "Dependencies are not checked. okhttp3 is allowed in azure-core-http-okhttp." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class com\\.azure\\.storage\\..+", + "exampleUseChainInOldApi": ".*com\\.azure\\.storage\\..*", + "justification": "Dependencies are not checked. azure-storage-common is used in the storage modules." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldClass|newClass)", + "new": "missing\\-class ((com\\.azure\\.messaging\\.eventhubs\\.models\\..+)|(com\\.azure\\.storage\\.blob\\.BlobContainerAsyncClient))", + "exampleUseChainInNewApi": ".*com\\.azure\\.messaging\\.eventhubs\\.checkpointstore\\.blob\\..*", + "justification": "azure-messaging-eventhubs and azure-storage-blob are used in the Event Hubs checkpoint store." + } + ] + } +] diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index c2cc7828e485..7bb93e757447 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -59,12 +59,12 @@ jobs: - ${{ each artifact in parameters.Artifacts }}: - script: | - python3 --version + python3 --version python3 eng/versioning/set_versions.py --update-type all --build-type client --build-qualifier dev.$(Build.BuildNumber) --artifact-id ${{artifact.name}} python3 eng/versioning/set_versions.py --update-type all --build-type data --build-qualifier dev.$(Build.BuildNumber) --artifact-id ${{artifact.name}} condition: eq(variables['SetDevVersion'],'true') displayName: Append dev package version suffix for ${{artifact.name}} - + - script: | python3 --version python3 eng/versioning/update_versions.py --update-type all --build-type client @@ -157,7 +157,7 @@ jobs: displayName: 'Install all client libraries (for SpotBugs analysis)' inputs: mavenPomFile: pom.client.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Dverify-readme' + options: '$(DefaultOptions) -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -Dverify-readme' mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' @@ -165,9 +165,9 @@ jobs: publishJUnitResults: false goals: 'install' - # Run SpotBugs, CheckStyle and JavaDoc tools to ensure high code quality - these will fail the build if issues are found + # Run SpotBugs, CheckStyle, Revapi, and JavaDoc tools to ensure high code quality - these will fail the build if issues are found - task: Maven@3 - displayName: 'Run SpotBugs, CheckStyle, and JavaDoc' + displayName: 'Run SpotBugs, CheckStyle, Revapi, and JavaDoc' inputs: mavenPomFile: pom.client.xml options: '-DskipTests -Dgpg.skip' @@ -176,7 +176,7 @@ jobs: jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'spotbugs:check checkstyle:checkstyle-aggregate javadoc:aggregate' + goals: 'spotbugs:check checkstyle:checkstyle-aggregate revapi:check javadoc:aggregate' # We run a separate SpotBugs aggregate report step here to roll-up all the issues identified per-module - task: Maven@3 diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index df939235380f..51691aadf659 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -123,6 +123,15 @@ + + + org.revapi + revapi-maven-plugin + 0.11.2 + + true + + diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 616f212a45a9..8bb071c8802d 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -75,7 +75,7 @@ org.eclipse.jetty:jetty-server;9.4.11.v20180605 org.hamcrest:hamcrest-all;1.3 org.hamcrest:hamcrest-library;2.2 # https://junit.org/junit5/docs/current/user-guide/#running-tests-ide-intellij-idea -# use 5.4.2 now since Version 5.5.2 as of 11.2019 fails to discover tests +# use 5.4.2 now since Version 5.5.2 as of 11.2019 fails to discover tests # https://youtrack.jetbrains.com/issue/IDEA-223700 # org.junit:junit-bom;5.4.2 is a pom file that will add its dependencyManagement section to parent pom's which # effectively means that each dependency needs to be listed here. @@ -144,9 +144,12 @@ org.jacoco:jacoco-maven-plugin;0.8.4 org.jacoco:org.jacoco.agent;0.8.4 org.mockito:mockito-core;3.0.0 org.nanohttpd:nanohttpd;2.3.1 +org.revapi:revapi-java;0.20.0 +org.revapi:revapi-maven-plugin;0.11.2 + # External Dependency Exceptions -# This section is for external dependencies whose versions were different than +# This section is for external dependencies whose versions were different than # what was defined in the parent pom. # Format; # _groupId:artifactId;dependency-version diff --git a/pom.client.xml b/pom.client.xml index a5692b96f27c..565aec13a851 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -302,6 +302,8 @@ + + org.jacoco jacoco-maven-plugin @@ -340,6 +342,42 @@ build-helper-maven-plugin 3.0.0 + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + revapi/revapi.json + + + ^\d+\.\d+\.\d+$ + false + true + + + + com.azure + sdk-build-tools + 1.0.0 + + + org.revapi + revapi-java + 0.20.0 + + + + + + check + + + + @@ -515,7 +553,6 @@ - @@ -645,8 +682,37 @@ + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + revapi/revapi.json + + + ^\d+\.\d+\.\d+$ + false + true + + + + + report + + + + false + + report-aggregate + + + + + diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 7b8789f9786e..e6a918698e92 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -137,6 +137,16 @@ + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + true + +