From 320cd47cecbf0f1b1a1a3d8905563a7b23349fce Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 19 Nov 2024 10:18:45 -0800 Subject: [PATCH] Introduce BUILD files by the rust /cargo, /protobuf_codegen and protobuf_codegen/example directories. PiperOrigin-RevId: 698062640 --- .../Reflection/FeatureSetDescriptor.g.cs | 17 ----------------- rust/BUILD | 18 +++++++++++------- rust/cargo/BUILD | 5 +++++ rust/protobuf_codegen/BUILD | 5 +++++ rust/protobuf_codegen/example/BUILD | 5 +++++ 5 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs create mode 100644 rust/cargo/BUILD create mode 100644 rust/protobuf_codegen/BUILD create mode 100644 rust/protobuf_codegen/example/BUILD diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs deleted file mode 100644 index 208ce1fcb6..0000000000 --- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs +++ /dev/null @@ -1,17 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 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 -#endregion - -namespace Google.Protobuf.Reflection; - -internal sealed partial class FeatureSetDescriptor -{ - // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. - private const string DefaultsBase64 = - "ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; -} diff --git a/rust/BUILD b/rust/BUILD index 9b08070eb9..da42bd3241 100644 --- a/rust/BUILD +++ b/rust/BUILD @@ -249,16 +249,20 @@ config_setting( }, ) +# Note: strip_prefix.from_pkg() should work for this below, but has surprising behavior in bazel +# with filegroups and so we only use strip_prefix.from_root() and this constant instead. +SRC_ROOT = "rust" + pkg_files( name = "rust_protobuf_src", srcs = glob(["*"]), - strip_prefix = strip_prefix.from_pkg(""), + strip_prefix = strip_prefix.from_root(SRC_ROOT), ) pkg_files( name = "crate_root_files", - srcs = glob(["cargo/**/*"]), - strip_prefix = strip_prefix.from_pkg("/cargo"), + srcs = ["//rust/cargo:srcs"], + strip_prefix = strip_prefix.from_root(SRC_ROOT + "/cargo"), ) pkg_filegroup( @@ -297,8 +301,8 @@ pkg_tar( pkg_files( name = "protobuf_codegen_files", - srcs = glob(["protobuf_codegen/src/*"]) + ["protobuf_codegen/Cargo.toml"], - strip_prefix = strip_prefix.from_pkg("/protobuf_codegen"), + srcs = ["//rust/protobuf_codegen:srcs"], + strip_prefix = strip_prefix.from_root(SRC_ROOT + "/protobuf_codegen"), ) pkg_tar( @@ -323,8 +327,8 @@ pkg_tar( pkg_files( name = "codegen_example_files", - srcs = glob(["protobuf_codegen/example/**/*"]), - strip_prefix = strip_prefix.from_pkg("/protobuf_codegen/example"), + srcs = ["//rust/protobuf_codegen/example:srcs"], + strip_prefix = strip_prefix.from_root(SRC_ROOT + "/protobuf_codegen/example"), ) pkg_tar( diff --git a/rust/cargo/BUILD b/rust/cargo/BUILD new file mode 100644 index 0000000000..f478eae366 --- /dev/null +++ b/rust/cargo/BUILD @@ -0,0 +1,5 @@ +filegroup( + name = "srcs", + srcs = glob(["**/*"]), + visibility = ["//rust:__subpackages__"], +) diff --git a/rust/protobuf_codegen/BUILD b/rust/protobuf_codegen/BUILD new file mode 100644 index 0000000000..f478eae366 --- /dev/null +++ b/rust/protobuf_codegen/BUILD @@ -0,0 +1,5 @@ +filegroup( + name = "srcs", + srcs = glob(["**/*"]), + visibility = ["//rust:__subpackages__"], +) diff --git a/rust/protobuf_codegen/example/BUILD b/rust/protobuf_codegen/example/BUILD new file mode 100644 index 0000000000..f478eae366 --- /dev/null +++ b/rust/protobuf_codegen/example/BUILD @@ -0,0 +1,5 @@ +filegroup( + name = "srcs", + srcs = glob(["**/*"]), + visibility = ["//rust:__subpackages__"], +)