From ac2386d1c760c970a7c5df7745923c3e37f3dfba Mon Sep 17 00:00:00 2001 From: A Googler Date: Fri, 12 Apr 2024 08:08:04 -0700 Subject: [PATCH] Add `load()` statements for the Bazel builtin top-level java symbols Loads are being added in preparation for moving the symbols out of Bazel and into `rules_java`. PiperOrigin-RevId: 624181985 Change-Id: I503f2dce02bef4e8031ef69368614d91cdd1b623 --- MODULE.bazel | 2 +- mobile_install/BUILD | 2 ++ mobile_install/adapters/BUILD | 1 + mobile_install/adapters/aar_import.bzl | 1 + mobile_install/adapters/android_binary.bzl | 1 + mobile_install/adapters/android_library.bzl | 1 + mobile_install/adapters/java_import.bzl | 1 + mobile_install/adapters/java_library.bzl | 1 + mobile_install/adapters/java_lite_grpc_library.bzl | 1 + mobile_install/adapters/proto_library.bzl | 1 + mobile_install/mi.bzl | 1 + mobile_install/r_java.bzl | 1 + mobile_install/utils.bzl | 1 + prereqs.bzl | 4 ++-- rules/aar_import/attrs.bzl | 1 + rules/aar_import/impl.bzl | 2 ++ rules/aar_import/rule.bzl | 1 + rules/android_application/android_application_rule.bzl | 1 + rules/android_binary.bzl | 1 + rules/android_binary_internal/attrs.bzl | 1 + rules/android_binary_internal/impl.bzl | 3 +++ rules/android_library/attrs.bzl | 2 ++ rules/android_library/impl.bzl | 2 ++ rules/android_library/rule.bzl | 1 + rules/android_local_test/BUILD | 1 + rules/android_local_test/attrs.bzl | 2 ++ rules/android_local_test/impl.bzl | 3 +++ rules/android_neverlink_aspect.bzl | 1 + rules/android_sdk.bzl | 1 + rules/attrs.bzl | 1 + rules/bundletool.bzl | 1 + rules/common.bzl | 2 ++ rules/dex_desugar_aspect.bzl | 1 + rules/java.bzl | 1 + rules/native_deps.bzl | 1 + rules/resources.bzl | 2 ++ test/rules/android_local_test/BUILD | 3 +++ test/rules/android_local_test/test.bzl | 1 + test/utils/BUILD | 1 + 39 files changed, 53 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 34e1c5577..6c1998a11 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,7 +5,7 @@ module( bazel_dep(name = "platforms", version = "0.0.5") bazel_dep(name = "rules_license", version = "0.0.4") -bazel_dep(name = "rules_java", version = "7.4.0") +bazel_dep(name = "rules_java", version = "7.5.0") bazel_dep(name = "stardoc", version = "0.6.2") rules_java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains") diff --git a/mobile_install/BUILD b/mobile_install/BUILD index 2008e8f8d..8ea8e4ba1 100644 --- a/mobile_install/BUILD +++ b/mobile_install/BUILD @@ -40,6 +40,7 @@ bzl_library( "//mobile_install/adapters:bzl", "//rules:bzl", "//rules:min_sdk_version_bzl", + "@rules_java//java/common", ], ) @@ -88,5 +89,6 @@ bzl_library( ":constants", "//rules:min_sdk_version_bzl", "//rules/flags:bzl", + "@rules_java//java/common", ], ) diff --git a/mobile_install/adapters/BUILD b/mobile_install/adapters/BUILD index f149d52a0..3431b91af 100644 --- a/mobile_install/adapters/BUILD +++ b/mobile_install/adapters/BUILD @@ -17,6 +17,7 @@ bzl_library( "//mobile_install:resources", "//mobile_install:transform", "//mobile_install:utils", + "@rules_java//java/common", ], ) diff --git a/mobile_install/adapters/aar_import.bzl b/mobile_install/adapters/aar_import.bzl index b36bbe5cf..a0fe116d3 100644 --- a/mobile_install/adapters/aar_import.bzl +++ b/mobile_install/adapters/aar_import.bzl @@ -24,6 +24,7 @@ load( load("//mobile_install:resources.bzl", "liteparse") load("//mobile_install:transform.bzl", "dex") load("//rules:java.bzl", _java = "java") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/android_binary.bzl b/mobile_install/adapters/android_binary.bzl index 5a2303f6f..660e749d9 100644 --- a/mobile_install/adapters/android_binary.bzl +++ b/mobile_install/adapters/android_binary.bzl @@ -26,6 +26,7 @@ load( load("//mobile_install:transform.bzl", "dex", "filter_jars") load("//mobile_install:utils.bzl", "utils") load("//rules/flags:flags.bzl", "flags") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/android_library.bzl b/mobile_install/adapters/android_library.bzl index e95100efd..7e2ab3e6e 100644 --- a/mobile_install/adapters/android_library.bzl +++ b/mobile_install/adapters/android_library.bzl @@ -25,6 +25,7 @@ load( ) load("//mobile_install:resources.bzl", "get_assets_dir") load("//mobile_install:transform.bzl", "dex", "filter_jars") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/java_import.bzl b/mobile_install/adapters/java_import.bzl index a04cc73c8..578667a59 100644 --- a/mobile_install/adapters/java_import.bzl +++ b/mobile_install/adapters/java_import.bzl @@ -21,6 +21,7 @@ load( ) load("//mobile_install:transform.bzl", "dex", "extract_jar_resources") load("//mobile_install:utils.bzl", "utils") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/java_library.bzl b/mobile_install/adapters/java_library.bzl index fdcb4381a..50249f5ca 100644 --- a/mobile_install/adapters/java_library.bzl +++ b/mobile_install/adapters/java_library.bzl @@ -20,6 +20,7 @@ load( "providers", ) load("//mobile_install:transform.bzl", "dex", "extract_jar_resources") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/java_lite_grpc_library.bzl b/mobile_install/adapters/java_lite_grpc_library.bzl index c613b00f7..0c8eb37d8 100644 --- a/mobile_install/adapters/java_lite_grpc_library.bzl +++ b/mobile_install/adapters/java_lite_grpc_library.bzl @@ -15,6 +15,7 @@ load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "MIJavaResourcesInfo", "providers") load("//mobile_install:transform.bzl", "dex", "extract_jar_resources") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/adapters/proto_library.bzl b/mobile_install/adapters/proto_library.bzl index 8fc5b9be8..c98fda896 100644 --- a/mobile_install/adapters/proto_library.bzl +++ b/mobile_install/adapters/proto_library.bzl @@ -15,6 +15,7 @@ load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "providers") load("//mobile_install:transform.bzl", "dex") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":base.bzl", "make_adapter") def _aspect_attrs(): diff --git a/mobile_install/mi.bzl b/mobile_install/mi.bzl index 6c51c7f00..2a1fc8e36 100644 --- a/mobile_install/mi.bzl +++ b/mobile_install/mi.bzl @@ -16,6 +16,7 @@ load("//rules:min_sdk_version.bzl", "min_sdk_version") load("//rules:utils.bzl", "ANDROID_SDK_TOOLCHAIN_TYPE") load("//rules/flags:flags.bzl", "flags") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":adapters.bzl", "adapters") load(":debug.bzl", "debug") load(":tools.bzl", "TOOL_ATTRS") diff --git a/mobile_install/r_java.bzl b/mobile_install/r_java.bzl index f97660f94..c15014657 100644 --- a/mobile_install/r_java.bzl +++ b/mobile_install/r_java.bzl @@ -13,6 +13,7 @@ # limitations under the License. """Methods to create and process R.java.""" +load("@rules_java//java/common:java_common.bzl", "java_common") load(":utils.bzl", "utils") def _make_r_java(ctx, resource_src_jar, main_r_java, out_r_java): diff --git a/mobile_install/utils.bzl b/mobile_install/utils.bzl index d8cc712f7..630801318 100644 --- a/mobile_install/utils.bzl +++ b/mobile_install/utils.bzl @@ -15,6 +15,7 @@ load("//rules:min_sdk_version.bzl", _min_sdk_version = "min_sdk_version") load("//rules/flags:flags.bzl", "flags") +load("@rules_java//java/common:java_common.bzl", "java_common") load(":constants.bzl", "constants") _PACKAGE_NAME_EXTRACTION_SCRIPT = """ diff --git a/prereqs.bzl b/prereqs.bzl index 12db2e34b..47441d9b6 100644 --- a/prereqs.bzl +++ b/prereqs.bzl @@ -24,9 +24,9 @@ def rules_android_prereqs(dev_mode = False): http_archive, name = "rules_java", urls = [ - "https://github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz", + "https://github.com/bazelbuild/rules_java/releases/download/7.5.0/rules_java-7.5.0.tar.gz", ], - sha256 = "976ef08b49c929741f201790e59e3807c72ad81f428c8bc953cdbeff5fed15eb", + sha256 = "4da3761f6855ad916568e2bfe86213ba6d2637f56b8360538a7fb6125abf6518", ) maybe( diff --git a/rules/aar_import/attrs.bzl b/rules/aar_import/attrs.bzl index a6ff2d48b..84a1dcb65 100644 --- a/rules/aar_import/attrs.bzl +++ b/rules/aar_import/attrs.bzl @@ -18,6 +18,7 @@ load( "//rules:attrs.bzl", _attrs = "attrs", ) +load("@rules_java//java/common:java_info.bzl", "JavaInfo") ATTRS = _attrs.add( dict( diff --git a/rules/aar_import/impl.bzl b/rules/aar_import/impl.bzl index 5f2d72a9e..8ca4c3c7e 100644 --- a/rules/aar_import/impl.bzl +++ b/rules/aar_import/impl.bzl @@ -39,6 +39,8 @@ load( _get_android_toolchain = "get_android_toolchain", _utils = "utils", ) +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") RULE_PREFIX = "_aar" ANDROID_MANIFEST = "AndroidManifest.xml" diff --git a/rules/aar_import/rule.bzl b/rules/aar_import/rule.bzl index dddee69df..7ad421cca 100644 --- a/rules/aar_import/rule.bzl +++ b/rules/aar_import/rule.bzl @@ -18,6 +18,7 @@ load( "//rules:utils.bzl", "ANDROID_SDK_TOOLCHAIN_TYPE", ) +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":attrs.bzl", _ATTRS = "ATTRS") load(":impl.bzl", _impl = "impl") diff --git a/rules/android_application/android_application_rule.bzl b/rules/android_application/android_application_rule.bzl index 578a07507..98b1777bc 100644 --- a/rules/android_application/android_application_rule.bzl +++ b/rules/android_application/android_application_rule.bzl @@ -58,6 +58,7 @@ load( "AndroidArchivedSandboxedSdkInfo", "AndroidSandboxedSdkBundleInfo", ) +load("@rules_java//java/common:java_common.bzl", "java_common") load(":android_feature_module_rule.bzl", "get_feature_module_paths") load(":attrs.bzl", "ANDROID_APPLICATION_ATTRS") diff --git a/rules/android_binary.bzl b/rules/android_binary.bzl index 441aacff6..74918e3b5 100644 --- a/rules/android_binary.bzl +++ b/rules/android_binary.bzl @@ -26,6 +26,7 @@ load( "android_binary_internal_macro", "sanitize_attrs", ) +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":common.bzl", "common") load(":migration_tag_DONOTUSE.bzl", "add_migration_tag") load(":proguard.bzl", "proguard") diff --git a/rules/android_binary_internal/attrs.bzl b/rules/android_binary_internal/attrs.bzl index c398de725..2f966a9b1 100644 --- a/rules/android_binary_internal/attrs.bzl +++ b/rules/android_binary_internal/attrs.bzl @@ -26,6 +26,7 @@ load( "split_config_aspect", ) load("//rules:providers.bzl", "StarlarkApkInfo") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") def make_deps(allow_rules, providers, aspects): return attr.label_list( diff --git a/rules/android_binary_internal/impl.bzl b/rules/android_binary_internal/impl.bzl index 0864eec53..1ead28a1d 100644 --- a/rules/android_binary_internal/impl.bzl +++ b/rules/android_binary_internal/impl.bzl @@ -45,6 +45,9 @@ load( "get_android_toolchain", "utils", ) +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") +load("@rules_java//java/common:java_plugin_info.bzl", "JavaPluginInfo") load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") load(":r8.bzl", "process_r8", "process_resource_shrinking_r8") diff --git a/rules/android_library/attrs.bzl b/rules/android_library/attrs.bzl index ff7e9c19b..db6827f10 100644 --- a/rules/android_library/attrs.bzl +++ b/rules/android_library/attrs.bzl @@ -19,6 +19,8 @@ load( _attrs = "attrs", ) load("//rules:providers.bzl", "StarlarkApkInfo") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") +load("@rules_java//java/common:java_plugin_info.bzl", "JavaPluginInfo") ATTRS = _attrs.add( dict( diff --git a/rules/android_library/impl.bzl b/rules/android_library/impl.bzl index e9f00a8ef..ba0980a88 100644 --- a/rules/android_library/impl.bzl +++ b/rules/android_library/impl.bzl @@ -31,6 +31,8 @@ load("//rules:providers.bzl", "AndroidLintRulesInfo", "StarlarkApkInfo") load("//rules:resources.bzl", _resources = "resources") load("//rules:utils.bzl", "get_android_sdk", "get_android_toolchain", "log", "utils") load("//rules/flags:flags.bzl", _flags = "flags") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") +load("@rules_java//java/common:java_plugin_info.bzl", "JavaPluginInfo") _USES_DEPRECATED_IMPLICIT_EXPORT_ERROR = ( "Setting `deps` without `srcs` or `resource_files` is not supported. Consider using " + diff --git a/rules/android_library/rule.bzl b/rules/android_library/rule.bzl index 324ee2729..20122f097 100644 --- a/rules/android_library/rule.bzl +++ b/rules/android_library/rule.bzl @@ -19,6 +19,7 @@ load( "//rules:attrs.bzl", _attrs = "attrs", ) +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":attrs.bzl", _ATTRS = "ATTRS") load(":impl.bzl", _impl = "impl") diff --git a/rules/android_local_test/BUILD b/rules/android_local_test/BUILD index 52f4637db..ada4380e1 100644 --- a/rules/android_local_test/BUILD +++ b/rules/android_local_test/BUILD @@ -23,6 +23,7 @@ bzl_library( deps = [ "//rules:common_bzl", "//rules/flags:bzl", + "@rules_java//java/common", "@bazel_skylib//rules:common_settings", ], ) diff --git a/rules/android_local_test/attrs.bzl b/rules/android_local_test/attrs.bzl index 66e369bfd..f9648749e 100644 --- a/rules/android_local_test/attrs.bzl +++ b/rules/android_local_test/attrs.bzl @@ -18,6 +18,8 @@ load( "//rules:attrs.bzl", _attrs = "attrs", ) +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") def make_attrs(additional_aspects = [], native_libs_transition = None): return _attrs.add( diff --git a/rules/android_local_test/impl.bzl b/rules/android_local_test/impl.bzl index 16738107d..d21e723b2 100644 --- a/rules/android_local_test/impl.bzl +++ b/rules/android_local_test/impl.bzl @@ -33,6 +33,9 @@ load( "log", "utils", ) +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") +load("@rules_java//java/common:java_plugin_info.bzl", "JavaPluginInfo") load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") JACOCOCO_CLASS = "com.google.testing.coverage.JacocoCoverageRunner" diff --git a/rules/android_neverlink_aspect.bzl b/rules/android_neverlink_aspect.bzl index 1dab304d8..5daa10023 100644 --- a/rules/android_neverlink_aspect.bzl +++ b/rules/android_neverlink_aspect.bzl @@ -22,6 +22,7 @@ load( "//rules:utils.bzl", "utils", ) +load("@rules_java//java/common:java_info.bzl", "JavaInfo") StarlarkAndroidNeverlinkInfo = provider( doc = "Contains all neverlink libraries in the transitive closure.", diff --git a/rules/android_sdk.bzl b/rules/android_sdk.bzl index e5e1fa7c8..fcf021af5 100644 --- a/rules/android_sdk.bzl +++ b/rules/android_sdk.bzl @@ -14,6 +14,7 @@ """Bazel rule for Android sdk.""" +load("@rules_java//java/common:java_common.bzl", "java_common") load(":attrs.bzl", "ANDROID_SDK_ATTRS") def _impl(ctx): diff --git a/rules/attrs.bzl b/rules/attrs.bzl index bc166af4a..8b4d578a4 100644 --- a/rules/attrs.bzl +++ b/rules/attrs.bzl @@ -15,6 +15,7 @@ """Common attributes for Android rules.""" load("//rules:android_split_transition.bzl", "android_transition") +load("@rules_java//java/common:java_plugin_info.bzl", "JavaPluginInfo") load(":native_toolchain_attrs.bzl", "ANDROID_SDK_TOOLCHAIN_TYPE_DEFAULT") load(":utils.bzl", "log") diff --git a/rules/bundletool.bzl b/rules/bundletool.bzl index 3765b817c..94aff3922 100644 --- a/rules/bundletool.bzl +++ b/rules/bundletool.bzl @@ -18,6 +18,7 @@ load( "//rules:utils.bzl", "ANDROID_TOOLCHAIN_TYPE", ) +load("@rules_java//java/common:java_common.bzl", "java_common") load("@bazel_skylib//lib:paths.bzl", "paths") load(":common.bzl", _common = "common") load(":java.bzl", _java = "java") diff --git a/rules/common.bzl b/rules/common.bzl index e957bccf8..ffa67a6f0 100644 --- a/rules/common.bzl +++ b/rules/common.bzl @@ -15,6 +15,8 @@ """Bazel common library for the Android rules.""" load("//rules/android_common:reexport_android_common.bzl", _native_android_common = "native_android_common") +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":utils.bzl", "ANDROID_TOOLCHAIN_TYPE", "get_android_toolchain", _log = "log") # Suffix attached to the Starlark portion of android_binary target diff --git a/rules/dex_desugar_aspect.bzl b/rules/dex_desugar_aspect.bzl index c4ce16330..3e4307736 100644 --- a/rules/dex_desugar_aspect.bzl +++ b/rules/dex_desugar_aspect.bzl @@ -14,6 +14,7 @@ """Aspect that transitively build .dex archives and desugar jars.""" +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load(":attrs.bzl", _attrs = "attrs") load(":desugar.bzl", _desugar = "desugar") load(":dex.bzl", _dex = "dex") diff --git a/rules/java.bzl b/rules/java.bzl index 53e860c1c..4051c9af0 100644 --- a/rules/java.bzl +++ b/rules/java.bzl @@ -14,6 +14,7 @@ """Bazel Java APIs for the Android rules.""" +load("@rules_java//java/common:java_common.bzl", "java_common") load(":path.bzl", _path = "path") load(":utils.bzl", "log") diff --git a/rules/native_deps.bzl b/rules/native_deps.bzl index 6b7298fc4..59b24879f 100644 --- a/rules/native_deps.bzl +++ b/rules/native_deps.bzl @@ -18,6 +18,7 @@ of split deps """ load("//rules:common.bzl", "common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load("@bazel_skylib//lib:paths.bzl", "paths") SplitConfigInfo = provider( diff --git a/rules/resources.bzl b/rules/resources.bzl index 436337c65..fe6ab25e0 100644 --- a/rules/resources.bzl +++ b/rules/resources.bzl @@ -16,6 +16,8 @@ load("//rules:acls.bzl", "acls") load("//rules:min_sdk_version.bzl", _min_sdk_version = "min_sdk_version") +load("@rules_java//java/common:java_common.bzl", "java_common") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") load(":attrs.bzl", _attrs = "attrs") load(":busybox.bzl", _busybox = "busybox") diff --git a/test/rules/android_local_test/BUILD b/test/rules/android_local_test/BUILD index 4374760d0..ff0d41b7a 100644 --- a/test/rules/android_local_test/BUILD +++ b/test/rules/android_local_test/BUILD @@ -19,6 +19,9 @@ bzl_library( name = "bzl", srcs = glob(["*.bzl"]), visibility = ["//visibility:private"], + deps = [ + "@rules_java//java/common", + ], ) android_local_test( diff --git a/test/rules/android_local_test/test.bzl b/test/rules/android_local_test/test.bzl index 5b1677e3b..80fac45ba 100644 --- a/test/rules/android_local_test/test.bzl +++ b/test/rules/android_local_test/test.bzl @@ -19,6 +19,7 @@ rule_test: Inspect and assert on rule providers. load("//rules:providers.bzl", "AndroidFilteredJdepsInfo") load("//test/utils:asserts.bzl", "asserts") +load("@rules_java//java/common:java_info.bzl", "JavaInfo") VALIDATION = "_validation" diff --git a/test/utils/BUILD b/test/utils/BUILD index a774f3a27..6511e2c52 100644 --- a/test/utils/BUILD +++ b/test/utils/BUILD @@ -29,5 +29,6 @@ bzl_library( ], deps = [ "@rules_java//java:core_rules", + "@bazel_skylib//lib:unittest", ], )