Merge "Reduce the propagation of LOCAL_DEX_PREOPT := nostripping" am: aefeae367e

am: afabdbcc8b

Change-Id: I8557c34977184616a8499417df09326c2ac31cd7
This commit is contained in:
Colin Cross 2018-10-24 11:13:27 -07:00 committed by android-build-merger
commit 74cd0c4525
9 changed files with 24 additions and 15 deletions

View File

@ -275,6 +275,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES:=
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_LIBRARIES:=
LOCAL_STRIP_DEX:=
LOCAL_STRIP_MODULE:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_TARGET_REQUIRED_MODULES:=
@ -285,6 +286,7 @@ LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_TIDY:=
LOCAL_TIDY_CHECKS:=
LOCAL_TIDY_FLAGS:=
LOCAL_UNCOMPRESS_DEX:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_USE_AAPT2:=$(USE_AAPT2)

View File

@ -2640,12 +2640,12 @@ endef
# Copy an apk to a target location while removing classes*.dex
# $(1): source file
# $(2): destination file
# $(3): LOCAL_DEX_PREOPT, if nostripping then leave classes*.dex
# $(3): LOCAL_STRIP_DEX, if non-empty then strip classes*.dex
define dexpreopt-copy-jar
$(2): $(1)
@echo "Copy: $$@"
$$(copy-file-to-target)
$(if $(filter nostripping,$(3)),,$$(call dexpreopt-remove-classes.dex,$$@))
$(if $(3),$$(call dexpreopt-remove-classes.dex,$$@))
endef
# $(1): the .jar or .apk to remove classes.dex. Note that if all dex files

View File

@ -73,7 +73,7 @@ define _dexpreopt-boot-jar-remove-classes.dex
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
$(call dexpreopt-copy-jar,$$(_dbj_src_jar),$$(_dbj_jar_no_dex),$(DEX_PREOPT_DEFAULT))
$(call dexpreopt-copy-jar,$$(_dbj_src_jar),$$(_dbj_jar_no_dex),$(filter-out nostripping,$(DEX_PREOPT_DEFAULT)))
_dbj_jar_no_dex :=
_dbj_src_jar :=

View File

@ -5,7 +5,6 @@
# We explicitly uncompress APKs of privileged apps, and used by
# privileged apps
LOCAL_UNCOMPRESS_DEX := false
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
LOCAL_UNCOMPRESS_DEX := true
@ -33,6 +32,13 @@ ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
endif
endif
ifeq (nostripping,$(LOCAL_DEX_PREOPT))
LOCAL_DEX_PREOPT := true
LOCAL_STRIP_DEX :=
else
LOCAL_STRIP_DEX := true
endif
ifeq (false,$(LOCAL_DEX_PREOPT))
LOCAL_DEX_PREOPT :=
endif
@ -81,14 +87,14 @@ endif
ifeq ($(LOCAL_DEX_PREOPT),true)
# Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
LOCAL_DEX_PREOPT := nostripping
LOCAL_STRIP_DEX :=
endif # LOCAL_UNCOMPRESS_DEX
# system_other isn't there for an OTA, so don't strip
# if module is on system, and odex is on system_other.
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
ifneq ($(call install-on-system-other, $(my_module_path)),)
LOCAL_DEX_PREOPT := nostripping
LOCAL_STRIP_DEX :=
endif # install-on-system-other
endif # BOARD_USES_SYSTEM_OTHER_ODEX
@ -320,7 +326,8 @@ ifdef LOCAL_DEX_PREOPT
ifeq (true,$(my_generate_dm))
LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
LOCAL_DEX_PREOPT := nostripping
LOCAL_DEX_PREOPT := true
LOCAL_STRIP_DEX :=
my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex

View File

@ -96,7 +96,7 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
endif # ! boot jar

View File

@ -665,7 +665,7 @@ ifneq ($(BUILD_PLATFORM_ZIP),)
@# Keep a copy of apk with classes.dex unstripped
$(hide) cp -f $@ $(dir $@)package.dex.apk
endif # BUILD_PLATFORM_ZIP
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
ifdef LOCAL_STRIP_DEX
$(call dexpreopt-remove-classes.dex,$@)
endif
endif # LOCAL_DEX_PREOPT

View File

@ -380,9 +380,9 @@ endif
$(run-appcompat)
endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
ifdef LOCAL_STRIP_DEX
$(call dexpreopt-remove-classes.dex,$@)
endif # LOCAL_DEX_PREOPT != nostripping
endif # LOCAL_STRIP_DEX
endif # LOCAL_DEX_PREOPT
$(sign-package)
# No need for align-package because sign-package takes care of alignment
@ -400,7 +400,7 @@ endif # ! LOCAL_REPLACE_PREBUILT_APK_INSTALLED
# can do optimizations based on whether the built module only
# contains uncompressed dex code.
ifdef LOCAL_DEX_PREOPT
ifeq (nostripping,$(LOCAL_DEX_PREOPT))
ifndef LOCAL_STRIP_DEX
$(built_odex) : $(built_module)
$(call dexpreopt-one-file,$<,$@)
else
@ -470,7 +470,7 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(my_prebuilt_src_file)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(my_prebuilt_src_file),$(built_module),$(LOCAL_DEX_PREOPT)))
$(eval $(call dexpreopt-copy-jar,$(my_prebuilt_src_file),$(built_module),$(LOCAL_STRIP_DEX)))
endif # boot jar
else # ! LOCAL_DEX_PREOPT
$(built_module) : $(my_prebuilt_src_file)

View File

@ -69,7 +69,7 @@ endif
ifdef LOCAL_DEX_PREOPT
$(built_odex): $(LOCAL_SOONG_DEX_JAR)
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
$(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
endif

View File

@ -108,7 +108,7 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
endif # ! boot jar
else # LOCAL_DEX_PREOPT
$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))