diff options
Diffstat (limited to 'rules/android_binary_internal/impl.bzl')
-rw-r--r-- | rules/android_binary_internal/impl.bzl | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/rules/android_binary_internal/impl.bzl b/rules/android_binary_internal/impl.bzl index 3b3516e..e49b628 100644 --- a/rules/android_binary_internal/impl.bzl +++ b/rules/android_binary_internal/impl.bzl @@ -31,7 +31,7 @@ load( "ProviderInfo", "processing_pipeline", ) -load("//rules:proguard.bzl", "proguard", proguard_testing = "testing") +load("//rules:proguard.bzl", "proguard") load("//rules:providers.bzl", "StarlarkAndroidDexInfo", "StarlarkApkInfo") load("//rules:resources.bzl", _resources = "resources") load( @@ -389,6 +389,7 @@ def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, dep dex_info = AndroidDexInfo( deploy_jar = deploy_jar, + filtered_deploy_jar = deploy_ctx.filtered_deploy_jar, final_classes_dex_zip = final_classes_dex_zip, final_proguard_output_map = final_proguard_output_map, java_resource_jar = binary_jar if ctx.fragments.android.get_java_resources_from_optimized_jar else deploy_jar, @@ -409,7 +410,7 @@ def _process_dex(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, proto_ctx, dep ) def _process_deploy_jar(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, build_info_ctx, proto_ctx, **_unused_ctxs): - deploy_jar, desugar_dict = None, {} + deploy_jar, filtered_deploy_jar, desugar_dict = None, None, {} if acls.in_android_binary_starlark_dex_desugar_proguard(str(ctx.label)): java_toolchain = common.get_java_toolchain(ctx) @@ -460,7 +461,9 @@ def _process_deploy_jar(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, build_i if _is_instrumentation(ctx): filtered_deploy_jar = ctx.actions.declare_file(ctx.label.name + "_migrated_filtered.jar") - filter_jar = ctx.attr.instruments[AndroidPreDexJarInfo].pre_dex_jar + + # TODO(b/303286042): Use AndroidPreDexInfo.pre_dex_jar to be the filter_jar + filter_jar = ctx.attr.instruments[ApkInfo].deploy_jar common.filter_zip_exclude( ctx, output = filtered_deploy_jar, @@ -478,6 +481,7 @@ def _process_deploy_jar(ctx, stamp_ctx, packaged_resources_ctx, jvm_ctx, build_i value = struct( deploy_jar = deploy_jar, desugar_dict = desugar_dict, + filtered_deploy_jar = filtered_deploy_jar, providers = [], ), ) @@ -709,20 +713,6 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, bp_ctx, **_unused proguard_tool = get_android_sdk(ctx).proguard, ) - providers = [] - if proguard_output: - providers.append(proguard_testing.ProguardOutputInfo( - input_jar = deploy_ctx.deploy_jar, - output_jar = proguard_output.output_jar, - mapping = proguard_output.mapping, - seeds = proguard_output.seeds, - 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 shrunk_resource_output = None if use_resource_shrinking: @@ -737,7 +727,6 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, bp_ctx, **_unused busybox = get_android_toolchain(ctx).android_resources_busybox.files_to_run, host_javabase = common.get_host_javabase(ctx), ) - providers.append(shrunk_resource_output) optimized_resource_output = _resources.optimize( ctx, @@ -748,7 +737,26 @@ def _process_optimize(ctx, deploy_ctx, packaged_resources_ctx, bp_ctx, **_unused busybox = get_android_toolchain(ctx).android_resources_busybox.files_to_run, host_javabase = common.get_host_javabase(ctx), ) - providers.append(optimized_resource_output) + + providers = [] + providers.append( + AndroidOptimizationInfo( + optimized_jar = proguard_output.output_jar if proguard_output else None, + mapping = proguard_output.mapping if proguard_output else None, + seeds = proguard_output.seeds if proguard_output else None, + library_jar = proguard_output.library_jar if proguard_output else None, + config = proguard_output.config if proguard_output else None, + proto_mapping = proguard_output.proto_mapping if proguard_output else None, + rewritten_startup_profile = proguard_output.startup_profile_rewritten if proguard_output else None, + rewriten_merged_baseline_profile = proguard_output.baseline_profile_rewritten if proguard_output else None, + optimized_resource_apk = optimized_resource_output.resources_apk, + shrunk_resource_apk = shrunk_resource_output.resources_apk if shrunk_resource_output else None, + shrunk_resource_zip = shrunk_resource_output.resources_zip if shrunk_resource_output else None, + resource_shrinker_log = shrunk_resource_output.shrinker_log if shrunk_resource_output else None, + resource_optimization_config = shrunk_resource_output.optimization_config if shrunk_resource_output else None, + resource_path_shortening_map = optimized_resource_output.path_shortening_map, + ), + ) return ProviderInfo( name = "optimize_ctx", |