gradle-infrastructure
gradle-infrastructure copied to clipboard
android: Add DSL for BuildConfig fields
It would be nice to have type-safe DSL to add fields to BuildConfig:
buildConfig {
int("VERSION_CODE", 1) // buildConfigField("int", "VERSION_CODE", "1")
string("VERSION", "1.0") // buildConfigField("String", "VERSION", "\"1.0\"")
enum("STAGE", "io.example.Stage.PROD") // buildConfigField("io.example.Stage", "STAGE", "io.example.Stage.PROD")
}
Another possible way to go - create abstraction over build config field. With this approach we can share field between different build types and flavors:
val stage = buildConfig.enumField("STAGE", "io.example.Stage")
debug {
stage.set("DEV")
}
release {
stage.set("PROD")
}