Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit f166313

Browse files
authored
Ensure we don't find breaks in api dependencies needlessly (#238)
Fixes a bug introduced in 1.3.2 where breaks for `api` dependencies would be spuriously reported.
1 parent 39d0f33 commit f166313

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type: fix
2+
fix:
3+
description: Fixes a bug introduced in 1.3.2 where breaks for `api` dependencies
4+
would be spuriously reported.
5+
links:
6+
- https://github.com/palantir/gradle-revapi/pull/238

src/main/java/com/palantir/gradle/revapi/ResolveOldApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private static OldApi resolveOldApiWithVersion(Project project, GroupNameVersion
102102
Set<File> oldWithDeps = OldApiConfigurations.resolveOldConfiguration(project, groupNameVersion, true);
103103

104104
Set<File> oldJustDeps = new HashSet<>(oldWithDeps);
105-
oldJustDeps.removeAll(oldWithDeps);
105+
oldJustDeps.removeAll(oldOnlyJar);
106106

107107
return OldApi.builder().jars(oldOnlyJar).dependencyJars(oldJustDeps).build();
108108
}

src/test/groovy/com/palantir/gradle/revapi/RevapiSpec.groovy

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,47 @@ class RevapiSpec extends IntegrationSpec {
569569
println runTasksSuccessfully("revapi").standardOutput
570570
}
571571
572+
def 'should not say there are breaks in api dependencies when nothing has changed'() {
573+
when:
574+
rootProjectNameIs('test')
575+
576+
buildFile << """
577+
apply plugin: '${TestConstants.PLUGIN_NAME}'
578+
apply plugin: 'java-library'
579+
apply plugin: 'maven-publish'
580+
581+
group = 'revapi'
582+
version = '1.0.0'
583+
584+
repositories {
585+
mavenCentral()
586+
}
587+
${mavenRepoGradle()}
588+
589+
${testMavenPublication()}
590+
591+
dependencies {
592+
api 'junit:junit:4.12'
593+
}
594+
595+
revapi {
596+
oldVersion = project.version
597+
}
598+
""".stripIndent()
599+
600+
writeToFile 'src/main/java/foo/Foo.java', '''
601+
package foo;
602+
// Use an junit interface in our public api so revapi cares about it
603+
public interface Foo extends org.junit.rules.TestRule { }
604+
'''
605+
606+
and:
607+
println runTasksSuccessfully("publish").standardOutput
608+
609+
then:
610+
println runTasksSuccessfully("revapi").standardOutput
611+
}
612+
572613
def 'ignores scala classes'() {
573614
when:
574615
buildFile << """

0 commit comments

Comments
 (0)