I would like to make something like (pseudo code):
if (BuildType == "release"){
apply plugin: 'testfairy'
} else if (BuildType == "debug"){
apply plugin: 'io.fabric'
}
The idea is that based on the build type, apply (or not) a plugin. How to do it ?
With Gradle 4.6, the following works:
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
apply plugin: 'testfairy'
} else if (getGradle().getStartParameter().getTaskRequests().toString().contains("Debug")) {
apply plugin: 'io.fabric'
}
Based on Stefan Oehme, a Gradle core developer, he said:
Plugins can't be applied to only "part of your project". They are either applied or not. What is the use case where this becomes a problem for you?
So, the answer is this is not possible. I have exposed my use cases where this is becomes a problem and I'll see what hi says about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With