Skip to content

Commit

Permalink
fix: support Gradle 8+ (#769)
Browse files Browse the repository at this point in the history
* chore: correct spacing in verification failure message

* test: update test to work with symlinks in expected paths

* fix: annotate deprecated properties with @ReplacedBy to pass gradle smoke test validations

* feat: remove @OverRide from methods which will be removed in Gradle 8

* fix: replace @ReplacedBy with @internal so they're still treated as inputs
  • Loading branch information
tresat authored Aug 22, 2022
1 parent 42d2715 commit 4b53ab5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ spotbugsMain {
then:
result.task(':spotbugsMain').outcome == TaskOutcome.FAILED
result.output.contains('See the report at')
def expectedOutput = rootDir.toPath().resolve(Paths.get("build", "reports", "spotbugs", "main.xml")).toUri().toString()
def expectedOutput = rootDir.toPath().toRealPath().resolve(Paths.get("build", "reports", "spotbugs", "main.xml")).toUri().toString()
result.output.contains(expectedOutput)
where:
Expand Down
8 changes: 2 additions & 6 deletions src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public SpotBugsReport(ObjectFactory objects, SpotBugsTask task) {
public abstract String toCommandLineOption();

/** @deprecated use {@link #getOutputLocation()} instead. */
@Override
@Deprecated
@Internal
public File getDestination() {
return destination.get().getAsFile();
}
Expand All @@ -75,35 +75,31 @@ public Property<Boolean> getRequired() {

/** @deprecated use {@link #getRequired()} instead. */
@Deprecated
@Override
@Internal
public boolean isEnabled() {
return isRequired.get();
}

/** @deprecated use {@code getRequired().set(value)} instead. */
@Deprecated
@Override
public void setEnabled(boolean b) {
isRequired.set(b);
}

/** @deprecated use {@code getRequired().set(provider)} instead. */
@Deprecated
@Override
public void setEnabled(Provider<Boolean> provider) {
isRequired.set(provider);
}

/** @deprecated use {@code getOutputLocation().set(file)} instead. */
@Deprecated
@Override
public void setDestination(File file) {
destination.set(file);
}

/** @deprecated use {@code getOutputLocation().set(provider)} instead. */
@Deprecated
@Override
public void setDestination(Provider<File> provider) {
destination.set(this.task.getProject().getLayout().file(provider));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void execute() {
return;
}

String errorMessage = "Verification failed: SpotBugs ended with exit code " + exitValue;
String errorMessage = "Verification failed: SpotBugs ended with exit code " + exitValue + ".";
List<String> reportPaths =
params.getReports().get().stream()
.map(RegularFile::getAsFile)
Expand All @@ -149,7 +149,7 @@ public void execute() {
.map(URI::toString)
.collect(Collectors.toList());
if (!reportPaths.isEmpty()) {
errorMessage += "See the report at: " + String.join(",", reportPaths);
errorMessage += " See the report at: " + String.join(",", reportPaths);
}
throw new GradleException(errorMessage);
}
Expand Down

0 comments on commit 4b53ab5

Please sign in to comment.