我的问题很直接,很容易理解。
题
在Gradle中,有什么方法可以在运行时获取当前的构建类型。例如,在运行汇编Debug任务时,build.gradle文件中的任务是否可以基于该任务与debug build变体相关的事实来做出决策?
样例代码
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 …Run Code Online (Sandbox Code Playgroud) android gradle android-studio build.gradle android-gradle-plugin