feat: re-enable Java example of using pre-built protoc
diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel
index c70cebd..9773da9 100644
--- a/examples/MODULE.bazel
+++ b/examples/MODULE.bazel
@@ -73,8 +73,8 @@
http_jar(
name = "protobuf-java",
- sha256 = "0532ad1024d62361561acaedb974d7d16889e7670b36e23e9321dd6b9d334ef9",
- urls = ["https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/4.27.0-RC3/protobuf-java-4.27.0-RC3.jar"],
+ integrity = "sha256-rSOIR3s7lplCQeZHMaE2iU3J/tbeufJ21ISosXGxRQw=",
+ urls = ["https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/4.28.0/protobuf-java-4.28.0.jar"],
)
####### RUST ##########
diff --git a/examples/java/BUILD b/examples/java/BUILD
index e0f5fe8..50d8d1c 100644
--- a/examples/java/BUILD
+++ b/examples/java/BUILD
@@ -1,10 +1,9 @@
-# See comment in examples/BUILD.bazel
-# java_binary(
-# name = "java",
-# srcs = ["Main.java"],
-# main_class = "Main",
-# deps = [
-# "//:foo_java_proto",
-# "@protobuf-java//jar",
-# ],
-# )
+java_binary(
+ name = "java",
+ srcs = ["Main.java"],
+ main_class = "Main",
+ deps = [
+ "//proto:greeter_java_proto",
+ "@protobuf-java//jar",
+ ],
+)
diff --git a/examples/java/Main.java b/examples/java/Main.java
index dd8deae..4efa820 100644
--- a/examples/java/Main.java
+++ b/examples/java/Main.java
@@ -1,14 +1,14 @@
import com.google.protobuf.InvalidProtocolBufferException;
-import static proto.FooOuterClass.Foo;
+import static proto.GreeterOuterClass.HelloReply;
public class Main {
public static void main(String[] args) throws InvalidProtocolBufferException {
System.out.println(makeMessage("Hello World!"));
}
- public static Foo makeMessage(String msg) {
- Foo.Builder person = Foo.newBuilder();
- person.setMsg(msg);
- return person.build();
+ public static HelloReply makeMessage(String msg) {
+ HelloReply.Builder response = HelloReply.newBuilder();
+ response.setMessage(msg);
+ return response.build();
}
}
diff --git a/examples/proto/BUILD.bazel b/examples/proto/BUILD.bazel
index 88c206c..588f1ea 100644
--- a/examples/proto/BUILD.bazel
+++ b/examples/proto/BUILD.bazel
@@ -17,13 +17,10 @@
deps = [":greeter_proto"],
)
-# Broken by https://github.com/protocolbuffers/protobuf/pull/19679
-# which causes building C++ code from source.
-# TODO: re-enable once protobuf honors the toolchain
-# java_proto_library(
-# name = "greeter_java_proto",
-# deps = [":greeter_proto"],
-# )
+java_proto_library(
+ name = "greeter_java_proto",
+ deps = [":greeter_proto"],
+)
go_proto_library(
name = "greeter_go_proto",