Skip to content

Commit

Permalink
First round of adding visibility to our bzl files.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 638457470
Change-Id: Ifdcbe2ae77d240ce2e26c09826e09e9f78d1f68d
  • Loading branch information
timpeut authored and Copybara-Service committed May 29, 2024
1 parent 46531d4 commit e98ee9e
Show file tree
Hide file tree
Showing 93 changed files with 292 additions and 7 deletions.
5 changes: 5 additions & 0 deletions mobile_install/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bzl_library(
"//mobile_install/adapters:bzl",
"//rules:bzl",
"//rules:min_sdk_version_bzl",
"//rules:visibility_bzl",
"@rules_java//java/common",
],
)
Expand All @@ -55,6 +56,7 @@ bzl_library(
deps = [
"utils",
":providers",
"//rules:visibility_bzl",
],
)

Expand All @@ -69,6 +71,7 @@ bzl_library(
deps = [
":constants",
":utils",
"//rules:visibility_bzl",
],
)

Expand All @@ -78,6 +81,7 @@ bzl_library(
deps = [
":constants",
":utils",
"//rules:visibility_bzl",
"//rules/flags:bzl",
],
)
Expand All @@ -88,6 +92,7 @@ bzl_library(
deps = [
":constants",
"//rules:min_sdk_version_bzl",
"//rules:visibility_bzl",
"//rules/flags:bzl",
"@rules_java//java/common",
],
Expand Down
1 change: 1 addition & 0 deletions mobile_install/adapters/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ bzl_library(
"//mobile_install:resources",
"//mobile_install:transform",
"//mobile_install:utils",
"//rules:visibility_bzl",
"@rules_java//java/common",
],
)
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/aar_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ load(
load("//mobile_install:resources.bzl", "liteparse")
load("//mobile_install:transform.bzl", "dex")
load("//rules:java.bzl", _java = "java")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps", "exports"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/android_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ load(
)
load("//mobile_install:transform.bzl", "dex", "filter_jars")
load("//mobile_install:utils.bzl", "utils")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/flags:flags.bzl", "flags")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["_android_sdk", "deps", "resources", "instruments"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/android_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ load(
)
load("//mobile_install:resources.bzl", "get_assets_dir")
load("//mobile_install:transform.bzl", "dex", "filter_jars")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return [
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/android_sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
"""Rule adapter for android_sdk."""

load("//mobile_install:providers.bzl", "MIAndroidSdkInfo")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["aidl_lib"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/apk_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

load("//mobile_install:providers.bzl", "MIAppInfo")
load("//mobile_install:utils.bzl", "utils")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["unsigned_apk"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/java_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ load(
)
load("//mobile_install:transform.bzl", "dex", "extract_jar_resources")
load("//mobile_install:utils.bzl", "utils")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps", "exports"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/java_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ load(
"providers",
)
load("//mobile_install:transform.bzl", "dex", "extract_jar_resources")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps", "exports", "runtime_deps"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/java_lite_grpc_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@

load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "MIJavaResourcesInfo", "providers")
load("//mobile_install:transform.bzl", "dex", "extract_jar_resources")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps", "_toolchain"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/java_lite_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ propagate the deps, the proto_library rules.
"""

load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "MIJavaResourcesInfo", "providers")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps", "_aspect_proto_toolchain_for_javalite"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/java_rpc_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
"""Rule adapter for java_rpc_toolchain.bzl."""

load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "providers")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["runtime"] # all potential implicit runtime deps
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/proto_lang_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
"""Rule adapter for proto_lang_toolchain."""

load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "MIJavaResourcesInfo", "providers")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["runtime"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters/proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@

load("//mobile_install:providers.bzl", "MIAndroidDexInfo", "providers")
load("//mobile_install:transform.bzl", "dex")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load(":base.bzl", "make_adapter")

visibility(PROJECT_VISIBILITY)

def _aspect_attrs():
"""Attrs of the rule requiring traversal by the aspect."""
return ["deps"]
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/adapters_base.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ load("//mobile_install/adapters:java_library.bzl", "java_library")
load("//mobile_install/adapters:java_lite_proto_library.bzl", "java_lite_proto_library")
load("//mobile_install/adapters:proto_lang_toolchain.bzl", "proto_lang_toolchain")
load("//mobile_install/adapters:proto_library.bzl", "proto_library")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")

visibility(PROJECT_VISIBILITY)

# Visible for testing
ADAPTERS = dict(
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/apks.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
"""Creates the apk(s)."""

load("//rules:utils.bzl", "get_android_sdk")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

def _compile_android_manifest(ctx, manifest, resources_zip, out_manifest):
"""Compile AndroidManifest.xml."""
android_jar = get_android_sdk(ctx).android_jar
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/launcher_direct.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
# limitations under the License.
"""Creates the app launcher scripts."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/flags:flags.bzl", "flags")
load(":deploy_info.bzl", "make_deploy_info_pb")
load(":providers.bzl", "MIAppLaunchInfo")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

HOST_TEST_WORKSPACE = "host_test_runner_workspace"

_DEPLOY_SCRIPT = '''#!/bin/bash
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/mi.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@

load("//rules:min_sdk_version.bzl", "min_sdk_version")
load("//rules:utils.bzl", "ANDROID_SDK_TOOLCHAIN_TYPE")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
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")

visibility(PROJECT_VISIBILITY)

def aspect_impl(target, ctx):
"""Calls the adapter for a given rule and returns its providers.
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/native_libs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
# limitations under the License.
"Creates the zip with the app native libraries."

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

def make_native_zip(ctx, native_libs, aar_native_libs, sibling):
"""Creates a zip file containing all of the application native libraries."""
input = []
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/process.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
# limitations under the License.
"""Processes the target or collected data."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":apks.bzl", "make_split_apks")
load(":native_libs.bzl", "make_native_zip", "make_swigdeps_file")
load(":providers.bzl", "MIAppInfo")
load(":r_java.bzl", "make_r")
load(":transform.bzl", "merge_dex_shards")

visibility(PROJECT_VISIBILITY)

def process(
ctx,
merged_manifest,
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/r_java.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
# limitations under the License.
"""Methods to create and process R.java."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@rules_java//java/common:java_common.bzl", "java_common")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

def _make_r_java(ctx, resource_src_jar, main_r_java, out_r_java):
"""Remove final qualifieres from R.java."""

Expand Down
3 changes: 3 additions & 0 deletions mobile_install/resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
# limitations under the License.
"""Methods to process Android resources."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":constants.bzl", "constants")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

# Android resource types, see https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/tools/aapt2/Resource.h
res_types = [
"anim",
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/tools.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
# limitations under the License.
"""Tools needed by the mobile-install aspect defined as aspect attributes."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":dependency_map.bzl", "versioned_deps")

visibility(PROJECT_VISIBILITY)

TOOL_ATTRS = dict(
# Target Attrs
# This library should not be versioned. It needs to be built with the same
Expand Down
3 changes: 3 additions & 0 deletions mobile_install/transform.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# limitations under the License.
"""Transform contains data transformation methods."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/flags:flags.bzl", _flags = "flags")
load(":constants.bzl", "constants")
load(":utils.bzl", "utils")

visibility(PROJECT_VISIBILITY)

def _declare_file(ctx, filename, sibling = None):
return utils.isolated_declare_file(ctx, filename, sibling = sibling)

Expand Down
3 changes: 3 additions & 0 deletions mobile_install/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
"""Utilities for by the Mobile-Install aspect."""

load("//rules:min_sdk_version.bzl", _min_sdk_version = "min_sdk_version")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/flags:flags.bzl", "flags")
load("@rules_java//java/common:java_common.bzl", "java_common")
load(":constants.bzl", "constants")

visibility(PROJECT_VISIBILITY)

_PACKAGE_NAME_EXTRACTION_SCRIPT = """
#!/bin/bash
set -e # exit on failure
Expand Down
Loading

0 comments on commit e98ee9e

Please sign in to comment.