Skip to content

Commit e4044ba

Browse files
committed
Extract baseline-prof.txt from AARs in aar_import
aar_import now extracts baseline-prof.txt and provides BaselineProfileProvider, so baseline profiles from maven AARs propagate through the dependency graph to android_binary.
1 parent dd245bd commit e4044ba

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

rules/aar_import/impl.bzl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
"""Implementation."""
1515

16-
load("//providers:providers.bzl", "AndroidLintRulesInfo", "AndroidNativeLibsInfo")
16+
load("//providers:providers.bzl", "AndroidLintRulesInfo", "AndroidNativeLibsInfo", "BaselineProfileProvider")
1717
load(
1818
"//rules:acls.bzl",
1919
_acls = "acls",
@@ -575,6 +575,18 @@ def impl(ctx):
575575
)
576576
providers.extend(lint_providers)
577577

578+
# Extract baseline-prof.txt from the AAR if present, otherwise create an empty file.
579+
baseline_prof = create_aar_artifact(ctx, "baseline-prof.txt")
580+
extract_single_file(
581+
ctx,
582+
baseline_prof,
583+
aar,
584+
"baseline-prof.txt",
585+
unzip_tool,
586+
create_empty_file = True,
587+
)
588+
providers.append(BaselineProfileProvider(files = depset([baseline_prof])))
589+
578590
validation_outputs.append(_validate_rule(
579591
ctx,
580592
aar = aar,

rules/aar_import/rule.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
"""aar_import rule."""
1515

16-
load("//providers:providers.bzl", "AndroidIdeInfo", "AndroidLibraryResourceClassJarProvider", "AndroidNativeLibsInfo")
16+
load("//providers:providers.bzl", "AndroidIdeInfo", "AndroidLibraryResourceClassJarProvider", "AndroidNativeLibsInfo", "BaselineProfileProvider")
1717
load(
1818
"//rules:utils.bzl",
1919
"ANDROID_SDK_TOOLCHAIN_TYPE",
@@ -60,6 +60,7 @@ aar_import = rule(
6060
AndroidIdeInfo,
6161
AndroidLibraryResourceClassJarProvider,
6262
AndroidNativeLibsInfo,
63+
BaselineProfileProvider,
6364
JavaInfo,
6465
],
6566
toolchains = [

0 commit comments

Comments
 (0)