Created
April 5, 2022 08:26
-
-
Save nguyensinhtu/8a26b26568f3721c3d550ecbc8f022d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| buildscript { | |
| ext { | |
| grpcVersion = "1.39.0" | |
| protobufVersion = "3.17.3" | |
| protoGenValidateVersion = "0.4.1" | |
| } | |
| } | |
| plugins { | |
| id "com.google.protobuf" version "0.8.16" | |
| id "java" | |
| id "maven-publish" | |
| id "idea" | |
| } | |
| group = "my_group" | |
| sourceSets { | |
| main { | |
| proto { | |
| srcDirs 'schema/proto' | |
| include '**/*.protodevel' | |
| } | |
| java { | |
| srcDirs 'java/main/grpc' | |
| srcDirs 'java/main/java' | |
| } | |
| } | |
| } | |
| idea { | |
| module { | |
| sourceDirs += file("${projectDir}/schema/proto") | |
| } | |
| } | |
| repositories { | |
| mavenCentral() | |
| jcenter() | |
| } | |
| protobuf { | |
| protoc { | |
| artifact = "com.google.protobuf:protoc:${protobufVersion}" | |
| } | |
| plugins { | |
| grpc { | |
| artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" | |
| } | |
| javapgv { | |
| artifact = "io.envoyproxy.protoc-gen-validate:protoc-gen-validate:${protoGenValidateVersion}" | |
| } | |
| } | |
| generateProtoTasks { | |
| all()*.plugins { | |
| grpc {} | |
| javapgv { | |
| option "lang=java" | |
| } | |
| } | |
| } | |
| generatedFilesBaseDir = "${projectDir}/java" | |
| } | |
| dependencies { | |
| implementation "io.grpc:grpc-netty:${grpcVersion}" | |
| implementation "io.grpc:grpc-protobuf:${grpcVersion}" | |
| implementation "io.grpc:grpc-stub:${grpcVersion}" | |
| implementation "com.google.protobuf:protobuf-java:${protobufVersion}" | |
| implementation "io.envoyproxy.protoc-gen-validate:pgv-java-stub:${protoGenValidateVersion}" | |
| implementation "javax.annotation:javax.annotation-api:1.3.2" | |
| protobuf "com.google.protobuf:protobuf-java:${protobufVersion}" | |
| } | |
| sourceSets { | |
| main { | |
| proto { | |
| srcDirs "schema/proto" | |
| } | |
| java { | |
| srcDirs "java/main/grpc" | |
| srcDirs "java/main/java" | |
| } | |
| } | |
| } | |
| publishing { | |
| repositories { | |
| maven { | |
| name = "GitHubPackages" | |
| url = uri("${url_to_publish_package}") | |
| credentials { | |
| username = System.getenv("GITHUB_USERNAME") | |
| password = System.getenv("GITHUB_TOKEN") | |
| } | |
| } | |
| } | |
| publications { | |
| gpr(MavenPublication) { | |
| from(components.java) | |
| } | |
| } | |
| } | |
| java { | |
| withSourcesJar() | |
| } | |
| jar { | |
| from { | |
| configurations.runtimeClasspath.filter { it.exists() }.collect { it.isDirectory() ? it : zipTree(it) } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment