@@ -8,7 +8,6 @@ plugins {
88 id ' elasticsearch.internal-es-plugin'
99 id ' elasticsearch.internal-yaml-rest-test'
1010 id ' elasticsearch.internal-cluster-test'
11- id(' com.google.protobuf' ) version ' 0.9.5'
1211}
1312
1413esplugin {
@@ -18,8 +17,6 @@ esplugin {
1817 extendedPlugins = [' x-pack-core' ]
1918}
2019
21- // manually update verification-metadata.xml via dev-tools/protoc_exe_sha256.sh when updating the protobuf version
22- def protobufVersion = " 4.32.0"
2320dependencies {
2421 api project(" :libs:exponential-histogram" )
2522 compileOnly project(path : xpackModule(' core' ))
@@ -58,88 +55,4 @@ dependencies {
5855 testImplementation " io.opentelemetry:opentelemetry-exporter-sender-jdk:$otelVersion "
5956 testImplementation " io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:$otelVersion "
6057 testImplementation " io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:$otelVersion "
61-
62- implementation " com.google.protobuf:protobuf-java:${ protobufVersion} "
63- }
64-
65- protobuf {
66- protoc {
67- // The artifact spec for the Protobuf Compiler
68- artifact = " com.google.protobuf:protoc:${ protobufVersion} "
69- }
70- }
71-
72- def otlpProtoVersion = " 1.7.0" // Version of the OpenTelemetry proto files to use
73-
74- // To generate the checksum, download the file and run "shasum -a 256 ~/path/to/vfoo.zip"
75- def protoChecksum = " ddb80357ff146f5e3bda584907185b1f635412a4b31edf6f96b102a18b8e05dc"
76- def protoArchivePath = layout. buildDirectory. file(" archives/opentelemetry-proto-${ otlpProtoVersion} .zip" )
77-
78- def downloadProtoArchive = tasks. register(" downloadProtoArchive" ) {
79- outputs. file(protoArchivePath)
80- onlyIf { ! protoArchivePath. get(). asFile. exists() }
81- doLast {
82- protoArchivePath. get(). asFile. parentFile. mkdirs()
83- " https://github.com/open-telemetry/opentelemetry-proto/archive/v${ otlpProtoVersion} .zip" . toURL()
84- .withInputStream { is ->
85- protoArchivePath. get(). asFile. withOutputStream {os -> os << is }
86- }
87- }
88- }
89-
90- def verifyProtoArchive = tasks. register(" verifyProtoArchive" ) {
91- dependsOn(downloadProtoArchive)
92- doLast {
93- protoArchivePath. get(). asFile. withInputStream { inputStream ->
94- def sha256 = inputStream. readAllBytes(). digest(" SHA-256" )
95- if (sha256 != protoChecksum) {
96- throw new GradleException (" Checksum verification failed for $protoArchivePath : expected $protoChecksum , got $sha256 " )
97- }
98- }
99- }
100- }
101-
102- def unzipProtoArchive = tasks. register(" unzipProtoArchive" , Copy ) {
103- dependsOn(verifyProtoArchive)
104- from zipTree(protoArchivePath)
105- into layout. buildDirectory. dir(" protos" )
106- }
107-
108- // Avoid unnecessary String allocations in the generated AnyValue class
109- // We always need the ByteString (UTF-8) representation of string attributes
110- def adjustAnyValueBuilder = tasks. register(" adjustAnyValueBuilder" ) {
111- doLast {
112- ant. replace(
113- file : ' build/generated/sources/proto/main/java/io/opentelemetry/proto/common/v1/AnyValue.java' ,
114- token : ' java.lang.String s = input.readStringRequireUtf8();' ,
115- value : ' com.google.protobuf.ByteString s = input.readBytes();' ,
116- encoding : ' UTF-8'
117- )
118- }
119- }
120-
121- sourceSets {
122- main {
123- proto {
124- srcDir layout. buildDirectory. dir(" protos/opentelemetry-proto-${ otlpProtoVersion} " )
125- }
126- }
127- }
128-
129- afterEvaluate {
130- tasks. named(" generateProto" ) {
131- dependsOn(unzipProtoArchive)
132- finalizedBy(adjustAnyValueBuilder)
133- }
134- }
135-
136- idea {
137- module {
138- sourceDirs + = layout. buildDirectory. dir(" generated/sources/proto/main/java" ). get(). asFile
139- }
140- }
141-
142- tasks. named(" dependencyLicenses" ). configure {
143- mapping from : / opentelemetry-.*/ , to : ' opentelemetry'
144- mapping from : / protobuf.*/ , to : ' protobuf'
14558}
0 commit comments