I'm thing I'd like to understand conceptually is h...
# gradle
r
I'm thing I'd like to understand conceptually is how the classpath works. With groovy syntax when I add a plugin like
com.google.protobuf
I now have available
protobuf
as a keyword. Is there an equivalent process that happens with adding plugins to a Kotlin build script? And how does Kotlin script handle classpath / imports when only one project within a larger build adds a plugin, especially given that Kotlin script seems to require imports at the top level?
s
rocketraman: for generating the
protobuf
extension, apply the plugin and run
./gradlew gskGenerateAccessors
. After that you should be able to access everything like in groovy but in a type safe manner.
r
As I understand from https://kotlin.link/articles/Gradle-Script-Kotlin-0-8-0-Release-Notes.html, shouldn't the type-safe accessors be generated automatically if my properties file contains
org.gradle.script.lang.kotlin.accessors.auto=true
(which mine does)? In any case,
gskGenerateAccessors
just reports "task not found".
I think my issue is more around the classpath and multiple project blocks within the same build file. But I'm not sure.