Skip to content

[Build] Gradle 5.0 deprecation: should not remove tasks  #33343

@alpar-t

Description

@alpar-t

Gradle deprecated removing a task if it's added as a dependency.

Do not remove a Task instance from a task dependency set when it contains a Provider to the Task instance. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0.
	at org.gradle.api.internal.tasks.DefaultTaskDependency$TaskDependencySet.remove(DefaultTaskDependency.java:245)
	at java_util_Set$remove$0.call(Unknown Source)
	at com.carrotsearch.gradle.junit4.RandomizedTestingPlugin.replaceTestTask(RandomizedTestingPlugin.groovy:98)
	at com.carrotsearch.gradle.junit4.RandomizedTestingPlugin$replaceTestTask$0.callStatic(Unknown Source)
	at com.carrotsearch.gradle.junit4.RandomizedTestingPlugin.apply(RandomizedTestingPlugin.groovy:22)
	at com.carrotsearch.gradle.junit4.RandomizedTestingPlugin.apply(RandomizedTestingPlugin.groovy)
[...]

"Provider to the Task instance" is part of the delayed task ( a.k.a lazy task ) improvements added in 4.8, documented and refined in 4.9, and in this case it's not something we can control as the initial test task is represented as a provider, we have no control to change that, we also don't have control to prevent adding it as a dependency.

This will effectively prevent us from replacing the test task in Gradle 5.0.
Some options that come to mind:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions