Remove support for stripping dex.

Stripping is incompatible with ART module updatability.

Bug: 65154345
Bug: 138851227

Test: build and observe no change in output (stripping is not used by
default).

Change-Id: Ic2d9738ef393814c3af3cad116071f7b5938aa84
This commit is contained in:
Nicolas Geoffray 2019-10-18 14:47:19 +01:00
parent 46cfab96d8
commit 2ca0e49f61
9 changed files with 7 additions and 91 deletions

View file

@ -2557,7 +2557,7 @@ pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
$(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
pdk_classes_dex := $(strip \
$(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
$(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
$(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.apk))
pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
@ -2575,7 +2575,7 @@ $(pdk_odex_config_mk) :
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
)
$(foreach m,$(PRIVATE_APPS),\
$(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.apk)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\

View file

@ -215,17 +215,6 @@ $(built_module) : $(appcompat-files)
$(LOCAL_BUILT_MODULE): PRIVATE_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE)
endif
ifneq ($(BUILD_PLATFORM_ZIP),)
$(built_module) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
endif
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
ifdef LOCAL_DEX_PREOPT
$(built_module) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
$(built_module) : $(intermediates)/strip.sh
$(built_module) : | $(DEXPREOPT_STRIP_DEPS)
$(built_module) : .KATI_DEPFILE := $(built_module).d
endif
endif
ifeq ($(module_run_appcompat),true)
$(built_module) : $(AAPT2)
endif
@ -235,23 +224,11 @@ $(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(ZIP2ZIP) $(SIGNAPK_JAR
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
$(uncompress-dexs)
endif # LOCAL_UNCOMPRESS_DEX
ifdef LOCAL_DEX_PREOPT
ifneq ($(BUILD_PLATFORM_ZIP),)
@# Keep a copy of apk with classes.dex unstripped
$(hide) cp -f $@ $(dir $@)package.dex.apk
endif # BUILD_PLATFORM_ZIP
endif # LOCAL_DEX_PREOPT
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
@# Only strip out files if we can re-sign the package.
# Run appcompat before stripping the classes.dex file.
ifeq ($(module_run_appcompat),true)
$(call appcompat-header, aapt2)
$(run-appcompat)
endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT
mv -f $@ $@.tmp
$(PRIVATE_STRIP_SCRIPT) $@.tmp $@
endif # LOCAL_DEX_PREOPT
$(sign-package)
# No need for align-package because sign-package takes care of alignment
else # LOCAL_CERTIFICATE == PRESIGNED

View file

@ -56,7 +56,7 @@ LOCAL_DEX_PREOPT_APP_IMAGE:=
LOCAL_DEX_PREOPT_FLAGS:=
LOCAL_DEX_PREOPT_GENERATE_PROFILE:=
LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DEX_PREOPT:= # '',true,false
LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG:=
LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES:=
LOCAL_DONT_CHECK_MODULE:=

View file

@ -13,16 +13,9 @@ SYSTEM_OTHER_ODEX_FILTER ?= \
product/app/% \
product/priv-app/% \
# The default values for pre-opting. To support the runtime module we ensure no dex files
# get stripped.
ifeq ($(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING),)
PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING := true
endif
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
ifeq (eng,$(TARGET_BUILD_VARIANT))
# Don't strip for quick development turnarounds.
DEX_PREOPT_DEFAULT := nostripping
# For an eng build only pre-opt the boot image and system server. This gives reasonable performance
# and still allows a simple workflow: building in frameworks/base and syncing.
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
@ -86,7 +79,6 @@ ifeq ($(WRITE_SOONG_VARIABLES),true)
$(call json_start)
$(call add_json_bool, DefaultNoStripping, $(filter nostripping,$(DEX_PREOPT_DEFAULT)))
$(call add_json_bool, DisablePreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT))))
$(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES))
$(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY)))
@ -173,6 +165,3 @@ DEXPREOPT_GEN_DEPS := \
$(SOONG_ZIP) \
$(ZIP2ZIP) \
$(BUILD_SYSTEM)/construct_context.sh \
DEXPREOPT_STRIP_DEPS := \
$(ZIP2ZIP) \

View file

@ -207,8 +207,7 @@ ifdef LOCAL_DEX_PREOPT
$(call json_start)
# DexPath, StripInputPath, and StripOutputPath are not set, they will
# be filled in by dexpreopt_gen.
# DexPath is not set: it will be filled in by dexpreopt_gen.
$(call add_json_str, Name, $(LOCAL_MODULE))
$(call add_json_str, DexLocation, $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)))
@ -237,13 +236,10 @@ ifdef LOCAL_DEX_PREOPT
$(call add_json_bool, ForceCreateAppImage, $(filter true,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
$(call add_json_bool, PresignedPrebuilt, $(filter PRESIGNED,$(LOCAL_CERTIFICATE)))
$(call add_json_bool, NoStripping, $(filter nostripping,$(LOCAL_DEX_PREOPT)))
$(call json_end)
my_dexpreopt_config := $(intermediates)/dexpreopt.config
my_dexpreopt_script := $(intermediates)/dexpreopt.sh
my_strip_script := $(intermediates)/strip.sh
my_dexpreopt_zip := $(intermediates)/dexpreopt.zip
$(my_dexpreopt_config): PRIVATE_MODULE := $(LOCAL_MODULE)
@ -252,17 +248,15 @@ ifdef LOCAL_DEX_PREOPT
@echo "$(PRIVATE_MODULE) dexpreopt.config"
echo -e -n '$(subst $(newline),\n,$(subst ','\'',$(subst \,\\,$(PRIVATE_CONTENTS))))' > $@
.KATI_RESTAT: $(my_dexpreopt_script) $(my_strip_script)
.KATI_RESTAT: $(my_dexpreopt_script)
$(my_dexpreopt_script): PRIVATE_MODULE := $(LOCAL_MODULE)
$(my_dexpreopt_script): PRIVATE_GLOBAL_CONFIG := $(DEX_PREOPT_CONFIG_FOR_MAKE)
$(my_dexpreopt_script): PRIVATE_MODULE_CONFIG := $(my_dexpreopt_config)
$(my_dexpreopt_script): PRIVATE_STRIP_SCRIPT := $(my_strip_script)
$(my_dexpreopt_script): .KATI_IMPLICIT_OUTPUTS := $(my_strip_script)
$(my_dexpreopt_script): $(DEXPREOPT_GEN)
$(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_CONFIG_FOR_MAKE)
@echo "$(PRIVATE_MODULE) dexpreopt gen"
$(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \
-dexpreopt_script $@ -strip_script $(PRIVATE_STRIP_SCRIPT) \
-dexpreopt_script $@ \
-out_dir $(OUT_DIR)
my_dexpreopt_deps := $(my_dex_jar)
@ -302,6 +296,5 @@ ifdef LOCAL_DEX_PREOPT
my_dexpreopt_config :=
my_dexpreopt_script :=
my_strip_script :=
my_dexpreopt_zip :=
endif # LOCAL_DEX_PREOPT

View file

@ -85,17 +85,6 @@ endif # LOCAL_UNCOMPRESS_DEX
.KATI_RESTAT: $(common_javalib.jar)
ifdef LOCAL_DEX_PREOPT
$(LOCAL_BUILT_MODULE): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
$(LOCAL_BUILT_MODULE): $(intermediates)/strip.sh
$(LOCAL_BUILT_MODULE): | $(DEXPREOPT_STRIP_DEPS)
$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
$(PRIVATE_STRIP_SCRIPT) $< $@
else # LOCAL_DEX_PREOPT
$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
endif # LOCAL_DEX_PREOPT
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY

View file

@ -45,19 +45,8 @@ ALL_MODULES.$(my_register_name).CLASSES_JAR := $(common_classes_jar)
# defines built_odex along with rule to install odex
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
#######################################
ifdef LOCAL_DEX_PREOPT
$(built_module): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
$(built_module): $(intermediates)/strip.sh
$(built_module): | $(DEXPREOPT_STRIP_DEPS)
$(built_module): .KATI_DEPFILE := $(built_module).d
$(built_module): $(my_prebuilt_src_file)
$(PRIVATE_STRIP_SCRIPT) $< $@
else # ! LOCAL_DEX_PREOPT
$(built_module) : $(my_prebuilt_src_file)
$(call copy-file-to-target)
endif # LOCAL_DEX_PREOPT
else # ! prebuilt_module_is_dex_javalib
$(built_module) : $(my_prebuilt_src_file)

View file

@ -538,15 +538,6 @@ endif
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
$(LOCAL_BUILT_MODULE) : $(ZIP2ZIP)
endif
ifneq ($(BUILD_PLATFORM_ZIP),)
$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
endif
ifdef LOCAL_DEX_PREOPT
$(LOCAL_BUILT_MODULE) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
$(LOCAL_BUILT_MODULE) : $(intermediates)/strip.sh
$(LOCAL_BUILT_MODULE) : | $(DEXPREOPT_STRIP_DEPS)
$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
endif
$(LOCAL_BUILT_MODULE): PRIVATE_USE_EMBEDDED_NATIVE_LIBS := $(LOCAL_USE_EMBEDDED_NATIVE_LIBS)
$(LOCAL_BUILT_MODULE):
@echo "target Package: $(PRIVATE_MODULE) ($@)"
@ -569,19 +560,11 @@ ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
@# No need to align, sign-package below will do it.
$(uncompress-dexs)
endif
# Run appcompat before stripping the classes.dex file.
# Run appcompat before signing.
ifeq ($(module_run_appcompat),true)
$(appcompat-header)
$(run-appcompat)
endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT
ifneq ($(BUILD_PLATFORM_ZIP),)
@# Keep a copy of apk with classes.dex unstripped
$(hide) cp -f $@ $(dir $@)package.dex.apk
endif # BUILD_PLATFORM_ZIP
mv -f $@ $@.tmp
$(PRIVATE_STRIP_SCRIPT) $@.tmp $@
endif # LOCAL_DEX_PREOPT
$(sign-package)
ifdef LOCAL_COMPRESSED_MODULE
$(compress-package)

View file

@ -97,10 +97,6 @@ endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
java-dex: $(LOCAL_SOONG_DEX_JAR)
ifneq ($(BUILD_PLATFORM_ZIP),)
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk))
endif
my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
$(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
my_installed := $(call copy-many-files, $(my_built_installed))