google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.76k stars 274 forks source link

Documentation incomplete #707

Open WebTiger89 opened 1 year ago

WebTiger89 commented 1 year ago

The documentation is deprecated incomplete. No section which options are available to configure the tasks. No section how configuration is done with kotlin dsl. Instead you can read about instructions for versions from 2016, fucking time waste shit.

ejona86 commented 1 year ago

The documentation is not deprecated. It applies to the release that was done a few weeks ago.

No section which options are available to configure the tasks.

See the "Customize code generation tasks" section.

No section how configuration is done with kotlin dsl.

No, but generally people know how to do it given the groovy-centric documentation since mostly it is just syntax that is different. You can also take a look at the exampleKotlinDslProject.

WebTiger89 commented 1 year ago

My bad. I changed the title to "Documentation incomplete".

Given the fact that not all users are familiar with gradle, this documentation is shit for sure. There is so much missing. For example what exactly is the different between the lite version and non-lite version of protobuf dependency. How to add options to an element like java in Kotlin DSL:

generateProtoTasks {
        all().forEach { task ->
            task.builtins {
               id("java") { option("lite") }
            }
        }
    }

Gives me an error that java is already added, which makes sense, because it is added by default according to documentation but took me some time to figure out. While this doesn't work in a pure java/kotlin module it works in an android module. So how to add the "lite" option? Do I even need to add this option? How can I debug the protoc arguments which are generated by the plugin? Kotlin DSL pendants are missing. Do not refer to the fucking shit example please, it doesn't cover the builtins part.

A lot of questions for such simple actions. Would I have a more complex use case I had to study source code to get this shit running. For the question how to add an option to an exisiting element, I came up with:

generateProtoTasks {
        all().forEach { task ->
            task.builtins {
               named("java") { option("lite") }
            }
        }
    }

Not sure if it gets applied for java this way.