Migrate protobuf logic to plugin (#3329)
* Migrate protobuf build logic to plugin * Cleanup
This commit is contained in:
parent
07ee2f86a3
commit
5f03e70628
|
@ -12,9 +12,6 @@ plugins {
|
|||
id("io.github.gradle-nexus.publish-plugin")
|
||||
id("nebula.release")
|
||||
|
||||
id("com.google.protobuf") apply false
|
||||
id("io.morethan.jmhreport") apply false
|
||||
id("otel.jmh-conventions") apply false
|
||||
id("ru.vyarus.animalsniffer") apply false
|
||||
id("me.champeau.gradle.japicmp") apply false
|
||||
}
|
||||
|
@ -107,37 +104,6 @@ subprojects {
|
|||
group = "io.opentelemetry"
|
||||
|
||||
plugins.withId("java") {
|
||||
plugins.withId("com.google.protobuf") {
|
||||
protobuf {
|
||||
val versions: Map<String, String> by project
|
||||
protoc {
|
||||
// The artifact spec for the Protobuf Compiler
|
||||
artifact = "com.google.protobuf:protoc:${versions["com.google.protobuf"]}"
|
||||
}
|
||||
plugins {
|
||||
id("grpc") {
|
||||
artifact = "io.grpc:protoc-gen-grpc-java:${versions["io.grpc"]}"
|
||||
}
|
||||
}
|
||||
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")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("ru.vyarus.animalsniffer") {
|
||||
dependencies {
|
||||
add(AnimalSnifferPlugin.SIGNATURE_CONF, "com.toasttab.android:gummy-bears-api-21:0.3.0:coreLib@signature")
|
||||
|
|
|
@ -10,6 +10,7 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
implementation("com.diffplug.spotless:spotless-plugin-gradle:5.13.0")
|
||||
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.16")
|
||||
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.0")
|
||||
implementation("me.champeau.jmh:jmh-gradle-plugin:0.6.5")
|
||||
implementation("net.ltgt.gradle:gradle-errorprone-plugin:2.0.1")
|
||||
|
|
|
@ -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:${versions["com.google.protobuf"]}"
|
||||
}
|
||||
plugins {
|
||||
id("grpc") {
|
||||
artifact = "io.grpc:protoc-gen-grpc-java:${versions["io.grpc"]}"
|
||||
}
|
||||
}
|
||||
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")))
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
plugins {
|
||||
id("otel.java-conventions")
|
||||
id("otel.protobuf-conventions")
|
||||
`maven-publish`
|
||||
|
||||
id("com.google.protobuf")
|
||||
id("ru.vyarus.animalsniffer")
|
||||
}
|
||||
|
||||
|
@ -30,12 +29,3 @@ dependencies {
|
|||
|
||||
testRuntimeOnly("io.grpc:grpc-netty-shaded")
|
||||
}
|
||||
|
||||
// IntelliJ complains that the generated classes are not found, ask IntelliJ to include the
|
||||
// generated Java directories as source folders.
|
||||
idea {
|
||||
module {
|
||||
sourceDirs.add(file("build/generated/source/proto/main/java"))
|
||||
// If you have additional sourceSets and/or codegen plugins, add all of them
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@ import de.undercouch.gradle.tasks.download.Download
|
|||
import de.undercouch.gradle.tasks.download.Verify
|
||||
|
||||
plugins {
|
||||
id("otel.java-conventions")
|
||||
id("otel.protobuf-conventions")
|
||||
id("maven-publish")
|
||||
|
||||
id("com.google.protobuf")
|
||||
id("de.undercouch.download")
|
||||
id("ru.vyarus.animalsniffer")
|
||||
}
|
||||
|
@ -59,12 +58,3 @@ sourceSets {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IntelliJ complains that the generated classes are not found, ask IntelliJ to include the
|
||||
// generated Java directories as source folders.
|
||||
idea {
|
||||
module {
|
||||
sourceDirs.add(file("build/generated/source/proto/main/java"))
|
||||
// If you have additional sourceSets and/or codegen plugins, add all of them
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
plugins {
|
||||
id("otel.java-conventions")
|
||||
id("otel.protobuf-conventions")
|
||||
`maven-publish`
|
||||
|
||||
id("com.google.protobuf")
|
||||
id("ru.vyarus.animalsniffer")
|
||||
}
|
||||
|
||||
|
@ -23,12 +22,3 @@ dependencies {
|
|||
|
||||
testRuntimeOnly("io.grpc:grpc-netty-shaded")
|
||||
}
|
||||
|
||||
// IntelliJ complains that the generated classes are not found, ask IntelliJ to include the
|
||||
// generated Java directories as source folders.
|
||||
idea {
|
||||
module {
|
||||
sourceDirs.add(file("build/generated/source/proto/main/java"))
|
||||
// If you have additional sourceSets and/or codegen plugins, add all of them
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ pluginManagement {
|
|||
plugins {
|
||||
id("com.github.ben-manes.versions") version "0.39.0"
|
||||
id("com.github.johnrengelman.shadow") version "7.0.0"
|
||||
id("com.google.protobuf") version "0.8.16"
|
||||
id("com.gradle.enterprise") version "3.6"
|
||||
id("de.undercouch.download") version "4.1.1"
|
||||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
||||
|
|
Loading…
Reference in New Issue