Skip to content

Add version flag and version info in generated code #1216

@meling

Description

@meling

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions