Package dev.gradleplugins.runnerkit
Interface BuildResult
-
public interface BuildResult
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceBuildResult.Failure
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description BuildResultasRichOutputResult()Dilutes the build result to match a rich console, output scrapping, build result.static BuildResultfrom(java.lang.String output)Creates a build result from a textual output produced by a Gradle build.java.util.List<java.lang.String>getExecutedTaskPaths()Returns a list of task paths for all executed tasks (e.g.java.util.List<BuildResult.Failure>getFailures()Returns the failures in this build result, if any.java.lang.StringgetOutput()The textual output produced during the build.java.util.List<java.lang.String>getSkippedTaskPaths()Returns a list of task paths for all skipped tasks (e.g.java.util.List<BuildTask>getTasks()The tasks that were part of the build.BuildTasktask(java.lang.String taskPath)Returns the result object for a particular task, ornullif the given task was not part of the build.java.util.List<BuildTask>tasks(TaskOutcome outcome)The subset ofgetTasks()that had the given outcome.BuildResultwithNormalizedTaskOutput(java.util.function.Predicate<TaskPath> predicate, java.util.function.UnaryOperator<java.lang.String> outputNormalizer)Returns a new build result with the task output matching the predicate normalized by the output normalizer.BuildResultwithoutBuildSrc()Returns a new build result without the tasks executed from the buildSrc included build.
-
-
-
Method Detail
-
getOutput
java.lang.String getOutput()
The textual output produced during the build.This is equivalent to the console output produced when running a build from the command line. It contains both the standard output, and standard error output, of the build.
- Returns:
- the build output, or an empty string if there was no build output (e.g. ran with
-q)
-
getExecutedTaskPaths
java.util.List<java.lang.String> getExecutedTaskPaths()
Returns a list of task paths for all executed tasks (e.g. any outcome).- Returns:
- a list of task path, never null.
-
getSkippedTaskPaths
java.util.List<java.lang.String> getSkippedTaskPaths()
Returns a list of task paths for all skipped tasks (e.g. up-to-date, no-source, skipped, and cached outcome).- Returns:
- a list of task path, never null.
-
from
static BuildResult from(java.lang.String output)
Creates a build result from a textual output produced by a Gradle build. The build result is limited by what is "seen" in the textual output. Unfortunately, the same build result with different console (i.e. verbose vs quiet) will produce different build result. We can use transformers to align build results by removing information from the result to create a common denominator.- Parameters:
output- the textual output produced by a Gradle build.- Returns:
- a
BuildResultrepresenting the output, never null.
-
getTasks
java.util.List<BuildTask> getTasks()
The tasks that were part of the build.The order of the tasks corresponds to the order in which the tasks were started. If executing a parallel enabled build, the order is not guaranteed to be deterministic.
The returned list is an unmodifiable view of items. The returned list will be empty if no tasks were executed. This can occur if the build fails early, due to a build script failing to compile for example.
- Returns:
- the build tasks
-
tasks
java.util.List<BuildTask> tasks(TaskOutcome outcome)
The subset ofgetTasks()that had the given outcome.The returned list is an unmodifiable view of items. The returned list will be empty if no tasks were executed with the given outcome.
- Parameters:
outcome- the desired outcome- Returns:
- the build tasks with the given outcome
-
task
@Nullable BuildTask task(java.lang.String taskPath)
Returns the result object for a particular task, ornullif the given task was not part of the build.- Parameters:
taskPath- the path of the target task- Returns:
- information about the executed task, or
nullif the task was not executed
-
withNormalizedTaskOutput
BuildResult withNormalizedTaskOutput(java.util.function.Predicate<TaskPath> predicate, java.util.function.UnaryOperator<java.lang.String> outputNormalizer)
Returns a new build result with the task output matching the predicate normalized by the output normalizer.- Parameters:
predicate- a predicate matching tasks based on their task path.outputNormalizer- an output normalizer to use for normalizing the task output.- Returns:
- a new
BuildResultwith the matching task output normalized, never null.
-
withoutBuildSrc
BuildResult withoutBuildSrc()
Returns a new build result without the tasks executed from the buildSrc included build.- Returns:
- a new
BuildResultwithout any tasks from buildSrc, never null.
-
asRichOutputResult
BuildResult asRichOutputResult()
Dilutes the build result to match a rich console, output scrapping, build result. Every tasks without output will be drop without affecting the actionable task count. It means the same build for a rich console or a verbose console will be equals.- Returns:
- a new
BuildResultwithout outputless tasks, never null.
-
getFailures
java.util.List<BuildResult.Failure> getFailures()
Returns the failures in this build result, if any.- Returns:
- a list of failure description and causes for this build result or empty list if the build was successful.
-
-