Please update the Datastore with Protobuf codelab to support Gradle Kotlin DSL / Kotlin code generation
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- kotlin
- Domain
- documentation
Research direction
Start with the Datastore codelab's existing Java and Gradle Groovy protobuf configuration. Update the codelab to document Gradle Kotlin DSL setup and Kotlin Protobuf code generation, then verify that the documented configuration matches the working example in the issue.
Written by the indexing model from the issue text.
Description
Hi,
It took me some hours to figure out how to set it up correctly, I think the codelab should mention it:
import com.google.protobuf.gradle.id
plugins {
// ...
id("com.google.protobuf") // version 0.9.1
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.21.9"
}
// 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 {
// see https://github.com/google/protobuf-gradle-plugin/issues/518
// see https://github.com/google/protobuf-gradle-plugin/issues/491
// all() here because of android multi-variant
all().forEach { task ->
// this only works on version 3.8+ that has buildins for javalite / kotlin lite
// with previous version the java build in is to be removed and a new plugin
// need to be declared
task.builtins {
id("java") { // id is imported above
option("lite")
}
id("kotlin") {
option("lite")
}
}
}
}
}
depencencies {
// ...
implementaiton("com.google.protobuf:protobuf-javalite:3.21.9")
implementaiton("com.google.protobuf:protobuf-kotlin-lite:3.21.9")
// ....
}
this generate kotlin helpers for the proto and correctly works on gradle kotlin-dsl
the codelab only show how to configure for java and gradle groovy
- Dominant language
- Kotlin
- Stars
- 240
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/codelab-android-datastore
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
android/codelab-android-datastore#83 · 1 comment · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in android/codelab-android-datastore
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Issue: Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
OpenAPITools/openapi-generator#24978 ·
-
helsemelding-json-schema json-schema-core
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
contributor: external needs review
Difficulty 2/5 1-3 hours Newbie friendliness 82/100