diff options
-rw-r--r-- | core/base_rules.mk | 2 | ||||
-rw-r--r-- | core/cleanbuild.mk | 6 | ||||
-rw-r--r-- | core/definitions.mk | 2 | ||||
-rw-r--r-- | core/dex_preopt.mk | 2 | ||||
-rw-r--r-- | core/envsetup.mk | 2 | ||||
-rw-r--r-- | core/java_library.mk | 37 | ||||
-rw-r--r-- | core/prebuilt.mk | 8 |
7 files changed, 30 insertions, 29 deletions
diff --git a/core/base_rules.mk b/core/base_rules.mk index 6931069..e520228 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -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 diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index dbc64ff..cf25ce1 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -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. diff --git a/core/definitions.mk b/core/definitions.mk index ee006d9..5262249 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -394,7 +394,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)) \ diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 0e151bd..6e0b093 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -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: $$@" diff --git a/core/envsetup.mk b/core/envsetup.mk index 1b40f7e..a8592a4 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -276,7 +276,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 diff --git a/core/java_library.mk b/core/java_library.mk index 794b5d6..abc4728 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -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 diff --git a/core/prebuilt.mk b/core/prebuilt.mk index b03f2af..b4717e0 100644 --- a/core/prebuilt.mk +++ b/core/prebuilt.mk @@ -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 |