Reputation: 19758
I have something like the following:
test {
// bunch of common config stuff
// some config stuff specific to `test`
}
task integrationTest(type: Test) {
// bunch of common config stuff
// some config stuff specific to `integrationTest`
}
How can I avoid duplication of the 'bunch of common config stuff'?
Upvotes: 2
Views: 273
Reputation: 123890
tasks.withType(Test) {
// common stuff
}
test { ... }
task integrationTest(type: Test) { ... }
Upvotes: 4
Reputation: 1531
You can use methods: http://www.gradle.org/docs/current/userguide/userguide_single.html
test {
config()
// some config stuff specific to `test`
}
task integrationTest(type: Test) {
config()
// some config stuff specific to `integrationTest`
}
void config() {
// bunch of common config stuff
}
Upvotes: -1