Skip to content

Commit

Permalink
Add problem collection to BuildResult
Browse files Browse the repository at this point in the history
  • Loading branch information
reinsch82 committed Apr 17, 2024
1 parent d3262c2 commit 483bda2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions subprojects/core-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
api(project(":resources"))
api(project(":persistent-cache"))
api(project(":declarative-dsl-api"))
// api(project(":problems-api"))
api(libs.jsr305)
api(libs.groovy)
api(libs.groovyAnt)
Expand Down
24 changes: 20 additions & 4 deletions subprojects/core-api/src/main/java/org/gradle/BuildResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import com.google.common.collect.ImmutableList;
import org.gradle.api.GradleException;
import org.gradle.api.Incubating;
import org.gradle.api.invocation.Gradle;
import org.gradle.api.problems.internal.Problem;

import javax.annotation.Nullable;
import java.util.Collection;
Expand All @@ -29,14 +29,24 @@
public class BuildResult {
private final String action;
private final Throwable failure;
private final Collection<Problem> problemCollection;
private final Collection<?> problemCollection;
private final Gradle gradle;

public BuildResult(@Nullable Gradle gradle, @Nullable Throwable failure) {
this("Build", gradle, failure, ImmutableList.of());
}

public BuildResult(String action, @Nullable Gradle gradle, @Nullable Throwable failure, Collection<Problem> problemCollection) {
public BuildResult(String action, @Nullable Gradle gradle, @Nullable Throwable failure) {
this(action, gradle, failure, ImmutableList.of());
}

/**
* Constructor
*
* @since 8.9
*/
@Incubating
public BuildResult(String action, @Nullable Gradle gradle, @Nullable Throwable failure, Collection<?> problemCollection) {
this.action = action;
this.gradle = gradle;
this.failure = failure;
Expand All @@ -53,7 +63,13 @@ public Throwable getFailure() {
return failure;
}

public Collection<Problem> getProblems() {
/**
* Problems that occurred during the build.
*
* @since 8.9
*/
@Incubating
public Collection<?> getProblems() {
return problemCollection;
}

Expand Down

0 comments on commit 483bda2

Please sign in to comment.