Hello, I have set up `build-logic` instead of `bui...
# gradle
n
Hello, I have set up
build-logic
instead of
buildSrc
and moved some code in there. However, I am getting an exception when I try to use something from
build-logic
Copy code
fun VariantDimension.stringField(name: String, value: String) {
    buildConfigField("String", name, "\"$value\"")
}
Copy code
ScriptCompilationException(errors=[ScriptCompilationError(message=Unresolved reference: stringField, location=/Users/nuhkoca/.gradle/.tmp/gradle-kotlin-dsl-16705359721542638789.tmp/build.gradle.kts (27:9))
m
You need a no-op plugin in order to access
stringField
in your gradle scripts from
build-logic
because
build-logic
isn't on gradle hot classpath by default unlike
buildSrc
. For more information, see: https://kotlinlang.slack.com/archives/C19FD9681/p1655824505656089
n
Thanks! Asked there 🙂 but seems there is no way except creating a convention plugin to expose an extension function to other
Gradle
scripts, right?
m
Yeah, I guess so