Fix preopting Soong apps

dex_preopt_odex_install.mk should always be included, it handles
setting a default value for LOCAL_DEX_PREOPT.
Use dexpreopt-copy-jar when preopting to strip the dex file if
necessary.

Bug: 115967961
Test: m SystemUI
Change-Id: I74f77ed0e88a67043836407261f3845a16cbaf37
This commit is contained in:
Colin Cross 2018-09-18 10:16:37 -07:00
parent d55211f915
commit 1fe104cc13

View file

@ -43,8 +43,6 @@ endif
endif # TURBINE_ENABLED != false
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
resource_export_package := $(intermediates.COMMON)/package-export.apk
resource_export_stamp := $(intermediates.COMMON)/src/R.stamp
@ -61,14 +59,18 @@ endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
java-dex: $(LOCAL_SOONG_DEX_JAR)
ifdef LOCAL_DEX_PREOPT
# defines built_odex along with rule to install odex
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
$(built_odex): $(LOCAL_SOONG_DEX_JAR)
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)))
else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
endif
PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
ifdef LOCAL_CERTIFICATE
PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE)