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

revapiAcceptAllBreaks now works when there are multiple breaks #48

Merged
merged 7 commits into from
Oct 2, 2019
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
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.assertj:assertj-core'
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleting this line makes spock tests silently not run. 🔥🔥🔥


annotationProcessor "org.immutables:value"
compileOnly "org.immutables:value::annotations"
Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-48.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: revapiAcceptAllBreaks now works when there are multiple breaks
links:
- https://github.com/palantir/gradle-revapi/pull/48
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.palantir.gradle.revapi.config.Justification;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -57,7 +58,9 @@ public final void addVersionOverride() throws Exception {
throw new RuntimeException("Please supply the --" + JUSTIFICATION + " param to this task");
}

File breaksPath = Files.createTempFile("reavpi-breaks", ".yml").toFile();
Path tempDir = getProject().getLayout().getBuildDirectory().dir("tmp").get().getAsFile().toPath();

File breaksPath = Files.createTempFile(tempDir, "revapi-breaks", ".yml").toFile();

runRevapi(RevapiConfig.empty()
.withTextReporter("gradle-revapi-accept-breaks.ftl", breaksPath));
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/gradle-revapi-accept-breaks.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<#list reports as report>
<#list report.differences as diff>
{
"code": "${diff.code}",
"old": "${report.oldElement!""}",
"new": "${report.newElement!""}",
"justification": "",
}
"code": ${diff.code},
"old": ${report.oldElement!"null"},
"new": ${report.newElement!"null"},
"justification": "<needs justification>",
},
</#list>
</#list>
]
5 changes: 4 additions & 1 deletion src/test/groovy/com/palantir/gradle/revapi/RevapiSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class RevapiSpec extends IntegrationSpec {
runRevapiExpectingToFindDifferences("root-project")
}

def 'errors out when the there are breaks but then is fine when breaks are accepted'() {
def 'errors out when there are breaks but then is fine when breaks are accepted'() {
when:
buildFile << """
apply plugin: '${TestConstants.PLUGIN_NAME}'
Expand All @@ -232,9 +232,12 @@ class RevapiSpec extends IntegrationSpec {
""".stripIndent()

rootProjectNameIs("root-project")
File revapiYml = new File(getProjectDir(), ".palantir/revapi.yml")

and:
!revapiYml.exists()
runTasksSuccessfully("revapiAcceptAllBreaks", "--justification", "it's all good :)")
revapiYml.text.contains('java.class.removed')

then:
runTasksSuccessfully("revapi")
Expand Down
7 changes: 4 additions & 3 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ org.yaml:snakeyaml:1.23 (1 constraints: 6e17f627)
cglib:cglib-nodep:3.2.2 (1 constraints: 490ded24)
com.netflix.nebula:nebula-test:7.3.0 (1 constraints: 0c051736)
commons-io:commons-io:2.5 (1 constraints: eb0c8d0a)
junit:junit:4.12 (1 constraints: 050de611)
junit:junit:4.12 (2 constraints: 531d130d)
net.bytebuddy:byte-buddy:1.9.10 (1 constraints: 450b52de)
net.bytebuddy:byte-buddy-agent:1.9.10 (1 constraints: 450b52de)
org.apiguardian:apiguardian-api:1.1.0 (5 constraints: 0654a8a8)
org.apiguardian:apiguardian-api:1.1.0 (6 constraints: 7d64a5c6)
org.assertj:assertj-core:3.13.2 (1 constraints: 3b05403b)
org.hamcrest:hamcrest-core:1.3 (1 constraints: cc05fe3f)
org.junit:junit-bom:5.5.2 (1 constraints: 0e051536)
Expand All @@ -37,7 +37,8 @@ org.junit.jupiter:junit-jupiter-api:5.5.2 (4 constraints: 7f38ff30)
org.junit.jupiter:junit-jupiter-engine:5.5.2 (2 constraints: 1b17483c)
org.junit.jupiter:junit-jupiter-params:5.5.2 (2 constraints: 1b17483c)
org.junit.platform:junit-platform-commons:1.5.2 (3 constraints: e529282a)
org.junit.platform:junit-platform-engine:1.5.2 (2 constraints: b6193ef3)
org.junit.platform:junit-platform-engine:1.5.2 (3 constraints: 332a035c)
org.junit.vintage:junit-vintage-engine:5.5.2 (1 constraints: 13098495)
org.mockito:mockito-core:3.1.0 (1 constraints: 0605fd35)
org.objenesis:objenesis:2.6 (2 constraints: 9d17f557)
org.opentest4j:opentest4j:1.2.0 (2 constraints: cd205b49)
Expand Down