Skip to content

Commit

Permalink
Migrate to protobuf-lite
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Apr 11, 2024
1 parent da77b9f commit 897a8d1
Show file tree
Hide file tree
Showing 367 changed files with 283,724 additions and 424,219 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
buf:
rm -rf core/sdk/src/main/gen
rm -rf core/sdk/src/main/resources/protofds
mkdir -p core/sdk/src/main/resources/protofds
buf build --as-file-descriptor-set=true -o core/sdk/src/main/resources/protofds/viam.api buf.build/viamrobotics/api
buf generate --template buf.gen.yaml buf.build/viamrobotics/api
buf generate --template buf.gen.yaml buf.build/viamrobotics/goutils
buf generate --template buf.gen.yaml buf.build/googleapis/googleapis
./gradlew rewriteRun


run_client:
./gradlew runExample1Client --args="localhost:8080"
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
## Pure Java SDK

### Server

* `make run_server`

### Client

* `make run_client`

## Publishing to mavenLocal

Run `./gradlew install`.

## Known Issues
* Android 10 (the min supported at API 29) testing appears to show that webrtc video decoding is failing. This needs to be looked into but could be a simple fix of passing in different decoder factory settings. Android 14 works great.

* Android 10 (the min supported at API 29) testing appears to show that webrtc video decoding is
failing. This needs to be looked into but could be a simple fix of passing in different decoder
factory settings. Android 14 works great.
* Custom modular APIs not yet supported
* These libraries use protobuf-lite, not protobuf-java. See further discussion
at https://github.com/protocolbuffers/protobuf/issues/8104
2 changes: 2 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ version: v1
plugins:
- plugin: buf.build/protocolbuffers/java:v25.2
out: core/sdk/src/main/gen
opt: lite
- plugin: buf.build/grpc/java:v1.61.1
out: core/sdk/src/main/gen
opt: lite
20 changes: 15 additions & 5 deletions core/sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
plugins {
id "com.github.hierynomus.license-report" version "0.16.1"
id("org.openrewrite.rewrite") version("6.11.2")
}

apply plugin: 'java-library'

ext.pomDisplayName = "Viam Core SDK"

dependencies {
api 'io.grpc:grpc-protobuf:1.61.1'
api 'io.grpc:grpc-services:1.61.1'
api 'io.grpc:grpc-stub:1.61.1'
api 'io.grpc:grpc-protobuf-lite:1.62.2'
api 'io.grpc:grpc-stub:1.62.2'
implementation 'org.json:json:20240205'
implementation 'com.google.api.grpc:proto-google-common-protos:2.34.0'
implementation 'com.google.protobuf:protobuf-java-util:3.25.3'
// TODO: this has DescriptorProtos work for extensions and
// should shortly be in the next lite release.
// see https://github.com/protocolbuffers/protobuf/issues/7331
// In the meantime, there's a small risk of a duplicate class exception if
// someone else has DescriptorProtos from the real protobuf-java/lite.
// A possible workaround when that happens is to exclude in the including app/library.
implementation 'build.buf:protobuf-javalite:4.26.1'
api 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
implementation 'commons-io:commons-io:2.15.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

rewrite {
activeRecipe("com.viam.proto.thirdparty")
}

test {
useJUnitPlatform()
testLogging {
Expand Down
8 changes: 8 additions & 0 deletions core/sdk/rewrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
type: specs.openrewrite.org/v1beta/recipe
name: com.viam.proto.thirdparty
displayName: Rename third party protos
recipeList:
- org.openrewrite.java.ChangePackage:
oldPackageName: com.google.rpc
newPackageName: com.viam.shaded.com.google.rpc
38 changes: 38 additions & 0 deletions core/sdk/src/main/gen/com/google/api/AnnotationsProto.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions core/sdk/src/main/gen/com/google/api/ClientLibraryDestination.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 897a8d1

Please sign in to comment.