nebula-plugins / nebula-test

Test harness for Gradle plugins
Apache License 2.0
45 stars 18 forks source link

Task state detection incorrect when have sub-projects with same task #140

Open esword opened 3 years ago

esword commented 3 years ago

Checking the state/result of a task can return an incorrect value if the same task also ran in a sub-project. This method can incorrectly return the result from the sub-project task:

https://github.com/nebula-plugins/nebula-test/blob/master/src/main/groovy/nebula/test/functional/internal/toolingapi/BuildLauncherBackedGradleHandle.groovy#L118-L119

e.g. if it is checking if :myTask was SKIPPED, it will return true if :subproject:myTask was SKIPPED even if :myTask was not.

A simple fix would be to ensure there was whitespace before the task name so it matches the whole task path:

stdout.contains(" $taskName $stateIdentifier".toString())