Skip to content

Commit

Permalink
Add japicmp to test, rx2, rx, extras, and core
Browse files Browse the repository at this point in the history
gradle -p mobius-test japicmp ;\
gradle -p mobius-rx2 japicmp ;\
gradle -p mobius-rx japicmp ;\
gradle -p mobius-extras japicmp ;\
gradle -p mobius-core japicmp
  • Loading branch information
bootstraponline committed Sep 22, 2018
1 parent d8e2eea commit ba183ef
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -74,6 +74,7 @@ subprojects {
variant.javaCompiler.dependsOn(rootProject.tasks.format)
}
} else if (proj.plugins.findPlugin('java-library')) {
proj.apply from: rootProject.file('gradle/binary_compatibility.gradle')
// for Java (which is easier than android because AGP), ensure compilation is run before
// formatting, since the compiler has much better error messages for syntax errors.
rootProject.tasks.format.dependsOn(proj.tasks.compileTestJava)
Expand Down
42 changes: 42 additions & 0 deletions gradle/binary_compatibility.gradle
@@ -0,0 +1,42 @@
// code from: https://github.com/Visistema/Groovy1/blob/ba5eb9b2f19ca0cc8927359ce414c4e1974b7016/gradle/binarycompatibility.gradle#L48
import me.champeau.gradle.japicmp.JapicmpTask

buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.2.6'
}
}

File baselineJar = null
def baselineVersion = "1.2.0"
def projectGroup = project.group
def projectName = project.name

try {
String dependency = "$projectGroup:$projectName:$baselineVersion@jar"
String jarFile = "$projectName-${baselineVersion}.jar"
project.group = 'group_that_does_not_exist'

baselineJar = files(configurations.detachedConfiguration(
dependencies.create(dependency)
).files).filter {
it.name.equals(jarFile)
}.singleFile
} finally {
project.group = projectGroup
}

task japicmp(type: JapicmpTask, dependsOn: jar) {
oldClasspath = files(baselineJar)
newArchives = files(jar.archivePath)
newClasspath = configurations.runtimeClasspath
onlyModified = true
failOnModification = true
ignoreMissingClasses = true
htmlOutputFile = file("$buildDir/reports/japi.html")
}

0 comments on commit ba183ef

Please sign in to comment.