Skip to content

Commit a15ee36

Browse files
authored
Seperate proto version from nebula.release version (#12)
1 parent 3a9bbbd commit a15ee36

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,28 @@ your desired version.
3232
implementation("io.opentelemetry.proto:opentelemetry-proto:{{version}}")
3333
```
3434

35+
## Project setup
36+
37+
The build downloads proto definitions
38+
from [open-telemetry/opentelemetry-proto](https://github.com/open-telemetry/opentelemetry-proto) and
39+
generates Java bindings:
40+
41+
```shell
42+
./gradlew build
43+
```
44+
45+
By default protos definitions will be downloaded for the latest published tag
46+
of `opentelemetry-proto-java`. For example, if the latest version
47+
is [0.20.0](https://github.com/open-telemetry/opentelemetry-proto-java/tree/v0.20.0), protos will be
48+
downloaded from
49+
the [v0.20.0 release](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.20.0).
50+
This can be overridden for the build or other gradle tasks (e.g. `publishToMavenLocal`)
51+
with `-Prelease.version`:
52+
53+
```shell
54+
./gradlew build -Prelease.version=1.0.0
55+
```
56+
3557
## Releasing
3658

3759
See [RELEASING.md](./RELEASING.md)

build.gradle.kts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ plugins {
1515
}
1616

1717
release {
18+
defaultVersionStrategy = nebula.plugin.release.git.opinion.Strategies.getSNAPSHOT()
1819
}
1920

2021
tasks {
@@ -25,13 +26,6 @@ tasks {
2526

2627
description = "Java Bindings for the OpenTelemetry Protocol (OTLP)"
2728

28-
// Project version is set from -Prelease.version or inferred from the latest tag
29-
if (properties.contains("release.version")) {
30-
version = properties.get("release.version") as String
31-
} else {
32-
version = NearestVersionLocator(TagStrategy()).locate(release.grgit).any.toString()
33-
}
34-
3529
val grpcVersion = "1.56.1"
3630
val protobufVersion = "3.23.4"
3731

@@ -71,7 +65,14 @@ protobuf {
7165
}
7266
}
7367

74-
val protoVersion = version
68+
// Proto version is set from -Prelease.version or inferred from the latest tag
69+
var protoVersion = if (properties.contains(
70+
"release.version"
71+
)) {
72+
properties.get("release.version") as String
73+
} else {
74+
NearestVersionLocator(TagStrategy()).locate(release.grgit).any.toString()
75+
}
7576
val protoArchive = file("$buildDir/archives/opentelemetry-proto-$protoVersion.zip")
7677

7778
tasks {

0 commit comments

Comments
 (0)