Skip to content

Commit 4be89cc

Browse files
authored
Merge pull request #669 from openziti/edge-protobuf
use protobuf-defined protocol constants
2 parents 7adaea9 + 33b9b70 commit 4be89cc

File tree

8 files changed

+6343
-100
lines changed

8 files changed

+6343
-100
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ plugins {
2424
alias(libs.plugins.kotlin).apply(false)
2525
alias(libs.plugins.nexus.publish)
2626
alias(libs.plugins.semver.git)
27+
alias(libs.plugins.download).apply(false)
2728
}
2829

2930
semver {

gradle/libs.versions.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ semver-git = "2.3.7"
77
openapi-gen = "7.11.0"
88
spotless = "7.0.2"
99
shadow-jar = "8.3.5"
10+
download = "5.6.0"
1011

1112
# OpenZiti Edge API
1213
ziti-api = "0.26.39"
@@ -26,6 +27,9 @@ springboot = "3.2.5"
2627
jackson = "2.18.2"
2728
jakarta-annotation = "1.3.5"
2829
okhttp3 = "4.12.0"
30+
protobuf = "4.28.2"
31+
metrics = "4.2.30"
32+
bouncycastle = "1.80"
2933

3034
[libraries]
3135

@@ -57,8 +61,10 @@ jackson-bind = { group = "com.fasterxml.jackson.core", name = "jackson-databind"
5761
jackson-datatype = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jsr310", version.ref = "jackson" }
5862
jackson-kotlin = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin", version.ref = "jackson" }
5963

60-
okhttp3 = { group = "com.squareup.okhttp3", name ="okhttp", version.ref = "okhttp3" }
61-
64+
okhttp3 = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp3" }
65+
protobuf = { group = "com.google.protobuf", name = "protobuf-javalite", version.ref = "protobuf" }
66+
metrics = { group = "io.dropwizard.metrics", name = "metrics-core", version.ref = "metrics" }
67+
bouncycastle = { group = "org.bouncycastle", name = "bcpkix-jdk18on", version.ref = "bouncycastle" }
6268

6369
[plugins]
6470
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
@@ -69,5 +75,5 @@ semver-git = { id = "io.wusa.semver-git-plugin", version.ref = "semver-git" }
6975
openapi = { id = "org.openapi.generator", version.ref = "openapi-gen" }
7076
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
7177
shadow = { id = "com.gradleup.shadow", version.ref = "shadow-jar"}
72-
78+
download = { id = "de.undercouch.download", version.ref = "download" }
7379

ziti/build.gradle.kts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ plugins {
2424
alias(libs.plugins.dokka)
2525
id("maven-publish")
2626
alias(libs.plugins.shadow)
27+
alias(libs.plugins.download)
2728
}
2829

2930
ext {
@@ -47,9 +48,9 @@ dependencies {
4748
implementation(libs.jjwt.api)
4849
implementation(libs.jjwt.impl)
4950
implementation(libs.jjwt.gson)
50-
51-
implementation("io.dropwizard.metrics:metrics-core:4.2.30")
52-
implementation("org.bouncycastle:bcpkix-jdk18on:1.80")
51+
implementation(libs.protobuf)
52+
implementation(libs.metrics)
53+
implementation(libs.bouncycastle)
5354

5455
implementation(libs.sodium) {
5556
exclude(module = "slf4j-api")
@@ -75,8 +76,27 @@ tasks.register<WriteProperties>("versionProps") {
7576
property("branch", "$gitBranch")
7677
}
7778

78-
sourceSets.main {
79-
resources.srcDir(files(generatedResourcesDir).builtBy(tasks["versionProps"]))
79+
80+
sourceSets {
81+
main {
82+
resources.srcDir(files(generatedResourcesDir).builtBy(tasks["versionProps"]))
83+
}
84+
}
85+
86+
tasks.register<Exec>("updateProtobuf") {
87+
group = LifecycleBasePlugin.BUILD_GROUP
88+
description = "updates generated protobuf sources in src/main/java. requires `protoc` on your path"
89+
val protoDir = layout.buildDirectory.dir("proto")
90+
download.run {
91+
src("https://raw.githubusercontent.com/openziti/sdk-golang/refs/heads/main/pb/edge_client_pb/edge_client.proto")
92+
dest(protoDir)
93+
}
94+
95+
commandLine("protoc",
96+
"-I", protoDir.get().asFile.absolutePath,
97+
"--java_out=lite:src/main/java",
98+
"edge_client.proto"
99+
)
80100
}
81101

82102
java {

0 commit comments

Comments
 (0)