Skip to content

Commit c09781c

Browse files
committed
Delete unused variables and arguments
1 parent f143859 commit c09781c

13 files changed

Lines changed: 12 additions & 105 deletions

File tree

mobile_install/apks.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def make_split_apks(
115115
to_pack = dexes + [r_dex]
116116
if native_zips:
117117
to_pack.extend(native_zips)
118-
for i, artifact in enumerate(to_pack):
118+
for artifact in to_pack:
119119
# the split attr in the manifest will be used to name the file on the device like
120120
# split_${SPLIT_ID}.apk. We need to follow the same pattern so that we can compare
121121
# files during sync time and only do the incremental install.

rules/aar_import/impl.bzl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ RULE_PREFIX = "_aar"
5151
ANDROID_MANIFEST = "AndroidManifest.xml"
5252
LINT_JAR = "lint.jar"
5353

54-
# Resources context dict fields.
55-
_PROVIDERS = "providers"
56-
_VALIDATION_RESULTS = "validation_results"
57-
5854
def _create_aar_tree_artifact(ctx, name):
5955
return ctx.actions.declare_directory("%s/unzipped/%s/%s" % (RULE_PREFIX, name, ctx.label.name))
6056

@@ -138,9 +134,7 @@ def _process_resources(
138134
aar,
139135
package,
140136
manifest,
141-
deps,
142-
aar_resources_extractor_tool,
143-
unzip_tool):
137+
aar_resources_extractor_tool):
144138
# Extract resources and assets, if they exist.
145139
resources = _create_aar_tree_artifact(ctx, "resources")
146140
assets = _create_aar_tree_artifact(ctx, "assets")
@@ -492,10 +486,8 @@ def impl(ctx):
492486
aar = aar,
493487
package = package,
494488
manifest = manifest_ctx.processed_manifest,
495-
deps = ctx.attr.deps,
496489
aar_resources_extractor_tool =
497490
_get_android_toolchain(ctx).aar_resources_extractor.files_to_run,
498-
unzip_tool = unzip_tool,
499491
)
500492
providers.extend(resources_ctx.providers)
501493

rules/android_application/android_application_rule.bzl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ def _process_feature_module(
9595
get_android_sdk(ctx).aapt2,
9696
ctx.executable._feature_manifest_script,
9797
ctx.executable._priority_feature_manifest_script,
98-
get_android_toolchain(ctx).android_resources_busybox,
99-
_common.get_host_javabase(ctx),
10098
)
10199

102100
# Remove all dexes from the feature module apk. jvm / resources are not
@@ -186,9 +184,7 @@ def _create_feature_manifest(
186184
feature_target,
187185
aapt2,
188186
feature_manifest_script,
189-
priority_feature_manifest_script,
190-
android_resources_busybox,
191-
host_javabase):
187+
priority_feature_manifest_script):
192188
info = feature_target[AndroidFeatureModuleInfo]
193189
manifest = ctx.actions.declare_file(ctx.label.name + "/" + feature_target.label.name + "/AndroidManifest.xml")
194190

rules/android_binary/impl.bzl

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _process_build_info(_unused_ctx, **unused_ctxs):
259259
),
260260
)
261261

262-
def _process_dex(ctx, validation_ctx, packaged_resources_ctx, manifest_ctx, deploy_ctx, bp_ctx, optimize_ctx, **_unused_ctxs):
262+
def _process_dex(ctx, validation_ctx, packaged_resources_ctx, manifest_ctx, deploy_ctx, optimize_ctx, **_unused_ctxs):
263263
if validation_ctx.use_r8:
264264
return ProviderInfo(
265265
name = "dex_ctx",
@@ -421,7 +421,7 @@ def _process_dex(ctx, validation_ctx, packaged_resources_ctx, manifest_ctx, depl
421421
),
422422
)
423423

424-
def _process_deploy_jar(ctx, validation_ctx, stamp_ctx, manifest_ctx, packaged_resources_ctx, jvm_ctx, build_info_ctx, proto_ctx, **_unused_ctxs):
424+
def _process_deploy_jar(ctx, validation_ctx, stamp_ctx, manifest_ctx, jvm_ctx, build_info_ctx, **_unused_ctxs):
425425
if validation_ctx.use_r8:
426426
return ProviderInfo(
427427
name = "deploy_ctx",
@@ -608,17 +608,6 @@ def _get_library_r_jars(deps):
608608
transitive_resource_jars += dep.jars.to_list()
609609
return transitive_resource_jars
610610

611-
def _is_test_binary(ctx):
612-
"""Whether this android_binary target is a test binary.
613-
614-
Args:
615-
ctx: The context.
616-
617-
Returns:
618-
Boolean indicating whether the target is a test target.
619-
"""
620-
return ctx.attr.testonly or is_instrumentation(ctx) or str(ctx.label).find("/javatests/") >= 0
621-
622611
def is_instrumentation(ctx):
623612
"""Whether this android_binary target is an instrumentation binary.
624613

rules/android_binary/rule.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ load(":impl.bzl", "impl")
2727

2828
visibility(PROJECT_VISIBILITY)
2929

30-
_DEFAULT_ALLOWED_ATTRS = ["name", "visibility", "tags", "testonly", "transitive_configs", "$enable_manifest_merging", "features", "exec_properties"]
31-
3230
_DEFAULT_PROVIDES = [ApkInfo, JavaInfo]
3331

3432
def _outputs(name, proguard_generate_mapping, _package_name, _generate_proguard_outputs, _generate_art_profile_outputs):
@@ -126,7 +124,6 @@ def android_binary_macro(**attrs):
126124

127125
# Required for ACLs check in _outputs(), since the callback can't access the native module.
128126
attrs["$package_name"] = native.package_name()
129-
target_fqn = "//%s:%s" % (native.package_name(), attrs["name"])
130127

131128
if type(attrs.get("proguard_specs", None)) == "select" or attrs.get("proguard_specs", None):
132129
attrs["$generate_proguard_outputs"] = True

rules/android_library/impl.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def _process_lint_rules(ctx, **unused_sub_ctxs):
318318
),
319319
)
320320

321-
def _process_aar(ctx, java_package, resources_ctx, proguard_ctx, **unused_ctx):
321+
def _process_aar(ctx, resources_ctx, proguard_ctx, **unused_ctx):
322322
aar_ctx = {
323323
_PROVIDERS: [],
324324
_VALIDATION_OUTPUTS: [],
@@ -460,7 +460,6 @@ PROCESSORS = dict(
460460
def finalize(
461461
ctx,
462462
resources_ctx,
463-
intellij_ctx,
464463
jvm_ctx,
465464
proguard_ctx,
466465
providers,

rules/data_binding.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ def _setup_dependent_lib_artifacts(ctx, output_dir, deps):
132132
return dep_lib_artifacts
133133

134134
def _get_javac_opts(
135-
ctx,
136135
java_package,
137136
artifact_type,
138137
dependency_artifacts_dir,
@@ -284,7 +283,6 @@ def _process(
284283
)
285284

286285
db_info[_JAVAC_OPTS] = _get_javac_opts(
287-
ctx,
288286
java_package,
289287
artifact_type,
290288
(

rules/dex_desugar_aspect.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _aspect_impl(target, ctx):
120120

121121
if runtime_jars:
122122
basename_clash = _check_basename_clash(runtime_jars)
123-
aspect_dexopts = _get_aspect_dexopts(ctx)
123+
aspect_dexopts = _get_aspect_dexopts()
124124
for jar in runtime_jars:
125125
if ctx.fragments.android.desugar_java8:
126126
jar_to_desugar = jar
@@ -214,7 +214,7 @@ def _get_platform_based_toolchain_jars(ctx):
214214
return ctx.rule.attr._aidl_lib[JavaInfo].runtime_output_jars
215215
return []
216216

217-
def _get_aspect_dexopts(ctx):
217+
def _get_aspect_dexopts():
218218
return _power_set(_dex.normalize_dexopts(_dex.DEXOPTS_SUPPORTED_IN_INCREMENTAL_DEXING))
219219

220220
def _get_boot_classpath(target, ctx):

rules/min_sdk_version.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ it holds utilities for handling minSdkVersion propagation.
1818
1919
"""
2020

21-
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
2221
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
22+
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
2323

2424
visibility(PROJECT_VISIBILITY)
2525

2626
_SETTING = "//rules/flags:min_sdk_version"
2727
_DEPOT_FLOOR = 23
2828
_DEX_DESUGAR = 23 # Kept at 23 due to b/331852939. See some related discussion at b/319114605
29-
_MIN_SDK_LEVELS = sorted([_DEPOT_FLOOR, 24])
29+
# _MIN_SDK_LEVELS = sorted([_DEPOT_FLOOR, 24])
3030

3131
_ATTRS = dict(
3232
_min_sdk_version = attr.label(
@@ -35,7 +35,7 @@ _ATTRS = dict(
3535
),
3636
)
3737

38-
def _clamp(min_sdk_version):
38+
def _clamp(min_sdk_version): # @unused
3939
# TODO(asinclair): Uncomment this once android_binary is Starlarkified and the order of the
4040
# Android Platforms Transition and Feature Flags transition is swapped.
4141
# clamped = _MIN_SDK_LEVELS[0]
@@ -46,7 +46,7 @@ def _clamp(min_sdk_version):
4646
# return clamped
4747
return 0
4848

49-
def _get(ctx):
49+
def _get(ctx): # @unused
5050
# This is the case when an android_binary target does not set a value explicitly.
5151
# The configuration value defaults to 0
5252
# So in this case we use the depot floor.

rules/native_deps.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ SplitConfigInfo = provider(
3535
)
3636

3737
def _split_config_aspect_impl(__, ctx):
38-
android_cfg = ctx.fragments.android
3938
return SplitConfigInfo(
4039
build_config = ctx.configuration,
4140
target_platform = ctx.fragments.platform.platform,

0 commit comments

Comments
 (0)