Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish plugin artifact for external plugin usage #4

Closed
buildbreaker opened this issue Feb 24, 2023 · 3 comments · Fixed by #19
Closed

Publish plugin artifact for external plugin usage #4

buildbreaker opened this issue Feb 24, 2023 · 3 comments · Fixed by #19

Comments

@buildbreaker
Copy link
Contributor

Currently, the plugin is only published to the BSR. It would be nice for users of Connect-Kotlin to also be able to consume the plugin independently from the BSR. The options for this are:

  1. Publish directly to maven as another artifact: build.buf:connect-kotlin:protoc-gen-connect-kotlin
  2. Add an additional artifact within the releases which is the plugin jar
@buildbreaker buildbreaker changed the title Publish plugin for external plugin usage Publish plugin artifact for external plugin usage Feb 24, 2023
@kohenkatz
Copy link
Contributor

kohenkatz commented Feb 24, 2023

For users who are already using grpc-kotlin or grpc-java, I think that publishing an artifact to Maven is the easiest way to get them on board. The reason for this is that anyone who is already using the protobuf Gradle plugin can add connect-kotlin with just a few lines in the build.gradle{.kts} file.

Here's a snippet from build.gradle.kts that uses the protobuf plugin:

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:${rootProject.ext["protobufVersion"]}"
    }
    plugins {
        id("java") {
            artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcVersion"]}"
        }
        id("grpc") {
            artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcVersion"]}"
        }
        id("grpckt") {
            artifact = "io.grpc:protoc-gen-grpc-kotlin:${rootProject.ext["grpcKotlinVersion"]}:jdk8@jar"
        }
    }
    generateProtoTasks {
        all().forEach {
            it.plugins {
                id("java") {
                    option("lite")
                }
                id("grpc") {
                    option("lite")
                }
                id("grpckt") {
                    option("lite")
                }
            }
            it.builtins {
                id("kotlin") {
                    option("lite")
                }
            }
        }
    }
}

If the generator is published in maven central, something like this is probably all that's needed to make it work:

        id("connectkt") {
            artifact = "build.buf:protoc-gen-connect-kotlin:${rootProject.ext["connectKotlinVersion"]}:jdk8@jar"
        }

and

            it.plugins {
                // ...
                id("connecetkt") {
                }
            }

However, for users who want to get away from protoc and use buf command line, an artifact in GitHub releases is probably much easier to download.

@kohenkatz
Copy link
Contributor

I tested my comment above by building the JAR and running it like this:

        id("connectkt") {
            path = "/path/to/project/protoc-gen-connect-kotlin.jar"
        }

As far as I can tell so far, this works perfectly (except for the issue identified in #6).

@buildbreaker
Copy link
Contributor Author

This should be available in the next release (v0.1.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants