Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
This PR changes a bit the idea behind BuildResultSubject.task. It doesn't return a BuildTaskSubject with an actual == null anymore. Now BuildResultSubject.task fails if the task doesn't exist with a better error message.
Before:
Caused by: value of:
buildResult.task(:proj:compileJava2)
expected to have a value:
FAILED
but was:
null
buildResult was:
Calculating task graph as no cached configuration is available for tasks: proj:assemble
> Task :proj:processResources NO-SOURCE
> Task :proj:compileJava
> Task :proj:classes
> Task :proj:jar
> Task :proj:assemble
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 executed
Configuration cache entry stored.
After:
Caused by: value of:
buildResult.getTasks()
expected to contain:
:proj:compileJava2
but was:
[:proj:compileJava, :proj:processResources, :proj:classes, :proj:jar, :proj:assemble]
buildResult was:
Calculating task graph as no cached configuration is available for tasks: proj:assemble
> Task :proj:processResources NO-SOURCE
> Task :proj:compileJava
> Task :proj:classes
> Task :proj:jar
> Task :proj:assemble
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 executed
Configuration cache entry stored.
With only that change it would be impossible to check that a task does not exist. For that reason I added hasNotTask. I'm not very happy with the name, any suggestion is more than welcome.
And this function I think that also improves the error message:
Before:
Caused by: value of:
buildResult.task(:proj:compileJava)
expected:
null
but was:
:proj:compileJava=SUCCESS
buildResult was:
Calculating task graph as no cached configuration is available for tasks: proj:assemble
> Task :proj:processResources NO-SOURCE
> Task :proj:compileJava
> Task :proj:classes
> Task :proj:jar
> Task :proj:assemble
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 executed
Configuration cache entry stored.
After:
Caused by: value of:
buildResult.getTasks()
expected not to contain:
:proj:compileJava
but was:
[:proj:processResources, :proj:compileJava, :proj:classes, :proj:jar, :proj:assemble]
buildResult was:
Calculating task graph as no cached configuration is available for tasks: proj:assemble
> Task :proj:processResources NO-SOURCE
> Task :proj:compileJava
> Task :proj:classes
> Task :proj:jar
> Task :proj:assemble
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 executed
Configuration cache entry stored.
Close #1068
This PR changes a bit the idea behind
BuildResultSubject.task
. It doesn't return aBuildTaskSubject
with anactual == null
anymore. Now BuildResultSubject.task fails if the task doesn't exist with a better error message.Before:
After:
With only that change it would be impossible to check that a task does not exist. For that reason I added
hasNotTask
. I'm not very happy with the name, any suggestion is more than welcome.And this function I think that also improves the error message:
Before:
After: