Skip to content

Commit 2b33255

Browse files
committed
more fixes
1 parent a36ea52 commit 2b33255

33 files changed

Lines changed: 162 additions & 59 deletions

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/aar_import/impl.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ ANDROID_MANIFEST = "AndroidManifest.xml"
5252
LINT_JAR = "lint.jar"
5353

5454
# Resources context dict fields.
55-
_PROVIDERS = "providers"
56-
_VALIDATION_RESULTS = "validation_results"
55+
_PROVIDERS = "providers" # @unused
56+
_VALIDATION_RESULTS = "validation_results" # @unused
5757

5858
def _create_aar_tree_artifact(ctx, name):
5959
return ctx.actions.declare_directory("%s/unzipped/%s/%s" % (RULE_PREFIX, name, ctx.label.name))
@@ -138,9 +138,9 @@ def _process_resources(
138138
aar,
139139
package,
140140
manifest,
141-
deps,
141+
deps, # @unused
142142
aar_resources_extractor_tool,
143-
unzip_tool):
143+
unzip_tool): # @unused
144144
# Extract resources and assets, if they exist.
145145
resources = _create_aar_tree_artifact(ctx, "resources")
146146
assets = _create_aar_tree_artifact(ctx, "assets")

rules/acls.bzl

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

312312
def matches(fqn, dct):
313+
"""Returns whether a fully qualified label matches an ACL dictionary.
314+
315+
Args:
316+
fqn: The fully qualified label to match.
317+
dct: The ACL dictionary.
318+
319+
Returns:
320+
True if the label matches the ACL dictionary.
321+
"""
322+
313323
# Labels with workspace names ("@workspace//pkg:target") are not supported.
314324
# For now, default external dependency ACLs to True to enable rollout features for all
315325
# external users. See https://github.com/bazelbuild/rules_android/issues/68
316326
# Note that this only affects Bazel builds with OSS rules_android.
317-
if fqn.startswith("@") and not fqn.startswith("@//") and not fqn.startswith("@@//"):
327+
if fqn.startswith("@") and not fqn.startswith("@//") and not fqn.startswith("@@//"): # buildifier: disable=canonical-repository
318328
return True
319329

320330
# "@//" is the same as the main workspace. It's not completely accurate to treat these as
@@ -325,7 +335,7 @@ def matches(fqn, dct):
325335
fqn = fqn[1:]
326336

327337
# "@@//" refers to the canonical name of the main repository.
328-
if fqn.startswith("@@//"):
338+
if fqn.startswith("@@//"): # buildifier: disable=canonical-repository
329339
fqn = fqn[2:]
330340

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

rules/android_application/android_application_rule.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ def _create_feature_manifest(
187187
aapt2,
188188
feature_manifest_script,
189189
priority_feature_manifest_script,
190-
android_resources_busybox,
191-
host_javabase):
190+
android_resources_busybox, # @unused
191+
host_javabase): # @unused
192192
info = feature_target[AndroidFeatureModuleInfo]
193193
manifest = ctx.actions.declare_file(ctx.label.name + "/" + feature_target.label.name + "/AndroidManifest.xml")
194194

0 commit comments

Comments
 (0)