Yoni Obia
07/18/2024, 6:54 AMbuild-convention/convention
folder with all my *ConventionPlugin
In one of my module I had a groovy task which was setting a buildConfigField and when I migrated it to kts it no longer creates that field
When I uncomment the line in my android
block it does create it
I do have the buildFeatures { buildConfig = true }
in my custom.android.feature
plugins {
id("custom.android.feature")
}
tasks.create("myCustomTask") {
// Process
android.defaultConfig.buildConfigField("String", "CUSTOM_GRADLE_TASK_KEY", "\"TEST\"")
}
android {
namespace = "com.example.app.features.home"
// android.defaultConfig.buildConfigField("String", "CUSTOM_GRADLE_TASK_KEY_2", "\"TEST!!!\"")
}
dependencies {
...
}
Vampire
07/18/2024, 8:04 AMYoni Obia
07/18/2024, 9:21 AMVampire
07/18/2024, 9:26 AMYoni Obia
07/18/2024, 9:28 AMtasks.build {
dependsOn("myCustomTask")
}
the only thing the task does is reading a file and adding a buildConfigField to the BuildConfig.java of this specific module. Does that count as changing the configuration?Yoni Obia
07/18/2024, 11:26 AMclass AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply(libs.findPlugin("android.library").get().get().pluginId)
apply(libs.findPlugin("kotlin.android").get().get().pluginId)
}
}
}
}
// build.gradle.kts of my core module
plugins {
id("io.yoobi.library")
}
android {
namespace = "io.yoobi.gradleconvention.core"
}
I’d like to create a BuildConfigField for this module, this BuildConfigField is generated by reading multiple fileVampire
07/18/2024, 11:26 AMbuildConfigField
is something you usually configure in the build script, isn't it?
So yes, if you change it at execution time, that is changing configuration