Skip to content

Commit 63d966b

Browse files
Update protoc release to include editions language features proto for Go (#19013)
* Update protoc release to include editions language features proto for Go related to #16211 PiperOrigin-RevId: 684366194 * Internal change PiperOrigin-RevId: 684173423 * Pin to python 3.12 in upb/macos tests. Python 3.13 seems to have some issues with our dependencies and both numpy and setuptools fails to install. PiperOrigin-RevId: 689955916 --------- Co-authored-by: Protobuf Team Bot <[email protected]>
1 parent bb0d575 commit 63d966b

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.github/workflows/test_upb.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
ref: ${{ inputs.safe-checkout }}
117117
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
118118
with:
119+
python-version: 3.12
119120
cache: pip
120121
cache-dependency-path: 'python/requirements.txt'
121122
- name: Run tests

go/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filegroup(
2+
name = "go_features_proto_srcs",
3+
srcs = ["go_features.proto"],
4+
visibility = ["//:__subpackages__"],
5+
)

go/go_features.proto

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Protocol Buffers - Google's data interchange format
2+
// Copyright 2023 Google Inc. All rights reserved.
3+
//
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file or at
6+
// https://developers.google.com/open-source/licenses/bsd
7+
8+
syntax = "proto2";
9+
10+
package pb;
11+
12+
import "google/protobuf/descriptor.proto";
13+
14+
option go_package = "google.golang.org/protobuf/types/gofeaturespb";
15+
16+
extend google.protobuf.FeatureSet {
17+
optional GoFeatures go = 1002;
18+
}
19+
20+
message GoFeatures {
21+
// Whether or not to generate the deprecated UnmarshalJSON method for enums.
22+
optional bool legacy_unmarshal_json_enum = 1 [
23+
retention = RETENTION_RUNTIME,
24+
targets = TARGET_TYPE_ENUM,
25+
targets = TARGET_TYPE_FILE,
26+
feature_support = {
27+
edition_introduced: EDITION_2023,
28+
edition_deprecated: EDITION_2023,
29+
deprecation_warning: "The legacy UnmarshalJSON API is deprecated and "
30+
"will be removed in a future edition.",
31+
},
32+
edition_defaults = { edition: EDITION_LEGACY, value: "true" },
33+
edition_defaults = { edition: EDITION_PROTO3, value: "false" }
34+
];
35+
36+
enum APILevel {
37+
// API_LEVEL_UNSPECIFIED results in selecting the OPEN API,
38+
// but needs to be a separate value to distinguish between
39+
// an explicitly set api level or a missing api level.
40+
API_LEVEL_UNSPECIFIED = 0;
41+
API_OPEN = 1;
42+
API_HYBRID = 2;
43+
API_OPAQUE = 3;
44+
}
45+
46+
// One of OPEN, HYBRID or OPAQUE.
47+
optional APILevel api_level = 2 [
48+
retention = RETENTION_RUNTIME,
49+
targets = TARGET_TYPE_MESSAGE,
50+
targets = TARGET_TYPE_FILE,
51+
feature_support = {
52+
edition_introduced: EDITION_2023,
53+
},
54+
edition_defaults = { edition: EDITION_LEGACY, value: "API_LEVEL_UNSPECIFIED" },
55+
edition_defaults = { edition: EDITION_2024, value: "API_OPAQUE" }
56+
];
57+
}

pkg/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pkg_files(
1616
name = "wkt_protos_files",
1717
srcs = [
1818
"//:well_known_type_protos",
19+
"//go:go_features_proto_srcs",
1920
"//java/core:java_features_proto_srcs",
2021
"//src/google/protobuf:cpp_features_proto_srcs",
2122
"//src/google/protobuf:descriptor_proto_srcs",

0 commit comments

Comments
 (0)