From 2e2f840ebb02b737f116ca1c3ab604fc60ae90ca Mon Sep 17 00:00:00 2001 From: Zhaoqing Xu Date: Fri, 15 Sep 2023 11:31:05 -0700 Subject: [PATCH] Migrate baseline profiles rewriting, wildcards expansion and startup profiles support in optimizer tools from native to Starlark. PiperOrigin-RevId: 565733260 Change-Id: I5f62382792f0e3b83339750337961f56fe218cf4 --- ...aseline_profiles_optimizer_integration.bzl | 1 + rules/android_binary_internal/attrs.bzl | 13 ++ rules/android_binary_internal/impl.bzl | 87 ++++++-- rules/baseline_profiles.bzl | 195 ++++++++++++++---- rules/proguard.bzl | 64 +++++- 5 files changed, 306 insertions(+), 54 deletions(-) diff --git a/rules/acls/baseline_profiles_optimizer_integration.bzl b/rules/acls/baseline_profiles_optimizer_integration.bzl index 6fea730b..67014e5d 100644 --- a/rules/acls/baseline_profiles_optimizer_integration.bzl +++ b/rules/acls/baseline_profiles_optimizer_integration.bzl @@ -16,4 +16,5 @@ # keep sorted BASELINE_PROFILES_OPTIMIZER_INTEGRATION = [ + "//test/rules/android_binary_internal:__subpackages__", ] diff --git a/rules/android_binary_internal/attrs.bzl b/rules/android_binary_internal/attrs.bzl index 3944dd56..9a2df044 100644 --- a/rules/android_binary_internal/attrs.bzl +++ b/rules/android_binary_internal/attrs.bzl @@ -81,6 +81,19 @@ ATTRS = _attrs.replace( profile, speeding up app startup time or reducing jank in some circumstances. """, ), + startup_profiles = attr.label_list( + allow_empty = True, + allow_files = [".txt"], + doc = """ + List of baseline profiles that were collected at runtime (often from start-up) for + this binary. When this is specified, all baseline profiles (including these) are + used to inform code optimizations in the build toolchain. This may improve runtime + performance at the cost of dex size. If the dex size cost is too large and the + performance wins too small, the same profiles can be provided as a dep from an + android_library with `baseline_profiles` to avoid the runtime-focused code + optimizations that are enabled by `startup_profiles`. + """, + ), proguard_specs = attr.label_list(allow_empty = True, allow_files = True), resource_apks = attr.label_list( allow_rules = ["apk_import"], diff --git a/rules/android_binary_internal/impl.bzl b/rules/android_binary_internal/impl.bzl index c1b690fb..3e589d77 100644 --- a/rules/android_binary_internal/impl.bzl +++ b/rules/android_binary_internal/impl.bzl @@ -219,7 +219,7 @@ def _process_build_info(_unused_ctx, **unused_ctxs): ), ) -def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, deploy_ctx, optimize_ctx, **_unused_ctxs): +def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, deploy_ctx, bp_ctx, optimize_ctx, **_unused_ctxs): providers = [] classes_dex_zip = None dex_info = None @@ -231,6 +231,7 @@ def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, dep main_dex_list = ctx.file.main_dex_list multidex = ctx.attr.multidex optimizing_dexer = ctx.attr._optimizing_dexer + java8_legacy_dex_map = None if acls.in_android_binary_starlark_dex_desugar_proguard(str(ctx.label)): proguarded_jar = optimize_ctx.proguard_output.output_jar if is_binary_optimized else None @@ -320,8 +321,7 @@ def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, dep min_sdk_version = ctx.attr.min_sdk_version, main_dex_list = main_dex_list, library_jar = optimize_ctx.proguard_output.library_jar, - # TODO(b/286955442): Support baseline profiles. - startup_profile = None, + startup_profile = bp_ctx.baseline_profile_output.startup_profile if bp_ctx.baseline_profile_output else None, optimizing_dexer = optimizing_dexer.files_to_run, toolchain_type = ANDROID_TOOLCHAIN_TYPE, ) @@ -398,6 +398,7 @@ def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, dep name = "dex_ctx", value = struct( dex_info = dex_info, + java8_legacy_dex_map = java8_legacy_dex_map, providers = providers, ), ) @@ -557,11 +558,20 @@ def _is_instrumentation(ctx): """ return bool(ctx.attr.instruments) -def _process_baseline_profiles(ctx, dex_ctx, **_unused_ctxs): - providers = [] - if (ctx.attr.generate_art_profile and +def _process_baseline_profiles(ctx, deploy_ctx, **_unused_ctxs): + baseline_profile_output = struct() + if (ctx.attr.generate_art_profile or acls.in_android_binary_starlark_dex_desugar_proguard(str(ctx.label))): + enable_optimizer_integration = acls.in_baseline_profiles_optimizer_integration(str(ctx.label)) + has_proguard_specs = bool(ctx.files.proguard_specs) + + if ctx.files.startup_profiles and not enable_optimizer_integration: + fail("Target %s is not allowed to set startup_profiles." % str(ctx.label)) + + # Include startup profiles if the optimizer is disabled since profiles won't be merged + # in the optimizer. transitive_profiles = depset( + ctx.files.startup_profiles if enable_optimizer_integration and not has_proguard_specs else [], transitive = [ profile_provider.files for profile_provider in utils.collect_providers( @@ -570,20 +580,57 @@ def _process_baseline_profiles(ctx, dex_ctx, **_unused_ctxs): ) ], ) - if transitive_profiles: - providers.append( - _baseline_profiles.process( - ctx, - dex_ctx.dex_info.final_classes_dex_zip, - transitive_profiles, - ), - ) + baseline_profile_output = _baseline_profiles.process( + ctx, + transitive_profiles = transitive_profiles, + startup_profiles = ctx.files.startup_profiles, + deploy_jar = deploy_ctx.deploy_jar, + has_proguard_specs = has_proguard_specs, + enable_optimizer_integration = enable_optimizer_integration, + merge_tool = get_android_toolchain(ctx).merge_baseline_profiles_tool.files_to_run, + profgen = get_android_toolchain(ctx).profgen.files_to_run, + toolchain_type = ANDROID_TOOLCHAIN_TYPE, + ) return ProviderInfo( name = "bp_ctx", + value = struct( + baseline_profile_output = baseline_profile_output, + ), + ) + +def _process_art_profile(ctx, bp_ctx, dex_ctx, optimize_ctx, **_unused_ctxs): + providers = [] + if (ctx.attr.generate_art_profile and + acls.in_android_binary_starlark_dex_desugar_proguard(str(ctx.label))): + merged_baseline_profile = bp_ctx.baseline_profile_output.baseline_profile + merged_baseline_profile_rewritten = \ + optimize_ctx.proguard_output.baseline_profile_rewritten if optimize_ctx.proguard_output else None + proguard_output_map = dex_ctx.dex_info.final_proguard_output_map + + if acls.in_baseline_profiles_optimizer_integration(str(ctx.label)): + # Minified symbols are emitted when rewriting, so only use map for symbols which + # weren't passed to bytecode optimizer (if it exists). + proguard_output_map = dex_ctx.java8_legacy_dex_map + + # At this point, either baseline profile here also contains startup-profiles, if any. + if merged_baseline_profile_rewritten: + merged_baseline_profile = merged_baseline_profile_rewritten + if merged_baseline_profile: + providers.append(_baseline_profiles.process_art_profile( + ctx, + final_classes_dex = dex_ctx.dex_info.final_classes_dex_zip, + merged_profile = merged_baseline_profile, + proguard_output_map = proguard_output_map, + profgen = get_android_toolchain(ctx).profgen.files_to_run, + zipper = get_android_toolchain(ctx).zipper.files_to_run, + toolchain_type = ANDROID_TOOLCHAIN_TYPE, + )) + return ProviderInfo( + name = "ap_ctx", value = struct(providers = providers), ) -def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, **_unused_ctxs): +def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, bp_ctx, **_unused_ctxs): if not acls.in_android_binary_starlark_dex_desugar_proguard(str(ctx.label)): return ProviderInfo( name = "optimize_ctx", @@ -636,6 +683,9 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, **_unused_ctxs): proguard_seeds = ctx.actions.declare_file(ctx.label.name + "_migrated_proguard.seeds") proguard_usage = ctx.actions.declare_file(ctx.label.name + "_migrated_proguard.usage") + startup_profile = bp_ctx.baseline_profile_output.startup_profile if bp_ctx.baseline_profile_output else None + baseline_profile = bp_ctx.baseline_profile_output.baseline_profile if bp_ctx.baseline_profile_output else None + proguard_output = proguard.apply_proguard( ctx, input_jar = deploy_ctx.deploy_jar, @@ -646,6 +696,8 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, **_unused_ctxs): proguard_output_map = proguard_output_map, proguard_seeds = proguard_seeds, proguard_usage = proguard_usage, + startup_profile = startup_profile, + baseline_profile = baseline_profile, proguard_tool = get_android_sdk(ctx).proguard, ) @@ -659,6 +711,8 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, **_unused_ctxs): usage = proguard_output.usage, library_jar = proguard_output.library_jar, config = proguard_output.config, + baseline_profile_rewritten = proguard_output.baseline_profile_rewritten, + startup_profile_rewritten = proguard_output.startup_profile_rewritten, )) use_resource_shrinking = is_resource_shrinking_enabled and has_proguard_specs @@ -712,9 +766,10 @@ PROCESSORS = dict( BuildInfoProcessor = _process_build_info, ProtoProcessor = _process_proto, DeployJarProcessor = _process_deploy_jar, + BaselineProfilesProcessor = _process_baseline_profiles, OptimizeProcessor = _process_optimize, DexProcessor = _process_dex, - BaselineProfilesProcessor = _process_baseline_profiles, + ArtProfileProcessor = _process_art_profile, R8Processor = process_r8, ResourecShrinkerR8Processor = process_resource_shrinking_r8, ) diff --git a/rules/baseline_profiles.bzl b/rules/baseline_profiles.bzl index 581631bd..9818a782 100644 --- a/rules/baseline_profiles.bzl +++ b/rules/baseline_profiles.bzl @@ -13,13 +13,97 @@ # limitations under the License. """ -Defines baseline profiles processing. +Defines baseline profiles processing methods in Android Rules. """ -load("//rules:utils.bzl", "ANDROID_TOOLCHAIN_TYPE", "get_android_toolchain") +_BASELINE_PROFILE_DIR_SUFFIX = "-baseline-profile/" -def _process(ctx, final_classes_dex, transitive_profiles): - """ Merges/compiles all the baseline profiles propagated from android_library and aar_import. +def _process( + ctx, + transitive_profiles = depset(), + startup_profiles = [], + deploy_jar = None, + has_proguard_specs = False, + enable_optimizer_integration = False, + merge_tool = None, + profgen = None, + toolchain_type = None): + """Processes all the transitive baseline profiles. + + Baseline profiles propagated from libraries will be merged, and if optimizer integration is + enabled, startup profiles will be merged as well, and wildcards in baseline profiles will be + expanded. + + Args: + ctx: The context. + transitive_profiles: Depset. The transitive baseline profiles propagated from android_library + and aar_import. + startup_profiles: List. The startup profiles. + deploy_jar: File. The deploy jar. + has_proguard_specs: Boolean. Whether to have proguard specs. + enable_optimizer_integration: Boolean. Whether to use startup profile and baseline profiles in optimization. + merge_tool: FilesToRunProvider. An executable for merging baseline profiles. + profgen: FilesToRunProvider: An executable for compiling baseline profiles. + toolchain_type: Label or String. Toolchain type of the executable used in actions. + Returns: + A struct containing all the outputs from processing baseline profiles. + """ + + baseline_profile = None + startup_profile = None + if transitive_profiles: + baseline_profile = _get_profile_artifact(ctx, "static-prof.txt") + _merge( + ctx, + baseline_profile, + transitive_profiles, + "MergeBaselineProfiles", + merge_tool = merge_tool, + toolchain_type = toolchain_type, + ) + + if has_proguard_specs and enable_optimizer_integration: + # This is only needed for optimized builds since otherwise the dexer doesn't process this. + if startup_profiles: + startup_profile = _get_profile_artifact(ctx, "static-startup-prof.txt") + _merge( + ctx, + output = startup_profile, + inputs = ctx.files.startup_profiles, + mnemonic = "MergeStartupProfiles", + merge_tool = merge_tool, + toolchain_type = toolchain_type, + ) + + # Wildcards only need to be expanded for optimized builds since if these aren't consumed by + # the optimizer, they can just be expanded during profile compilation instead. + # Start-up profiles are not expanded because it shouldn't be necessary as these should + # contain profiles generated by devices on start-up. + if baseline_profile: + expanded_baseline_profile = _get_profile_artifact(ctx, "expanded-static-prof.txt") + _expand_wildcards( + ctx, + output = expanded_baseline_profile, + deploy_jar = deploy_jar, + profile = baseline_profile, + profgen = profgen, + toolchain_type = toolchain_type, + ) + baseline_profile = expanded_baseline_profile + return struct( + baseline_profile = baseline_profile, + startup_profile = startup_profile, + ) + +def _process_art_profile( + ctx, + final_classes_dex, + merged_profile, + proguard_output_map = None, + profgen = None, + zipper = None, + toolchain_type = None): + """ Compiles the merged baseline profile. Profiles are compiled with profgen into binary ART profiles. The binary profiles will be bundled into the final APK and used at installation time to speed up app @@ -27,74 +111,113 @@ def _process(ctx, final_classes_dex, transitive_profiles): Args: ctx: The context. - final_classes_dex: Final classes zip artifact. - transitive_profiles: Depset of incoming baseline profile files. - + final_classes_dex: File. Final classes zip artifact. + merged_profile: File. The merged profile from transitive baseline profile files. + proguard_output_map: File. Optional. The proguard output mapping file. + profgen: FilesToRunProvider. The profgen executable for profile compilation. + zipper: FilesToRunProvider. An executable for compressing files to an archive. + toolchain_type: Label or String. Toolchain type of the executable used in actions. Returns: Provider info containing BaselineProfileProvider for all merged profiles. """ - # TODO(b/256652067) Pass proguard_output_map after AppReduce starlark migration. - proguard_output_map = None - merge_args = ctx.actions.args() - profile_dir = ctx.label.name + "-baseline-profile/" - merged_profile = ctx.actions.declare_file(profile_dir + "static-prof.txt") - merge_args.add_all(transitive_profiles, before_each = "--input") - merge_args.add("--output", merged_profile.path) - ctx.actions.run( - mnemonic = "MergeBaselineProfiles", - executable = get_android_toolchain(ctx).merge_baseline_profiles_tool.files_to_run, - arguments = [merge_args], - inputs = transitive_profiles, - outputs = [merged_profile], - use_default_shell_env = True, - toolchain = ANDROID_TOOLCHAIN_TYPE, - ) - # Profgen - output_profile = ctx.actions.declare_file(profile_dir + "baseline.prof") - output_profile_meta = ctx.actions.declare_file(profile_dir + "baseline.profm") + output_profile = _get_profile_artifact(ctx, "baseline.prof") + output_profile_meta = _get_profile_artifact(ctx, "baseline.profm") profgen_inputs = [final_classes_dex, merged_profile] profgen_args = ctx.actions.args() profgen_args.add("bin", merged_profile) - profgen_args.add("--apk", final_classes_dex.path) - profgen_args.add("--output", output_profile.path) - profgen_args.add("--output-meta", output_profile_meta.path) + profgen_args.add("--apk", final_classes_dex) + profgen_args.add("--output", output_profile) + profgen_args.add("--output-meta", output_profile_meta) if proguard_output_map: - profgen_args.add("--map", proguard_output_map.path) + profgen_args.add("--map", proguard_output_map) profgen_inputs.append(proguard_output_map) ctx.actions.run( mnemonic = "GenerateARTProfile", - executable = get_android_toolchain(ctx).profgen.files_to_run, + executable = profgen, progress_message = "Generating Android P-R ART profile for %{label} APK", arguments = [profgen_args], inputs = profgen_inputs, outputs = [output_profile, output_profile_meta], use_default_shell_env = True, - toolchain = ANDROID_TOOLCHAIN_TYPE, + toolchain = toolchain_type, ) # Zip ART profiles - output_profile_zip = ctx.actions.declare_file(profile_dir + "art_profile.zip") + output_profile_zip = _get_profile_artifact(ctx, "art_profile.zip") zip_args = ctx.actions.args() zip_args.add("c", output_profile_zip) zip_args.add(output_profile.path, format = "assets/dexopt/baseline.prof=%s") zip_args.add(output_profile_meta.path, format = "assets/dexopt/baseline.profm=%s") ctx.actions.run( mnemonic = "ZipARTProfiles", - executable = get_android_toolchain(ctx).zipper.files_to_run, + executable = zipper, progress_message = "Zip ART Profiles for %{label}", arguments = [zip_args], inputs = [output_profile, output_profile_meta], outputs = [output_profile_zip], use_default_shell_env = True, - toolchain = ANDROID_TOOLCHAIN_TYPE, + toolchain = toolchain_type, ) return BaselineProfileProvider( - transitive_profiles, + # Unnecessary to pass the transitive profiles to native rule + depset(), output_profile_zip, ) +def _get_profile_dir(ctx): + return ctx.label.name + _BASELINE_PROFILE_DIR_SUFFIX + +def _get_profile_artifact(ctx, name): + return ctx.actions.declare_file(_get_profile_dir(ctx) + name) + +def _merge( + ctx, + output, + inputs = [], + mnemonic = "MergeBaselineProfiles", + merge_tool = None, + toolchain_type = None): + args = ctx.actions.args() + args.add_all(inputs, before_each = "--input") + args.add("--output", output) + + ctx.actions.run( + executable = merge_tool, + mnemonic = mnemonic, + arguments = [args], + inputs = inputs, + outputs = [output], + use_default_shell_env = True, + toolchain = toolchain_type, + ) + +def _expand_wildcards( + ctx, + output, + deploy_jar = None, + profile = None, + profgen = None, + toolchain_type = None): + args = ctx.actions.args() + args.add("expandWildcards", deploy_jar) + args.add("--profile", profile) + args.add("--output", output) + + ctx.actions.run( + executable = profgen, + outputs = [output], + inputs = [deploy_jar, profile], + arguments = [args], + mnemonic = "ExpandBaselineProfileWildcards", + progress_message = "Expanding baseline profile wildcards for %{label} APK", + toolchain = toolchain_type, + ) + baseline_profiles = struct( + expand_wildcards = _expand_wildcards, + get_profile_artifact = _get_profile_artifact, process = _process, + process_art_profile = _process_art_profile, ) diff --git a/rules/proguard.bzl b/rules/proguard.bzl index 7b028551..d5caabb7 100644 --- a/rules/proguard.bzl +++ b/rules/proguard.bzl @@ -15,6 +15,7 @@ """Bazel Android Proguard library for the Android rules.""" load(":android_neverlink_aspect.bzl", "StarlarkAndroidNeverlinkInfo") +load(":baseline_profiles.bzl", _baseline_profiles = "baseline_profiles") load(":common.bzl", "common") load(":java.bzl", "java") load(":utils.bzl", "ANDROID_TOOLCHAIN_TYPE", "get_android_sdk", "utils") @@ -41,6 +42,8 @@ _ProguardOutputInfo = provider( usage = "Output usage", library_jar = "Merged library jar", config = "Output config", + baseline_profile_rewritten = "Optimized baseline profile", + startup_profile_rewritten = "Optimized startup profile", ), ) @@ -194,6 +197,10 @@ def _optimization_action( proguard_seeds = None, proguard_usage = None, proguard_config_output = None, + startup_profile = None, + startup_profile_rewritten = None, + baseline_profile = None, + baseline_profile_rewritten = None, runtype = None, last_stage_output = None, next_stage_output = None, @@ -225,8 +232,12 @@ def _optimization_action( classes and members which match a keep rule. proguard_usage: File. Optional file used to write all classes and members that are removed during shrinking (i.e. unused code). - proguard_config_output:File. Optional file used to write the entire configuration that has + proguard_config_output: File. Optional file used to write the entire configuration that has been parsed, included files and replaced variables. Useful for debugging. + startup_profile: File. Optional. The merged startup profile to be optimized. + startup_profile_rewritten: File. Optional file used to write the optimized startup profile. + baseline_profile: File. Optional. The merged baseline profile to be optimized. + baseline_profile_rewritten: File. Optional file used to write the optimized profile rules. runtype: String. Optional string identifying this run. One of [INITIAL, OPTIMIZATION, FINAL] last_stage_output: File. Optional input file to this optimization stage, which was output by the previous optimization stage. @@ -281,6 +292,22 @@ def _optimization_action( args.add("-printconfiguration", proguard_config_output) outputs.append(proguard_config_output) + if startup_profile: + args.add("-startupprofile", startup_profile) + inputs.append(startup_profile) + + if startup_profile_rewritten: + args.add("-printstartupprofile", startup_profile) + outputs.append(startup_profile_rewritten) + + if baseline_profile: + args.add("-baselineprofile", baseline_profile) + inputs.append(baseline_profile) + + if baseline_profile_rewritten: + args.add("-printbaselineprofile", baseline_profile_rewritten) + outputs.append(baseline_profile_rewritten) + if runtype: args.add("-runtype " + runtype) @@ -322,6 +349,8 @@ def _apply_proguard( proguard_output_map = None, proguard_seeds = None, proguard_usage = None, + startup_profile = None, + baseline_profile = None, proguard_tool = None): """Top-level method to apply proguard to a jar. @@ -335,6 +364,8 @@ def _apply_proguard( proguard_output_map: File. The output proguard map. proguard_seeds: File. The output proguard seeds. proguard_usage: File. The output proguard usage. + startup_profile: File. The input merged startup profile to be optimized. + baseline_profile: File. The input merged baseline profile to be optimized. proguard_tool: FilesToRun. The proguard executable. Returns: @@ -370,6 +401,8 @@ def _apply_proguard( proguard_output_map, input_jar, library_jars, + startup_profile, + baseline_profile, proguard_tool, ) @@ -379,7 +412,9 @@ def _get_proguard_output( proguard_seeds, proguard_usage, proguard_output_map, - combined_library_jar): + combined_library_jar, + startup_profile_rewritten, + baseline_profile_rewritten): """Helper method to get a struct of all proguard outputs.""" config_output = _get_proguard_temp_artifact(ctx, "_proguard.config") @@ -390,6 +425,8 @@ def _get_proguard_output( usage = proguard_usage, library_jar = combined_library_jar, config = config_output, + startup_profile_rewritten = startup_profile_rewritten, + baseline_profile_rewritten = baseline_profile_rewritten, ) def _create_optimization_actions( @@ -403,6 +440,8 @@ def _create_optimization_actions( proguard_output_map = None, input_jar = None, library_jars = depset(), + startup_profile = None, + baseline_profile = None, proguard_tool = None): """Helper method to create all optimizaction actions based on the target configuration.""" if not proguard_specs: @@ -426,6 +465,13 @@ def _create_optimization_actions( filter_zips = [input_jar], ) + startup_profile_rewritten = None + baseline_profile_rewritten = None + if startup_profile: + startup_profile_rewritten = _baseline_profiles.get_profile_artifact(ctx, "rewritten-startup-prof.txt") + if baseline_profile and startup_profile: + baseline_profile_rewritten = _baseline_profiles.get_profile_artifact(ctx, "rewritten-merged-prof.txt") + outputs = _get_proguard_output( ctx, proguard_output_jar, @@ -433,6 +479,8 @@ def _create_optimization_actions( proguard_usage, proguard_output_map, combined_library_jar, + startup_profile_rewritten, + baseline_profile_rewritten, ) # TODO(timpeut): Validate that optimizer target selection is correct @@ -452,6 +500,10 @@ def _create_optimization_actions( proguard_seeds = outputs.seeds, proguard_usage = outputs.usage, proguard_config_output = outputs.config, + startup_profile = startup_profile, + startup_profile_rewritten = outputs.startup_profile_rewritten, + baseline_profile = baseline_profile, + baseline_profile_rewritten = outputs.baseline_profile_rewritten, final = True, mnemonic = mnemonic, progress_message = "Trimming binary with %s: %s" % (mnemonic, ctx.label), @@ -474,6 +526,10 @@ def _create_optimization_actions( proguard_seeds = outputs.seeds, proguard_usage = None, proguard_config_output = None, + startup_profile = startup_profile, + startup_profile_rewritten = None, + baseline_profile = baseline_profile, + baseline_profile_rewritten = None, final = False, runtype = "INITIAL", next_stage_output = last_stage_output, @@ -536,6 +592,10 @@ def _create_optimization_actions( proguard_seeds = None, proguard_usage = outputs.usage, proguard_config_output = outputs.config, + startup_profile = None, + startup_profile_rewritten = outputs.startup_profile_rewritten, + baseline_profile = None, + baseline_profile_rewritten = outputs.baseline_profile_rewritten, final = True, runtype = "FINAL", last_stage_output = last_stage_output,