Skip to content

Commit

Permalink
Merge pull request #16 from Sixt/version-upgrade
Browse files Browse the repository at this point in the history
Version upgrade
  • Loading branch information
jfk-sixt authored Mar 27, 2023
2 parents 7409b33 + e3c5f58 commit 626ed17
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 117 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# ⛔️ DEPRECATED ⛔️

> This project is discontinued. It's code is provided as-is, and receives only limited maintenance and updates. If you find the project useful, feel free to fork it.
Alternative solution approaches to [Sixt/protoc](https://github.com/sixt/protoc) you may want to consider:

* Build proto stubs centrally, publish them as artifacts and use them with the native language features of the consumer, e.g. Maven/Gradle depenencies for Java, go modules for go.
* Vendor proto contracts or generated files into the contract consumer project.
* Use a git-native mechanism, e.g. git submodules, to include content into the consumer repo.

# protoc

This is a small, simple and backwards-compatible [protoc][protoc] wrapper.
This is a small, simple and backwards-compatible [protoc][protoc] wrapper. It enables you to compile proto files from remote git repos.

* [Features](#features)
* [How it works](#how-it-works)
Expand Down
35 changes: 19 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@ module github.com/sixt/protoc/v3
go 1.18

require (
github.com/go-git/go-git/v5 v5.4.2
github.com/go-git/go-git/v5 v5.6.1
github.com/stretchr/testify v1.7.0
)

require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/cloudflare/circl v1.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/imdario/mergo v0.3.14 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
165 changes: 111 additions & 54 deletions go.sum

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions include/google/protobuf/any.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ syntax = "proto3";

package google.protobuf;

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option go_package = "google.golang.org/protobuf/types/known/anypb";
option java_package = "com.google.protobuf";
option java_outer_classname = "AnyProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";

// `Any` contains an arbitrary serialized protocol buffer message along with a
// URL that describes the type of the serialized message.
Expand All @@ -63,6 +63,10 @@ option objc_class_prefix = "GPB";
// if (any.is(Foo.class)) {
// foo = any.unpack(Foo.class);
// }
// // or ...
// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
// foo = any.unpack(Foo.getDefaultInstance());
// }
//
// Example 3: Pack and unpack a message in Python.
//
Expand Down Expand Up @@ -93,7 +97,6 @@ option objc_class_prefix = "GPB";
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
// name "y.z".
//
//
// JSON
//
// The JSON representation of an `Any` value uses the regular
Expand Down
3 changes: 1 addition & 2 deletions include/google/protobuf/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ package google.protobuf;
import "google/protobuf/source_context.proto";
import "google/protobuf/type.proto";

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option java_package = "com.google.protobuf";
option java_outer_classname = "ApiProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option go_package = "google.golang.org/protobuf/types/known/apipb";

// Api is a light-weight descriptor for an API Interface.
Expand Down Expand Up @@ -82,7 +82,6 @@ message Api {
// be omitted. Zero major versions must only be used for
// experimental, non-GA interfaces.
//
//
string version = 4;

// Source context for the protocol buffer service represented by this
Expand Down
5 changes: 1 addition & 4 deletions include/google/protobuf/compiler/plugin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@

// Author: [email protected] (Kenton Varda)
//
// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
// change.
//
// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
// just a program that reads a CodeGeneratorRequest from stdin and writes a
// CodeGeneratorResponse to stdout.
Expand All @@ -50,6 +47,7 @@ package google.protobuf.compiler;
option java_package = "com.google.protobuf.compiler";
option java_outer_classname = "PluginProtos";

option csharp_namespace = "Google.Protobuf.Compiler";
option go_package = "google.golang.org/protobuf/types/pluginpb";

import "google/protobuf/descriptor.proto";
Expand Down Expand Up @@ -92,7 +90,6 @@ message CodeGeneratorRequest {

// The version number of protocol compiler.
optional Version compiler_version = 3;

}

// The plugin writes an encoded CodeGeneratorResponse to stdout.
Expand Down
100 changes: 77 additions & 23 deletions include/google/protobuf/descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
// A valid .proto file can be translated directly to a FileDescriptorProto
// without any other information (e.g. without reading its imports).


syntax = "proto2";

package google.protobuf;
Expand Down Expand Up @@ -86,8 +85,13 @@ message FileDescriptorProto {
optional SourceCodeInfo source_code_info = 9;

// The syntax of the proto file.
// The supported values are "proto2" and "proto3".
// The supported values are "proto2", "proto3", and "editions".
//
// If `edition` is present, this value must be "editions".
optional string syntax = 12;

// The edition of the proto file, which is an opaque string.
optional string edition = 13;
}

// Describes a message type.
Expand Down Expand Up @@ -129,7 +133,6 @@ message ExtensionRangeOptions {
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;


// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
Expand Down Expand Up @@ -305,7 +308,6 @@ message MethodDescriptorProto {
optional bool server_streaming = 6 [default = false];
}


// ===================================================================
// Options

Expand Down Expand Up @@ -346,7 +348,6 @@ message FileOptions {
// domain names.
optional string java_package = 1;


// Controls the name of the wrapper Java class generated for the .proto file.
// That class will always contain the .proto file's getDescriptor() method as
// well as any top-level extensions defined in the .proto file.
Expand All @@ -373,7 +374,6 @@ message FileOptions {
// This option has no effect on when used with the lite runtime.
optional bool java_string_check_utf8 = 27 [default = false];


// Generated classes can be optimized for speed or code size.
enum OptimizeMode {
SPEED = 1; // Generate complete code for parsing, serialization,
Expand All @@ -390,9 +390,6 @@ message FileOptions {
// - Otherwise, the basename of the .proto file, without extension.
optional string go_package = 11;




// Should generic services be generated in each language? "Generic" services
// are not specific to any particular RPC system. They are generated by the
// main code generators in each language (without additional plugins).
Expand All @@ -418,7 +415,6 @@ message FileOptions {
// only to generated classes for C++.
optional bool cc_enable_arenas = 31 [default = true];


// Sets the objective c class prefix which is prepended to all objective c
// generated classes from this .proto. There is no default.
optional string objc_class_prefix = 36;
Expand Down Expand Up @@ -451,7 +447,6 @@ message FileOptions {
// determining the ruby package.
optional string ruby_package = 45;


// The parser stores options it doesn't recognize here.
// See the documentation for the "Options" section above.
repeated UninterpretedOption uninterpreted_option = 999;
Expand Down Expand Up @@ -497,6 +492,10 @@ message MessageOptions {

reserved 4, 5, 6;

// NOTE: Do not set the option in .proto files. Always use the maps syntax
// instead. The option should only be implicitly set by the proto compiler
// parser.
//
// Whether the message is an automatically generated map entry type for the
// maps field.
//
Expand All @@ -514,15 +513,22 @@ message MessageOptions {
// use a native map in the target language to hold the keys and values.
// The reflection APIs in such implementations still need to work as
// if the field is a repeated message field.
//
// NOTE: Do not set the option in .proto files. Always use the maps syntax
// instead. The option should only be implicitly set by the proto compiler
// parser.
optional bool map_entry = 7;

reserved 8; // javalite_serializable
reserved 9; // javanano_as_lite

// Enable the legacy handling of JSON field name conflicts. This lowercases
// and strips underscored from the fields before comparison in proto3 only.
// The new behavior takes `json_name` into account and applies to proto2 as
// well.
//
// This should only be used as a temporary measure against broken builds due
// to the change in behavior for JSON field name conflicts.
//
// TODO(b/261750190) This is legacy behavior we plan to remove once downstream
// teams have had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];

// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
Expand Down Expand Up @@ -592,7 +598,6 @@ message FieldOptions {
// call from multiple threads concurrently, while non-const methods continue
// to require exclusive access.
//
//
// Note that implementations may choose not to check required fields within
// a lazy sub-message. That is, calling IsInitialized() on the outer message
// may return true even if the inner message has missing required fields.
Expand All @@ -604,11 +609,8 @@ message FieldOptions {
// check its required fields, regardless of whether or not the message has
// been parsed.
//
// As of 2021, lazy does no correctness checks on the byte stream during
// parsing. This may lead to crashes if and when an invalid byte stream is
// finally parsed upon access.
//
// TODO(b/211906113): Enable validation on lazy fields.
// As of May 2022, lazy verifies the contents of the byte stream during
// parsing. An invalid byte stream will cause the overall parsing to fail.
optional bool lazy = 5 [default = false];

// unverified_lazy does no correctness checks on the byte stream. This should
Expand All @@ -625,6 +627,39 @@ message FieldOptions {
// For Google-internal migration only. Do not use.
optional bool weak = 10 [default = false];

// Indicate that the field value should not be printed out when using debug
// formats, e.g. when the field contains sensitive credentials.
optional bool debug_redact = 16 [default = false];

// If set to RETENTION_SOURCE, the option will be omitted from the binary.
// Note: as of January 2023, support for this is in progress and does not yet
// have an effect (b/264593489).
enum OptionRetention {
RETENTION_UNKNOWN = 0;
RETENTION_RUNTIME = 1;
RETENTION_SOURCE = 2;
}

optional OptionRetention retention = 17;

// This indicates the types of entities that the field may apply to when used
// as an option. If it is unset, then the field may be freely used as an
// option on any kind of entity. Note: as of January 2023, support for this is
// in progress and does not yet have an effect (b/264593489).
enum OptionTargetType {
TARGET_TYPE_UNKNOWN = 0;
TARGET_TYPE_FILE = 1;
TARGET_TYPE_EXTENSION_RANGE = 2;
TARGET_TYPE_MESSAGE = 3;
TARGET_TYPE_FIELD = 4;
TARGET_TYPE_ONEOF = 5;
TARGET_TYPE_ENUM = 6;
TARGET_TYPE_ENUM_ENTRY = 7;
TARGET_TYPE_SERVICE = 8;
TARGET_TYPE_METHOD = 9;
}

optional OptionTargetType target = 18;

// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
Expand Down Expand Up @@ -657,6 +692,14 @@ message EnumOptions {

reserved 5; // javanano_as_lite

// Enable the legacy handling of JSON field name conflicts. This lowercases
// and strips underscored from the fields before comparison in proto3 only.
// The new behavior takes `json_name` into account and applies to proto2 as
// well.
// TODO(b/261750190) Remove this legacy behavior once downstream teams have
// had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];

// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;

Expand Down Expand Up @@ -729,7 +772,6 @@ message MethodOptions {
extensions 1000 to max;
}


// A message representing a option the parser does not recognize. This only
// appears in options protos created by the compiler::Parser class.
// DescriptorPool resolves these when building Descriptor objects. Therefore,
Expand Down Expand Up @@ -914,8 +956,20 @@ message GeneratedCodeInfo {
optional int32 begin = 3;

// Identifies the ending offset in bytes in the generated code that
// relates to the identified offset. The end offset should be one past
// relates to the identified object. The end offset should be one past
// the last relevant byte (so the length of the text = end - begin).
optional int32 end = 4;

// Represents the identified object's effect on the element in the original
// .proto file.
enum Semantic {
// There is no effect or the effect is indescribable.
NONE = 0;
// The element is set or otherwise mutated.
SET = 1;
// An alias to the element is returned.
ALIAS = 2;
}
optional Semantic semantic = 5;
}
}
3 changes: 1 addition & 2 deletions include/google/protobuf/duration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ syntax = "proto3";

package google.protobuf;

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
option go_package = "google.golang.org/protobuf/types/known/durationpb";
option java_package = "com.google.protobuf";
option java_outer_classname = "DurationProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";

// A Duration represents a signed, fixed-length span of time represented
// as a count of seconds and fractions of seconds at nanosecond
Expand Down Expand Up @@ -99,7 +99,6 @@ option objc_class_prefix = "GPB";
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
// microsecond should be expressed in JSON format as "3.000001s".
//
//
message Duration {
// Signed seconds of the span of time. Must be from -315,576,000,000
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
Expand Down
Loading

0 comments on commit 626ed17

Please sign in to comment.