I need some help with a Gradle build file. I have some subprojects which depend on tasks in the top folder. I just need to take a test
task and split it into two separate test tasks. Currently the file system structure looks like (tab indicates files inside a directory):
top-level-project-folder
A.gradle
B.gradle
C-subproject-folder
C.gradle
D-subproject-folder
D.gradle
Contents of A.gradle (before refactor):
subprojects {
tasks.test.dependsOn {
bTask
}
}
apply from: 'B.gradle'
Contents of C.gradle (before refactor):
test {
...
}
After the refactor, C.gradle needs to look like:
test {
...
}
task runDifferentTests(type : Test) {
...
}
The tricky part is that C.gradle
's test
task currently depends on bTask
. However, after the refactor, C.gradle
's test
task should not depend on bTask
, but the new runDifferentTests
task should depend on bTask
. (Currently, D.gradle
's test
task is marked as depending on bTask
, but it does not actually depend on it -- I'd like to remove that dependency. The only task in the two subprojects which depends on bTask
is the new runDifferentTests
task.)
I've tried some different things but can't seem to find a working solution.