-
Notifications
You must be signed in to change notification settings - Fork 596
Description
Hello Wire team!
I'm reaching out to share a project we've been working on called protobuf4j and to explore whether there might be opportunities for collaboration or shared learnings between our projects.
What is protobuf4j?
protobuf4j compiles the official protoc compiler and plugins (including grpc-java) to WebAssembly, then uses https://github.com/dylibso/chicory (a pure JVM WebAssembly runtime) to execute them as native Java bytecode.
This is at pre-MVP level, we have a working POC, and currently evaluating including it in our other projects.
This approach provides:
- Zero native dependencies - No need to bundle platform-specific protoc binaries
- Pure Java execution - Works anywhere the JVM runs, including environments where native execution is restricted
- Official protoc behavior - Uses the actual protobuf compiler, ensuring 100% compatibility with the official tools
- Support for both Protobuf 3.x and 4.x - Separate modules for each major version
The main API looks like:
// Get FileDescriptorSet from .proto files
FileDescriptorSet descriptors = Protobuf.getDescriptors(workdir, List.of("my.proto"));
// Run native plugins (Java code generation, gRPC)
CodeGeneratorResponse response = Protobuf.runNativePlugin(
NativePlugin.JAVA, codeGeneratorRequest, workdir);
The project will also include utilities for (and more to come, we're currently working on it):
- Syntax validation
- Schema compatibility checking
- Schema normalization
Why I'm reaching out
Wire has been an inspiration - you've built an impressive, independent implementation of Protocol Buffers that generates beautiful, idiomatic code for Java/Kotlin/Swift. Your approach of having a pure Java/Kotlin implementation has clear advantages.
I wanted to share protobuf4j because:
- Different but complementary approaches - Wire reimplements protobuf parsing and code generation in pure Kotlin; protobuf4j wraps the official C++ implementation via WebAssembly. Each approach has trade-offs that might be valuable in different contexts.
- Potential shared use cases - For schema registries, validation tools, or environments requiring official protoc behavior, the WebAssembly approach might be useful. Conversely, Wire's elegant code generation is unmatched.
- Learning from your experience - Your team has deep expertise in this space. Any feedback or thoughts on this approach would be invaluable.
Questions for the Wire team
- Does this approach seem interesting or potentially useful for any Wire use cases?
- Are there aspects of official protoc behavior that Wire users have requested that are difficult to replicate?
- Would there be any interest in collaboration, or is this more of a "different tools for different jobs" situation?
I want to be clear: I'm not proposing that protobuf4j replace Wire - they solve problems differently. Wire's code generation and developer experience are exceptional. I'm genuinely curious whether there's synergy here or valuable feedback you might share.
The project is still a work in progress, but the core functionality is operational. You can find it at: https://github.com/roastedroot/protobuf4j
Thank you for taking the time to read this, and for all the great work on Wire over the years!