pb: a tool for managing protoc builds and dependencies

Related tags

Network pb
Overview

pb

pb is a Protocol Buffers Build tool that manages dependencies and build configuration for protoc.

Flags

  • proto-path - Path to .proto to compile using configuration
  • config - Path to configuration file to use for compilation

Config

Configuration is provided in HCL with the following top-level configuration fields:

go

go configures protoc dependencies based on the go.mod, and includes any modules that contain *.proto files. Fields are:

  • path - Path to the go.mod file. Relative to configuration or absolute
  • ignores - array of directory paths to ignore for importing *.proto files

Example

go {
  path = "go.mod"
  ignores = ["internal"]
}

dependency(type, label)

dependencies configures the label dependencies for the provided type at the version provided

The fields are:

  • type (label) - The dependency type (either: git or local)
  • name (label) - The name and location of the dependency
  • version - The tag or commit to use as a version

Example

dependency "git" "github.com/googleapis/googleapis" {
    version = "5518740a67d22a7ad1b0b7656c98211ca5e19307"
}

plugin(name)

plugin configures protoc plugins for code generation. The fields are:

  • name - The binary name suffix (i.e. protoc-gen-<name>)
  • path - The path to place generated files, relative to the configuration
  • rel_path - The path to place generated files, relative to the *.proto file being generated for
  • options - Options to provide the protoc plugin

Example

plugin "go" {
    rel_path = "."
    options = {
        "paths": "source_relative",
    }
}

plugin "go-grpc" {
    rel_path = "."
    options = {
        "paths": "source_relative",
    }
}

Full example

go {
	path = "./go.mod"
	ignore = ["vendor", "test", "example", "internal"]
}

dependency "git" "github.com/googleapis/googleapis" {
	version = "5518740a67d22a7ad1b0b7656c98211ca5e19307"
}

plugin "go" {
	rel_path = "."
	options = {
		"paths": "source_relative",
	}
}

plugin "go-grpc" {
	rel_path = "."
	options = {
		"paths": "source_relative",
	}
}

plugin "swagger" {
	path = "./genspec/openapi/"
	options = {
		"allow_merge": "true",
		"merge_file_name": "api"
	}
}

plugin "grpc-gateway" {
	rel_path = "."
	options = {
		"paths": "source_relative",
		"allow_patch_feature": "false",
	}
}

Using with go generate

You can use this tool with go generate in place of using Makefiles for protoc generate, by adding a build-tag to a file alongside the .proto file:

//go:generate go run github.com/enmand/pb -proto-path=path/to/service.proto --config=path/to/proto.hcl
package service
You might also like...
This plugins watches and builds the source files continiusly in-memory

Caddy Esbuild plugin This plugins watches and builds the source files continiusly in-memory. It includes a etag to cache in the browser to save bandwi

Snap builds for CalyxVPN

Install snap sudo snap install riseup-vpn --classic You can track beta channel,

Netmaker is a tool for creating and managing virtual networks
Netmaker is a tool for creating and managing virtual networks

Netmaker is a tool for creating and managing virtual networks. The goal is to make virtual/overlay/mesh networking easy for non-networking people. It should be like clicking a button. Netmaker consists of a server, an agent, and a UI.

Fake server, Consumer Driven Contracts and help with testing performance from one configuration file with zero system dependencies and no coding whatsoever
Fake server, Consumer Driven Contracts and help with testing performance from one configuration file with zero system dependencies and no coding whatsoever

mockingjay server Mockingjay lets you define the contract between a consumer and producer and with just a configuration file you get: A fast to launch

Validates your Go installation and dependencies.

govalidate Validates your Go installation and dependencies. Checks the Go installation and version. Checks if the PATH is correctly configured. Checks

A simple terminal UI for managing SSH sessions
A simple terminal UI for managing SSH sessions

sshman A simple terminal UI for managing SSH sessions sshman uses your unix current user and it creates an account for you. All account and session in

A minimal analytics package to start collecting traffic data without client dependencies.

go-web-analytics A minimal analytics package to start collecting traffic data without client dependencies. Logging incoming requests import "github.co

Coral, a friendly Cobra fork with nearly all its features, but only 4 dependencies
Coral, a friendly Cobra fork with nearly all its features, but only 4 dependencies

Coral Preamble I love Cobra and I love Viper. They are great projects, incredibly useful and outstandingly important for the Go community. But sometim

Owner
Dan Enman
Dan Enman
🎉 An awesome version control tool for protoc and its related plugins.

❤️ PowerProto is actively maintained! Any questions in use can be directly raised issue, I will respond to you as fast as possible. If you think the p

storyicon 163 Nov 27, 2022
protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway.

protoc-gen-grpc-gateway-ts protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript

gRPC Ecosystem 91 Nov 18, 2022
A protoc-gen-go wrapper including an RPC stub generator

// Copyright 2013 Google. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE fi

Kyle Lemons 37 Nov 17, 2022
protobuf ではなく JSON でやり取りするファイルを出力する protoc プラグイン

protoc-gen-jsonif proto ファイルから、JSON フォーマットでやりとりする型定義ファイルを出力する protoc プラグインです。 proto ファイルで言語を越えて型定義が出来るのはとても良い しかし protobuf ライブラリを入れるのが面倒 今のプロジェクトには既に

melpon 3 Feb 28, 2022
Protoc plugin to generate contract tests for gRPC in Go

Deal - Go Introduction WE DO NOT SUPPORT THE SERVER SIDE YET This plugin allows us to write Consumer-Driver Contracts tests! Usage example Proto servi

Faunists 15 Sep 3, 2022
A plugin of protoc that for using a service of Protocol Buffers as http.Handler definition

protoc-gen-gohttp protoc-gen-gohttp is a plugin of protoc that for using a service of Protocol Buffers as http.Handler definition. The generated inter

John_Suu 1 Dec 9, 2021
Protoc plugin used to generate go-kit grpc code

protoc-gen-gokit-endpoint protoc plugin used to generate go-kit grpc code 安装 go install github.com/wwbweibo/protoc-gen-gokit-endpoint/cmd/protoc-gen-g

wangweibo 4 Sep 29, 2022
Protoc plugin used to generate go-kit grpc code

protoc-gen-gokit-endpoint protoc plugin used to generate go-kit grpc code 安装 go

wangweibo 4 Sep 29, 2022
The `protoc` compiler plugin which dumps the generation request details

Progotgen DUMP The protoc compiler plugin which dumps the generation request details in "google.golang.org/protobuf/compiler/protogen format to stderr

Albenik's Golang Projects 0 Jan 23, 2022
A Twirp RPC OpenAPI generator implemented as `protoc` plugin

twirp-openapi-gen A Twirp RPC OpenAPI generator implemented as protoc plugin Currently supports only OpenAPI 2.0 Usage Installing the generator for pr

Albenik's Golang Projects 1 May 26, 2022