Skip to content

Commit

Permalink
Prepare supporting targets for testing
Browse files Browse the repository at this point in the history
Rename bazel_osx_p4deps to for_bazel_tests. The name was used in the past.
Fix all bzl_libraries to have the correct set of dependencies.
Cleanup for_bazel_tests to include BUILD file and public bzl_libraries in the package.

PiperOrigin-RevId: 684713554
  • Loading branch information
protobuf-github-bot authored and comius committed Oct 15, 2024
1 parent 59511be commit a748b10
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 13 deletions.
23 changes: 23 additions & 0 deletions bazel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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__"],
)
13 changes: 9 additions & 4 deletions bazel/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down Expand Up @@ -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__"],
)
76 changes: 69 additions & 7 deletions bazel/private/BUILD
Original file line number Diff line number Diff line change
@@ -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"])

Expand Down Expand Up @@ -52,32 +52,83 @@ 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 = [
"bazel_proto_library_rule.bzl",
],
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 = [
"proto_toolchain_rule.bzl",
],
visibility = ["//bazel:__subpackages__"],
deps = [
":toolchain_helpers_bzl",
"//bazel/common:proto_common_bzl",
"//bazel/common:proto_lang_toolchain_info_bzl",
"//bazel/private:toolchain_helpers_bzl",
],
)

Expand Down Expand Up @@ -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"],
)
11 changes: 11 additions & 0 deletions bazel/private/toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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__",
],
)
9 changes: 7 additions & 2 deletions bazel/toolchains/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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__",
],
Expand Down

0 comments on commit a748b10

Please sign in to comment.