forked from open-telemetry/opentelemetry-proto-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
129 lines (106 loc) · 3.11 KB
/
build.gradle.kts
File metadata and controls
129 lines (106 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import com.google.protobuf.gradle.*
import de.undercouch.gradle.tasks.download.Download
import java.time.Duration
plugins {
id("com.google.protobuf")
id("de.undercouch.download")
id("io.github.gradle-nexus.publish-plugin")
id("otel.java-conventions")
id("otel.publish-conventions")
}
// start - updated by ./.github/workflows/prepare-release-branch.yml
val snapshot = true
// end
// The release version of opentelemetry-proto used to generate classes
var protoVersion = "1.10.0" // renovate(github-releases): open-telemetry/opentelemetry-proto
// Compute the artifact version, include the "-SNAPSHOT" suffix if not releasing
// Release example: 1.5.0
// Snapshot example: 1.5.0-SNAPSHOT
var ver = protoVersion
if (snapshot) {
ver += "-SNAPSHOT"
}
version = ver
description = "Java Bindings for the OpenTelemetry Protocol (OTLP)"
val grpcVersion = "1.81.0"
val protobufVersion = "4.34.1"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
api("com.google.protobuf:protobuf-java:$protobufVersion")
// Workaround for @javax.annotation.Generated
// see: https://github.com/grpc/grpc-java/issues/3633
compileOnly("javax.annotation:javax.annotation-api:1.3.2")
compileOnly("io.grpc:grpc-api:$grpcVersion")
compileOnly("io.grpc:grpc-protobuf:$grpcVersion")
compileOnly("io.grpc:grpc-stub:$grpcVersion")
}
protobuf {
protoc {
// The artifact spec for the Protobuf Compiler
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
all().configureEach {
plugins {
id("grpc")
}
}
}
}
val protoArchive = layout.buildDirectory.file("archives/opentelemetry-proto-$protoVersion.zip")
tasks {
test {
useJUnitPlatform()
}
val downloadProtoArchive by registering(Download::class) {
src("https://github.com/open-telemetry/opentelemetry-proto/archive/v$protoVersion.zip")
dest(protoArchive)
overwrite(false)
}
val unzipProtoArchive by registering(Copy::class) {
dependsOn(downloadProtoArchive)
from(zipTree(protoArchive))
into(layout.buildDirectory.dir("protos"))
}
named("processProtoResources") {
dependsOn(unzipProtoArchive)
}
afterEvaluate {
named("generateProto") {
dependsOn(unzipProtoArchive)
}
}
}
sourceSets {
main {
proto {
srcDir(layout.buildDirectory.dir("protos/opentelemetry-proto-$protoVersion"))
}
}
}
nexusPublishing {
packageGroup.set("io.opentelemetry")
repositories {
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_KEY"))
}
}
connectTimeout.set(Duration.ofMinutes(5))
clientTimeout.set(Duration.ofMinutes(5))
transitionCheckOptions {
maxRetries.set(300)
delayBetween.set(Duration.ofSeconds(10))
}
}