diff --git a/bazel/BUILD.bazel b/bazel/BUILD.bazel index d0546f9b30e6..71190a6ca545 100644 --- a/bazel/BUILD.bazel +++ b/bazel/BUILD.bazel @@ -13,24 +13,31 @@ bzl_library( name = "proto_library_bzl", srcs = ["proto_library.bzl"], visibility = ["//visibility:public"], + deps = [ + "//bazel/private:bazel_proto_library_rule_bzl", + "@proto_bazel_features//:features", + ], ) bzl_library( name = "cc_proto_library_bzl", srcs = ["cc_proto_library.bzl"], visibility = ["//visibility:public"], + deps = ["//bazel/private:bazel_cc_proto_library_bzl"], ) bzl_library( name = "java_proto_library_bzl", srcs = ["java_proto_library.bzl"], visibility = ["//visibility:public"], + deps = ["//bazel/private:bazel_java_proto_library_rule_bzl"], ) bzl_library( name = "java_lite_proto_library_bzl", srcs = ["java_lite_proto_library.bzl"], visibility = ["//visibility:public"], + deps = ["//bazel/private:java_lite_proto_library_bzl"], ) bzl_library( @@ -56,3 +63,19 @@ bzl_library( visibility = ["//visibility:public"], deps = ["//bazel/private:upb_proto_library_internal_bzl"], ) + +# The data in this target is exposed in //bazel/private:for_bazel_tests +filegroup( + name = "for_bazel_tests", + testonly = True, + srcs = [ + "BUILD.bazel", + ":cc_proto_library_bzl", + ":java_lite_proto_library_bzl", + ":proto_library_bzl", + ":py_proto_library_bzl", + "//bazel/common:for_bazel_tests", + "//bazel/toolchains:for_bazel_tests", + ], + visibility = ["//bazel/private:__pkg__"], +) diff --git a/bazel/common/BUILD b/bazel/common/BUILD index c79d22280384..4d9571732134 100644 --- a/bazel/common/BUILD +++ b/bazel/common/BUILD @@ -10,6 +10,7 @@ bzl_library( visibility = ["//visibility:public"], deps = [ ":proto_lang_toolchain_info_bzl", + "//bazel/private:native_bzl", "//bazel/private:toolchain_helpers_bzl", "@proto_bazel_features//:features", ], @@ -38,9 +39,13 @@ bzl_library( ) filegroup( - name = "bazel_osx_p4deps", - srcs = glob(["**"]) + ["@proto_bazel_features//:features"], - visibility = [ - "//bazel:__pkg__", + name = "for_bazel_tests", + testonly = True, + srcs = [ + "BUILD", + "proto_common_bzl", + "proto_info_bzl", + "proto_lang_toolchain_info_bzl", ], + visibility = ["//bazel:__pkg__"], ) diff --git a/bazel/private/BUILD b/bazel/private/BUILD index 9b04c1f8638b..e800c72bc849 100644 --- a/bazel/private/BUILD +++ b/bazel/private/BUILD @@ -1,5 +1,5 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("//bazel/private:native_bool_flag.bzl", "native_bool_flag") +load(":native_bool_flag.bzl", "native_bool_flag") package(default_applicable_licenses = ["//:license"]) @@ -52,6 +52,12 @@ bzl_library( visibility = ["//bazel:__subpackages__"], ) +bzl_library( + name = "proto_info_bzl", + srcs = ["proto_info.bzl"], + visibility = ["//bazel:__subpackages__"], +) + bzl_library( name = "bazel_proto_library_rule_bzl", srcs = [ @@ -59,15 +65,60 @@ bzl_library( ], visibility = ["//bazel:__subpackages__"], deps = [ + ":toolchain_helpers_bzl", "//bazel/common:proto_common_bzl", "//bazel/common:proto_info_bzl", - "//bazel/private:toolchain_helpers_bzl", "@bazel_skylib//lib:paths", "@bazel_skylib//rules:common_settings", "@proto_bazel_features//:features", ], ) +bzl_library( + name = "bazel_java_proto_library_rule_bzl", + srcs = [ + "bazel_java_proto_library_rule.bzl", + "java_proto_support.bzl", + ], + visibility = ["//bazel:__subpackages__"], + deps = [ + ":toolchain_helpers_bzl", + "//bazel/common:proto_common_bzl", + "//bazel/common:proto_info_bzl", + "@rules_java//java/common", + ], +) + +bzl_library( + name = "java_lite_proto_library_bzl", + srcs = [ + "java_lite_proto_library.bzl", + "java_proto_support.bzl", + ], + visibility = ["//bazel:__subpackages__"], + deps = [ + ":toolchain_helpers_bzl", + "//bazel/common:proto_common_bzl", + "//bazel/common:proto_info_bzl", + "@rules_java//java/common", + ], +) + +bzl_library( + name = "bazel_cc_proto_library_bzl", + srcs = [ + "bazel_cc_proto_library.bzl", + "cc_proto_support.bzl", + ], + visibility = ["//bazel:__subpackages__"], + deps = [ + ":toolchain_helpers_bzl", + "//bazel/common:proto_common_bzl", + "//bazel/common:proto_info_bzl", + "@proto_bazel_features//:features", + ], +) + bzl_library( name = "proto_toolchain_rule_bzl", srcs = [ @@ -75,9 +126,9 @@ bzl_library( ], visibility = ["//bazel:__subpackages__"], deps = [ + ":toolchain_helpers_bzl", "//bazel/common:proto_common_bzl", "//bazel/common:proto_lang_toolchain_info_bzl", - "//bazel/private:toolchain_helpers_bzl", ], ) @@ -131,10 +182,21 @@ native_bool_flag( visibility = ["//bazel:__subpackages__"], ) +bzl_library( + name = "native_bool_flag_bzl", + srcs = ["native_bool_flag.bzl"], + visibility = ["//visibility:private"], + deps = ["@bazel_skylib//rules:common_settings"], +) + filegroup( - name = "bazel_osx_p4deps", - srcs = glob(["**"]), - visibility = [ - "//bazel:__pkg__", + name = "for_bazel_tests", + testonly = True, + srcs = [ + "BUILD", + ":native_bool_flag_bzl", + "//bazel:for_bazel_tests", + "//bazel/private/toolchains:for_bazel_tests", ], + visibility = ["//visibility:public"], ) diff --git a/bazel/private/toolchains/BUILD.bazel b/bazel/private/toolchains/BUILD.bazel index b727a4a97590..b21e4627671f 100644 --- a/bazel/private/toolchains/BUILD.bazel +++ b/bazel/private/toolchains/BUILD.bazel @@ -72,3 +72,14 @@ toolchain( toolchain = "//java/lite:toolchain", toolchain_type = "@rules_java//java/proto:lite_toolchain_type", ) + +filegroup( + name = "for_bazel_tests", + testonly = True, + srcs = [ + "BUILD.bazel", + ], + visibility = [ + "//bazel/private:__pkg__", + ], +) diff --git a/bazel/toolchains/BUILD b/bazel/toolchains/BUILD index 6353a6544d2a..2f629a69e5fa 100644 --- a/bazel/toolchains/BUILD +++ b/bazel/toolchains/BUILD @@ -28,8 +28,13 @@ bzl_library( ) filegroup( - name = "bazel_osx_p4deps", - srcs = glob(["**"]), + name = "for_bazel_tests", + testonly = True, + srcs = [ + "BUILD", + "proto_lang_toolchain_bzl", + "proto_toolchain_bzl", + ], visibility = [ "//bazel:__pkg__", ],