Simply adding a dependency to compileReleaseSources causes a gradle error.
compileReleaseSources.dependsOn 'someTask'
Could not get unknown property 'compileReleaseSources' for project
The dependency need to be added in whenTaskAdded closure:
tasks.whenTaskAdded { t ->
if (t.name in ['compileReleaseSources', 'compileDebugSources']) {
t.shouldRunAfter 'someTask'
t.dependsOn 'someTask'
}
}
Note that you need both t. shouldRunAfter (or t.mustRunAfter) and t.dependsOn.
compileReleaseSources.dependsOn 'someTask'
Could not get unknown property 'compileReleaseSources' for project
The dependency need to be added in whenTaskAdded closure:
tasks.whenTaskAdded { t ->
if (t.name in ['compileReleaseSources', 'compileDebugSources']) {
t.shouldRunAfter 'someTask'
t.dependsOn 'someTask'
}
}
Note that you need both t. shouldRunAfter (or t.mustRunAfter) and t.dependsOn.