Skip to content

Commit 7d8d804

Browse files
committed
more fixes
1 parent 1c4a783 commit 7d8d804

27 files changed

Lines changed: 117 additions & 40 deletions

File tree

mobile_install/apks.bzl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,26 @@ def make_split_apks(
106106
key_rotation_min_sdk,
107107
zipalign_alignment,
108108
sibling):
109-
"""Create a split for each dex and for resources"""
109+
"""Create a split for each dex and for resources.
110+
111+
Args:
112+
ctx: The context.
113+
manifest: The merged AndroidManifest.xml.
114+
r_dex: The generated R dex artifact.
115+
dexes: A list of dex artifacts to package as splits.
116+
resource_apk: The resource APK.
117+
jar_resources: Java resource jars to package.
118+
native_zips: Native library zips to package.
119+
swigdeps_file: A generated SWIG deps file.
120+
debug_signing_keys: Debug keystores used to sign APKs.
121+
debug_signing_lineage_file: File containing the signing lineage.
122+
key_rotation_min_sdk: Minimum API level to rotate signing keys for.
123+
zipalign_alignment: Zip alignment used before signing.
124+
sibling: The file used to root generated outputs.
125+
126+
Returns:
127+
A tuple of the manifest package-name file and the generated split APKs.
128+
"""
110129
manifest_package_name = utils.isolated_declare_file(ctx, "manifest_package_name.txt", sibling = sibling)
111130
manifests = {}
112131
artifacts = {}

mobile_install/mi.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def make_aspect(
5757
dex_shards: Number of dex shards to split the project across.
5858
is_cmd: A Boolean, when True the aspect is running in the context of the
5959
mobile-install command. If False it is as a rule (e.g. mi_test).
60+
is_test: Whether the aspect is running for a test rule.
6061
res_shards: Number of Android resource shards during processing.
62+
tools: Tool attributes to attach to the aspect.
6163
Returns:
6264
A configured aspect.
6365
"""

mobile_install/process.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def process(
5858
debug_signing_keys: Debug keystores to be used to sign the apk.
5959
debug_signing_lineage_file: File containing the signing lineage.
6060
key_rotation_min_sdk: String of the minimum API level to rotate signing keys for.
61+
zipalign_alignment: Zip alignment used before signing.
6162
apk: The generated apk for the app.
6263
sibling: The path to the launcher file.
6364

mobile_install/resources.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ res_types = [
5151
]
5252

5353
def get_assets_dir(asset, base_dir):
54-
"""Build the full assets directory sanitizing the input first."""
54+
"""Build the full assets directory sanitizing the input first.
55+
56+
Args:
57+
asset: The asset file or directory.
58+
base_dir: The base assets directory.
59+
60+
Returns:
61+
The sanitized assets directory path.
62+
"""
5563
if base_dir == "":
5664
# some targets specify assets files and set assets_dirs = ""
5765
return asset.dirname

mobile_install/transform.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def merge_dex_shards(ctx, data, sibling):
131131
action per shard that runs dex_shard_merger on all dex files within that
132132
shard.
133133
134-
Arguments:
134+
Args:
135135
ctx: The context.
136136
data: A list of lists, where the inner list contains dex shards.
137137
sibling: A file used to root the merged_dex shards.

prereqs.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ load("//bzlmod_extensions:apksig.bzl", _apksig_archive = "apksig")
1919
load("//bzlmod_extensions:com_android_dex.bzl", _com_android_dex_archive = "com_android_dex")
2020

2121
def rules_android_prereqs(dev_mode = False):
22-
"""Downloads prerequisite repositories for rules_android."""
22+
"""Downloads prerequisite repositories for rules_android.
23+
24+
Args:
25+
dev_mode: Whether to include development dependencies.
26+
"""
2327

2428
maybe(
2529
http_archive,

providers/providers.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ InstrumentedAppInfo = provider(
125125
)
126126

127127
FailureInfo = provider(
128+
doc = "Provides failure information.",
128129
fields = dict(
129130
error = "Error message",
130131
),

rules/acls.bzl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,21 @@ BYTECODE_TRANSFORMERS_DICT = make_dict(BYTECODE_TRANSFORMERS)
302302
AAR_IMPORT_PROPAGATE_NATIVE_LIBS_FALLBACK_DICT = make_dict(AAR_IMPORT_PROPAGATE_NATIVE_LIBS_FALLBACK)
303303

304304
def matches(fqn, dct):
305+
"""Returns whether a fully qualified label matches an ACL dictionary.
306+
307+
Args:
308+
fqn: The fully qualified label to match.
309+
dct: The ACL dictionary.
310+
311+
Returns:
312+
True if the label matches the ACL dictionary.
313+
"""
314+
305315
# Labels with workspace names ("@workspace//pkg:target") are not supported.
306316
# For now, default external dependency ACLs to True to enable rollout features for all
307317
# external users. See https://github.com/bazelbuild/rules_android/issues/68
308318
# Note that this only affects Bazel builds with OSS rules_android.
309-
if fqn.startswith("@") and not fqn.startswith("@//") and not fqn.startswith("@@//"):
319+
if fqn.startswith("@") and not fqn.startswith("@//") and not fqn.startswith("@@//"): # buildifier: disable=canonical-repository
310320
return True
311321

312322
# "@//" is the same as the main workspace. It's not completely accurate to treat these as
@@ -317,7 +327,7 @@ def matches(fqn, dct):
317327
fqn = fqn[1:]
318328

319329
# "@@//" refers to the canonical name of the main repository.
320-
if fqn.startswith("@@//"):
330+
if fqn.startswith("@@//"): # buildifier: disable=canonical-repository
321331
fqn = fqn[2:]
322332

323333
if not fqn.startswith("//"):

rules/android_application/android_feature_module_rule.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ android_feature_module = rule(
9191
_skylark_testable = True,
9292
)
9393

94+
# buildifier: disable=unnamed-macro
9495
def get_feature_module_paths(fqn):
9596
# Given a fqn to an android_feature_module, returns the absolute paths to
9697
# all implicitly generated targets

rules/android_binary/impl.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _base_validations_processor(ctx, **_unused_ctxs):
7373
),
7474
)
7575

76-
def _process_manifest(ctx, **unused_ctxs):
76+
def _process_manifest(ctx, **_unused_ctxs):
7777
manifest_ctx = _resources.bump_min_sdk(
7878
ctx,
7979
manifest = ctx.file.manifest,
@@ -86,7 +86,7 @@ def _process_manifest(ctx, **unused_ctxs):
8686
value = manifest_ctx,
8787
)
8888

89-
def _process_resources(ctx, manifest_ctx, java_package, **unused_ctxs):
89+
def _process_resources(ctx, manifest_ctx, java_package, **_unused_ctxs):
9090
resource_apks = []
9191
for apk in utils.collect_providers(StarlarkApkInfo, ctx.attr.resource_apks):
9292
resource_apks.append(apk.signed_apk)
@@ -130,7 +130,7 @@ def _process_resources(ctx, manifest_ctx, java_package, **unused_ctxs):
130130
value = packaged_resources_ctx,
131131
)
132132

133-
def _validate_manifest(ctx, packaged_resources_ctx, manifest_ctx, **unused_ctxs):
133+
def _validate_manifest(ctx, packaged_resources_ctx, manifest_ctx, **_unused_ctxs):
134134
validation_outputs = []
135135

136136
manifest_validation_output = _resources.validate_manifest(
@@ -250,7 +250,7 @@ def _process_jvm(ctx, db_ctx, packaged_resources_ctx, proto_ctx, stamp_ctx, **_u
250250
),
251251
)
252252

253-
def _process_build_info(_unused_ctx, **unused_ctxs):
253+
def _process_build_info(_unused_ctx, **_unused_ctxs):
254254
return ProviderInfo(
255255
name = "build_info_ctx",
256256
value = struct(

0 commit comments

Comments
 (0)