Created
December 26, 2014 02:40
-
-
Save WanghongLin/80f102c57fea9aff3a34 to your computer and use it in GitHub Desktop.
dex optimization for prebuilt apk in aosp build system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: core/prebuilt.mk | |
=================================================================== | |
--- core/prebuilt.mk (revision 2966) | |
+++ core/prebuilt.mk (working copy) | |
@@ -16,6 +16,16 @@ | |
$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH)) | |
endif | |
+#ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) | |
+# ifeq (true,$(WITH_DEXPREOPT)) | |
+# ifeq (,$(TARGET_BUILD_APPS)) | |
+# ifndef LOCAL_DEX_PREOPT | |
+# LOCAL_DEX_PREOPT := true | |
+# endif | |
+# endif | |
+# endif | |
+#endif | |
+ | |
ifdef LOCAL_IS_HOST_MODULE | |
my_prefix:=HOST_ | |
else | |
@@ -113,6 +123,10 @@ | |
endif | |
ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) | |
+ifeq ($(LOCAL_DEX_PREOPT),true) | |
+# Make sure the boot jars get dexpreopt-ed first | |
+$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT) | |
+endif | |
ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) | |
# Ensure that presigned .apks have been aligned. | |
$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN) | |
@@ -123,6 +137,14 @@ | |
$(transform-prebuilt-to-target) | |
$(sign-package) | |
$(align-package) | |
+ifeq ($(LOCAL_DEX_PREOPT),true) | |
+ $(hide) rm -f $(patsubst %.apk,%.odex,$@) | |
+ $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@)) | |
+ $(call dexpreopt-remove-classes.dex,$@) | |
+ | |
+built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex | |
+$(built_odex): $(LOCAL_BUILT_MODULE) | |
+endif | |
endif | |
else | |
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment