ghedeon
06/07/2018, 7:34 AMbuild.gradle
into a different file, preserving the context of build.gradle
file?
Ex: I have a custom strField
extension of the buildConfigField
method:
com.android.build.gradle.internal.dsl.BuildType.metaClass.strField = { key, value -> delegate.buildConfigField "String", key, "\"$value\"" }
that allows me to create build type constants without worrying about quotes: strField(key, value)
Ideally, I'd like to extract this into an external file and import it via apply from: '../utils.gradle'
but seems like these script files have different context and the same code doesn't work anymore.
Also, will be this sort of metaprogramming possible if I switch to kotlin DSL?