Skip to content

Commit b6573d5

Browse files
committed
Hook up japicmp for all stable artifacts
This excludes okhttp-sse and okhttp-dnsoverhttps
1 parent 2a5b529 commit b6573d5

File tree

7 files changed

+83
-3
lines changed

7 files changed

+83
-3
lines changed

build.gradle

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ buildscript {
4747
plugins {
4848
id 'ru.vyarus.animalsniffer' version '1.5.0'
4949
id 'com.github.johnrengelman.shadow' version '4.0.1'
50+
id 'me.champeau.gradle.japicmp' version '0.2.6'
5051
}
5152

5253
allprojects {
@@ -151,4 +152,23 @@ def alpnBootVersionForPatchVersion(String javaVersion, int patchVersion) {
151152
default:
152153
throw new IllegalStateException("Unexpected Java version: ${javaVersion}")
153154
}
154-
}
155+
}
156+
157+
/**
158+
* Returns a .jar file for the golden version of this project.
159+
* https://github.com/Visistema/Groovy1/blob/ba5eb9b2f19ca0cc8927359ce414c4e1974b7016/gradle/binarycompatibility.gradle#L48
160+
*/
161+
ext.baselineJar = { project, version ->
162+
def group = project.property("GROUP")
163+
def artifactId = project.property("POM_ARTIFACT_ID")
164+
try {
165+
String jarFile = "$artifactId-${version}.jar"
166+
project.group = 'virtual_group_for_japicmp' // Prevent it from resolving the current version.
167+
def dependency = project.dependencies.create("$group:$artifactId:$version@jar")
168+
return project.configurations.detachedConfiguration(dependency).files
169+
.find { (it.name == jarFile) }
170+
} finally {
171+
project.group = group
172+
}
173+
}
174+
ext.baselineVersion = "3.14.0"

mockwebserver/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ dependencies {
1414
testImplementation project(':okhttp-tls')
1515
testImplementation deps.assertj
1616
}
17+
18+
apply plugin: 'me.champeau.gradle.japicmp'
19+
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
20+
oldClasspath = files(baselineJar(project, baselineVersion))
21+
newClasspath = files(jar.archivePath)
22+
onlyBinaryIncompatibleModified = true
23+
failOnModification = true
24+
txtOutputFile = file("$buildDir/reports/japi.txt")
25+
ignoreMissingClasses = true
26+
includeSynthetic = true
27+
}
28+
check.dependsOn(japicmp)

okhttp-logging-interceptor/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ dependencies {
1717
testImplementation project(':okhttp-tls')
1818
testImplementation deps.assertj
1919
}
20+
21+
apply plugin: 'me.champeau.gradle.japicmp'
22+
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
23+
oldClasspath = files(baselineJar(project, baselineVersion))
24+
newClasspath = files(jar.archivePath)
25+
onlyBinaryIncompatibleModified = true
26+
failOnModification = true
27+
txtOutputFile = file("$buildDir/reports/japi.txt")
28+
ignoreMissingClasses = true
29+
includeSynthetic = true
30+
}
31+
check.dependsOn(japicmp)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
POM_ARTIFACT_ID=okhttp-logging-interceptor
2-
POM_NAME=okhttp-logging-interceptor
1+
POM_ARTIFACT_ID=logging-interceptor
2+
POM_NAME=logging-interceptor
33
POM_PACKAGING=jar

okhttp-tls/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ dependencies {
1616
testImplementation deps.junit
1717
testImplementation deps.assertj
1818
}
19+
20+
apply plugin: 'me.champeau.gradle.japicmp'
21+
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
22+
oldClasspath = files(baselineJar(project, baselineVersion))
23+
newClasspath = files(jar.archivePath)
24+
onlyBinaryIncompatibleModified = true
25+
failOnModification = true
26+
txtOutputFile = file("$buildDir/reports/japi.txt")
27+
ignoreMissingClasses = true
28+
includeSynthetic = true
29+
}
30+
check.dependsOn(japicmp)

okhttp-urlconnection/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ dependencies {
1717
testImplementation deps.junit
1818
testImplementation deps.assertj
1919
}
20+
21+
apply plugin: 'me.champeau.gradle.japicmp'
22+
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
23+
oldClasspath = files(baselineJar(project, baselineVersion))
24+
newClasspath = files(jar.archivePath)
25+
onlyBinaryIncompatibleModified = true
26+
failOnModification = true
27+
txtOutputFile = file("$buildDir/reports/japi.txt")
28+
ignoreMissingClasses = true
29+
includeSynthetic = true
30+
}
31+
check.dependsOn(japicmp)

okhttp/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,15 @@ dependencies {
3131
testImplementation deps.junit
3232
testImplementation deps.assertj
3333
}
34+
35+
apply plugin: 'me.champeau.gradle.japicmp'
36+
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
37+
oldClasspath = files(baselineJar(project, baselineVersion))
38+
newClasspath = files(jar.archivePath)
39+
onlyBinaryIncompatibleModified = true
40+
failOnModification = true
41+
txtOutputFile = file("$buildDir/reports/japi.txt")
42+
ignoreMissingClasses = true
43+
includeSynthetic = true
44+
}
45+
check.dependsOn(japicmp)

0 commit comments

Comments
 (0)