Giter Site home page Giter Site logo

protoc-gen-twirp-java's Introduction

GitHub Workflow Status (with event) GitHub tag (with filter)

protoc-gen-twirp-java

Twirp protobuf generator for Java.

Usage notes

IMPORTANT Declare option go_package in your .proto files even if you do not plan to generate Go source.

Example project

See github.com/ngyewch/protoc-gen-twirp-java-example

Installation

go install github.com/ngyewch/protoc-gen-twirp-java@latest

Generating sources

Generated sources will need to be added via source set configuration. For example:

sourceSets {
    main {
        java {
            srcDir("build/generated/source/protoc-gen-twirp-java/main/java")
        }
    }
}

Command-line

OUTPUT_DIR=build/generated/source/protoc-gen-twirp-java/main/java
mkdir -p ${OUTPUT_DIR}
protoc --proto_path=${PB_DIR} \
    --twirp-java_out=${OUTPUT_DIR} \
    --twirp-java_opt=gen-helidon-client=true \
    --twirp-java_opt=gen-helidon-server=true \
    ${PB_FILE}

Via Docker

docker build --tag go-protoc-twirp-java:latest https://github.com/ngyewch/protoc-gen-twirp-java.git

OUTPUT_DIR=build/generated/source/protoc-gen-twirp-java/main/java
mkdir -p ${OUTPUT_DIR}
docker run --rm -it \
    --user $(id -u):$(id -g) \
    -v ${PB_DIR}:/protobuf \
    -v ${OUTPUT_DIR}:/build \
    go-protoc-twirp-java:latest \
    protoc --proto_path=/protobuf \
    --twirp-java_out=/build \
    --twirp-java_opt=gen-helidon-client=true \
    --twirp-java_opt=gen-helidon-server=true \
    ${PB_FILE}

Options

Name Type Default Description
gen-helidon-client boolean false Generate Helidon SE WebClient based client.
gen-helidon-server boolean false Generate Helidon SE WebServer based server.

Java dependencies

implementation("com.google.protobuf:protobuf-java:3.25.1")
implementation("com.google.protobuf:protobuf-java-util:3.25.1")

Helidon Client

implementation(platform("io.helidon:helidon-bom:2.6.4"))

implementation("io.helidon.webclient:helidon-webclient")

Helidon Server

implementation(platform("io.helidon:helidon-bom:2.6.4"))

implementation("io.helidon.common:helidon-common-http")
implementation("io.helidon.common:helidon-common-reactive")
implementation("io.helidon.media:helidon-media-common")
implementation("io.helidon.webserver:helidon-webserver")

protoc-gen-twirp-java's People

Contributors

ngyewch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.