summaryrefslogtreecommitdiffstats
path: root/core/package.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2010-09-17 16:36:06 -0700
committerYing Wang <wangying@google.com>2010-09-22 16:51:53 -0700
commite7874c430895b9a4e631c89f1e7729da9264d167 (patch)
treeeca14a68019faa2ee119cab7de78fcc8df7dedc0 /core/package.mk
parent38a3161dc7f5fec81df9412bc202c3962c74535d (diff)
downloadbuild-e7874c430895b9a4e631c89f1e7729da9264d167.zip
build-e7874c430895b9a4e631c89f1e7729da9264d167.tar.gz
build-e7874c430895b9a4e631c89f1e7729da9264d167.tar.bz2
Integrate dexpreopt into the build system.
Change-Id: Id67f85d0f5c8674f5bc22e431114ca73625811ef
Diffstat (limited to 'core/package.mk')
-rw-r--r--core/package.mk20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/package.mk b/core/package.mk
index 8254bae..6834995 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -154,6 +154,14 @@ endif # all_resources
endif # !custom
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
+ifeq (true,$(WITH_DEXPREOPT))
+ifneq (,$(LOCAL_SRC_FILES))
+ifndef LOCAL_DEX_PREOPT
+LOCAL_DEX_PREOPT := true
+endif
+endif
+endif
+
# The dex files go in the package, so we don't
# want to install them separately for this module.
old_DONT_INSTALL_DEX_FILES := $(DONT_INSTALL_DEX_FILES)
@@ -314,6 +322,10 @@ PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
+ifeq ($(LOCAL_DEX_PREOPT),true)
+# Make sure the boot jars get dexpreopt-ed first
+$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
+endif
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
@@ -332,6 +344,14 @@ endif
$(sign-package)
@# Alignment must happen after all other zip operations.
$(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
# Save information about this package
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))