aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProtobuf Team Bot <protobuf-github-bot@google.com>2024-05-10 10:24:50 -0700
committerCopybara-Service <copybara-worker@google.com>2024-05-10 10:26:58 -0700
commit24d42eacec4088319c9261e58fb1e7b04b5d0634 (patch)
tree2437219d2588634ed18d04b810573675aa437271
parentc99cf4bbfaf71f735cd0dea7d6fc0b2c1a589ed2 (diff)
downloadprotobuf-24d42eacec4088319c9261e58fb1e7b04b5d0634.tar.gz
Add a BUILD file under rust/accessors and rename helpers.h to default_value.h
PiperOrigin-RevId: 632535021
-rw-r--r--src/google/protobuf/compiler/rust/BUILD.bazel65
-rw-r--r--src/google/protobuf/compiler/rust/accessors/BUILD.bazel45
-rw-r--r--src/google/protobuf/compiler/rust/accessors/default_value.cc (renamed from src/google/protobuf/compiler/rust/accessors/helpers.cc)2
-rw-r--r--src/google/protobuf/compiler/rust/accessors/default_value.h (renamed from src/google/protobuf/compiler/rust/accessors/helpers.h)0
-rw-r--r--src/google/protobuf/compiler/rust/accessors/singular_scalar.cc2
5 files changed, 58 insertions, 56 deletions
diff --git a/src/google/protobuf/compiler/rust/BUILD.bazel b/src/google/protobuf/compiler/rust/BUILD.bazel
index 6b6f98754..5ff8f510a 100644
--- a/src/google/protobuf/compiler/rust/BUILD.bazel
+++ b/src/google/protobuf/compiler/rust/BUILD.bazel
@@ -82,7 +82,6 @@ cc_library(
copts = COPTS,
strip_include_prefix = "/src",
deps = [
- ":accessors",
":context",
":enum",
":naming",
@@ -90,6 +89,7 @@ cc_library(
"//src/google/protobuf",
"//src/google/protobuf/compiler/cpp:names",
"//src/google/protobuf/compiler/cpp:names_internal",
+ "//src/google/protobuf/compiler/rust/accessors",
"//upb_generator:mangle",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
@@ -99,45 +99,14 @@ cc_library(
)
cc_library(
- name = "accessors",
- srcs = [
- "accessors/accessor_case.cc",
- "accessors/accessors.cc",
- "accessors/map.cc",
- "accessors/repeated_field.cc",
- "accessors/singular_message.cc",
- "accessors/singular_scalar.cc",
- "accessors/singular_string.cc",
- "accessors/unsupported_field.cc",
- ],
- hdrs = [
- "accessors/accessor_case.h",
- "accessors/accessor_generator.h",
- "accessors/accessors.h",
- ],
- copts = COPTS,
- strip_include_prefix = "/src",
- deps = [
- ":context",
- ":helpers",
- ":naming",
- ":rust_field_type",
- "//src/google/protobuf",
- "//src/google/protobuf/compiler/cpp:names_internal",
- "//src/google/protobuf/io:tokenizer",
- "@com_google_absl//absl/log:absl_check",
- "@com_google_absl//absl/log:absl_log",
- "@com_google_absl//absl/strings",
- "@com_google_absl//absl/strings:str_format",
- ],
-)
-
-cc_library(
name = "context",
srcs = ["context.cc"],
hdrs = ["context.h"],
copts = COPTS,
strip_include_prefix = "/src",
+ visibility = [
+ "//src/google/protobuf/compiler/rust:__subpackages__",
+ ],
deps = [
"//src/google/protobuf",
"//src/google/protobuf/compiler:code_generator",
@@ -195,6 +164,9 @@ cc_library(
],
copts = COPTS,
strip_include_prefix = "/src",
+ visibility = [
+ "//src/google/protobuf/compiler/rust:__subpackages__",
+ ],
deps = [
":context",
":rust_field_type",
@@ -216,13 +188,13 @@ cc_library(
copts = COPTS,
strip_include_prefix = "/src",
deps = [
- ":accessors",
":context",
":naming",
":rust_field_type",
"//src/google/protobuf",
"//src/google/protobuf/compiler/cpp:names",
"//src/google/protobuf/compiler/cpp:names_internal",
+ "//src/google/protobuf/compiler/rust/accessors",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
],
@@ -251,28 +223,13 @@ cc_test(
)
cc_library(
- name = "helpers",
- srcs = ["accessors/helpers.cc"],
- hdrs = ["accessors/helpers.h"],
- strip_include_prefix = "/src",
- deps = [
- ":context",
- ":naming",
- ":rust_field_type",
- "//src/google/protobuf",
- "//src/google/protobuf/io:tokenizer",
- "@com_google_absl//absl/log:absl_check",
- "@com_google_absl//absl/log:absl_log",
- "@com_google_absl//absl/strings",
- "@com_google_absl//absl/strings:str_format",
- ],
-)
-
-cc_library(
name = "rust_field_type",
srcs = ["rust_field_type.cc"],
hdrs = ["rust_field_type.h"],
strip_include_prefix = "/src",
+ visibility = [
+ "//src/google/protobuf/compiler/rust:__subpackages__",
+ ],
deps = [
"//src/google/protobuf",
"@com_google_absl//absl/log:absl_log",
diff --git a/src/google/protobuf/compiler/rust/accessors/BUILD.bazel b/src/google/protobuf/compiler/rust/accessors/BUILD.bazel
new file mode 100644
index 000000000..d864d6258
--- /dev/null
+++ b/src/google/protobuf/compiler/rust/accessors/BUILD.bazel
@@ -0,0 +1,45 @@
+################################################################################
+# Protocol Buffers Compiler - Generation of accessors for individual fields.
+################################################################################
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+load("//build_defs:cpp_opts.bzl", "COPTS")
+
+cc_library(
+ name = "accessors",
+ srcs = [
+ "accessor_case.cc",
+ "accessors.cc",
+ "default_value.cc",
+ "map.cc",
+ "repeated_field.cc",
+ "singular_message.cc",
+ "singular_scalar.cc",
+ "singular_string.cc",
+ "unsupported_field.cc",
+ ],
+ hdrs = [
+ "accessor_case.h",
+ "accessor_generator.h",
+ "accessors.h",
+ "default_value.h",
+ ],
+ copts = COPTS,
+ strip_include_prefix = "/src",
+ visibility = [
+ "//pkg:__pkg__",
+ "//src/google/protobuf/compiler:__subpackages__",
+ ],
+ deps = [
+ "//src/google/protobuf",
+ "//src/google/protobuf/compiler/cpp:names_internal",
+ "//src/google/protobuf/compiler/rust:context",
+ "//src/google/protobuf/compiler/rust:naming",
+ "//src/google/protobuf/compiler/rust:rust_field_type",
+ "//src/google/protobuf/io:tokenizer",
+ "@com_google_absl//absl/log:absl_check",
+ "@com_google_absl//absl/log:absl_log",
+ "@com_google_absl//absl/strings",
+ "@com_google_absl//absl/strings:str_format",
+ ],
+)
diff --git a/src/google/protobuf/compiler/rust/accessors/helpers.cc b/src/google/protobuf/compiler/rust/accessors/default_value.cc
index 71c6b280f..27594b3c1 100644
--- a/src/google/protobuf/compiler/rust/accessors/helpers.cc
+++ b/src/google/protobuf/compiler/rust/accessors/default_value.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "google/protobuf/compiler/rust/accessors/helpers.h"
+#include "google/protobuf/compiler/rust/accessors/default_value.h"
#include <cmath>
#include <limits>
diff --git a/src/google/protobuf/compiler/rust/accessors/helpers.h b/src/google/protobuf/compiler/rust/accessors/default_value.h
index 2293c6cea..2293c6cea 100644
--- a/src/google/protobuf/compiler/rust/accessors/helpers.h
+++ b/src/google/protobuf/compiler/rust/accessors/default_value.h
diff --git a/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc b/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc
index 2c3546cbd..9131b361a 100644
--- a/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc
+++ b/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc
@@ -11,7 +11,7 @@
#include "google/protobuf/compiler/cpp/helpers.h"
#include "google/protobuf/compiler/rust/accessors/accessor_case.h"
#include "google/protobuf/compiler/rust/accessors/accessor_generator.h"
-#include "google/protobuf/compiler/rust/accessors/helpers.h"
+#include "google/protobuf/compiler/rust/accessors/default_value.h"
#include "google/protobuf/compiler/rust/context.h"
#include "google/protobuf/compiler/rust/naming.h"
#include "google/protobuf/descriptor.h"