feat(proctoc): Adds support for building protoc-gen-grpc-java on the RISC-V platform and provides protoc-gen-grpc-java prebuilt binaries #12301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for building protoc-gen-grpc-java on the RISC-V platform and provides prebuilt binaries, addressing the lack of official RISC-V support and prebuilts for protoc-gen-grpc-java.
Changes
Updated build scripts to detect and recognize riscv64 as a supported target platform.
Extended architecture-specific logic in compiler/build.gradle and compiler/check-artifact.sh to include the riscv64 architecture, enabling proper compilation for RISC-V.
Ensured all newly added code paths are conditionally compiled—this modification does not impact existing supported architectures (e.g., x86_64, ARM).
Motivation
RISC-V is an open, rapidly evolving CPU architecture with growing adoption. Prior to this PR:
protoc-gen-grpc-java lacked official build support for RISC-V, leading to compilation failures when attempting to build natively or cross-compile for the platform.
No protoc-gen-grpc-java prebuilt binaries for RISC-V exist in Maven Central Repository (https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/), which blocked direct use of protoc-gen-grpc-java prebuilts for Maven-based projects (e.g., Hadoop, Spark, and related plugins) on RISC-V.
This PR resolves both gaps to unblock RISC-V adoption for protoc-gen-grpc-java dependent projects.
Testing
Successfully built protoc-gen-grpc-java natively on a Sophgo SG2042 RISC-V CPU running Linux.
Used the RISC-V-built protoc-gen-grpc-java to compile Spark on riscv64 successfully.
Additional Notes
protoc prebuilt binaries:https://github.com/zhanchangbao-sanechips/plugin-repo/protoc-gen-grpc-java-1.47.0-linux-riscv64.exe.