bufbuild / protovalidate-java

Protocol Buffer Validation for Java.
https://central.sonatype.com/artifact/build.buf/protovalidate
Apache License 2.0
42 stars 13 forks source link

How to locally build protovalidate protos? #170

Open rishabh2a opened 3 months ago

rishabh2a commented 3 months ago

In this commit: https://github.com/bufbuild/protovalidate-java/commit/265d6891cc1702e5c452c96146b846da5320f145 how did we build these files?

I am trying to downgrade proto to 3.19.1, but these files are generated with a newer protoc compiler, so they're giving errors.

How can I re-generate these files with an older protoc compiler?

rishabh2a commented 3 months ago

Adding some more details: First issue I encountered was cel was using newer proto runtime. I moved it to 3.19.1 with the following changes in CEL:

repo: cel-java: checkout v0.4.4 gradle/libs.version.toml: protobuf = "3.25.1" => protobuf = "3.19.1" All unit tests pass.

Now, publish to mavenLocal

repo: protovalidate-java checkout v0.2.1

buf.gen.yaml:

buf.gen.imports.yaml:

buf.gen.noimports.yaml:

gradle/libs.versions.toml: cel = "0.4.4" => cel = "0.4.4-LOCAL" protobuf = "3.25.3" => protobuf = "3.21.7" <Since buf.build/protocolbuffers/java:v19.1 doesn't exist, I'm trying to move to protobuf 3.21.7>

run ./gradlew generate => files are generated successfully

run ./gradlew test => fails

/home/user/repos/protovalidate-java/conformance/src/main/java/build/buf/validate/conformance/cases/RepeatedMinAndMaxItemLen.java:46: error: emptyList() is not public in LazyStringArrayList; cannot be accessed from outside package
      com.google.protobuf.LazyStringArrayList.emptyList();
                                             ^
/home/user/repos/protovalidate-java/conformance/src/main/java/build/buf/validate/conformance/cases/RepeatedMinAndMaxItemLen.java:278: error: emptyList() is not public in LazyStringArrayList; cannot be accessed from outside package
          com.google.protobuf.LazyStringArrayList.emptyList();
                                                 ^
/home/user/repos/protovalidate-java/conformance/src/main/java/build/buf/validate/conformance/cases/RepeatedMinAndMaxItemLen.java:422: error: emptyList() is not public in LazyStringArrayList; cannot be accessed from outside package
        com.google.protobuf.LazyStringArrayList.emptyList();
                                               ^
/home/user/repos/protovalidate-java/conformance/src/main/java/build/buf/validate/conformance/cases/RepeatedMinAndMaxItemLen.java:511: error: emptyList() is not public in LazyStringArrayList; cannot be accessed from outside package
        com.google.protobuf.LazyStringArrayList.emptyList();