Move odex related files to product-specific dir.

For target Java libraries, now the LOCAL_BUILT_MODULE includes both javalib.jar
and the .odex file, if dexpreopt is enabled.
These 2 files are moved to a product-specific dir in this change.
For target Java Libraries, $(intermediates) now points to the product-specific dir.
There is still a javalib.jar in the $(intermediates.COMMON) dir, which is used as dependency.
Nothing is changed for host Java libraries.

Change-Id: I2546dbb940c74537864ca002d1acb49bb731fbbc
This commit is contained in:
Ying Wang 2010-09-24 18:09:04 -07:00
parent 46fc2341c5
commit a83940fa78
7 changed files with 30 additions and 29 deletions

View file

@ -342,7 +342,7 @@ ifneq ($(strip $(all_java_sources)$(all_res_assets)),)
full_static_java_libs := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
$(call intermediates-dir-for, \
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/javalib.jar)
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes

View file

@ -187,10 +187,8 @@ installclean_files := \
./$(PRODUCT_OUT)/recovery \
./$(PRODUCT_OUT)/root \
./$(PRODUCT_OUT)/system \
./$(PRODUCT_OUT)/dex_bootjars
# TODO: move the dex-preopt files to a product-specific directory
installclean_files += ./$(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/*/javalib.jar
./$(PRODUCT_OUT)/dex_bootjars \
./$(PRODUCT_OUT)/obj/JAVA_LIBRARIES
# The files/dirs to delete during a dataclean, which removes any files
# in the staging and emulator data partitions.

View file

@ -381,7 +381,7 @@ $(strip \
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
$(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
$(if $(filter $(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
, \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_INTERMEDIATES)) \

View file

@ -45,7 +45,7 @@ define _dexpreopt-boot-jar
$(eval _dbj_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).jar)
$(eval _dbj_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).odex)
$(eval _dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar)
$(eval _dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.dex.jar)
$(eval _dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar)
$(eval $(_dbj_odex): PRIVATE_DBJ_JAR := $(_dbj_jar))
$(_dbj_odex) : $(_dbj_src_jar) | $(ACP) $(DEXPREOPT) $(DEXOPT)
@echo "Dexpreopt Boot Jar: $$@"

View file

@ -274,7 +274,7 @@ TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data
TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
COMMON_MODULE_CLASSES := JAVA_LIBRARIES NOTICE_FILES
COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES
ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist

View file

@ -23,17 +23,15 @@ all_res_assets :=
LOCAL_BUILT_MODULE_STEM := javalib.jar
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
ifndef LOCAL_IS_HOST_MODULE
# This file will be the one that other modules should depend on.
common_javalib.jar := $(intermediates.COMMON)/$(LOCAL_BUILT_MODULE_STEM)
LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar)
ifeq (true,$(WITH_DEXPREOPT))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
jar_with_dex := $(intermediates.COMMON)/javalib.dex.jar
LOCAL_INTERMEDIATE_TARGETS += $(jar_with_dex)
endif
endif
endif
@ -43,15 +41,17 @@ include $(BUILD_SYSTEM)/java.mk
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex or resources; all we want are the .class files.
$(LOCAL_BUILT_MODULE): $(full_classes_jar)
$(common_javalib.jar) : $(full_classes_jar)
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
$(copy-file-to-target)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
ifeq ($(LOCAL_DEX_PREOPT),true)
$(jar_with_dex): PRIVATE_DEX_FILE := $(built_dex)
$(jar_with_dex) : $(built_dex) $(java_resource_sources) | $(AAPT)
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(AAPT)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
@ -59,6 +59,7 @@ ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif
ifeq ($(LOCAL_DEX_PREOPT),true)
dexpreopt_boot_jar_module := $(filter $(LOCAL_MODULE),$(DEXPREOPT_BOOT_JARS_MODULES))
ifneq ($(dexpreopt_boot_jar_module),)
# boot jar's rules are defined in dex_preopt.mk
@ -76,26 +77,20 @@ built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
# Make sure the boot jars get dex-preopt-ed first
$(built_odex) : $(DEXPREOPT_BOOT_ODEXS)
$(built_odex) : $(jar_with_dex) | $(DEXPREOPT) $(DEXOPT)
$(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(hide) rm -f $@
$(call dexpreopt-one-file,$<,$@)
$(LOCAL_BUILT_MODULE) : $(jar_with_dex) | $(ACP) $(AAPT)
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(AAPT)
$(call copy-file-to-target)
$(call dexpreopt-remove-classes.dex,$@)
endif # dexpreopt_boot_jar_module
else # LOCAL_DEX_PREOPT
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE) : $(built_dex) $(java_resource_sources) | $(AAPT)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif
endif # LOCAL_DEX_PREOPT
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
$(call copy-file-to-target)
endif # LOCAL_DEX_PREOPT
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY

View file

@ -42,6 +42,14 @@ $(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
endif
endif
ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
# while the deps should be in the common dir, so we make a copy in the common dir.
common_library_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/$(notdir $(LOCAL_BUILT_MODULE))
$(common_library_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
$(transform-prebuilt-to-target)
endif
ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
# The magic string "EXTERNAL" means this package will be signed with
# the test key throughout the build process, but we expect the final