Skip to content

Commit

Permalink
[build] Check binary compatibility using japicmp
Browse files Browse the repository at this point in the history
 - added a compatibleVersion property to gradle.properties
 - the corresponding artifact is resolved and the jar compared against
 the build-produced jar for incompatibilities
 - japicmp task is run after jar and fails the build
  • Loading branch information
simonbasle committed Sep 26, 2017
1 parent c7f1900 commit c211186
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
47 changes: 44 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import me.champeau.gradle.japicmp.JapicmpTask
import org.gradle.api.internal.plugins.osgi.OsgiHelper

/*
Expand Down Expand Up @@ -34,6 +35,7 @@ plugins {
id 'org.asciidoctor.convert' version '1.5.2'
id "me.champeau.gradle.jmh" version "0.4.4" apply false
id "org.jetbrains.dokka" version "0.9.15"
id "me.champeau.gradle.japicmp" version "0.2.5"
}

apply from: "gradle/doc.gradle"
Expand All @@ -49,7 +51,6 @@ ext {
project.version = realVersion
}
}
gradleVersion = '3.5'

// Logging
slf4jVersion = '1.7.12'
Expand All @@ -72,7 +73,6 @@ ext {

}


configure(subprojects) { p ->
apply plugin: 'java'
apply plugin: 'kotlin'
Expand Down Expand Up @@ -208,13 +208,15 @@ if (project.hasProperty('platformVersion')) {
}
}


project('reactor-core') {
apply plugin: 'idea' //needed to avoid IDEA seeing the jmh folder as source
apply plugin: 'me.champeau.gradle.jmh'

configurations {
compileOnly.extendsFrom jsr166backport
testCompile.extendsFrom jsr166backport
baseline
}

dependencies {
Expand Down Expand Up @@ -245,6 +247,21 @@ project('reactor-core') {
"org.testng:testng:6.8.5",
"org.assertj:assertj-core:$assertJVersion",
"org.mockito:mockito-core:$mockitoVersion"

baseline("io.projectreactor:reactor-core:$compatibleVersion") {
transitive = false
force = true
}
}

task japicmp(type: JapicmpTask) {
oldClasspath = configurations.baseline
newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = true
failOnModification = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
}

javadoc {
Expand Down Expand Up @@ -319,7 +336,6 @@ project('reactor-core') {

sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]


if (!JavaVersion.current().isJava9Compatible()) {
test {
jvmArgs = ["-Xbootclasspath/p:" + configurations.jsr166backport.asPath]
Expand All @@ -343,11 +359,19 @@ project('reactor-core') {

jacocoTestReport.dependsOn testNG
check.dependsOn jacocoTestReport
jar.finalizedBy(japicmp)
}




project('reactor-test') {
description = 'Reactor Test support'

configurations {
baseline
}

dependencies {
compile project(":reactor-core")

Expand All @@ -358,6 +382,21 @@ project('reactor-test') {
testCompile "org.hamcrest:hamcrest-library:1.3",
"org.assertj:assertj-core:$assertJVersion",
"org.mockito:mockito-core:$mockitoVersion"

baseline("io.projectreactor:reactor-test:$compatibleVersion") {
transitive = false
force = true
}
}

task japicmp(type: JapicmpTask) {
oldClasspath = configurations.baseline
newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = true
failOnModification = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
}

javadoc {
Expand Down Expand Up @@ -425,6 +464,8 @@ project('reactor-test') {
artifacts {
archives kdocZip
}

jar.finalizedBy(japicmp)
}

assemble.dependsOn docsZip
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
version=3.1.1.BUILD-SNAPSHOT
compatibleVersion=3.1.0.RELEASE

0 comments on commit c211186

Please sign in to comment.