Skip to content

Commit

Permalink
Pass the "implicit outputs" (files in DefaultInfo) from android_binar…
Browse files Browse the repository at this point in the history
…y_internal rule to the toplevel android_binary rule.

PiperOrigin-RevId: 621244930
Change-Id: I0014715bf6a5b2cc40ab3597bbfc7473d0be3a8a
  • Loading branch information
Zhaoqing Xu authored and copybara-github committed Apr 2, 2024
1 parent 0ea8bcd commit 996909c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions rules/android_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def _symlink_outputs(
# This happens when proguard_specs is empty or the rule is using R8 for optimization.
return files

# TODO(zhaoqxu): Consider removing these symlinks and passing the files directly to the underlying
# android_binary_internal rule.
if target[AndroidOptimizationInfo].optimized_resource_apk:
_symlink(
ctx,
Expand Down Expand Up @@ -186,18 +188,21 @@ def _symlink_outputs(
def _impl(ctx):
target = ctx.attr.application_resources

files = _symlink_outputs(
ctx,
target,
bool(ctx.attr.proguard_specs),
ctx.attr._generate_proguard_outputs,
ctx.attr.proguard_generate_mapping,
files = depset(
_symlink_outputs(
ctx,
target,
bool(ctx.attr.proguard_specs),
ctx.attr._generate_proguard_outputs,
ctx.attr.proguard_generate_mapping,
),
transitive = [target[DefaultInfo].files],
)

providers = [
DefaultInfo(
files = depset(files),
runfiles = ctx.runfiles(transitive_files = depset(files)),
files = files,
runfiles = ctx.runfiles(transitive_files = files),
),
# Reconstructing ApkInfo to use the "right" symlinked outputs. This is necessary because
# android_instrumentation_test rule gets the signed apk from ApkInfo and put it in in the
Expand Down

0 comments on commit 996909c

Please sign in to comment.