From e40342e2f929ca44f3401e54ff298e7b822fd010 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 12 Sep 2024 04:34:23 -0700 Subject: [PATCH] Add missing `bzl_library` and test filegroups PiperOrigin-RevId: 673788851 Change-Id: Ibe81809a76f0f038f022d50aa42ec359aa734594 --- java/bazel/BUILD.bazel | 6 +++++ java/bazel/common/BUILD.bazel | 6 +++++ java/bazel/common/empty.bzl | 1 + java/common/BUILD | 1 + java/common/rules/BUILD | 48 +++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 java/bazel/common/BUILD.bazel create mode 100644 java/bazel/common/empty.bzl diff --git a/java/bazel/BUILD.bazel b/java/bazel/BUILD.bazel index 1db01d36..c3abda26 100644 --- a/java/bazel/BUILD.bazel +++ b/java/bazel/BUILD.bazel @@ -53,3 +53,9 @@ done <<< '{configs}' >> $@ ], visibility = ["//visibility:private"], ) + +filegroup( + name = "for_bazel_tests", + testonly = 1, + visibility = ["//java:__pkg__"], +) diff --git a/java/bazel/common/BUILD.bazel b/java/bazel/common/BUILD.bazel new file mode 100644 index 00000000..c0237707 --- /dev/null +++ b/java/bazel/common/BUILD.bazel @@ -0,0 +1,6 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + +bzl_library( + name = "common", + srcs = glob(["*.bzl"]), +) diff --git a/java/bazel/common/empty.bzl b/java/bazel/common/empty.bzl new file mode 100644 index 00000000..c40e750a --- /dev/null +++ b/java/bazel/common/empty.bzl @@ -0,0 +1 @@ +"""Placeholder for glob""" diff --git a/java/common/BUILD b/java/common/BUILD index e8b08c0e..d8f22f7b 100644 --- a/java/common/BUILD +++ b/java/common/BUILD @@ -25,6 +25,7 @@ filegroup( srcs = [ "BUILD", ":common", + "//java/common/rules:for_bazel_tests", ], visibility = ["//java:__pkg__"], ) diff --git a/java/common/rules/BUILD b/java/common/rules/BUILD index 5031de89..5bbc94ed 100644 --- a/java/common/rules/BUILD +++ b/java/common/rules/BUILD @@ -1,3 +1,5 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + package(default_visibility = ["//visibility:public"]) filegroup( @@ -7,3 +9,49 @@ filegroup( ], visibility = ["//java/common:__pkg__"], ) + +bzl_library( + name = "android_lint_bzl", + srcs = ["android_lint.bzl"], + visibility = ["//visibility:private"], +) + +bzl_library( + name = "rule_util_bzl", + srcs = ["rule_util.bzl"], + visibility = ["//visibility:private"], +) + +bzl_library( + name = "core_rules", + srcs = [ + "basic_java_library.bzl", + "java_binary.bzl", + "java_binary_wrapper.bzl", + "java_import.bzl", + "java_library.bzl", + "java_plugin.bzl", + "java_toolchain.bzl", + ], + visibility = [ + "//java:__pkg__", + ], + deps = [ + ":android_lint_bzl", + ":rule_util_bzl", + # TODO: re-enable after rules_cc release + # "@rules_cc//cc/common", + "//java/common", + "@bazel_skylib//lib:paths", + ], +) + +filegroup( + name = "for_bazel_tests", + testonly = 1, + srcs = [ + "BUILD", + ":core_rules", + ], + visibility = ["//java/common:__pkg__"], +)