codelab-android-datastore
codelab-android-datastore copied to clipboard
how to config protobuf use kotlindsl in build.gradle ?
copy gradle code from this build.gradle into my project, it not work
copy gradle code from this build.gradle into my project, it not work
protobuf { protoc { artifact = "com.google.protobuf:protoc:3.10.0" }
// Generates the java Protobuf-lite code for the Protobufs in this project. See
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
// for more information.
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}
if you use the Gradle Kotlin DSL it should be like this
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:<version>"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
id("java") {
option("lite")
}
}
}
}
}