Skip to content

Commit

Permalink
Copy in protobuf conventions from SDK repo. (#4643)
Browse files Browse the repository at this point in the history
* Copy in protobuf conventions from SDK repo.

* fix

* Spot
  • Loading branch information
anuraaga committed Nov 16, 2021
1 parent 35a1aa7 commit 39964b3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
1 change: 1 addition & 0 deletions conventions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
// When updating, update above in plugins too
implementation("com.diffplug.spotless:spotless-plugin-gradle:5.16.0")
implementation("com.google.guava:guava:30.1-jre")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.17")
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0")
implementation("org.ow2.asm:asm:9.1")
implementation("org.ow2.asm:asm-tree:9.1")
Expand Down
36 changes: 36 additions & 0 deletions conventions/src/main/kotlin/otel.protobuf-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import com.google.protobuf.gradle.*

plugins {
id("com.google.protobuf")

id("otel.java-conventions")
}

protobuf {
val versions: Map<String, String> by project
protoc {
// The artifact spec for the Protobuf Compiler
artifact = "com.google.protobuf:protoc:3.3.0"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.6.0"
}
}
generateProtoTasks {
all().configureEach {
plugins {
id("grpc")
}
}
}
}

afterEvaluate {
// Classpath when compiling protos, we add dependency management directly
// since it doesn't follow Gradle conventions of naming / properties.
dependencies {
add("compileProtoPath", platform(project(":dependencyManagement")))
add("testCompileProtoPath", platform(project(":dependencyManagement")))
}
}
27 changes: 1 addition & 26 deletions instrumentation/grpc-1.6/testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
import com.google.protobuf.gradle.generateProtoTasks
import com.google.protobuf.gradle.id
import com.google.protobuf.gradle.plugins
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc

plugins {
id("otel.java-conventions")
id("com.google.protobuf") version "0.8.16"
id("otel.protobuf-conventions")
}

val grpcVersion = "1.6.0"

protobuf {
protoc {
// Download compiler rather than using locally installed version:
artifact = "com.google.protobuf:protoc:3.3.0"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
all().configureEach {
plugins {
id("grpc")
}
}
}
}

dependencies {
api(project(":testing-common"))

Expand Down

0 comments on commit 39964b3

Please sign in to comment.