This message was deleted.
# community-support
s
This message was deleted.
z
because
Provider<Task>
is the
dependsOn(..)
type, the task dependency ends up being ignored
d
What you may end up having is a provider without any implicit task dependencies. If you flatMap into a
Provider<Task>
you should be fine. Basically, the flatMap will use the task dependencies of the returned provider from the transform. At the dependsOn level, you can also use a
Callable
which can return anything Gradle understand as a dependency, i.e. task path as String, task instance or
Provider
. Not that every time Gradle is face with a
Provider
it would unpack the value for the implicit task dependencies but instead use whatever the provider returns (which is an internal feature hence “implicit”). It all boils down to
map
(use this provider dependencies) vs
flatMap
(use returned provider dependencies).
z
I’m fairly certain both
map
and
flatMap
suffer this problem
I solved this by just pulling the gradle property directly during configuration time.
Copy code
val deviceTestRunner: Provider<String> = // gradle property..
dependsOn(
    when (deviceTestRunner.get()) {
        MARATHON -> marathonTask
        SPOON -> spoonTask
        AGP_CONNECTED -> agpConnectedTask
        null -> error("was null")
    }
)
👍 1
which I guess is fine with Gradle 7.4