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

Overview

❤️ 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 project is helpful to you, please give me a star to encourage me!

PowerProto

Go Report Card TotalLine last-commit GoDoc

English | 中文

exmpales

PowerProto is used to solve the following three main problems:

  1. lower the usage threshold and usage cost of gRPC.
  2. solve the version control problem of protoc and its related plugins (such as protoc-gen-go, protoc-gen-grpc-gateway).
  3. efficiently manage the compilation of proto to achieve multi-platform compatibility, one-click installation and compilation.

🎉 Features

  1. one-click installation and multi-version management of protoc.
  2. one-click installation and multi-version management of protoc related plugins (such as protoc-gen-go).
  3. manage the compilation of proto through config file instead of shell script to improve readability and compatibility.
  4. bootstrap generation of config files, cross-platform compatibility, a config can be compiled in multiple platforms with one click.
  5. support batch and recursive compilation of proto files to improve efficiency.
  6. cross-platform support PostAction, you can perform some routine operations (such as replacing "omitempty" in all generated files) after the compilation.
  7. support PostShell, execute specific shell scripts after the compilation.
  8. one-click installation and version control of google apis and gogo protobuf etc。

Installation and Dependencies

  1. The current version of PowerProto relies on go(>=1.16) and git (in the future it may use CDN to pull built binaries directly), please make sure the runtime environment contains these two commands.
  2. protoc download source is Github, PowerProto respects HTTP_PROXY, HTTPS_PROXY environment variables when downloading protoc, if you encounter network problems, please configure your own proxy.
  3. When querying the version list of protoc, git ls-remote is used for github.com, if you encounter network problems, please configure the proxy for git by yourself.
  4. In the current version, downloading and querying plugin versions rely on the go command, so if you encounter network problems, please configure the GOPROXY environment variable yourself.
  5. By default, user directory/.powerproto is used as the installation directory, which is used to place the downloaded plug-ins and global config.
  6. If you think the name powerproto is too long, you can alias it into a simpler name to improve the input efficiency, for example, no one will mind if you call it pp.

I. Installation via Go

Installation can be performed by executing the following command directly:

go install github.com/storyicon/powerproto/cmd/[email protected]

II. out-of-the-box version

You can download the out-of-the-box version via the Github Release Page

Command Introduction

You can view help with powerproto -h, e.g.

powerproto -h
powerproto init -h
powerproto tidy -h
powerproto build -h
powerproto env -h

It has the advantage that the documentation on the command line is always consistent with your binary version.

I. Initial Config

The config can be initialized with the following command.

powerproto init

II. Tidy Config

The config can be tidied with the following command.

powerproto tidy

It will search for a config file named powerproto.yaml from the current directory to the parent directory, and will read and tidy the config.

You can also specify which config file to tidy.

powerproto tidy [the path of proto file]

Tidy the config consists of two main operations:

  1. replacing the latest in the version with the real latest version number by querying.
  2. install all dependencies defined in the config file.

Supports entering debug mode by appending the -d argument to see more detailed logs.

III. Compiling Proto files

The Proto file can be compiled with the following command.

// Compile the specified proto file
powerproto build xxxx.proto

// Compile all the proto files in the current directory
powerproto build .

// Compile all proto files in the current directory recursively, including subfolders.
powerproto build -r .

The execution logic is that for each proto file, the powerproto.yaml config file will be searched from the directory where the proto file is located to the ancestor directory:

  1. For the found config file, match it with the scope in it and use it if it matches.
  2. Check and install the dependencies declared in the config file.
  3. Compile the proto file according to the plugins, protoc, options, importPaths and other configs in the config file。 After all the proto files are compiled, if you specify the -p argument, PostAction and PostShell will also be executed.

Note: The default working directory of PowerProto is the directory where the proto file matches to the config file, it is equivalent to the directory where you execute the protoc command. You can change it via protocWorkDir in the config file.

Supports entering debug mode by appending the -d argument to see more detailed logs.

Supports entering dryRun mode by appending the -y argument, in this mode the commands are not actually executed, but just printed out, which is very useful for debugging.

IV. View environment variables

If your command keeps getting stuck in a certain state, there is a high probability that there is a network problem.

You can check if the environment variables are configured successfully with the following command:

powerproto env

Examples

For example, you have the following file structure in the /mnt/data/hello directory:

$ pwd
/mnt/data/hello

$ tree
./apis
└── hello.proto
powerproto.yaml

The contents of the powerproto.yaml file (you can easily generate the config file with the powerproto init command) are:

scopes:
    - ./
protoc: latest
protocWorkDir: ""
plugins:
    protoc-gen-go: google.golang.org/protobuf/cmd/[email protected]
    protoc-gen-go-grpc: google.golang.org/grpc/cmd/[email protected]
repositories:
    GOOGLE_APIS: https://github.com/googleapis/[email protected]
options:
    - --go_out=.
    - --go_opt=paths=source_relative
    - --go-grpc_out=.
    - --go-grpc_opt=paths=source_relative
importPaths:
    - .
    - $GOPATH
    - $POWERPROTO_INCLUDE
    - $GOOGLE_APIS/github.com/googleapis/googleapis
postActions: []
postShell: ""

Execute in any directory:

powerproto build -r /mnt/data/hello/apis

You can get the compiled file:

$ pwd
/mnt/data/hello

$ tree
./apis
├── hello.pb.go
├── hello.proto
└── hello_grpc.pb.go
powerproto.yaml

It is equivalent to if you were in the directory where powerproto.yaml is located and executed:

$POWERPROTO_HOME/protoc/3.17.3/protoc --go_out=. \
--go_opt=paths=source_relative \
--go-grpc_out=. \
--go-grpc_opt=paths=source_relative \
--proto_path=/mnt/data/hello \
--proto_path=$GOPATH \
--proto_path=$POWERPROTO_HOME/include \
--proto_path=$POWERPROTO_HOME/gits/75e9812478607db997376ccea247dd6928f70f45/github.com/googleapis/googleapis \
--plugin=protoc-gen-go=$POWERPROTO_HOME/plugins/google.golang.org/protobuf/cmd/[email protected]/protoc-gen-go \
--plugin=protoc-gen-go-grpc=$POWERPROTO_HOME/plugins/google.golang.org/grpc/cmd/[email protected]/protoc-gen-go-grpc \
/mnt/data/hello/apis/hello.proto

More examples can be found in examples.

Config File

The config file is used to describe the versions of various dependencies and parameters when compiling the proto file.

It can be easily initialized with powerproto init.

Definition

Take the following config file as an example:

# required. scopes is used to define scopes. 
# i.e. which directories in the project the current config item is valid for
scopes:
    - ./
# required. the version of protoc.
# you can fill in the 'latest', will be automatically converted to the latest version
protoc: 3.17.3
# optional. The working directory for executing the protoc command, 
# the default is the directory where the config file is located.
# support mixed environment variables in path, such as $GOPATH
protocWorkDir: ""
# optional. define dependent Git repositories
# Generally used for dependency control of public protobuf libraries
repositories:
    # Definition depends on the 27156597fdf4fb77004434d4409154a230dc9a32 version of https://github.com/googleapis/googleapis
    # and defines its name as GOOGLE_APIS
    # It can be referenced in importPaths by $GOOGLE_APIS
    GOOGLE_APIS: https://github.com/googleapis/[email protected]
    # Definition depends on the 226206f39bd7276e88ec684ea0028c18ec2c91ae version of https://github.com/gogo/protobuf
    # and defines its name as GOGO_PROTOBUF
    # It can be referenced in the importPaths by $GOGO_PROTOBUF
    GOGO_PROTOBUF: https://github.com/gogo/[email protected]
# required. it is used to describe which plug-ins are required for compilation
plugins:
    # the name, path, and version number of the plugin.
    # the address of the plugin must be in [email protected] format, 
    # and version can be filled with 'latest', which will be automatically converted to the latest version.
    protoc-gen-deepcopy: istio.io/tools/cmd/[email protected]
    protoc-gen-go: google.golang.org/protobuf/cmd/[email protected]
    protoc-gen-go-json: github.com/mitchellh/[email protected]
    protoc-gen-grpc-gateway: github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
# required. defines the parameters of protoc when compiling proto files
options:
    - --go_out=paths=source_relative:.
    - --go-json_out=.
    - --deepcopy_out=source_relative:.
    - --grpc-gateway_out=.
    - --go-grpc_out=paths=source_relative:.
# required. defines the path of the proto dependency, which will be converted to the --proto_path (-I) parameter.
importPaths:
    # Special variables. Will be replaced with the folder where the current configuration file is located.
    - .
    # Environment variables. Environment variables can be used in importPaths.
    # Support mixed writing like $GOPATH/include
    - $GOPATH
    # Special variables. Will be replaced with the local path to the public proto file that comes with protoc by default
    - $POWERPROTO_INCLUDE
    # Special variables. Reference to the directory where the proto file to be compiled is located
    # For example, if /a/b/data.proto is to be compiled, then the /a/b directory will be automatically referenced
    - $SOURCE_RELATIVE
    # References GOOGLE_APIS as defined in repositories
    - $GOOGLE_APIS/github.com/googleapis/googleapis
    # References GOGO_PROTOBUF as defined in repositories
    - $GOGO_PROTOBUF
# optional. The operation is executed after compilation.
# its working directory is the directory where the config file is located.
# postActions is cross-platform compatible.
# Note that the "-p" parameter must be appended to the "powerproto build" to allow execution of the postActions in the config file
postActions: []
# optional. The shell script that is executed after compilation.
# its working directory is the directory where the config file is located.
# postShell is not cross-platform compatible.
# Note that the "-p" parameter must be appended to the "powerproto build" to allow execution of the postShell in the config file
postShell: |
    // do something

Matching patterns and working directory

When building the proto file, the powerproto.yaml config file will be searched from the directory where the proto file is located to the ancestor directory, match with the scope in. The first matched config item will be used for the compilation of this proto file. When PowerProto executes protoc (and also when it executes postActions and postShell), the default is to use the directory where the config file is located as the working directory. (working directory is equivalent to the directory where you execute the protoc command.)

Multi-config

A config file can be filled with multiple configs, which are separated by "---".

In the example below, the apis1 directory uses protoc-gen-go with v1.25.0, while the apis2 directory uses protoc-gen-go with v1.27.0.

scopes:
    - ./apis1
protoc: v3.17.3
protocWorkDir: ""
plugins:
    protoc-gen-go: google.golang.org/protobuf/cmd/[email protected]
    protoc-gen-go-grpc: google.golang.org/grpc/cmd/[email protected]
repositories:
    GOOGLE_APIS: https://github.com/googleapis/[email protected]
options:
    - --go_out=.
    - --go_opt=paths=source_relative
    - --go-grpc_out=.
    - --go-grpc_opt=paths=source_relative
importPaths:
    - .
    - $GOPATH
    - $POWERPROTO_INCLUDE
    - $GOOGLE_APIS/github.com/googleapis/googleapis
postActions: []
postShell: ""

---

scopes:
    - ./apis2
protoc: v3.17.3
protocWorkDir: ""
plugins:
    protoc-gen-go: google.golang.org/protobuf/cmd/[email protected]
    protoc-gen-go-grpc: google.golang.org/grpc/cmd/[email protected]
repositories:
    GOOGLE_APIS: https://github.com/googleapis/[email protected]
options:
    - --go_out=.
    - --go_opt=paths=source_relative
    - --go-grpc_out=.
    - --go-grpc_opt=paths=source_relative
importPaths:
    - .
    - $GOPATH
    - $POWERPROTO_INCLUDE
    - $GOOGLE_APIS/github.com/googleapis/googleapis
postActions: []
postShell: ""

PostAction

PostAction allows to perform specific actions after all proto files have been compiled. In contrast to PostShell, it is cross-platform supported. For security reasons, the PostAction and PostShell defined in the config file will only be executed if the -p argument is appended to the execution of powerproto build.

Currently, PostAction supports the following commands:

Command Description Function Prototype
copy Copy file or folder copy(src string, dest string) error
move Move file or folder move(src string, dest string) error
remove Delete file or folder remove(path ...string) error
replace Batch replacement of strings in files replace(pattern string, from string, to string) error

1. copy

For copying files or folders, the function prototype is:

copy(src string, dest string) error

For security and config compatibility, only relative paths are allowed in the parameters.

If the target folder already exists, it will be merged.

The following example will copy 'a' from the directory where the config file is located to 'b'.

postActions:
    - name: copy
      args:
        - ./a
        - ./b

2. move

For moving files or folders, the function prototype is:

move(src string, dest string) error

For security and config compatibility, only relative paths are allowed in the parameters.

If the target folder already exists, it will be merged.

The following example will move 'a' in the directory where the config file is located to 'b'.

postActions:
    - name: move
      args:
        - ./a
        - ./b

3. remove

For deleting files or folders, the function prototype is:

remove(path ...string) error

For security and config compatibility, only relative paths are allowed in the parameters.

The following example will remove 'a', 'b' and 'c' from the directory where the config file is located:

postActions:
    - name: remove
      args:
        - ./a
        - ./b
        - ./c

4. replace

Used for batch replacement of strings in files. Its function prototype is:

replace(pattern string, from string, to string) error
  • pattern is a relative path that supports wildcard characters.
  • from is the string to be replaced.
  • to is the string to replace with.

The following example will replace ,omitempty with the empty string in all go files in the apis directory and its subdirectories:

postActions:
    - name: replace
      args:
        - ./apis/**/*.go
        - ',omitempty'
        - ""
Comments
  • Import

    Import "google/protobuf/descriptor.proto" was not found or had errors

    protoc vertion 3.13.0

    配置文件这样:

    scopes:
        - ./
    protoc: 3.13.0
    protocWorkDir: ""
    plugins:
        protoc-gen-go: google.golang.org/protobuf/cmd/[email protected]
        protoc-gen-grpc-gateway: github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
        protoc-gen-micro: github.com/asim/go-micro/cmd/protoc-gen-micro/[email protected]
        protoc-gen-openapiv2: github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
    repositories:
        GOOGLE_APIS: https://github.com/googleapis/[email protected]
    options:
        - --grpc-gateway_out=.
        - --grpc-gateway_opt=paths=source_relative
        - --openapiv2_out=.
    importPaths:
        - .
        - $GOPATH
        - $POWERPROTO_INCLUDE
        - $SOURCE_RELATIVE
        - $GOOGLE_APIS/github.com/googleapis/googleapis
    postActions: []
    postShell: ""
    

    xxx.proto里import了google/api下的proto文件:

    import "google/api/annotations.proto";
    import "google/api/field_behavior.proto";
    

    执行powerproto build xxx.proto 报错:

    google/protobuf/descriptor.proto: File not found.
    google/api/annotations.proto:20:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
    google/api/annotations.proto:28:8: "google.protobuf.MethodOptions" is not defined.
    google/api/field_behavior.proto:19:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
    google/api/field_behavior.proto:27:8: "google.protobuf.FieldOptions" is not defined.
    
    help wanted 
    opened by soooldier 8
  • 默认defaultExecuteTimeout 60秒在网络差的环境下不够用

    默认defaultExecuteTimeout 60秒在网络差的环境下不够用

    https://github.com/storyicon/powerproto/blob/7b2c0762d4cacb428328236b3b097cce7b9af4f1/pkg/component/pluginmanager/manager.go#L31

    建议executeTimeout可以通过传入参数控制

    opened by soooldier 3
  • 修改`protoc-gen-go`为`github.com/golang/protobuf/protoc-gen-go@v1.5.2`,生成的文件版本不一致。

    修改`protoc-gen-go`为`github.com/golang/protobuf/[email protected]`,生成的文件版本不一致。

    修改protoc-gen-gogithub.com/golang/protobuf/[email protected],生成的文件版本不一致。

    scopes:
        - ./
    protoc: v3.17.3
    protocWorkDir: ""
    plugins:
        protoc-gen-go: github.com/golang/protobuf/[email protected]
    repositories:
        GOGO_PROTOBUF: https://github.com/gogo/[email protected]
        GOOGLE_APIS: https://github.com/googleapis/[email protected]
    options:
        - --go_out=.
        - --go_opt=paths=source_relative
        - --go-grpc_out=.
        - --go-grpc_opt=paths=source_relative
    importPaths:
        - .
        - $GOPATH
        - $POWERPROTO_INCLUDE
        - $SOURCE_RELATIVE
        - $GOOGLE_APIS/github.com/googleapis/googleapis
        - $GOGO_PROTOBUF
    postActions: []
    postShell: ""
    
    // Code generated by protoc-gen-go. DO NOT EDIT.
    // versions:
    // 	protoc-gen-go v1.26.0
    // 	protoc        v3.17.3
    // source: app/model/type.proto
    
    package model
    
    import (
    	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
    	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
    	anypb "google.golang.org/protobuf/types/known/anypb"
    	reflect "reflect"
    	sync "sync"
    )
    
    const (
    	// Verify that this generated code is sufficiently up-to-date.
    	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
    	// Verify that runtime/protoimpl is sufficiently up-to-date.
    	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
    )
    
    type Type struct {
    	state         protoimpl.MessageState
    	sizeCache     protoimpl.SizeCache
    	unknownFields protoimpl.UnknownFields
    
    	Type string     `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
    	Data *anypb.Any `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
    }
    
    func (x *Type) Reset() {
    	*x = Type{}
    	if protoimpl.UnsafeEnabled {
    		mi := &file_app_model_type_proto_msgTypes[0]
    		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
    		ms.StoreMessageInfo(mi)
    	}
    }
    
    func (x *Type) String() string {
    	return protoimpl.X.MessageStringOf(x)
    }
    
    func (*Type) ProtoMessage() {}
    
    func (x *Type) ProtoReflect() protoreflect.Message {
    	mi := &file_app_model_type_proto_msgTypes[0]
    	if protoimpl.UnsafeEnabled && x != nil {
    		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
    		if ms.LoadMessageInfo() == nil {
    			ms.StoreMessageInfo(mi)
    		}
    		return ms
    	}
    	return mi.MessageOf(x)
    }
    
    // Deprecated: Use Type.ProtoReflect.Descriptor instead.
    func (*Type) Descriptor() ([]byte, []int) {
    	return file_app_model_type_proto_rawDescGZIP(), []int{0}
    }
    
    func (x *Type) GetType() string {
    	if x != nil {
    		return x.Type
    	}
    	return ""
    }
    
    func (x *Type) GetData() *anypb.Any {
    	if x != nil {
    		return x.Data
    	}
    	return nil
    }
    
    var File_app_model_type_proto protoreflect.FileDescriptor
    
    var file_app_model_type_proto_rawDesc = []byte{
    	0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65,
    	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0x19, 0x67,
    	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61,
    	0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65,
    	0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
    	0x74, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01,
    	0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
    	0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x42, 0x14,
    	0x5a, 0x12, 0x76, 0x6e, 0x65, 0x74, 0x2d, 0x63, 0x74, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6d,
    	0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
    }
    
    var (
    	file_app_model_type_proto_rawDescOnce sync.Once
    	file_app_model_type_proto_rawDescData = file_app_model_type_proto_rawDesc
    )
    
    func file_app_model_type_proto_rawDescGZIP() []byte {
    	file_app_model_type_proto_rawDescOnce.Do(func() {
    		file_app_model_type_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_model_type_proto_rawDescData)
    	})
    	return file_app_model_type_proto_rawDescData
    }
    
    var file_app_model_type_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
    var file_app_model_type_proto_goTypes = []interface{}{
    	(*Type)(nil),      // 0: model.Type
    	(*anypb.Any)(nil), // 1: google.protobuf.Any
    }
    var file_app_model_type_proto_depIdxs = []int32{
    	1, // 0: model.Type.Data:type_name -> google.protobuf.Any
    	1, // [1:1] is the sub-list for method output_type
    	1, // [1:1] is the sub-list for method input_type
    	1, // [1:1] is the sub-list for extension type_name
    	1, // [1:1] is the sub-list for extension extendee
    	0, // [0:1] is the sub-list for field type_name
    }
    
    func init() { file_app_model_type_proto_init() }
    func file_app_model_type_proto_init() {
    	if File_app_model_type_proto != nil {
    		return
    	}
    	if !protoimpl.UnsafeEnabled {
    		file_app_model_type_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
    			switch v := v.(*Type); i {
    			case 0:
    				return &v.state
    			case 1:
    				return &v.sizeCache
    			case 2:
    				return &v.unknownFields
    			default:
    				return nil
    			}
    		}
    	}
    	type x struct{}
    	out := protoimpl.TypeBuilder{
    		File: protoimpl.DescBuilder{
    			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
    			RawDescriptor: file_app_model_type_proto_rawDesc,
    			NumEnums:      0,
    			NumMessages:   1,
    			NumExtensions: 0,
    			NumServices:   0,
    		},
    		GoTypes:           file_app_model_type_proto_goTypes,
    		DependencyIndexes: file_app_model_type_proto_depIdxs,
    		MessageInfos:      file_app_model_type_proto_msgTypes,
    	}.Build()
    	File_app_model_type_proto = out.File
    	file_app_model_type_proto_rawDesc = nil
    	file_app_model_type_proto_goTypes = nil
    	file_app_model_type_proto_depIdxs = nil
    }
    
    

    执行的命令以及输出

    [email protected]:/mnt/c/Users/ovo/workspace/openwrt/vnet-ctl$ powerproto.exe build -r .
    search proto files...
    [ ● ] tidy configs [=============] 100%  (1/1) success!
    [ ● ] Lookup configs of proto files [=============] 100%  (2/2) success!
    the following 1 configurations will be used:
            C:\Users\ovo\workspace\openwrt\vnet-ctl\powerproto.yaml
    [ ● ] Install protoc [=============] 100%  (1/1) the v3.17.3 version of protoc is already cached
    the following versions of protoc will be used: [v3.17.3]
    [ ● ] Install repositories [=============] 100%  (2/2) all repositories have been installed
    the following versions of googleapis will be used:
            https://github.com/gogo/[email protected]
            https://github.com/googleapis/[email protected]
    [ ● ] Install plugins [=============] 100%  (1/1) all plugins have been installed
    the following plugins will be used:
            github.com/golang/protobuf/[email protected]
    [ ● ] Compile Proto Files [=============] 100%  (2/2) C:\Users\ovo\workspace\openwrt\vnet-ctl\app\model\type.proto
    PostAction and PostShell is skipped. If you need to allow execution, please append '-p' to command flags to enable
    Good job! you are ready to go :)
    succeed! you are ready to go :)
    
    
    opened by rc452860 1
  • feat(*): support perComandTimeout & variables in options

    feat(*): support perComandTimeout & variables in options

    Signed-off-by: storyicon [email protected]

    1. support the -t parameter to specify the timeout period when executing each subcommand.
    2. support the use of variables in options.
    opened by storyicon 0
  • 关于在指定的proto目录下生成文件

    关于在指定的proto目录下生成文件

    目前测试存在这样的问题 比如在 a目录下存在b c 两个proto文件 里面的package是a/b a/c 采用 --go_out=paths=source_relative:./apis/ 会把a/b 和a/c 生成在a的目录下,但是 a/b a/c是两个service文件就会造成 同一个包下有两个 包名称 存在bug 同一个目录下的proto必须是一个package 否则生成出来的就是不对的

    opened by gaoyangy 0
  • 请问如何对插件一次性输入所有文件?

    请问如何对插件一次性输入所有文件?

    在使用插件github.com/google/gnostic/cmd/protoc-gen-openapi或者github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2的时候存在需要将文件全部输入插件的情况;

    按照目前powerproto build -r {dir}的逻辑,会将所有的文件分拆成多个指令一次执行;

    我需要powerproto build {1.proto} {2.proto} ...可以输入多个proto文件,执行一条指令即可;

    opened by ppaanngggg 0
  • support java-grpc

    support java-grpc

    https://github.com/grpc/grpc-java panic: failed to execute /.gvm/gos/go1.17.5/bin/go install github.com/grpc/[email protected] in , stderr: go install: github.com/grpc/[email protected]: module github.com/grpc/[email protected] found, but does not contain package github.com/grpc/grpc-java , exit code 1, exit status 1

    how to use protoc-gen-grpc-java , help .

    opened by ideamean 0
  • Support for gRPC-Web

    Support for gRPC-Web

    If I attempt to add github.com/grpc/grpc-web to my plugins directive, powerproto attempts to go install it, which (of course) fails.

    panic: failed to execute /usr/bin/go install github.com/grpc/[email protected] in , stderr: go: downloading github.com/grpc/grpc-web v0.0.0-20211119232535-3fcc2a2a8a04
    go install github.com/grpc/[email protected]: module github.com/grpc/[email protected] found (v0.0.0-20211119232535-3fcc2a2a8a04), but does not contain package github.com/grpc/grpc-web
    , exit code 1, exit status 1
    
    goroutine 1 [running]:
    github.com/storyicon/powerproto/pkg/bootstraps.StepInstallPlugins(0xb5a5c0, 0xc00011db00, 0xb603a8, 0xc00022e300, 0xc000274020, 0x1, 0x1, 0x0, 0x0)
            github.com/storyicon/[email protected]/pkg/bootstraps/build.go:215 +0xc88
    

    When I install protoc-gen-grpc-web, powerproto won't detect it, because it's not passed to the plugin list (due to above.)

    I also didn't see it in the output option list shown during init.

    opened by DamonBlais 0
  • 请问如何指定xxxx.proto.go生成的路径

    请问如何指定xxxx.proto.go生成的路径

    在powerproto.yml中,若想指定go文件生成的路径,请问要如何操作?

    现在的方案

    • 强制指定某个路径,比如/home/admin/proto
    options:
        - --go_out=paths=source_relative:/home/admin/proto
    

    希望的方式

    • 能通过读取环境变量的方式指定生成路径,比如$GEN_PATH
    options:
        - --go_out=paths=source_relative:$GEN_PATH
    
    • 能通过powerproto命令指定生成路径,比如--gen_path指定目标路径
    powerproto --gen_path=/home/admin/proto
    
    opened by redwolf2019 2
  • Variables support in the

    Variables support in the "options" section

    Hello! I have a separate config file for grpc-gw config, so a directory structure looks like this:

    .
    ├── powerproto.yaml
    ├── service_1
    │   ├── service_1.proto
    │   └── service_1.yaml
    └── service_2
        ├── service_2.proto
        └── service_2.yaml
    

    I need to pass --grpc-gateway_opt=grpc_api_configuration=service_1/service_1.yaml option, but looks like an option array does not have variable parsing support.

    So i can't specify options like this: --grpc-gateway_opt=grpc_api_configuration=$SOURCE_RELATIVE/grpc_api_config.yaml

    It would be great if powerproto will have support of variables inside of options array. Thanks!

    opened by strobil 1
Releases(v0.4.1)
Owner
storyicon
🍖hardcore artist, sometimes enjoy reinventing the wheel
storyicon
pb: a tool for managing protoc builds and dependencies

pb pb is a Protocol Buffers Build tool that manages dependencies and build confi

Dan Enman 3 Feb 11, 2022
Go Http Proxy with Authentication, Schedule Control, and Portal Control

goproxy Go Http Proxy with Authentication, Schedule Control, and Portal Control Why this tool? You may need to restrict my kids's youtube watch time i

Wu Shilin 2 Mar 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 82 Sep 28, 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 36 Nov 5, 2021
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 3 May 6, 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 3 May 6, 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
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

Richard Hagen 3 Jun 17, 2022
Provides agent and server plugins for SPIRE to allow Tailscale node attestation.

SPIRE Tailscale Plugin ⚠️ this node attestation plugin relies on a Tailscale OIDC id-token feature, which is marked as Work-in-Progress and may not be

Johan Siebens 9 May 22, 2022
Package for writing Nagios/Icinga/et cetera plugins in Go (golang)

nagiosplugin Package for writing Nagios/Icinga/et cetera plugins in Go (golang). Documentation See http://godoc.org/github.com/olorin/nagiosplugin. Us

Sharif Olorin 71 Aug 30, 2022
gophertunnel is composed of several packages that may be of use for creating Minecraft related tools

gophertunnel is composed of several packages that may be of use for creating Minecraft related tools. A brief overview of all packages may be found here.

Sandertv 289 Sep 22, 2022
Get related domains / subdomains by looking at Google Analytics IDs

AnalyticsRelationships This script try to get related domains / subdomains by looking at Google Analytics IDs from a URL. First search for ID of Googl

Josué Encinar 133 Sep 24, 2022
🌍 Package tcplisten provides a customizable TCP net.Listener with various performance-related options

Package tcplisten provides customizable TCP net.Listener with various performance-related options: SO_REUSEPORT. This option allows linear scaling ser

Spiral Scout 1 Sep 7, 2022
Grpc bridge to various mediabank related systems

Mediabank bridge This internal tool enables authenticated gRPC based endpoint for securely communicating with systems like: Telestream Vantage Workflo

BCC Code 0 Jan 7, 2022
Dofind - Dofind is fast domain related finder made with golang

Dofind is fast domain related finder made with golang. ██████╗░░█████╗░███████╗

Muhamad Burhanudin 4 Feb 16, 2022