Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protoc release to include editions language features proto for Go #19013

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_upb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ jobs:
ref: ${{ inputs.safe-checkout }}
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: 3.12
cache: pip
cache-dependency-path: 'python/requirements.txt'
- name: Run tests
Expand Down
5 changes: 5 additions & 0 deletions go/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "go_features_proto_srcs",
srcs = ["go_features.proto"],
visibility = ["//:__subpackages__"],
)
57 changes: 57 additions & 0 deletions go/go_features.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

syntax = "proto2";

package pb;

import "google/protobuf/descriptor.proto";

option go_package = "google.golang.org/protobuf/types/gofeaturespb";

extend google.protobuf.FeatureSet {
optional GoFeatures go = 1002;
}

message GoFeatures {
// Whether or not to generate the deprecated UnmarshalJSON method for enums.
optional bool legacy_unmarshal_json_enum = 1 [
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_ENUM,
targets = TARGET_TYPE_FILE,
feature_support = {
edition_introduced: EDITION_2023,
edition_deprecated: EDITION_2023,
deprecation_warning: "The legacy UnmarshalJSON API is deprecated and "
"will be removed in a future edition.",
},
edition_defaults = { edition: EDITION_LEGACY, value: "true" },
edition_defaults = { edition: EDITION_PROTO3, value: "false" }
];

enum APILevel {
// API_LEVEL_UNSPECIFIED results in selecting the OPEN API,
// but needs to be a separate value to distinguish between
// an explicitly set api level or a missing api level.
API_LEVEL_UNSPECIFIED = 0;
API_OPEN = 1;
API_HYBRID = 2;
API_OPAQUE = 3;
}

// One of OPEN, HYBRID or OPAQUE.
optional APILevel api_level = 2 [
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_MESSAGE,
targets = TARGET_TYPE_FILE,
feature_support = {
edition_introduced: EDITION_2023,
},
edition_defaults = { edition: EDITION_LEGACY, value: "API_LEVEL_UNSPECIFIED" },
edition_defaults = { edition: EDITION_2024, value: "API_OPAQUE" }
];
}
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pkg_files(
name = "wkt_protos_files",
srcs = [
"//:well_known_type_protos",
"//go:go_features_proto_srcs",
"//java/core:java_features_proto_srcs",
"//src/google/protobuf:cpp_features_proto_srcs",
"//src/google/protobuf:descriptor_proto_srcs",
Expand Down
Loading