2009-03-04 11:28:42 +08:00
|
|
|
###########################################################
|
|
|
|
## Standard rules for building a java library.
|
|
|
|
##
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
$(error $(LOCAL_PATH): Host java libraries must use BUILD_HOST_JAVA_LIBRARY)
|
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
|
|
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
|
|
|
|
|
|
|
ifneq (,$(LOCAL_ASSET_DIR))
|
|
|
|
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_ASSET_DIR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(LOCAL_RESOURCE_DIR))
|
|
|
|
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_RESOURCE_DIR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
#xxx base_rules.mk looks at this
|
|
|
|
all_res_assets :=
|
|
|
|
|
|
|
|
LOCAL_BUILT_MODULE_STEM := javalib.jar
|
|
|
|
|
2010-09-28 05:53:39 +08:00
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
|
|
|
2010-09-25 09:09:04 +08:00
|
|
|
# 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)
|
|
|
|
|
2011-10-25 03:17:03 +08:00
|
|
|
ifneq (true,$(WITH_DEXPREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
else
|
2011-01-13 03:12:06 +08:00
|
|
|
ifeq (,$(TARGET_BUILD_APPS))
|
2010-09-18 07:36:06 +08:00
|
|
|
ifndef LOCAL_DEX_PREOPT
|
|
|
|
LOCAL_DEX_PREOPT := true
|
|
|
|
endif
|
|
|
|
endif
|
2011-01-13 03:12:06 +08:00
|
|
|
endif
|
2011-10-25 03:17:03 +08:00
|
|
|
ifeq (false,$(LOCAL_DEX_PREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
2010-09-18 07:36:06 +08:00
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
#################################
|
|
|
|
include $(BUILD_SYSTEM)/java.mk
|
|
|
|
#################################
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2011-04-02 06:45:58 +08:00
|
|
|
# No dex; all we want are the .class files with resources.
|
|
|
|
$(common_javalib.jar) : $(full_classes_jar) $(java_resource_sources)
|
2009-03-04 11:28:42 +08:00
|
|
|
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(copy-file-to-target)
|
2011-04-02 06:45:58 +08:00
|
|
|
ifneq ($(extra_jar_args),)
|
|
|
|
$(add-java-resources-to-package)
|
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2010-09-25 09:09:04 +08:00
|
|
|
$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
|
|
|
|
$(copy-file-to-target)
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
2010-09-25 09:09:04 +08:00
|
|
|
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(AAPT)
|
2010-09-18 07:36:06 +08:00
|
|
|
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-empty-package)
|
|
|
|
$(add-dex-to-package)
|
|
|
|
ifneq ($(extra_jar_args),)
|
|
|
|
$(add-java-resources-to-package)
|
|
|
|
endif
|
|
|
|
|
2011-10-25 03:17:03 +08:00
|
|
|
ifdef LOCAL_DEX_PREOPT
|
2010-09-18 07:36:06 +08:00
|
|
|
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
|
|
|
|
dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) | $(ACP)
|
|
|
|
$(call copy-file-to-target)
|
|
|
|
|
|
|
|
dexpreopted_boot_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module).odex
|
|
|
|
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
|
|
|
|
$(built_odex) : $(dexpreopted_boot_odex) | $(ACP)
|
|
|
|
$(call copy-file-to-target)
|
|
|
|
|
|
|
|
else # dexpreopt_boot_jar_module
|
|
|
|
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)
|
2010-09-25 09:09:04 +08:00
|
|
|
$(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
|
2010-09-18 07:36:06 +08:00
|
|
|
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(hide) rm -f $@
|
|
|
|
$(call dexpreopt-one-file,$<,$@)
|
|
|
|
|
2010-09-25 09:09:04 +08:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(AAPT)
|
2010-09-18 07:36:06 +08:00
|
|
|
$(call copy-file-to-target)
|
2011-10-25 03:17:03 +08:00
|
|
|
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
2010-09-18 07:36:06 +08:00
|
|
|
$(call dexpreopt-remove-classes.dex,$@)
|
2011-10-25 03:17:03 +08:00
|
|
|
endif
|
2010-09-18 07:36:06 +08:00
|
|
|
|
|
|
|
endif # dexpreopt_boot_jar_module
|
|
|
|
|
|
|
|
else # LOCAL_DEX_PREOPT
|
2010-09-25 09:09:04 +08:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
|
|
|
|
$(call copy-file-to-target)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2010-09-25 09:09:04 +08:00
|
|
|
endif # LOCAL_DEX_PREOPT
|
2009-03-04 11:28:42 +08:00
|
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|