Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 1 | # This file defines the rule to fuse the platform.zip into the current PDK build. |
Colin Cross | c451a37 | 2013-12-18 19:36:44 -0800 | [diff] [blame] | 2 | PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR := |
| 3 | PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR := \ |
| 4 | host/common/obj/JAVA_LIBRARIES/bouncycastle-host_intermediates |
| 5 | PDK_PLATFORM_JAVA_ZIP_CONTENTS := |
| 6 | |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 7 | ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP)) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 8 | # 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 Cross | c451a37 | 2013-12-18 19:36:44 -0800 | [diff] [blame] | 11 | PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR += \ |
Nicholas Sauer | 1b2637e | 2015-03-27 09:26:27 -0700 | [diff] [blame] | 12 | 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 Jastrzebski | 89b94c8 | 2015-02-17 16:55:52 +0000 | [diff] [blame] | 18 | target/common/obj/JAVA_LIBRARIES/core-oj_intermediates \ |
Nicholas Sauer | 1b2637e | 2015-03-27 09:26:27 -0700 | [diff] [blame] | 19 | target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \ |
Paul Duffin | 6470f4f | 2016-11-29 12:15:13 +0000 | [diff] [blame] | 20 | target/common/obj/JAVA_LIBRARIES/legacy-test_intermediates \ |
Nicholas Sauer | 1b2637e | 2015-03-27 09:26:27 -0700 | [diff] [blame] | 21 | target/common/obj/JAVA_LIBRARIES/ext_intermediates \ |
| 22 | target/common/obj/JAVA_LIBRARIES/framework_intermediates \ |
| 23 | target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \ |
| 24 | target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \ |
| 25 | target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \ |
| 26 | target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \ |
Colin Cross | 4b76499 | 2014-01-29 10:01:37 -0800 | [diff] [blame] | 27 | |
Colin Cross | c451a37 | 2013-12-18 19:36:44 -0800 | [diff] [blame] | 28 | # not java libraries |
| 29 | PDK_PLATFORM_JAVA_ZIP_CONTENTS += \ |
| 30 | target/common/obj/APPS/framework-res_intermediates/package-export.apk \ |
| 31 | target/common/obj/APPS/framework-res_intermediates/src/R.stamp |
| 32 | endif # platform-java or FUSION build |
| 33 | |
Colin Cross | 074d838 | 2013-12-17 12:06:59 -0800 | [diff] [blame] | 34 | PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \ |
| 35 | $(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR) \ |
| 36 | $(PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR) |
Colin Cross | c451a37 | 2013-12-18 19:36:44 -0800 | [diff] [blame] | 37 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 38 | PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\ |
Keun-young Park | c8d7349 | 2016-01-26 19:22:37 -0800 | [diff] [blame] | 39 | $(lib_dir)/classes.jack $(lib_dir)/classes.jar $(lib_dir)/classes.jar.toc \ |
| 40 | $(lib_dir)/javalib.jar $(lib_dir)/classes*.dex \ |
| 41 | $(lib_dir)/classes.dex.toc ) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 42 | |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 43 | # check and override java support level |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 44 | ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 45 | ifneq ($(wildcard external/proguard),) |
| 46 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk |
| 47 | else # no proguard |
| 48 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := |
| 49 | endif |
| 50 | # platform supprot is set after checking platform.zip |
| 51 | endif # PDK |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 52 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 53 | ifdef PDK_FUSION_PLATFORM_ZIP |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 54 | _pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion) |
| 55 | _pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp |
| 56 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 57 | _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \ |
| 58 | '*[^/]' -x 'target/common/*' 2>/dev/null) |
| 59 | _pdk_fusion_java_file_list := \ |
| 60 | $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null) |
| 61 | _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\ |
| 62 | $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list)) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 63 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 64 | ifneq ($(_pdk_fusion_java_file_list),) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 65 | # This represents whether java build can use platform API or not |
| 66 | # This should not be used in Android.mk |
| 67 | TARGET_BUILD_PDK_JAVA_PLATFORM := true |
| 68 | ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),) |
| 69 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform |
| 70 | endif |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 71 | endif |
| 72 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 73 | $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP) |
| 74 | @echo "Unzip $(dir $@) <- $<" |
| 75 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 76 | $(hide) unzip -qo $< -d $(dir $@) |
Keun young Park | d8de82f | 2012-05-25 10:52:44 -0700 | [diff] [blame] | 77 | $(call split-long-arguments,-touch,$(_pdk_fusion_files)) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 78 | $(hide) touch $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 79 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 80 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 81 | $(_pdk_fusion_files) : $(_pdk_fusion_stamp) |
| 82 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 83 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 84 | # Implicit pattern rules to copy the fusion files to the system image directory. |
| 85 | # Note that if there is already explicit rule in the build system to generate a file, |
| 86 | # the pattern rule will be just ignored by make. |
| 87 | # That's desired by us: we want only absent files from the platform zip package. |
| 88 | # Copy with the last-modified time preserved, never follow symbolic links. |
Colin Cross | 2bea2e6 | 2012-04-23 18:49:04 -0700 | [diff] [blame] | 89 | $(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp) |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 90 | @mkdir -p $(dir $@) |
Sungmin Choi | 79d5109 | 2013-02-04 00:54:03 +0900 | [diff] [blame] | 91 | $(hide) rm -rf $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 92 | $(hide) cp -fpPR $< $@ |
| 93 | |
Colin Cross | c451a37 | 2013-12-18 19:36:44 -0800 | [diff] [blame] | 94 | # implicit rules for host java files |
| 95 | $(HOST_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/host/common/% $(_pdk_fusion_stamp) |
| 96 | @mkdir -p $(dir $@) |
| 97 | $(hide) cp -fpPR $< $@ |
| 98 | |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 99 | ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM)) |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 100 | |
keunyoung | a219bdc | 2013-07-25 18:20:09 -0700 | [diff] [blame] | 101 | PDK_FUSION_OUT_DIR := $(OUT_DIR) |
Tom Cherry | 6076762 | 2012-06-14 17:33:38 -0700 | [diff] [blame] | 102 | ifeq (debug,$(TARGET_BUILD_TYPE)) |
| 103 | PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR) |
Tom Cherry | 6076762 | 2012-06-14 17:33:38 -0700 | [diff] [blame] | 104 | endif |
keunyoung | a219bdc | 2013-07-25 18:20:09 -0700 | [diff] [blame] | 105 | |
| 106 | define JAVA_dependency_template |
Yohann Roussel | 00221d4 | 2016-01-29 13:06:11 +0100 | [diff] [blame] | 107 | $(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\ |
| 108 | $(foreach d,$(filter $(2),$(_pdk_fusion_java_file_list)),$(PDK_FUSION_OUT_DIR)/$(d))) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 109 | endef |
| 110 | |
| 111 | # needs explicit dependency as package-export.apk is not explicitly pulled |
| 112 | $(eval $(call JAVA_dependency_template,\ |
| 113 | target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\ |
| 114 | target/common/obj/APPS/framework-res_intermediates/package-export.apk)) |
| 115 | |
| 116 | # javalib.jar should pull classes.jar as classes.jar is not explicitly pulled. |
Colin Cross | 074d838 | 2013-12-17 12:06:59 -0800 | [diff] [blame] | 117 | $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\ |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 118 | $(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\ |
| 119 | $(lib_dir)/classes.jar))) |
| 120 | |
Keun-young Park | c8d7349 | 2016-01-26 19:22:37 -0800 | [diff] [blame] | 121 | # pull .jack and .dex files |
| 122 | $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\ |
| 123 | $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.jar.toc,\ |
| 124 | $(lib_dir)/classes.jar $(lib_dir)/classes.jack))) |
| 125 | $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\ |
| 126 | $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.dex.toc,\ |
Yohann Roussel | 00221d4 | 2016-01-29 13:06:11 +0100 | [diff] [blame] | 127 | $(lib_dir)/classes.jar $(lib_dir)/classes.jack $(lib_dir)/classes%.dex))) |
Keun-young Park | c8d7349 | 2016-01-26 19:22:37 -0800 | [diff] [blame] | 128 | |
Colin Cross | 074d838 | 2013-12-17 12:06:59 -0800 | [diff] [blame] | 129 | # implicit rules for all other target files |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 130 | $(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp) |
| 131 | @mkdir -p $(dir $@) |
| 132 | $(hide) cp -fpPR $< $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 133 | endif |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 134 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 135 | ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list)) |
| 136 | |
| 137 | endif # PDK_FUSION_PLATFORM_ZIP |
| 138 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 139 | ifeq ($(TARGET_BUILD_PDK),true) |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 140 | $(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL)) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 141 | ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 142 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 143 | # SDK used for Java build under PDK |
| 144 | PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)) |
| 145 | $(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION)) |
| 146 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 147 | else # PDK_JAVA |
| 148 | |
| 149 | $(info PDK Build uses the current platform API) |
| 150 | |
| 151 | endif # PDK_JAVA |
| 152 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 153 | endif # BUILD_PDK |
Keun young Park | 7222669 | 2012-07-31 17:13:20 -0700 | [diff] [blame] | 154 | |
| 155 | ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK))) |
| 156 | # files under $(PRODUCT_OUT)/symbols to help debugging. |
| 157 | # Source not included to PDK due to dependency issue, so provide symbols instead. |
Ying Wang | 788c778 | 2014-05-15 10:54:32 -0700 | [diff] [blame] | 158 | |
Ying Wang | 00b8341 | 2014-05-15 16:13:15 -0700 | [diff] [blame] | 159 | # We may not be building all of them. |
| 160 | # The platform.zip just silently ignores the nonexistent ones. |
Keun young Park | 7222669 | 2012-07-31 17:13:20 -0700 | [diff] [blame] | 161 | PDK_SYMBOL_FILES_LIST := \ |
Ying Wang | 00b8341 | 2014-05-15 16:13:15 -0700 | [diff] [blame] | 162 | system/bin/app_process32 \ |
| 163 | system/bin/app_process64 |
Keun young Park | 7222669 | 2012-07-31 17:13:20 -0700 | [diff] [blame] | 164 | |
| 165 | ifdef PDK_FUSION_PLATFORM_ZIP |
| 166 | # symbols should be explicitly pulled for fusion build |
Ying Wang | 00b8341 | 2014-05-15 16:13:15 -0700 | [diff] [blame] | 167 | $(foreach f,$(filter $(PDK_SYMBOL_FILES_LIST), $(_pdk_fusion_file_list)),\ |
Keun young Park | 7222669 | 2012-07-31 17:13:20 -0700 | [diff] [blame] | 168 | $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f)))) |
| 169 | endif # PLATFORM_ZIP |
| 170 | endif # platform.zip build or PDK |