Skip to content

Commit

Permalink
Merge pull request #44 from bootstraponline/japicmp
Browse files Browse the repository at this point in the history
Add japicmp to test, rx2, rx, extras, and core
  • Loading branch information
togi authored Sep 23, 2018
2 parents d8e2eea + 9a6bedc commit bad5a10
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cache:
- $HOME/.gradle/caches/

script:
- ./gradlew check jacocoTestReport
- ./gradlew check jacocoTestReport japicmp

after_success:
- bash <(curl -s https://codecov.io/bash)
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Copyright 2017-2018 Spotify AB
This project uses gradle/gradle-mvn-push.gradle from LeakCanary:
https://github.com/square/leakcanary

This project uses gradle/binary_compatibility.gradle from Groovy1:
https://github.com/Visistema/Groovy1/
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 bad5a10

Please sign in to comment.