Skip to content

roastedroot/protobuf4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protobuf4j

🚧 WORK IN PROGRESS: 🚧 This repo is currently under development and is not intended for public usage yet.

protobuf4j is protobuf running as pure Java bytecode.

Why?

protoc is widely used by Java developers, unfortunately, invoking it and plugins requires native dependencies or relying on rewrites of the functionality. By compiling protobuf to Wasm and Wasm to Java bytecode thanks to Chicory we don't need to port the original source code and we have 1:1 functionality out-of-the-box.

Version Support

protobuf4j provides separate artifacts for different Protocol Buffers major versions:

Artifact Protobuf Version Use When
protobuf4j-v3 3.25.x Your app uses protobuf-java 3.x
protobuf4j-v4 4.28.x Your app uses protobuf-java 4.x

Which version should I use?

  • Use the version that matches your application's protobuf-java dependency
  • Most enterprise applications currently use v3
  • v4 is the latest version but may have breaking changes from v3

Quick Start

For Protobuf 3.x Applications

Add protobuf4j-v3 as a Maven dependency:

<dependency>
    <groupId>io.roastedroot</groupId>
    <artifactId>protobuf4j-v3</artifactId>
    <version>0.0.1</version>
</dependency>

For Protobuf 4.x Applications

Add protobuf4j-v4 as a Maven dependency:

<dependency>
    <groupId>io.roastedroot</groupId>
    <artifactId>protobuf4j-v4</artifactId>
    <version>0.0.1</version>
</dependency>

Building the Project

To build this project, you'll need:

  • Docker (for building WASM modules)
  • JDK 11 or newer
  • Maven

Build Everything

Build both WASM modules and all Maven artifacts:

# Build WASM modules for both v3 and v4
make build

# Build and install Maven artifacts
mvn clean install

Build Individual Versions

Build only what you need:

# Build only v3
make build-v3
mvn install -pl core-v3

# Build only v4
make build-v4
mvn install -pl core-v4

Skip WASM Build

If you already have the WASM modules built:

# Just build/test Java code
mvn clean install

Project Structure

protobuf4j/
├── core-v3/          → protobuf4j-v3 artifact (Protobuf 3.25.x)
├── core-v4/          → protobuf4j-v4 artifact (Protobuf 4.28.x)
├── buildtools/       → WASM build config for v3
├── buildtools-v4/    → WASM build config for v4
└── wasm/            → Compiled WASM modules

Acknowledgements

This project stands on the shoulders of giants:

About

Work in progress pure Java Protobuf tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published