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

Commit 79b85e7

Browse files
authored
Compatibility with gradle-shadow-jar (#247)
Shaded classes placed in the top level `shadow` package are no longer identified as breaks (this makes `gradle-revapi` compatible with `gradle-shadow-jar`
1 parent e340bfb commit 79b85e7

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: Shaded classes placed in the top level `shadow` package are no longer
4+
identified as breaks (this makes `gradle-revapi` compatible with `gradle-shadow-jar`
5+
links:
6+
- https://github.com/palantir/gradle-revapi/pull/247

src/main/resources/revapi-configuration.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"filter": {
77
"classes": {
88
"regex": true,
9-
"exclude": [".*\\$$"]
9+
"exclude": [
10+
".*\\$$",
11+
"^shadow.*"
12+
]
1013
}
1114
}
1215
}

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,44 @@ class RevapiSpec extends IntegrationSpec {
814814
runTasksSuccessfully('revapi').wasExecuted('revapiAnalyze')
815815
}
816816
817+
def 'compatible with gradle-shadow-jar'() {
818+
when:
819+
rootProjectNameIs('root')
820+
821+
buildFile << """
822+
apply plugin: '${TestConstants.PLUGIN_NAME}'
823+
apply plugin: 'java'
824+
apply plugin: 'maven-publish'
825+
826+
allprojects {
827+
group = 'revapi.test'
828+
${mavenRepoGradle()}
829+
}
830+
831+
version = '1.0.0'
832+
833+
revapi {
834+
oldVersion = project.version
835+
}
836+
837+
${testMavenPublication()}
838+
"""
839+
840+
def shadowedClass = 'src/main/java/shadow/com/palantir/foo/Bar.java'
841+
writeToFile shadowedClass, '''
842+
package shadow.com.palantir.foo;
843+
public class Bar {}
844+
'''.stripIndent()
845+
846+
and:
847+
println runTasksSuccessfully('publish').standardOutput
848+
849+
file(shadowedClass).delete()
850+
851+
then:
852+
println runTasksSuccessfully('revapi').standardOutput
853+
}
854+
817855
@RestoreSystemProperties
818856
def 'breaks detected in conjure projects should be limited to those which break java but are not caught by conjure-backcompat'() {
819857
when:

0 commit comments

Comments
 (0)