Мой вопрос очень прямой и простой для понимания.
Вопрос
В Gradle, есть ли способ получить текущий тип сборки во время выполнения. Например, при выполнении задачи сборки Debug могут ли задачи в файле build.gradle принимать решения на основе того факта, что эта задача связана с вариантом сборки отладки?
Пример кода
apply plugin: 'com.android.library'
ext.buildInProgress = ""
buildscript {
repositories {
maven {
url = url_here
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
configurations {
//get current build in progress here e.g buildInProgress = this.getBuildType()
}
android {
//Android build settings here
}
buildTypes {
release {
//release type details here
}
debug {
//debug type details here
}
anotherBuildType{
//another build type details here
}
}
}
dependencies {
//dependency list here
}
repositories{
maven(url=url2_here)
}
task myTask{
if(buildInProgress=='release'){
//do something this way
}
else if(buildInProgress=='debug'){
//do something this way
}
else if(buildInProgress=='anotherBuildType'){
//do it another way
}
}
В итоге
Есть ли способ для меня точно определить тип сборки в myTask {} ?