From 2b12880e7433d3afb6588ebe5eee6895b3a69e19 Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:07:12 -0800 Subject: [PATCH 01/11] update google protobuf protos to ones in protoc 3.15 --- external/google/protobuf/any.proto | 12 +- external/google/protobuf/api.proto | 6 +- external/google/protobuf/descriptor.proto | 166 ++++++++++-------- external/google/protobuf/duration.proto | 5 +- external/google/protobuf/empty.proto | 2 +- external/google/protobuf/field_mask.proto | 49 +++--- external/google/protobuf/source_context.proto | 2 +- external/google/protobuf/struct.proto | 3 +- external/google/protobuf/timestamp.proto | 50 ++++-- external/google/protobuf/type.proto | 44 ++--- external/google/protobuf/wrappers.proto | 7 +- 11 files changed, 191 insertions(+), 155 deletions(-) diff --git a/external/google/protobuf/any.proto b/external/google/protobuf/any.proto index 4932942..6ed8a23 100644 --- a/external/google/protobuf/any.proto +++ b/external/google/protobuf/any.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/any"; +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; @@ -77,10 +77,13 @@ option objc_class_prefix = "GPB"; // Example 4: Pack and unpack a message in Go // // foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } // ... // foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// if err := any.UnmarshalTo(foo); err != nil { // ... // } // @@ -121,7 +124,8 @@ option objc_class_prefix = "GPB"; // message Any { // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. The last segment of the URL's path must represent + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent // the fully qualified name of the type (as in // `path/google.protobuf.Duration`). The name should be in a canonical form // (e.g., leading "." is not accepted). diff --git a/external/google/protobuf/api.proto b/external/google/protobuf/api.proto index f37ee2f..3d598fc 100644 --- a/external/google/protobuf/api.proto +++ b/external/google/protobuf/api.proto @@ -40,7 +40,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "ApiProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/api;api"; +option go_package = "google.golang.org/protobuf/types/known/apipb"; // Api is a light-weight descriptor for an API Interface. // @@ -52,7 +52,6 @@ option go_package = "google.golang.org/genproto/protobuf/api;api"; // this message itself. See https://cloud.google.com/apis/design/glossary for // detailed terminology. message Api { - // The fully qualified name of this interface, including package name // followed by the interface's simple name. string name = 1; @@ -99,7 +98,6 @@ message Api { // Method represents a method of an API interface. message Method { - // The simple name of this method. string name = 1; @@ -169,7 +167,7 @@ message Method { // The mixin construct implies that all methods in `AccessControl` are // also declared with same name and request/response types in // `Storage`. A documentation generator or annotation processor will -// see the effective `Storage.GetAcl` method after inherting +// see the effective `Storage.GetAcl` method after inheriting // documentation and annotations as follows: // // service Storage { diff --git a/external/google/protobuf/descriptor.proto b/external/google/protobuf/descriptor.proto index ed08fcb..9f0ce6c 100644 --- a/external/google/protobuf/descriptor.proto +++ b/external/google/protobuf/descriptor.proto @@ -40,7 +40,8 @@ syntax = "proto2"; package google.protobuf; -option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; + +option go_package = "google.golang.org/protobuf/types/descriptorpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; @@ -59,8 +60,8 @@ message FileDescriptorSet { // Describes a complete .proto file. message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. // Names of files imported by this file. repeated string dependency = 3; @@ -100,8 +101,8 @@ message DescriptorProto { repeated EnumDescriptorProto enum_type = 4; message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. optional ExtensionRangeOptions options = 3; } @@ -115,8 +116,8 @@ message DescriptorProto { // fields or extension ranges in the same message. Reserved ranges may // not overlap. message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. } repeated ReservedRange reserved_range = 9; // Reserved field names, which may not be used by fields in the same message. @@ -128,6 +129,7 @@ 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; } @@ -137,42 +139,42 @@ message FieldDescriptorProto { enum Type { // 0 is reserved for errors. // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; + TYPE_INT64 = 3; + TYPE_UINT64 = 4; // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; // Tag-delimited aggregate. // Group type is deprecated and not supported in proto3. However, Proto3 // implementations should still be able to parse the group wire format and // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - }; + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + } enum Label { // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - }; + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } optional string name = 1; optional int32 number = 3; @@ -211,6 +213,29 @@ message FieldDescriptorProto { optional string json_name = 10; optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; } // Describes a oneof. @@ -234,8 +259,8 @@ message EnumDescriptorProto { // is inclusive such that it can appropriately represent the entire int32 // domain. message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. } // Range of reserved numeric values. Reserved numeric values may not be used @@ -276,9 +301,9 @@ message MethodDescriptorProto { optional MethodOptions options = 4; // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default=false]; + optional bool client_streaming = 5 [default = false]; // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default=false]; + optional bool server_streaming = 6 [default = false]; } @@ -314,7 +339,6 @@ message MethodDescriptorProto { // If this turns out to be popular, a web service will be set up // to automatically assign option numbers. - message FileOptions { // Sets the Java package where classes generated from this .proto will be @@ -337,7 +361,7 @@ message FileOptions { // named by java_outer_classname. However, the outer class will still be // generated to contain the file's getDescriptor() method as well as any // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default=false]; + optional bool java_multiple_files = 10 [default = false]; // This option does nothing. optional bool java_generate_equals_and_hash = 20 [deprecated=true]; @@ -348,17 +372,17 @@ message FileOptions { // Message reflection will do the same. // However, an extension field still accepts non-UTF-8 byte sequences. // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default=false]; + 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, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. } - optional OptimizeMode optimize_for = 9 [default=SPEED]; + optional OptimizeMode optimize_for = 9 [default = SPEED]; // Sets the Go package where structs generated from this .proto will be // placed. If omitted, the Go package will be derived from the following: @@ -369,6 +393,7 @@ message FileOptions { + // 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). @@ -379,20 +404,20 @@ message FileOptions { // that generate code specific to your particular RPC system. Therefore, // these default to false. Old code which depends on generic services should // explicitly set them to true. - optional bool cc_generic_services = 16 [default=false]; - optional bool java_generic_services = 17 [default=false]; - optional bool py_generic_services = 18 [default=false]; - optional bool php_generic_services = 42 [default=false]; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; // Is this file deprecated? // Depending on the target platform, this can emit Deprecated annotations // for everything in the file, or it will be completely ignored; in the very // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default=false]; + optional bool deprecated = 23 [default = false]; // Enables the use of arenas for the proto messages in this file. This applies // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default=false]; + optional bool cc_enable_arenas = 31 [default = true]; // Sets the objective c class prefix which is prepended to all objective c @@ -417,10 +442,9 @@ message FileOptions { // determining the namespace. optional string php_namespace = 41; - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be used - // for determining the namespace. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. optional string php_metadata_namespace = 44; // Use this option to change the package of ruby generated classes. Default @@ -428,6 +452,7 @@ 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; @@ -458,18 +483,18 @@ message MessageOptions { // // Because this is an option, the above two restrictions are not enforced by // the protocol compiler. - optional bool message_set_wire_format = 1 [default=false]; + optional bool message_set_wire_format = 1 [default = false]; // Disables the generation of the standard "descriptor()" accessor, which can // conflict with a field of the same name. This is meant to make migration // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default=false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; // Is this message deprecated? // Depending on the target platform, this can emit Deprecated annotations // for the message, or it will be completely ignored; in the very least, // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default=false]; + optional bool deprecated = 3 [default = false]; // Whether the message is an automatically generated map entry type for the // maps field. @@ -486,7 +511,7 @@ message MessageOptions { // // Implementations may choose not to generate the map_entry=true message, but // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as + // 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 @@ -497,6 +522,7 @@ message MessageOptions { reserved 8; // javalite_serializable reserved 9; // javanano_as_lite + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -576,16 +602,16 @@ message FieldOptions { // implementation must either *always* check its required fields, or *never* // check its required fields, regardless of whether or not the message has // been parsed. - optional bool lazy = 5 [default=false]; + optional bool lazy = 5 [default = false]; // Is this field deprecated? // Depending on the target platform, this can emit Deprecated annotations // for accessors, or it will be completely ignored; in the very least, this // is a formalization for deprecating fields. - optional bool deprecated = 3 [default=false]; + optional bool deprecated = 3 [default = false]; // For Google-internal migration only. Do not use. - optional bool weak = 10 [default=false]; + optional bool weak = 10 [default = false]; // The parser stores options it doesn't recognize here. See above. @@ -615,7 +641,7 @@ message EnumOptions { // Depending on the target platform, this can emit Deprecated annotations // for the enum, or it will be completely ignored; in the very least, this // is a formalization for deprecating enums. - optional bool deprecated = 3 [default=false]; + optional bool deprecated = 3 [default = false]; reserved 5; // javanano_as_lite @@ -631,7 +657,7 @@ message EnumValueOptions { // Depending on the target platform, this can emit Deprecated annotations // for the enum value, or it will be completely ignored; in the very least, // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default=false]; + optional bool deprecated = 1 [default = false]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -651,7 +677,7 @@ message ServiceOptions { // Depending on the target platform, this can emit Deprecated annotations // for the service, or it will be completely ignored; in the very least, // this is a formalization for deprecating services. - optional bool deprecated = 33 [default=false]; + optional bool deprecated = 33 [default = false]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -671,18 +697,18 @@ message MethodOptions { // Depending on the target platform, this can emit Deprecated annotations // for the method, or it will be completely ignored; in the very least, // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default=false]; + optional bool deprecated = 33 [default = false]; // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, // or neither? HTTP based RPC implementation may choose GET verb for safe // methods, and PUT verb for idempotent methods instead of the default POST. enum IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects } - optional IdempotencyLevel idempotency_level = - 34 [default=IDEMPOTENCY_UNKNOWN]; + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -763,7 +789,7 @@ message SourceCodeInfo { // beginning of the "extend" block and is shared by all extensions within // the block. // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines + // does not mean that it is a descendant. For example, a "group" defines // both a type and a field in a single declaration. Thus, the locations // corresponding to the type and field and their components will overlap. // - Code which tries to interpret locations should probably be designed to @@ -794,14 +820,14 @@ message SourceCodeInfo { // [ 4, 3, 2, 7 ] // this path refers to the whole field declaration (from the beginning // of the label to the terminating semicolon). - repeated int32 path = 1 [packed=true]; + repeated int32 path = 1 [packed = true]; // Always has exactly three or four elements: start line, start column, // end line (optional, otherwise assumed same as start line), end column. // These are packed into a single field for efficiency. Note that line // and column numbers are zero-based -- typically you will want to add // 1 to each before displaying to a user. - repeated int32 span = 2 [packed=true]; + repeated int32 span = 2 [packed = true]; // If this SourceCodeInfo represents a complete declaration, these are any // comments appearing before and after the declaration which appear to be @@ -866,7 +892,7 @@ message GeneratedCodeInfo { message Annotation { // Identifies the element in the original source .proto file. This field // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed=true]; + repeated int32 path = 1 [packed = true]; // Identifies the filesystem path to the original source .proto. optional string source_file = 2; diff --git a/external/google/protobuf/duration.proto b/external/google/protobuf/duration.proto index 975fce4..81c3e36 100644 --- a/external/google/protobuf/duration.proto +++ b/external/google/protobuf/duration.proto @@ -34,7 +34,7 @@ package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/duration"; +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; @@ -61,7 +61,7 @@ option objc_class_prefix = "GPB"; // if (duration.seconds < 0 && duration.nanos > 0) { // duration.seconds += 1; // duration.nanos -= 1000000000; -// } else if (durations.seconds > 0 && duration.nanos < 0) { +// } else if (duration.seconds > 0 && duration.nanos < 0) { // duration.seconds -= 1; // duration.nanos += 1000000000; // } @@ -101,7 +101,6 @@ option objc_class_prefix = "GPB"; // // 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: // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years diff --git a/external/google/protobuf/empty.proto b/external/google/protobuf/empty.proto index 03cacd2..5f992de 100644 --- a/external/google/protobuf/empty.proto +++ b/external/google/protobuf/empty.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/empty"; +option go_package = "google.golang.org/protobuf/types/known/emptypb"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true; diff --git a/external/google/protobuf/field_mask.proto b/external/google/protobuf/field_mask.proto index 76e09f3..6b5104f 100644 --- a/external/google/protobuf/field_mask.proto +++ b/external/google/protobuf/field_mask.proto @@ -37,7 +37,8 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "FieldMaskProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; +option go_package = "google.golang.org/protobuf/types/known/fieldmaskpb"; +option cc_enable_arenas = true; // `FieldMask` represents a set of symbolic field paths, for example: // @@ -107,57 +108,49 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // describe the updated values, the API ignores the values of all // fields not covered by the mask. // -// If a repeated field is specified for an update operation, the existing -// repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a `paths` -// string. +// If a repeated field is specified for an update operation, new values will +// be appended to the existing repeated field in the target resource. Note that +// a repeated field is only allowed in the last position of a `paths` string. // // If a sub-message is specified in the last position of the field mask for an -// update operation, then the existing sub-message in the target resource is -// overwritten. Given the target message: +// update operation, then new value will be merged into the existing sub-message +// in the target resource. +// +// For example, given the target message: // // f { // b { -// d : 1 -// x : 2 +// d: 1 +// x: 2 // } -// c : 1 +// c: [1] // } // // And an update message: // // f { // b { -// d : 10 +// d: 10 // } +// c: [2] // } // // then if the field mask is: // -// paths: "f.b" +// paths: ["f.b", "f.c"] // // then the result will be: // // f { // b { -// d : 10 +// d: 10 +// x: 2 // } -// c : 1 +// c: [1, 2] // } // -// However, if the update mask was: -// -// paths: "f.b.d" -// -// then the result would be: -// -// f { -// b { -// d : 10 -// x : 2 -// } -// c : 1 -// } +// An implementation may provide options to override this default behavior for +// repeated and message fields. // // In order to reset a field's value to the default, the field must // be in the mask and set to the default value in the provided resource. @@ -245,7 +238,7 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // // The implementation of any API method which has a FieldMask type field in the // request should verify the included field paths, and return an -// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. +// `INVALID_ARGUMENT` error if any path is unmappable. message FieldMask { // The set of field mask paths. repeated string paths = 1; diff --git a/external/google/protobuf/source_context.proto b/external/google/protobuf/source_context.proto index f3b2c96..06bfc43 100644 --- a/external/google/protobuf/source_context.proto +++ b/external/google/protobuf/source_context.proto @@ -37,7 +37,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "SourceContextProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/source_context;source_context"; +option go_package = "google.golang.org/protobuf/types/known/sourcecontextpb"; // `SourceContext` represents information about the source of a // protobuf element, like the file in which it is defined. diff --git a/external/google/protobuf/struct.proto b/external/google/protobuf/struct.proto index 7d7808e..545215c 100644 --- a/external/google/protobuf/struct.proto +++ b/external/google/protobuf/struct.proto @@ -34,13 +34,12 @@ package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; +option go_package = "google.golang.org/protobuf/types/known/structpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "StructProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; - // `Struct` represents a structured data value, consisting of fields // which map to dynamically typed values. In some languages, `Struct` // might be supported by a native representation. For example, in diff --git a/external/google/protobuf/timestamp.proto b/external/google/protobuf/timestamp.proto index eafb3fa..3b2df6d 100644 --- a/external/google/protobuf/timestamp.proto +++ b/external/google/protobuf/timestamp.proto @@ -34,23 +34,25 @@ package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; +option go_package = "google.golang.org/protobuf/types/known/timestamppb"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -// A Timestamp represents a point in time independent of any time zone -// or calendar, represented as seconds and fractions of seconds at -// nanosecond resolution in UTC Epoch time. It is encoded using the -// Proleptic Gregorian Calendar which extends the Gregorian calendar -// backwards to year one. It is encoded assuming all minutes are 60 -// seconds long, i.e. leap seconds are "smeared" so that no leap second -// table is needed for interpretation. Range is from -// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. -// By restricting to that range, we ensure that we can convert to -// and from RFC 3339 date strings. -// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). +// A Timestamp represents a point in time independent of any time zone or local +// calendar, encoded as a count of seconds and fractions of seconds at +// nanosecond resolution. The count is relative to an epoch at UTC midnight on +// January 1, 1970, in the proleptic Gregorian calendar which extends the +// Gregorian calendar backwards to year one. +// +// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +// second table is needed for interpretation, using a [24-hour linear +// smear](https://developers.google.com/time/smear). +// +// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +// restricting to that range, we ensure that we can convert to and from [RFC +// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. // // # Examples // @@ -89,7 +91,16 @@ option objc_class_prefix = "GPB"; // .setNanos((int) ((millis % 1000) * 1000000)).build(); // // -// Example 5: Compute Timestamp from current time in Python. +// Example 5: Compute Timestamp from Java `Instant.now()`. +// +// Instant now = Instant.now(); +// +// Timestamp timestamp = +// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +// .setNanos(now.getNano()).build(); +// +// +// Example 6: Compute Timestamp from current time in Python. // // timestamp = Timestamp() // timestamp.GetCurrentTime() @@ -111,17 +122,18 @@ option objc_class_prefix = "GPB"; // 01:30 UTC on January 15, 2017. // // In JavaScript, one can convert a Date object to this format using the -// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] +// standard +// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) // method. In Python, a standard `datetime.datetime` object can be converted -// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) -// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one -// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// to this format using +// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // ) to obtain a formatter capable of generating timestamps in this format. // // message Timestamp { - // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. diff --git a/external/google/protobuf/type.proto b/external/google/protobuf/type.proto index 624c15e..d3f6a68 100644 --- a/external/google/protobuf/type.proto +++ b/external/google/protobuf/type.proto @@ -41,7 +41,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "TypeProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/ptype;ptype"; +option go_package = "google.golang.org/protobuf/types/known/typepb"; // A protocol buffer message type. message Type { @@ -64,44 +64,44 @@ message Field { // Basic field types. enum Kind { // Field type unknown. - TYPE_UNKNOWN = 0; + TYPE_UNKNOWN = 0; // Field type double. - TYPE_DOUBLE = 1; + TYPE_DOUBLE = 1; // Field type float. - TYPE_FLOAT = 2; + TYPE_FLOAT = 2; // Field type int64. - TYPE_INT64 = 3; + TYPE_INT64 = 3; // Field type uint64. - TYPE_UINT64 = 4; + TYPE_UINT64 = 4; // Field type int32. - TYPE_INT32 = 5; + TYPE_INT32 = 5; // Field type fixed64. - TYPE_FIXED64 = 6; + TYPE_FIXED64 = 6; // Field type fixed32. - TYPE_FIXED32 = 7; + TYPE_FIXED32 = 7; // Field type bool. - TYPE_BOOL = 8; + TYPE_BOOL = 8; // Field type string. - TYPE_STRING = 9; + TYPE_STRING = 9; // Field type group. Proto2 syntax only, and deprecated. - TYPE_GROUP = 10; + TYPE_GROUP = 10; // Field type message. - TYPE_MESSAGE = 11; + TYPE_MESSAGE = 11; // Field type bytes. - TYPE_BYTES = 12; + TYPE_BYTES = 12; // Field type uint32. - TYPE_UINT32 = 13; + TYPE_UINT32 = 13; // Field type enum. - TYPE_ENUM = 14; + TYPE_ENUM = 14; // Field type sfixed32. - TYPE_SFIXED32 = 15; + TYPE_SFIXED32 = 15; // Field type sfixed64. - TYPE_SFIXED64 = 16; + TYPE_SFIXED64 = 16; // Field type sint32. - TYPE_SINT32 = 17; + TYPE_SINT32 = 17; // Field type sint64. - TYPE_SINT64 = 18; - }; + TYPE_SINT64 = 18; + } // Whether a field is optional, required, or repeated. enum Cardinality { @@ -113,7 +113,7 @@ message Field { CARDINALITY_REQUIRED = 2; // For repeated fields. CARDINALITY_REPEATED = 3; - }; + } // The field type. Kind kind = 1; diff --git a/external/google/protobuf/wrappers.proto b/external/google/protobuf/wrappers.proto index 0194763..d49dd53 100644 --- a/external/google/protobuf/wrappers.proto +++ b/external/google/protobuf/wrappers.proto @@ -32,6 +32,11 @@ // for embedding primitives in the `google.protobuf.Any` type and for places // where we need to distinguish between the absence of a primitive // typed field and its default value. +// +// These wrappers have no meaningful use within repeated fields as they lack +// the ability to detect presence on individual elements. +// These wrappers have no meaningful use within a map or a oneof since +// individual entries of a map or fields of a oneof can already detect presence. syntax = "proto3"; @@ -39,7 +44,7 @@ package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/wrappers"; +option go_package = "google.golang.org/protobuf/types/known/wrapperspb"; option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true; From e65d30fb18cda89a4595e67a00f34582cf259cde Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:17:31 -0800 Subject: [PATCH 02/11] version pin go packages used; start managing protoc installation from .bin, just like in gloo mesh --- Makefile | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1dc5f7f..7bc8762 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ EXEC_NAME := $(OUTPUT_DIR)/protoc-gen-ext SOURCES := $(shell find . -name "*.go" | grep -v test.go) VERSION ?= $(shell git describe --tags) -GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 GOARCH=amd64 +GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 GOARCH=$(shell uname -m) GCFLAGS := 'all=-N -l' @@ -44,14 +44,14 @@ GO_IMPORT_SPACES := ${EXT_IMPORT},\ GO_IMPORT:=$(subst $(space),,$(GO_IMPORT_SPACES)) -PHONE: generated-code +.PHONY: generated-code generated-code: - PATH=$(DEPSGOBIN):$$PATH protoc -I=. --go_out="${EXT_IMPORT}:." extproto/ext.proto + PATH=$(DEPSGOBIN):$$PATH $(DEPSGOBIN)/protoc -I=. -I=./external --go_out="${EXT_IMPORT}:." extproto/ext.proto PATH=$(DEPSGOBIN):$$PATH cp -r ${PACKAGE}/extproto/* extproto - PATH=$(DEPSGOBIN):$$PATH protoc -I=. -I=./extproto --go_out="." --ext_out="." tests/api/hello.proto + PATH=$(DEPSGOBIN):$$PATH $(DEPSGOBIN)/protoc -I=. -I=./extproto -I=./external --go_out="." --ext_out="." tests/api/hello.proto PATH=$(DEPSGOBIN):$$PATH cp -r ${PACKAGE}/tests/api/* tests/api/ PATH=$(DEPSGOBIN):$$PATH rm -rf github.com - PATH=$(DEPSGOBIN):$$PATH goimports -w . + PATH=$(DEPSGOBIN):$$PATH $(DEPSGOBIN)/goimports -w . DEPSGOBIN=$(shell pwd)/_output/.bin @@ -60,12 +60,39 @@ DEPSGOBIN=$(shell pwd)/_output/.bin .PHONY: install-go-tools install-go-tools: install mkdir -p $(DEPSGOBIN) - GOBIN=$(DEPSGOBIN) go install github.com/golang/protobuf/protoc-gen-go - GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports - GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo + GOBIN=$(DEPSGOBIN) go install github.com/golang/protobuf/protoc-gen-go@v1.5.2 + GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports@v0.1.2 + GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo@v1.16.5 + +# proto compiler installation +PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8 +.PHONY: install-protoc +install-protoc: +ifeq ($(shell uname),Darwin) + @echo downloading protoc for osx + wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip +else +ifeq ($(shell uname -m),aarch64) + @echo downloading protoc for linux aarch64 + wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip +else + @echo downloading protoc for linux x86-64 + wget $(PROTOC_URL)-linux-x86_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip +endif +endif + + unzip $(DEPSGOBIN)/protoc-3.15.8.zip -d $(DEPSGOBIN)/protoc-3.15.8 + mv $(DEPSGOBIN)/protoc-3.15.8/bin/protoc $(DEPSGOBIN)/protoc + chmod +x $(DEPSGOBIN)/protoc + rm -rf $(DEPSGOBIN)/protoc-3.15.8 $(DEPSGOBIN)/protoc-3.15.8.zip + + # manage google protos too, since we have a folder of them based on the protoc version + +.PHONY: install-tools +install-tools: install-go-tools install-protoc .PHONY: run-tests -run-tests: install-go-tools +run-tests: install-tools $(DEPSGOBIN)/ginkgo -r -failFast -trace -progress -race -compilers=4 -failOnPending -noColor $(TEST_PKG) $(EXEC_NAME): From 848c1ef0f7417c523c2f94c687a58b243c0fd0ab Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:18:23 -0800 Subject: [PATCH 03/11] add missing package that caused test failures --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 2f39ea3..72c1efc 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/onsi/ginkgo v1.10.3 github.com/onsi/gomega v1.7.1 golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect + golang.org/x/sys v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 90b1a9b..f1afb61 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 51318a122b6d4c613cbb3e029952c4ece9b7651b Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:30:46 -0800 Subject: [PATCH 04/11] GOARCH for any architecture --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7bc8762..b65088e 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ EXEC_NAME := $(OUTPUT_DIR)/protoc-gen-ext SOURCES := $(shell find . -name "*.go" | grep -v test.go) VERSION ?= $(shell git describe --tags) -GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 GOARCH=$(shell uname -m) +GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 $(shell go env | grep GOARCH) GCFLAGS := 'all=-N -l' From ac139a8cf430f137ba5d44bc9b974a2bfff3e645 Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Tue, 6 Dec 2022 10:03:01 -0800 Subject: [PATCH 05/11] revert some changes bc of wrong go version --- Makefile | 6 +++--- go.mod | 1 - go.sum | 3 +-- main.go | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b65088e..f4ac438 100644 --- a/Makefile +++ b/Makefile @@ -60,9 +60,9 @@ DEPSGOBIN=$(shell pwd)/_output/.bin .PHONY: install-go-tools install-go-tools: install mkdir -p $(DEPSGOBIN) - GOBIN=$(DEPSGOBIN) go install github.com/golang/protobuf/protoc-gen-go@v1.5.2 - GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports@v0.1.2 - GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo@v1.16.5 + GOBIN=$(DEPSGOBIN) go install github.com/golang/protobuf/protoc-gen-go + GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports + GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo # proto compiler installation PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8 diff --git a/go.mod b/go.mod index 72c1efc..2f39ea3 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/onsi/ginkgo v1.10.3 github.com/onsi/gomega v1.7.1 golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sys v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index f1afb61..f1c5e42 100644 --- a/go.sum +++ b/go.sum @@ -43,11 +43,10 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= diff --git a/main.go b/main.go index 1820efb..0a6d603 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + pgs "github.com/lyft/protoc-gen-star" pgsgo "github.com/lyft/protoc-gen-star/lang/go" "google.golang.org/protobuf/types/pluginpb" @@ -8,8 +9,6 @@ import ( "github.com/solo-io/protoc-gen-ext/module/equal" "github.com/solo-io/protoc-gen-ext/module/hash" "github.com/solo-io/protoc-gen-ext/module/merge" - - pgs "github.com/lyft/protoc-gen-star" ) func main() { From ba2ef7a986757ac2340560d51829f126dd85464b Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Wed, 7 Dec 2022 10:46:48 -0700 Subject: [PATCH 06/11] manage google protos too, since we have a folder of them based on the protoc version --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f4ac438..368b336 100644 --- a/Makefile +++ b/Makefile @@ -84,15 +84,16 @@ endif unzip $(DEPSGOBIN)/protoc-3.15.8.zip -d $(DEPSGOBIN)/protoc-3.15.8 mv $(DEPSGOBIN)/protoc-3.15.8/bin/protoc $(DEPSGOBIN)/protoc chmod +x $(DEPSGOBIN)/protoc + @echo manage google protos too, since we have a folder of them based on the protoc version + rm -Rf $(shell pwd)/external/google/protobuf/* + mv $(DEPSGOBIN)/protoc-3.15.8/include/google/protobuf/*.proto $(shell pwd)/external/google/protobuf rm -rf $(DEPSGOBIN)/protoc-3.15.8 $(DEPSGOBIN)/protoc-3.15.8.zip - # manage google protos too, since we have a folder of them based on the protoc version - .PHONY: install-tools install-tools: install-go-tools install-protoc .PHONY: run-tests -run-tests: install-tools +run-tests: $(DEPSGOBIN)/ginkgo -r -failFast -trace -progress -race -compilers=4 -failOnPending -noColor $(TEST_PKG) $(EXEC_NAME): From 9fde49cacc7a673c1223d1aaa52a9eebe91bbf4b Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Thu, 8 Dec 2022 14:45:06 -0700 Subject: [PATCH 07/11] install-go-tools in ci --- .github/workflows/pull_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 7f53b74..d42481f 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -25,4 +25,4 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Test - run: make run-tests + run: make install-go-tools run-tests From 70dae6f798e54002254d80776f43fa69a7a594a6 Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Fri, 9 Dec 2022 15:03:47 -0700 Subject: [PATCH 08/11] pr feedback --- Makefile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 368b336..343ea57 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ EXEC_NAME := $(OUTPUT_DIR)/protoc-gen-ext SOURCES := $(shell find . -name "*.go" | grep -v test.go) VERSION ?= $(shell git describe --tags) -GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 $(shell go env | grep GOARCH) +GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0 GCFLAGS := 'all=-N -l' @@ -65,29 +65,35 @@ install-go-tools: install GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo # proto compiler installation -PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8 +PROTOC_VERSION:=3.15.8 +PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION} .PHONY: install-protoc +ifeq ($(shell $(DEPSGOBIN)/protoc --version | grep -c ${PROTOC_VERSION}),1) +install-protoc: + @echo expected protoc version ${PROTOC_VERSION} already installed +else install-protoc: ifeq ($(shell uname),Darwin) @echo downloading protoc for osx - wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip + wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip else ifeq ($(shell uname -m),aarch64) @echo downloading protoc for linux aarch64 - wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip + wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip else @echo downloading protoc for linux x86-64 - wget $(PROTOC_URL)-linux-x86_64.zip -O $(DEPSGOBIN)/protoc-3.15.8.zip + wget $(PROTOC_URL)-linux-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip endif endif - unzip $(DEPSGOBIN)/protoc-3.15.8.zip -d $(DEPSGOBIN)/protoc-3.15.8 - mv $(DEPSGOBIN)/protoc-3.15.8/bin/protoc $(DEPSGOBIN)/protoc + unzip $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -d $(DEPSGOBIN)/protoc-${PROTOC_VERSION} + mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/bin/protoc $(DEPSGOBIN)/protoc chmod +x $(DEPSGOBIN)/protoc @echo manage google protos too, since we have a folder of them based on the protoc version rm -Rf $(shell pwd)/external/google/protobuf/* - mv $(DEPSGOBIN)/protoc-3.15.8/include/google/protobuf/*.proto $(shell pwd)/external/google/protobuf - rm -rf $(DEPSGOBIN)/protoc-3.15.8 $(DEPSGOBIN)/protoc-3.15.8.zip + mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/include/google/protobuf/*.proto $(shell pwd)/external/google/protobuf + rm -rf $(DEPSGOBIN)/protoc-${PROTOC_VERSION} $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip +endif .PHONY: install-tools install-tools: install-go-tools install-protoc From 01de7d4425d8f83803135ba5b8db23beb51ca8d3 Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Tue, 20 Dec 2022 15:59:10 -0700 Subject: [PATCH 09/11] update install-protoc target to determine protoc installation state when target is executed --- Makefile | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 343ea57..a510f9c 100644 --- a/Makefile +++ b/Makefile @@ -68,32 +68,28 @@ install-go-tools: install PROTOC_VERSION:=3.15.8 PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION} .PHONY: install-protoc -ifeq ($(shell $(DEPSGOBIN)/protoc --version | grep -c ${PROTOC_VERSION}),1) install-protoc: - @echo expected protoc version ${PROTOC_VERSION} already installed -else -install-protoc: -ifeq ($(shell uname),Darwin) - @echo downloading protoc for osx - wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -else -ifeq ($(shell uname -m),aarch64) - @echo downloading protoc for linux aarch64 - wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -else - @echo downloading protoc for linux x86-64 - wget $(PROTOC_URL)-linux-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -endif -endif - - unzip $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -d $(DEPSGOBIN)/protoc-${PROTOC_VERSION} - mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/bin/protoc $(DEPSGOBIN)/protoc - chmod +x $(DEPSGOBIN)/protoc - @echo manage google protos too, since we have a folder of them based on the protoc version - rm -Rf $(shell pwd)/external/google/protobuf/* - mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/include/google/protobuf/*.proto $(shell pwd)/external/google/protobuf - rm -rf $(DEPSGOBIN)/protoc-${PROTOC_VERSION} $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -endif + if [ $(shell ${DEPSGOBIN}/protoc --version | grep -c ${PROTOC_VERSION}) -ne 0 ]; then \ + echo expected protoc version ${PROTOC_VERSION} already installed ;\ + else \ + if [ $(shell uname)==Darwin ]; then \ + echo "downloading protoc for osx" ;\ + wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ + elif [ $(shell uname -m)==aarch64 ]; then \ + echo "downloading protoc for linux aarch64" ;\ + wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ + else \ + echo "downloading protoc for linux x86-64" ;\ + wget $(PROTOC_URL)-linux-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ + fi ;\ + unzip $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip -d $(DEPSGOBIN)/protoc-${PROTOC_VERSION} ;\ + mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/bin/protoc $(DEPSGOBIN)/protoc ;\ + chmod +x $(DEPSGOBIN)/protoc ;\ + @echo manage google protos too, since we have a folder of them based on the protoc version ;\ + rm -Rf $(shell pwd)/external/google/protobuf/* ;\ + mv $(DEPSGOBIN)/protoc-${PROTOC_VERSION}/include/google/protobuf/*.proto $(shell pwd)/external/google/protobuf ;\ + rm -rf $(DEPSGOBIN)/protoc-${PROTOC_VERSION} $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ + fi .PHONY: install-tools install-tools: install-go-tools install-protoc From baa94bbf8bad71dd2c32988d851c649d3eec42bd Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Tue, 20 Dec 2022 19:51:59 -0600 Subject: [PATCH 10/11] fix install-protoc conditionals --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a510f9c..86b3e13 100644 --- a/Makefile +++ b/Makefile @@ -72,10 +72,10 @@ install-protoc: if [ $(shell ${DEPSGOBIN}/protoc --version | grep -c ${PROTOC_VERSION}) -ne 0 ]; then \ echo expected protoc version ${PROTOC_VERSION} already installed ;\ else \ - if [ $(shell uname)==Darwin ]; then \ + if [ "$(shell uname)" == "Darwin" ]; then \ echo "downloading protoc for osx" ;\ wget $(PROTOC_URL)-osx-x86_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ - elif [ $(shell uname -m)==aarch64 ]; then \ + elif [ "$(shell uname -m)" == "aarch64" ]; then \ echo "downloading protoc for linux aarch64" ;\ wget $(PROTOC_URL)-linux-aarch_64.zip -O $(DEPSGOBIN)/protoc-${PROTOC_VERSION}.zip ;\ else \ From 2b4d216f37f1e0d9ff87b61cfcc72216e628f5cb Mon Sep 17 00:00:00 2001 From: Conrad Hanson <27842017+conradhanson@users.noreply.github.com> Date: Thu, 19 Jan 2023 10:18:35 -0500 Subject: [PATCH 11/11] add comment to install-protoc about arm mac build --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 86b3e13..2493c6f 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ install-go-tools: install GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo # proto compiler installation +# no explicit arm build, but x86_64 build works on arm macs PROTOC_VERSION:=3.15.8 PROTOC_URL:=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION} .PHONY: install-protoc