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

how to config protobuf use kotlindsl in build.gradle ? #24

Open
zs1973 opened this issue Mar 10, 2021 · 2 comments
Open

how to config protobuf use kotlindsl in build.gradle ? #24

zs1973 opened this issue Mar 10, 2021 · 2 comments

Comments

@zs1973
Copy link

zs1973 commented Mar 10, 2021

copy gradle code from this build.gradle into my project, it not work

@zs1973
Copy link
Author

zs1973 commented Mar 10, 2021

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'
            }
        }
    }
}

}

@zs1973 zs1973 changed the title how to config protobuf use kotlindsl in gradle ? how to config protobuf use kotlindsl in build.gradle ? Mar 10, 2021
@chrimaeon
Copy link

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")
                }
            }
        }
    }
}

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

No branches or pull requests

2 participants