blob: 92ba8b781f9fa88a6c8fdeae7d9e7a8ecfacb5cf [file] [log] [blame]
Ying Wang82b836f2012-03-30 18:08:07 -07001# This file defines the rule to fuse the platform.zip into the current PDK build.
Colin Crossc451a372013-12-18 19:36:44 -08002PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR :=
3PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR := \
4 host/common/obj/JAVA_LIBRARIES/bouncycastle-host_intermediates
5PDK_PLATFORM_JAVA_ZIP_CONTENTS :=
6
Keun young Parkf4d14382012-06-18 12:46:46 -07007ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP))
Keun young Park816b9fd2012-05-16 10:32:41 -07008# additional items to add to platform.zip for platform-java build
9# For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
10# all paths under out dir
Colin Crossc451a372013-12-18 19:36:44 -080011PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR += \
Nicholas Sauer1b2637e2015-03-27 09:26:27 -070012 target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
13 target/common/obj/JAVA_LIBRARIES/android-common_intermediates \
14 target/common/obj/JAVA_LIBRARIES/android-ex-camera2_intermediates \
15 target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
16 target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates \
17 target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates \
Piotr Jastrzebski89b94c82015-02-17 16:55:52 +000018 target/common/obj/JAVA_LIBRARIES/core-oj_intermediates \
Nicholas Sauer1b2637e2015-03-27 09:26:27 -070019 target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \
Paul Duffin6470f4f2016-11-29 12:15:13 +000020 target/common/obj/JAVA_LIBRARIES/legacy-test_intermediates \
Keun-young Park37ae4222017-07-27 14:11:49 -070021 target/common/obj/JAVA_LIBRARIES/legacy-android-test_intermediates \
Nicholas Sauer1b2637e2015-03-27 09:26:27 -070022 target/common/obj/JAVA_LIBRARIES/ext_intermediates \
23 target/common/obj/JAVA_LIBRARIES/framework_intermediates \
24 target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
25 target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \
26 target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
27 target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \
Colin Cross4b764992014-01-29 10:01:37 -080028
Colin Crossc451a372013-12-18 19:36:44 -080029# not java libraries
30PDK_PLATFORM_JAVA_ZIP_CONTENTS += \
31 target/common/obj/APPS/framework-res_intermediates/package-export.apk \
32 target/common/obj/APPS/framework-res_intermediates/src/R.stamp
33endif # platform-java or FUSION build
34
Colin Cross074d8382013-12-17 12:06:59 -080035PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \
36 $(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR) \
37 $(PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR)
Colin Crossc451a372013-12-18 19:36:44 -080038
Keun young Park816b9fd2012-05-16 10:32:41 -070039PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
Keun-young Parkc8d73492016-01-26 19:22:37 -080040 $(lib_dir)/classes.jack $(lib_dir)/classes.jar $(lib_dir)/classes.jar.toc \
41 $(lib_dir)/javalib.jar $(lib_dir)/classes*.dex \
42 $(lib_dir)/classes.dex.toc )
Keun young Park816b9fd2012-05-16 10:32:41 -070043
Keun young Parkefe02ce2012-06-06 17:19:29 -070044# check and override java support level
Keun young Parkf4d14382012-06-18 12:46:46 -070045ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),)
Keun young Parkefe02ce2012-06-06 17:19:29 -070046ifneq ($(wildcard external/proguard),)
47TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
48else # no proguard
49TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
50endif
51# platform supprot is set after checking platform.zip
52endif # PDK
Keun young Park816b9fd2012-05-16 10:32:41 -070053
Ying Wang82b836f2012-03-30 18:08:07 -070054ifdef PDK_FUSION_PLATFORM_ZIP
Ying Wang82b836f2012-03-30 18:08:07 -070055_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
56_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
57
Keun young Park816b9fd2012-05-16 10:32:41 -070058_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
59 '*[^/]' -x 'target/common/*' 2>/dev/null)
60_pdk_fusion_java_file_list := \
61 $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
62_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
63 $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
Keun young Parkefe02ce2012-06-06 17:19:29 -070064
Keun young Park816b9fd2012-05-16 10:32:41 -070065ifneq ($(_pdk_fusion_java_file_list),)
Keun young Parkefe02ce2012-06-06 17:19:29 -070066# This represents whether java build can use platform API or not
67# This should not be used in Android.mk
68TARGET_BUILD_PDK_JAVA_PLATFORM := true
69ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
70TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
71endif
Keun young Park816b9fd2012-05-16 10:32:41 -070072endif
73
Ying Wang82b836f2012-03-30 18:08:07 -070074$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
75 @echo "Unzip $(dir $@) <- $<"
76 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
77 $(hide) unzip -qo $< -d $(dir $@)
Keun young Parkd8de82f2012-05-25 10:52:44 -070078 $(call split-long-arguments,-touch,$(_pdk_fusion_files))
Keun young Park816b9fd2012-05-16 10:32:41 -070079 $(hide) touch $@
Ying Wang82b836f2012-03-30 18:08:07 -070080
Keun young Park816b9fd2012-05-16 10:32:41 -070081
Ying Wang82b836f2012-03-30 18:08:07 -070082$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
83
Keun young Park816b9fd2012-05-16 10:32:41 -070084
Ying Wang82b836f2012-03-30 18:08:07 -070085# Implicit pattern rules to copy the fusion files to the system image directory.
86# Note that if there is already explicit rule in the build system to generate a file,
87# the pattern rule will be just ignored by make.
88# That's desired by us: we want only absent files from the platform zip package.
89# Copy with the last-modified time preserved, never follow symbolic links.
Colin Cross2bea2e62012-04-23 18:49:04 -070090$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp)
Ying Wang82b836f2012-03-30 18:08:07 -070091 @mkdir -p $(dir $@)
Sungmin Choi79d51092013-02-04 00:54:03 +090092 $(hide) rm -rf $@
Ying Wang82b836f2012-03-30 18:08:07 -070093 $(hide) cp -fpPR $< $@
94
Colin Crossc451a372013-12-18 19:36:44 -080095# implicit rules for host java files
96$(HOST_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/host/common/% $(_pdk_fusion_stamp)
97 @mkdir -p $(dir $@)
98 $(hide) cp -fpPR $< $@
99
Keun young Parkefe02ce2012-06-06 17:19:29 -0700100ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
Ying Wang82b836f2012-03-30 18:08:07 -0700101
keunyounga219bdc2013-07-25 18:20:09 -0700102PDK_FUSION_OUT_DIR := $(OUT_DIR)
Tom Cherry60767622012-06-14 17:33:38 -0700103ifeq (debug,$(TARGET_BUILD_TYPE))
104PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR)
Tom Cherry60767622012-06-14 17:33:38 -0700105endif
keunyounga219bdc2013-07-25 18:20:09 -0700106
107define JAVA_dependency_template
Yohann Roussel00221d42016-01-29 13:06:11 +0100108$(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
109 $(foreach d,$(filter $(2),$(_pdk_fusion_java_file_list)),$(PDK_FUSION_OUT_DIR)/$(d)))
Keun young Park816b9fd2012-05-16 10:32:41 -0700110endef
111
112# needs explicit dependency as package-export.apk is not explicitly pulled
113$(eval $(call JAVA_dependency_template,\
114target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
115target/common/obj/APPS/framework-res_intermediates/package-export.apk))
116
117# javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
Colin Cross074d8382013-12-17 12:06:59 -0800118$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
Keun young Park816b9fd2012-05-16 10:32:41 -0700119$(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
120$(lib_dir)/classes.jar)))
121
Keun-young Parkc8d73492016-01-26 19:22:37 -0800122# pull .jack and .dex files
123$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
124 $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.jar.toc,\
125 $(lib_dir)/classes.jar $(lib_dir)/classes.jack)))
126$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
127 $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.dex.toc,\
Yohann Roussel00221d42016-01-29 13:06:11 +0100128 $(lib_dir)/classes.jar $(lib_dir)/classes.jack $(lib_dir)/classes%.dex)))
Keun-young Parkc8d73492016-01-26 19:22:37 -0800129
Colin Cross074d8382013-12-17 12:06:59 -0800130# implicit rules for all other target files
Keun young Park816b9fd2012-05-16 10:32:41 -0700131$(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)
132 @mkdir -p $(dir $@)
133 $(hide) cp -fpPR $< $@
Ying Wang82b836f2012-03-30 18:08:07 -0700134endif
Keun young Parkebb351e2012-04-19 15:36:18 -0700135
Keun young Park816b9fd2012-05-16 10:32:41 -0700136ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
137
138endif # PDK_FUSION_PLATFORM_ZIP
139
Keun young Parkebb351e2012-04-19 15:36:18 -0700140ifeq ($(TARGET_BUILD_PDK),true)
Keun young Parkf4d14382012-06-18 12:46:46 -0700141$(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL))
Keun young Parkefe02ce2012-06-06 17:19:29 -0700142ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
Keun young Park816b9fd2012-05-16 10:32:41 -0700143
Keun young Parkebb351e2012-04-19 15:36:18 -0700144# SDK used for Java build under PDK
145PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
146$(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
147
Keun young Park816b9fd2012-05-16 10:32:41 -0700148else # PDK_JAVA
149
150$(info PDK Build uses the current platform API)
151
152endif # PDK_JAVA
153
Keun young Parkebb351e2012-04-19 15:36:18 -0700154endif # BUILD_PDK
Keun young Park72226692012-07-31 17:13:20 -0700155
156ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK)))
157# files under $(PRODUCT_OUT)/symbols to help debugging.
158# Source not included to PDK due to dependency issue, so provide symbols instead.
Ying Wang788c7782014-05-15 10:54:32 -0700159
Ying Wang00b83412014-05-15 16:13:15 -0700160# We may not be building all of them.
161# The platform.zip just silently ignores the nonexistent ones.
Keun young Park72226692012-07-31 17:13:20 -0700162PDK_SYMBOL_FILES_LIST := \
Ying Wang00b83412014-05-15 16:13:15 -0700163 system/bin/app_process32 \
164 system/bin/app_process64
Keun young Park72226692012-07-31 17:13:20 -0700165
166ifdef PDK_FUSION_PLATFORM_ZIP
167# symbols should be explicitly pulled for fusion build
Ying Wang00b83412014-05-15 16:13:15 -0700168$(foreach f,$(filter $(PDK_SYMBOL_FILES_LIST), $(_pdk_fusion_file_list)),\
Keun young Park72226692012-07-31 17:13:20 -0700169 $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f))))
170endif # PLATFORM_ZIP
171endif # platform.zip build or PDK