From 182699f8fde413e3fdc770ecf3808fe2f2fe01c3 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 27 Aug 2024 01:49:12 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 667891921 --- bazel/common/{BUILD.bazel => BUILD} | 0 bazel/private/{BUILD.bazel => BUILD} | 30 +++++++++++-------- ..._rule.bzl => bazel_proto_library_rule.bzl} | 0 bazel/private/proto_lang_toolchain_rule.bzl | 3 +- bazel/private/proto_toolchain_rule.bzl | 7 +++++ bazel/proto_library.bzl | 2 +- bazel/tests/proto_common_compile_tests.bzl | 7 +++++ bazel/tests/testdata/compile_rule.bzl | 7 +++++ bazel/toolchains/{BUILD.bazel => BUILD} | 2 ++ bazel/toolchains/proto_lang_toolchain.bzl | 7 +++++ bazel/toolchains/proto_toolchain.bzl | 7 +++++ 11 files changed, 58 insertions(+), 14 deletions(-) rename bazel/common/{BUILD.bazel => BUILD} (100%) rename bazel/private/{BUILD.bazel => BUILD} (76%) rename bazel/private/{proto_library_rule.bzl => bazel_proto_library_rule.bzl} (100%) rename bazel/toolchains/{BUILD.bazel => BUILD} (84%) diff --git a/bazel/common/BUILD.bazel b/bazel/common/BUILD similarity index 100% rename from bazel/common/BUILD.bazel rename to bazel/common/BUILD diff --git a/bazel/private/BUILD.bazel b/bazel/private/BUILD similarity index 76% rename from bazel/private/BUILD.bazel rename to bazel/private/BUILD index c90632d7b0ed..4a44f3334f3b 100644 --- a/bazel/private/BUILD.bazel +++ b/bazel/private/BUILD @@ -1,15 +1,6 @@ -# Copyright (c) 2009-2021, Google LLC -# 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 - load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//bazel/private:native_bool_flag.bzl", "native_bool_flag") -licenses(["notice"]) - toolchain_type( name = "proto_toolchain_type", ) @@ -44,10 +35,25 @@ bzl_library( "proto_toolchain_rule.bzl", ], visibility = ["//bazel:__subpackages__"], + deps = [ + "//bazel/common:proto_common_bzl", + "//bazel/common:proto_lang_toolchain_info_bzl", + "//bazel/private:toolchain_helpers_bzl", + ], +) + +bzl_library( + name = "proto_lang_toolchain_rule_bzl", + srcs = [ + "proto_lang_toolchain_rule.bzl", + ], + visibility = ["//bazel:__subpackages__"], deps = [ ":toolchain_helpers_bzl", "//bazel/common:proto_common_bzl", + "//bazel/common:proto_info_bzl", "//bazel/common:proto_lang_toolchain_info_bzl", + "@proto_bazel_features//:features", ], ) @@ -67,7 +73,7 @@ native_bool_flag( name = "experimental_proto_descriptor_sets_include_source_info", flag = "experimental_proto_descriptor_sets_include_source_info", match_value = "true", - visibility = ["//visibility:public"], + visibility = ["//bazel:__subpackages__"], ) native_bool_flag( @@ -75,7 +81,7 @@ native_bool_flag( flag = "strict_proto_deps", match_value = "off", result = False, - visibility = ["//visibility:public"], + visibility = ["//bazel:__subpackages__"], ) native_bool_flag( @@ -83,5 +89,5 @@ native_bool_flag( flag = "strict_public_imports", match_value = "off", result = False, - visibility = ["//visibility:public"], + visibility = ["//bazel:__subpackages__"], ) diff --git a/bazel/private/proto_library_rule.bzl b/bazel/private/bazel_proto_library_rule.bzl similarity index 100% rename from bazel/private/proto_library_rule.bzl rename to bazel/private/bazel_proto_library_rule.bzl diff --git a/bazel/private/proto_lang_toolchain_rule.bzl b/bazel/private/proto_lang_toolchain_rule.bzl index 665a4b85611d..d99b58c9dcb8 100644 --- a/bazel/private/proto_lang_toolchain_rule.bzl +++ b/bazel/private/proto_lang_toolchain_rule.bzl @@ -1,9 +1,10 @@ # Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. +# Copyright 2024 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 +# """Implementation of the proto_lang_toolchain rule.""" load("@proto_bazel_features//:features.bzl", "bazel_features") diff --git a/bazel/private/proto_toolchain_rule.bzl b/bazel/private/proto_toolchain_rule.bzl index 8a11fac9db02..3a4ee72a7c06 100644 --- a/bazel/private/proto_toolchain_rule.bzl +++ b/bazel/private/proto_toolchain_rule.bzl @@ -1,3 +1,10 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2024 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 +# """A Starlark implementation of the proto_toolchain rule.""" load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo") diff --git a/bazel/proto_library.bzl b/bazel/proto_library.bzl index f0fece155373..336623067d4e 100644 --- a/bazel/proto_library.bzl +++ b/bazel/proto_library.bzl @@ -9,7 +9,7 @@ Macro of proto_library rule. """ load("@proto_bazel_features//:features.bzl", "bazel_features") -load("//bazel/private:proto_library_rule.bzl", _proto_library = "proto_library") +load("//bazel/private:bazel_proto_library_rule.bzl", _proto_library = "proto_library") def proto_library(**kwattrs): # This condition causes Starlark rules to be used only on Bazel >=7.0.0 diff --git a/bazel/tests/proto_common_compile_tests.bzl b/bazel/tests/proto_common_compile_tests.bzl index 58ecc899cea8..f0d0110f1b1b 100644 --- a/bazel/tests/proto_common_compile_tests.bzl +++ b/bazel/tests/proto_common_compile_tests.bzl @@ -1,3 +1,10 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2024 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 +# """Tests for `proto_common.compile` function.""" load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite") diff --git a/bazel/tests/testdata/compile_rule.bzl b/bazel/tests/testdata/compile_rule.bzl index 65bf99b68de1..8aec0a8209c3 100644 --- a/bazel/tests/testdata/compile_rule.bzl +++ b/bazel/tests/testdata/compile_rule.bzl @@ -1,3 +1,10 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2024 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 +# """Testing function for proto_common module""" load("//bazel/common:proto_common.bzl", "proto_common") diff --git a/bazel/toolchains/BUILD.bazel b/bazel/toolchains/BUILD similarity index 84% rename from bazel/toolchains/BUILD.bazel rename to bazel/toolchains/BUILD index 2c21426b1534..6a6bfbc7ec19 100644 --- a/bazel/toolchains/BUILD.bazel +++ b/bazel/toolchains/BUILD @@ -20,5 +20,7 @@ bzl_library( visibility = ["//visibility:public"], deps = [ "//bazel/common:proto_common_bzl", + "//bazel/private:proto_lang_toolchain_rule_bzl", + "@proto_bazel_features//:features", ], ) diff --git a/bazel/toolchains/proto_lang_toolchain.bzl b/bazel/toolchains/proto_lang_toolchain.bzl index 2b2237f13e29..4c1666530ebb 100644 --- a/bazel/toolchains/proto_lang_toolchain.bzl +++ b/bazel/toolchains/proto_lang_toolchain.bzl @@ -1,3 +1,10 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2024 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 +# """proto_lang_toolchain rule""" load("@proto_bazel_features//:features.bzl", "bazel_features") diff --git a/bazel/toolchains/proto_toolchain.bzl b/bazel/toolchains/proto_toolchain.bzl index 1bad37b3a65c..dba256b05ea7 100644 --- a/bazel/toolchains/proto_toolchain.bzl +++ b/bazel/toolchains/proto_toolchain.bzl @@ -1,3 +1,10 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2024 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 +# """Macro wrapping the proto_toolchain implementation. The macro additionally creates toolchain target when toolchain_type is given.