feat: add initially-empty C# features proto

PiperOrigin-RevId: 890289024
This commit is contained in:
Protobuf Team Bot 2026-03-27 00:47:19 -07:00 committed by Copybara-Service
parent 63d6ef01b0
commit 2893999a3c
7 changed files with 62 additions and 0 deletions

View file

@ -621,6 +621,16 @@ alias(
visibility = ["//visibility:public"],
)
################################################################################
# C# support
################################################################################
alias(
name = "csharp_features_proto",
actual = "//csharp:csharp_features_proto", # proto_library
visibility = ["//visibility:public"],
)
################################################################################
# Test protos
################################################################################

View file

@ -92,6 +92,7 @@ set(protobuf_HEADERS
${cpp_features_proto_proto_srcs}
${descriptor_proto_proto_srcs}
${plugin_proto_proto_srcs}
${c_sharp_features_proto_proto_srcs}
${java_features_proto_proto_srcs}
${go_features_proto_proto_srcs}
)
@ -109,6 +110,7 @@ endif ()
set(protobuf_STRIP_PREFIXES
"/src"
"/java/core/src/main/resources"
"/csharp"
"/go"
"/"
)

View file

@ -9,6 +9,7 @@ google/protobuf/arena_allocation_policy.h
google/protobuf/arena_cleanup.h
google/protobuf/arenastring.h
google/protobuf/arenaz_sampler.h
google/protobuf/c_sharp_features.proto
google/protobuf/compiler/code_generator.h
google/protobuf/compiler/code_generator_lite.h
google/protobuf/compiler/command_line_interface.h

View file

@ -3,11 +3,28 @@
# See also code generation logic under /src/google/protobuf/compiler/csharp.
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//bazel:proto_library.bzl", "proto_library")
load("//build_defs:internal_shell.bzl", "inline_sh_test")
load("//conformance:defs.bzl", "conformance_test")
load("//editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
load("//upb/cmake:build_defs.bzl", "staleness_test")
################################################################################
# C# features
################################################################################
filegroup(
name = "c_sharp_features_proto_srcs",
srcs = ["google/protobuf/c_sharp_features.proto"],
visibility = ["//:__subpackages__"],
)
proto_library(
name = "c_sharp_features_proto",
srcs = ["google/protobuf/c_sharp_features.proto"],
visibility = ["//:__subpackages__"],
deps = ["//:descriptor_proto"],
)
################################################################################
# Tests
################################################################################
@ -44,6 +61,7 @@ filegroup(
"src/*/obj/**/*",
],
) + [
"google/protobuf/c_sharp_features.proto",
"src/Directory.Build.props",
"src/Google.Protobuf.Test/testprotos.pb",
"src/Google.Protobuf.sln",

View file

@ -46,6 +46,12 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
src/google/protobuf/wrappers.proto \
src/google/protobuf/compiler/plugin.proto
# C# features
$PROTOC -Icsharp -Isrc --csharp_out=csharp/src/Google.Protobuf \
--csharp_opt=base_namespace=Google.Protobuf \
--csharp_opt=file_extension=.pb.cs \
csharp/google/protobuf/c_sharp_features.proto
# Test protos
# Note that this deliberately does *not* include old_extensions1.proto
# and old_extensions2.proto, which are generated with an older version

View file

@ -0,0 +1,23 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2026 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;
option csharp_namespace = "Google.Protobuf.Reflection";
option java_multiple_files = true;
option java_outer_classname = "CSharpFeaturesOuterClass";
import "google/protobuf/descriptor.proto";
extend google.protobuf.FeatureSet {
optional CSharpFeatures csharp = 1004;
}
message CSharpFeatures {
}

View file

@ -16,6 +16,7 @@ pkg_files(
name = "wkt_protos_files",
srcs = [
"//:well_known_type_protos",
"//csharp:c_sharp_features_proto_srcs",
"//go:go_features_proto_srcs",
"//java/core:java_features_proto_srcs",
"//src/google/protobuf:cpp_features_proto_srcs",
@ -121,6 +122,7 @@ gen_file_lists(
"//src/google/protobuf:cpp_features_proto": "cpp_features_proto",
"//src/google/protobuf:descriptor_proto": "descriptor_proto",
"//src/google/protobuf/compiler:plugin_proto": "plugin_proto",
"//csharp:c_sharp_features_proto": "c_sharp_features_proto",
"//java/core:java_features_proto": "java_features_proto,src/google/protobuf/compiler/java/",
"//go:go_features_proto": "go_features_proto,go/",