forked from openkylin/platform_build
enable PDK to use platform JAVA API
- make platform-java will add necessary Java stuffs from out/target/common/ to platform.zip - make platform works as before: no Java libraries - normal fusion build will pick up the file, and define TARGET_BUILD_PDK_JAVA besides TARGET_BUILD_PDK if Java stuffs are included - For TARGET_BUILD_PDK_JAVA, java.mk does not touch LOCAL_SDK_VERSION, which will lead into pulling non-SDK Java APIs Bug: 6482799 Change-Id: I90b1a0b06dc774150711680a6612f2b97b9eab3f
This commit is contained in:
parent
4007faf4c6
commit
816b9fd4e2
|
@ -815,19 +815,31 @@ systemtarball-nodeps: $(FS_GET_STATS) \
|
|||
.PHONY: stnod
|
||||
stnod: systemtarball-nodeps
|
||||
|
||||
# For platform-java goal, add platform as well
|
||||
ifneq (,$(filter platform-java, $(MAKECMDGOALS)))
|
||||
PLATFORM_ZIP_ADD_JAVA := true
|
||||
endif
|
||||
|
||||
#######
|
||||
## platform.zip: system, plus other files to be used in PDK fusion build,
|
||||
## in a zip file
|
||||
INSTALLED_PLATFROM_ZIP := $(PRODUCT_OUT)/platform.zip
|
||||
$(INSTALLED_PLATFROM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
|
||||
$(call pretty,"Platform zip package: $(INSTALLED_PLATFROM_ZIP)")
|
||||
INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
|
||||
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
|
||||
$(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
|
||||
$(hide) rm -f $@
|
||||
$(hide) cd $(dir $@) && zip -qry $(notdir $@) \
|
||||
$(TARGET_COPY_OUT_SYSTEM) \
|
||||
$(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES))
|
||||
ifeq (true,$(PLATFORM_ZIP_ADD_JAVA))
|
||||
$(hide) cd $(OUT_DIR) && zip -qry ../$(INSTALLED_PLATFORM_ZIP) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: platform
|
||||
platform: $(INSTALLED_PLATFROM_ZIP)
|
||||
platform: $(INSTALLED_PLATFORM_ZIP)
|
||||
|
||||
.PHONY: platform-java
|
||||
platform-java: platform
|
||||
|
||||
# Dist the platform.zip
|
||||
ifneq (,$(filter platform, $(MAKECMDGOALS)))
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
# all_res_assets
|
||||
|
||||
ifeq ($(TARGET_BUILD_PDK),true)
|
||||
ifeq ($(TARGET_BUILD_PDK_JAVA),)
|
||||
# LOCAL_SDK not defined or set to current
|
||||
ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
|
||||
LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
|
||||
endif
|
||||
endif # !PDK_JAVA
|
||||
endif #PDK
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,25 @@ endif
|
|||
endif # fusion
|
||||
endif # pdk or fusion
|
||||
|
||||
|
||||
# additional items to add to platform.zip for platform-java build
|
||||
# For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
|
||||
# all paths under out dir
|
||||
PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \
|
||||
target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
|
||||
target/common/obj/JAVA_LIBRARIES/core_intermediates \
|
||||
target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
|
||||
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
|
||||
target/common/obj/JAVA_LIBRARIES/framework_intermediates \
|
||||
target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates
|
||||
# not java libraries
|
||||
PDK_PLATFORM_JAVA_ZIP_CONTENTS := \
|
||||
target/common/obj/APPS/framework-res_intermediates/package-export.apk \
|
||||
target/common/obj/APPS/framework-res_intermediates/src/R.stamp
|
||||
PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
|
||||
$(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
|
||||
|
||||
|
||||
ifdef PDK_FUSION_PLATFORM_ZIP
|
||||
TARGET_BUILD_PDK := true
|
||||
ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
|
||||
|
@ -42,17 +61,27 @@ endif
|
|||
_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
|
||||
_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
|
||||
|
||||
_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
|
||||
'*[^/]' -x 'target/common/*' 2>/dev/null)
|
||||
_pdk_fusion_java_file_list := \
|
||||
$(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
|
||||
_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
|
||||
$(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
|
||||
ifneq ($(_pdk_fusion_java_file_list),)
|
||||
TARGET_BUILD_PDK_JAVA := true
|
||||
endif
|
||||
|
||||
$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
|
||||
@echo "Unzip $(dir $@) <- $<"
|
||||
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
|
||||
$(hide) unzip -qo $< -d $(dir $@)
|
||||
$(hide) touch $@
|
||||
$(call split-long-arguments,touch,$(_pdk_fusion_files))
|
||||
$(hide) touch $@
|
||||
|
||||
|
||||
_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null)
|
||||
_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list))
|
||||
$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
|
||||
|
||||
|
||||
# Implicit pattern rules to copy the fusion files to the system image directory.
|
||||
# Note that if there is already explicit rule in the build system to generate a file,
|
||||
# the pattern rule will be just ignored by make.
|
||||
|
@ -62,14 +91,47 @@ $(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp)
|
|||
@mkdir -p $(dir $@)
|
||||
$(hide) cp -fpPR $< $@
|
||||
|
||||
ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
|
||||
ifeq (true,$(TARGET_BUILD_PDK_JAVA))
|
||||
|
||||
define JAVA_dependency_template
|
||||
$(OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) $(OUT_DIR)/$(strip $(2)) \
|
||||
$(_pdk_fusion_stamp)
|
||||
@mkdir -p $$(dir $$@)
|
||||
$(hide) cp -fpPR $$< $$@
|
||||
endef
|
||||
|
||||
# needs explicit dependency as package-export.apk is not explicitly pulled
|
||||
$(eval $(call JAVA_dependency_template,\
|
||||
target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
|
||||
target/common/obj/APPS/framework-res_intermediates/package-export.apk))
|
||||
|
||||
# javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
|
||||
$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
|
||||
$(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
|
||||
$(lib_dir)/classes.jar)))
|
||||
|
||||
# implicit rules for all others
|
||||
$(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) cp -fpPR $< $@
|
||||
endif
|
||||
|
||||
ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
|
||||
|
||||
endif # PDK_FUSION_PLATFORM_ZIP
|
||||
|
||||
ifeq ($(TARGET_BUILD_PDK),true)
|
||||
|
||||
ifeq ($(TARGET_BUILD_PDK_JAVA),)
|
||||
|
||||
# SDK used for Java build under PDK
|
||||
PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
|
||||
$(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
|
||||
|
||||
else # PDK_JAVA
|
||||
|
||||
$(info PDK Build uses the current platform API)
|
||||
|
||||
endif # PDK_JAVA
|
||||
|
||||
endif # BUILD_PDK
|
||||
|
|
Loading…
Reference in New Issue