Created
September 16, 2013 18:27
-
-
Save noel-yap/6584523 to your computer and use it in GitHub Desktop.
Recursively set Gradle task dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TaskUtil { | |
| static def recursivelyApplyToTaskDependencies(Task parent, Closure closure) { | |
| closure(parent) | |
| parent.dependsOn.findAll { dependency -> | |
| dependency instanceof Task | |
| }.each { task -> | |
| recursivelyApplyToTaskDependencies(task, closure) | |
| } | |
| } | |
| static def recursivelyAddTaskDependency(Task parent, Task dependency) { | |
| recursivelyApplyToTaskDependencies(parent) { p -> | |
| if (!p.name.equals(dependency.name)) { | |
| p.dependsOn(dependency) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment