Gradle Module A
is an android module which defines several custom build types
android {
buildTypes {
debug {
buildConfigField 'boolean', 'DEV', 'true'
}
internal {
buildConfigField 'boolean', 'INTERNAL', 'true'
}
external {
buildConfigField 'boolean', 'EXTERNAL', 'true'
}
release {
buildConfigField 'boolean', 'RELEASE', 'true'
}
}
}
dependencies {
implementation project(":module-b")
}
Gradle Module B
is a kotlin/java only module:
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
dependencies {
}
Module A depends on module B:
// Module A build.gradle
dependencies {
implementation project(":module-b")
}
In Module B
sources I need to know how exactly is it consumed by Module A
, what is the current buildType
of Module A
: is it 'debug', 'internal', 'external' or 'release'?
Ideally I'd like to have BuildConfig.java
in Module B
similar to one provided by an Android Gradle Plugin, but if this is not possible I'd like to have at least some way of figuring out the build type in non-android modules.
EDIT Another example to put this into perspective: let's say there's one 'app' module and 10 java-only modules. When I execute 'app:assembleExternal' task, then in all 10 java-only modules I want to know that it is "external" build type being built.