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

Add japicmp to test, rx2, rx, extras, and core #44

Merged
merged 3 commits into from
Sep 23, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about android modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to use japicmp-gradle-plugin on an aar file.

// 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to update the NOTICE file in the root of the repository too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

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")
}