Provider.map is incompatible with excluded tasks #21179
Labels
a:bug
in:exec-tasks
in:provider-api
property lazy provider MapProperty ListProperty DirectoryProperty
Expected Behavior
Calling
get()
on a provider created withprovider.map { it }
succeeds in a task action, even if the task that produced the original provider is excluded.Dealing with excluded tasks (
-x
) in a build is strange and might be open to interpretation on precise behavior, but it seems it should behave similarly to a disabled task (enable = false
) and definitely not penalize.map{}
usage. If the current behavior is working as designed then modern providers are incompatible with task exclusion and exclusion should be deprecated to allow usingprovider.map
in plugins.Current Behavior
Within a task action, calling
provider.get()
for output of an excluded task commonly works. But if the provider was mapped (provider.map { it }.get()
) then the build fails:Context
A user complained about a bug in my plugin after the plugin introduced a
.map {}
usage. (It is unclear what caused the issue for the original poster, but that later user did provide a clear repro which I used to investigate.)Steps to Reproduce
https://github.com/ejona86/gradle-bug-map-exclude
Your Environment
Build scan URL: https://gradle.com/s/tpslxaztlxvma
The text was updated successfully, but these errors were encountered: