Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JapiCmp: avoid misses, improve reporting and exclusions #2497

Merged
merged 3 commits into from Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/check_transport.yml
Expand Up @@ -30,7 +30,10 @@ jobs:
echo -e "\n - \u001b[1mSpotless (license headers)\u001b[0m failures on touched java files \033[38;5;255;48;5;0m\u001b[1mcan be automatically fixed by running\u001b[0m:"
echo -e " \033[38;5;0;48;5;255m ./gradlew spotlessApply \033[0m"
echo -e "\n - \u001b[1mAPI Compatibility\u001b[0m failures should be considered carefully and \033[38;5;255;48;5;0m\u001b[1mdiscussed with maintainers in the PR\u001b[0m"
echo " If there are failures, the detail should be available in the logs of the api compatibility step above"
echo " If there are failures, the detail should be available in the step's log:"
echo -e " Look for the \033[38;5;0;48;5;255m API compatibility failures \033[0m block(s)."
echo " Alternatively, locally run the following command to get access to the full report:"
echo -e " \033[38;5;0;48;5;255m ./gradlew japicmp \033[0m"
echo ""
exit -1

Expand Down
33 changes: 31 additions & 2 deletions reactor-netty-core/build.gradle
Expand Up @@ -177,16 +177,45 @@ task downloadBaseline(type: Download) {
dest "${buildDir}/baselineLibs/reactor-netty-core-${compatibleVersion}-original.jar"
}

def japicmpReport = tasks.register('japicmpReport') {
onlyIf {
japicmp.state.failure != null
}
doLast {
def reportFile = file("${project.buildDir}/reports/japi.txt")
if (reportFile.exists()) {
println "\n **********************************"
println " * /!\\ API compatibility failures *"
println " **********************************"
println "Japicmp report was filtered and interpreted to find the following incompatibilities:"
reportFile.eachLine {
if (it.contains("*") && (!it.contains("***") || it.contains("****")))
println "source incompatible change: $it"
else if (it.contains("!"))
println "binary incompatible change: $it"
}
}
else println "No incompatible change to report"
}
}

task japicmp(type: JapicmpTask) {
finalizedBy(japicmpReport)
onlyIf { "$compatibleVersion" != "SKIP" }

oldClasspath.from(files("${buildDir}/baselineLibs/reactor-netty-core-${compatibleVersion}-original.jar"))
newClasspath.from(files(jar.archiveFile))
onlyBinaryIncompatibleModified = true
// these onlyXxx parameters result in a report that is slightly too noisy, but better than
// onlyBinaryIncompatibleModified = true which masks source-incompatible-only changes
onlyBinaryIncompatibleModified = false
onlyModified = true
failOnModification = true
failOnSourceIncompatibility = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
onlyIf { "$compatibleVersion" != "SKIP" }

compatibilityChangeExcludes = [ "METHOD_NEW_DEFAULT" ]
}

tasks.japicmp.dependsOn(downloadBaseline)
Expand Down
35 changes: 32 additions & 3 deletions reactor-netty-http-brave/build.gradle
Expand Up @@ -76,16 +76,45 @@ task downloadBaseline(type: Download) {
dest "${buildDir}/baselineLibs/reactor-netty-http-brave-${compatibleVersion}.jar"
}

def japicmpReport = tasks.register('japicmpReport') {
onlyIf {
japicmp.state.failure != null
}
doLast {
def reportFile = file("${project.buildDir}/reports/japi.txt")
if (reportFile.exists()) {
println "\n **********************************"
println " * /!\\ API compatibility failures *"
println " **********************************"
println "Japicmp report was filtered and interpreted to find the following incompatibilities:"
reportFile.eachLine {
if (it.contains("*") && (!it.contains("***") || it.contains("****")))
println "source incompatible change: $it"
else if (it.contains("!"))
println "binary incompatible change: $it"
}
}
else println "No incompatible change to report"
}
}

task japicmp(type: JapicmpTask) {
finalizedBy(japicmpReport)
onlyIf { "$compatibleVersion" != "SKIP" }

oldClasspath.from(files("${buildDir}/baselineLibs/reactor-netty-http-brave-${compatibleVersion}.jar"))
newClasspath.from(files(jar.archiveFile, project(':reactor-netty-core').jar))
onlyBinaryIncompatibleModified = true
newClasspath.from(files(jar.archiveFile))
// these onlyXxx parameters result in a report that is slightly too noisy, but better than
// onlyBinaryIncompatibleModified = true which masks source-incompatible-only changes
onlyBinaryIncompatibleModified = false
onlyModified = true
failOnModification = true
failOnSourceIncompatibility = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
onlyIf { "$compatibleVersion" != "SKIP" }

compatibilityChangeExcludes = [ "METHOD_NEW_DEFAULT" ]
}

tasks.japicmp.dependsOn(downloadBaseline)
Expand Down
35 changes: 32 additions & 3 deletions reactor-netty-http/build.gradle
Expand Up @@ -180,16 +180,45 @@ task downloadBaseline(type: Download) {
dest "${buildDir}/baselineLibs/reactor-netty-http-${compatibleVersion}.jar"
}

def japicmpReport = tasks.register('japicmpReport') {
onlyIf {
japicmp.state.failure != null
}
doLast {
def reportFile = file("${project.buildDir}/reports/japi.txt")
if (reportFile.exists()) {
println "\n **********************************"
println " * /!\\ API compatibility failures *"
println " **********************************"
println "Japicmp report was filtered and interpreted to find the following incompatibilities:"
reportFile.eachLine {
if (it.contains("*") && (!it.contains("***") || it.contains("****")))
println "source incompatible change: $it"
else if (it.contains("!"))
println "binary incompatible change: $it"
}
}
else println "No incompatible change to report"
}
}

task japicmp(type: JapicmpTask) {
finalizedBy(japicmpReport)
onlyIf { "$compatibleVersion" != "SKIP" }

oldClasspath.from(files("${buildDir}/baselineLibs/reactor-netty-http-${compatibleVersion}.jar"))
newClasspath.from(files(jar.archiveFile, project(':reactor-netty-core').jar))
onlyBinaryIncompatibleModified = true
newClasspath.from(files(jar.archiveFile))
// these onlyXxx parameters result in a report that is slightly too noisy, but better than
// onlyBinaryIncompatibleModified = true which masks source-incompatible-only changes
onlyBinaryIncompatibleModified = false
onlyModified = true
failOnModification = true
failOnSourceIncompatibility = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
onlyIf { "$compatibleVersion" != "SKIP" }

compatibilityChangeExcludes = [ "METHOD_NEW_DEFAULT" ]
}

tasks.japicmp.dependsOn(downloadBaseline)
Expand Down