grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.56k stars 762 forks source link

Add version flag and version info in generated code #1216

Closed meling closed 2 years ago

meling commented 2 years ago

The official protoc compiler and several plugins support a --version flag:

% protoc --version
libprotoc 3.19.4
% protoc-gen-go --version
protoc-gen-go v1.27.1
% protoc-gen-go-grpc --version
protoc-gen-go-grpc 1.2.0

However, no such flag is recognized by:

% protoc-gen-grpc-web --version
protoc-gen-grpc-web: Unknown option: --version

Such a flag would be useful for reproducible builds between developers. Similarly, the source code files generated by protoc-gen-grpc-web does not include any version information to identify the version used to generate said files. Such version information is included in source files generated by other plugins, e.g.:

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//  protoc-gen-go v1.27.1
//  protoc        v3.19.4
// source: ag/ag.proto
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.19.4
// source: ag/ag.proto

I propose to add such version information to generated code files along with support for a corresponding --version flag to the protoc-gen-grpc-web plugin.

sampajano commented 2 years ago

@meling Hi! This is a great suggestion! PR is very welcome too! 😃