Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2008 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | ########################################################### |
| 18 | ## Standard rules for building an application package. |
| 19 | ## |
| 20 | ## Additional inputs from base_rules.make: |
| 21 | ## LOCAL_PACKAGE_NAME: The name of the package; the directory |
| 22 | ## will be called this. |
| 23 | ## |
| 24 | ## MODULE, MODULE_PATH, and MODULE_SUFFIX will |
| 25 | ## be set for you. |
| 26 | ########################################################### |
| 27 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 28 | LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME)) |
| 29 | ifeq ($(LOCAL_PACKAGE_NAME),) |
| 30 | $(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME) |
| 31 | endif |
| 32 | |
| 33 | ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),) |
| 34 | $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX) |
| 35 | endif |
| 36 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) |
| 37 | |
Cole Faust | c2becd0 | 2021-11-05 12:28:33 -0700 | [diff] [blame] | 38 | ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),) |
| 39 | $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_STEM or LOCAL_BUILT_MODULE_STEM) |
| 40 | endif |
| 41 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 42 | ifneq ($(strip $(LOCAL_MODULE)),) |
| 43 | $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE) |
| 44 | endif |
| 45 | LOCAL_MODULE := $(LOCAL_PACKAGE_NAME) |
| 46 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 47 | ifneq ($(strip $(LOCAL_MODULE_CLASS)),) |
| 48 | $(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS) |
| 49 | endif |
| 50 | LOCAL_MODULE_CLASS := APPS |
| 51 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 52 | intermediates := $(call local-intermediates-dir) |
| 53 | intermediates.COMMON := $(call local-intermediates-dir,COMMON) |
| 54 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 55 | # Package LOCAL_MODULE_TAGS default to optional |
| 56 | LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS)) |
| 57 | ifeq ($(LOCAL_MODULE_TAGS),) |
| 58 | LOCAL_MODULE_TAGS := optional |
| 59 | endif |
| 60 | |
| 61 | ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),) |
| 62 | # Force localization check if it's not tagged as tests. |
| 63 | LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z |
| 64 | endif |
| 65 | |
Ying Wang | 4cb0499 | 2014-07-29 10:34:30 -0700 | [diff] [blame] | 66 | need_compile_asset := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 67 | ifeq (,$(LOCAL_ASSET_DIR)) |
| 68 | LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets |
Ying Wang | 4cb0499 | 2014-07-29 10:34:30 -0700 | [diff] [blame] | 69 | else |
| 70 | need_compile_asset := true |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 71 | endif |
| 72 | |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 73 | # LOCAL_RESOURCE_DIR may point to resource generated during the build |
| 74 | need_compile_res := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 75 | ifeq (,$(LOCAL_RESOURCE_DIR)) |
| 76 | LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 77 | else |
| 78 | need_compile_res := true |
Dan Willemsen | fa7ecfb | 2017-05-02 23:55:44 -0700 | [diff] [blame] | 79 | LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d))) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 80 | endif |
| 81 | |
Jiyong Park | 185d41e | 2019-01-05 12:57:54 +0900 | [diff] [blame] | 82 | # If LOCAL_MODULE matches a rule in PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES, |
Jiyong Park | 9ee3a16 | 2019-01-16 01:07:35 +0900 | [diff] [blame] | 83 | # override the manifest package name by the (first) rule matched |
Jiyong Park | 185d41e | 2019-01-05 12:57:54 +0900 | [diff] [blame] | 84 | override_manifest_name := $(strip $(word 1,\ |
| 85 | $(foreach rule,$(PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES),\ |
| 86 | $(eval _pkg_name_pat := $(call word-colon,1,$(rule)))\ |
| 87 | $(eval _manifest_name_pat := $(call word-colon,2,$(rule)))\ |
| 88 | $(if $(filter $(_pkg_name_pat),$(LOCAL_MODULE)),\ |
| 89 | $(patsubst $(_pkg_name_pat),$(_manifest_name_pat),$(LOCAL_MODULE))\ |
| 90 | )\ |
| 91 | )\ |
| 92 | )) |
| 93 | |
| 94 | ifneq (,$(override_manifest_name)) |
Jiyong Park | 9ee3a16 | 2019-01-16 01:07:35 +0900 | [diff] [blame] | 95 | # Note: this can override LOCAL_MANIFEST_PACKAGE_NAME value set in Android.mk |
Jiyong Park | 185d41e | 2019-01-05 12:57:54 +0900 | [diff] [blame] | 96 | LOCAL_MANIFEST_PACKAGE_NAME := $(override_manifest_name) |
| 97 | endif |
| 98 | |
Colin Cross | 2029903 | 2018-05-09 13:29:51 -0700 | [diff] [blame] | 99 | include $(BUILD_SYSTEM)/force_aapt2.mk |
Spandan Das | 68684be | 2021-11-02 03:54:05 +0000 | [diff] [blame] | 100 | # validate that app contains a manifest file for aapt2 |
| 101 | ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE))) |
| 102 | ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml)) |
| 103 | $(call pretty-error,App missing manifest file which is required by aapt2. \ |
| 104 | Provide a manifest file by either setting LOCAL_MANIFEST_FILE in Android.mk \ |
| 105 | or via a AndroidManifest.xml in this directory) |
| 106 | endif |
| 107 | endif |
Colin Cross | 2029903 | 2018-05-09 13:29:51 -0700 | [diff] [blame] | 108 | |
Colin Cross | 7bc6cab | 2018-05-17 15:05:47 -0700 | [diff] [blame] | 109 | # Process Support Library dependencies. |
| 110 | include $(BUILD_SYSTEM)/support_libraries.mk |
| 111 | |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 112 | # Determine whether auto-RRO is enabled for this package. |
| 113 | enforce_rro_enabled := |
Colin Cross | 93ff702 | 2023-05-17 10:56:44 -0700 | [diff] [blame] | 114 | ifeq (,$(filter tests,$(LOCAL_MODULE_TAGS))) |
| 115 | ifneq (,$(filter *, $(PRODUCT_ENFORCE_RRO_TARGETS))) |
| 116 | # * means all system and system_ext APKs, so enable conditionally based on module path. |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 117 | |
Colin Cross | 93ff702 | 2023-05-17 10:56:44 -0700 | [diff] [blame] | 118 | # Note that base_rules.mk has not yet been included, so it's likely that only |
| 119 | # one of LOCAL_MODULE_PATH and the LOCAL_X_MODULE flags has been set. |
| 120 | ifeq (,$(LOCAL_MODULE_PATH)) |
| 121 | non_rro_target_module := $(filter true,\ |
| 122 | $(LOCAL_ODM_MODULE) \ |
| 123 | $(LOCAL_OEM_MODULE) \ |
| 124 | $(LOCAL_PRODUCT_MODULE) \ |
| 125 | $(LOCAL_PROPRIETARY_MODULE) \ |
| 126 | $(LOCAL_VENDOR_MODULE)) |
| 127 | enforce_rro_enabled := $(if $(non_rro_target_module),,true) |
| 128 | else ifneq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),) |
| 129 | enforce_rro_enabled := true |
| 130 | endif |
| 131 | else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS))) |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 132 | enforce_rro_enabled := true |
| 133 | endif |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 134 | endif |
| 135 | |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 136 | product_package_overlays := $(strip \ |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 137 | $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \ |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 138 | $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR))))) |
| 139 | device_package_overlays := $(strip \ |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 140 | $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \ |
| 141 | $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR))))) |
| 142 | |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 143 | static_resource_overlays := |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 144 | runtime_resource_overlays_product := |
| 145 | runtime_resource_overlays_vendor := |
Jaekyun Seok | ccee95e | 2017-09-01 17:23:25 +0900 | [diff] [blame] | 146 | ifdef enforce_rro_enabled |
| 147 | ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),) |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 148 | # The PRODUCT_ exclusion variable applies to both inclusion variables.. |
| 149 | static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(product_package_overlays)) |
| 150 | static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(device_package_overlays)) |
Jaekyun Seok | ccee95e | 2017-09-01 17:23:25 +0900 | [diff] [blame] | 151 | endif |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 152 | runtime_resource_overlays_product := $(filter-out $(static_resource_overlays),$(product_package_overlays)) |
| 153 | runtime_resource_overlays_vendor := $(filter-out $(static_resource_overlays),$(device_package_overlays)) |
Jaekyun Seok | ccee95e | 2017-09-01 17:23:25 +0900 | [diff] [blame] | 154 | else |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 155 | static_resource_overlays := $(product_package_overlays) $(device_package_overlays) |
Jaekyun Seok | 3070610 | 2017-02-02 00:44:58 +0900 | [diff] [blame] | 156 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 157 | |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 158 | # Add the static overlays. Auto-RRO is created later, as it depends on |
| 159 | # other logic in this file. |
| 160 | LOCAL_RESOURCE_DIR := $(static_resource_overlays) $(LOCAL_RESOURCE_DIR) |
| 161 | |
Colin Cross | 2c32144 | 2014-02-12 13:06:30 -0800 | [diff] [blame] | 162 | all_assets := $(strip \ |
| 163 | $(foreach dir, $(LOCAL_ASSET_DIR), \ |
| 164 | $(addprefix $(dir)/, \ |
| 165 | $(patsubst assets/%,%, \ |
| 166 | $(call find-subdir-assets, $(dir)) \ |
| 167 | ) \ |
| 168 | ) \ |
| 169 | )) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 170 | |
Ying Wang | 4cb0499 | 2014-07-29 10:34:30 -0700 | [diff] [blame] | 171 | ifneq ($(all_assets),) |
| 172 | need_compile_asset := true |
| 173 | endif |
| 174 | |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 175 | my_res_package := |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 176 | # In aapt2 the last takes precedence. |
| 177 | my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR)) |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 178 | my_res_dir := |
| 179 | my_overlay_res_dirs := |
| 180 | |
Colin Cross | 71c5b95 | 2018-05-23 13:35:53 -0700 | [diff] [blame] | 181 | ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),) |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 182 | # If we are using static android libraries, every source file becomes an overlay. |
| 183 | # This is to emulate old AAPT behavior which simulated library support. |
| 184 | my_res_dir := |
| 185 | my_overlay_res_dirs := $(my_resource_dirs) |
| 186 | else |
| 187 | # Without static libraries, the first directory is our directory, which can then be |
| 188 | # overlaid by the rest. (First directory in my_resource_dirs is last directory in |
| 189 | # $(LOCAL_RESOURCE_DIR) due to it being reversed. |
| 190 | my_res_dir := $(firstword $(my_resource_dirs)) |
| 191 | my_overlay_res_dirs := $(wordlist 2,999,$(my_resource_dirs)) |
| 192 | endif |
| 193 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 194 | my_overlay_resources := $(strip \ |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 195 | $(foreach d,$(my_overlay_res_dirs),\ |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 196 | $(addprefix $(d)/, \ |
| 197 | $(call find-subdir-assets,$(d))))) |
| 198 | |
Colin Cross | fe10963 | 2016-11-29 11:12:56 -0800 | [diff] [blame] | 199 | my_res_resources := $(if $(my_res_dir),$(strip \ |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 200 | $(addprefix $(my_res_dir)/, \ |
Colin Cross | fe10963 | 2016-11-29 11:12:56 -0800 | [diff] [blame] | 201 | $(call find-subdir-assets,$(my_res_dir))))) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 202 | |
| 203 | all_resources := $(strip $(my_res_resources) $(my_overlay_resources)) |
| 204 | |
| 205 | # The linked resource package. |
Jeongik Cha | ba1b925 | 2023-04-21 22:55:10 +0900 | [diff] [blame] | 206 | my_res_package := $(intermediates.COMMON)/package-res.apk |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 207 | LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) |
| 208 | |
Jeongik Cha | ba1b925 | 2023-04-21 22:55:10 +0900 | [diff] [blame] | 209 | my_bundle_module := $(intermediates.COMMON)/base.zip |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 210 | LOCAL_INTERMEDIATE_TARGETS += $(my_bundle_module) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 211 | |
Ying Wang | e585397 | 2016-03-01 12:06:47 -0800 | [diff] [blame] | 212 | # Always run aapt2, because we need to at least compile the AndroidManifest.xml. |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 213 | need_compile_res := true |
| 214 | |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 215 | ifneq ($(all_resources),) |
| 216 | need_compile_res := true |
| 217 | endif |
| 218 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 219 | all_res_assets := $(strip $(all_assets) $(all_resources)) |
| 220 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 221 | # If no assets or resources were found, clear the directory variables so |
| 222 | # we don't try to build them. |
Ying Wang | 4cb0499 | 2014-07-29 10:34:30 -0700 | [diff] [blame] | 223 | ifneq (true,$(need_compile_asset)) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 224 | LOCAL_ASSET_DIR:= |
| 225 | endif |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 226 | ifneq (true,$(need_compile_res)) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 227 | LOCAL_RESOURCE_DIR:= |
| 228 | R_file_stamp := |
| 229 | else |
| 230 | # Make sure that R_file_stamp inherits the proper PRIVATE vars. |
| 231 | # If R.stamp moves, be sure to update the framework makefile, |
| 232 | # which has intimate knowledge of its location. |
Ying Wang | 98ae798 | 2014-12-18 14:53:52 -0800 | [diff] [blame] | 233 | R_file_stamp := $(intermediates.COMMON)/src/R.stamp |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 234 | LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp) |
| 235 | endif |
| 236 | |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 237 | ifdef LOCAL_COMPRESSED_MODULE |
| 238 | ifneq (true,$(LOCAL_COMPRESSED_MODULE)) |
| 239 | $(call pretty-error, Unknown value for LOCAL_COMPRESSED_MODULE $(LOCAL_COMPRESSED_MODULE)) |
| 240 | endif |
| 241 | endif |
| 242 | |
| 243 | ifdef LOCAL_COMPRESSED_MODULE |
Narayan Kamath | 6a4bd69 | 2017-08-14 10:53:50 +0100 | [diff] [blame] | 244 | PACKAGES.$(LOCAL_PACKAGE_NAME).COMPRESSED := gz |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 245 | LOCAL_BUILT_MODULE_STEM := package.apk.gz |
| 246 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk.gz |
| 247 | else # !LOCAL_COMPRESSED_MODULE |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 248 | LOCAL_BUILT_MODULE_STEM := package.apk |
Ying Wang | af9757e | 2014-07-17 21:24:42 -0700 | [diff] [blame] | 249 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 250 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 251 | |
| 252 | LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED)) |
| 253 | ifndef LOCAL_PROGUARD_ENABLED |
| 254 | ifneq ($(DISABLE_PROGUARD),true) |
| 255 | LOCAL_PROGUARD_ENABLED :=full |
| 256 | endif |
| 257 | endif |
| 258 | ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) |
| 259 | # the package explicitly request to disable proguard. |
| 260 | LOCAL_PROGUARD_ENABLED := |
| 261 | endif |
| 262 | proguard_options_file := |
| 263 | ifneq ($(LOCAL_PROGUARD_ENABLED),custom) |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 264 | ifeq ($(need_compile_res),true) |
Ying Wang | 98ae798 | 2014-12-18 14:53:52 -0800 | [diff] [blame] | 265 | proguard_options_file := $(intermediates.COMMON)/proguard_options |
Ying Wang | 6129192 | 2014-06-25 13:23:58 -0700 | [diff] [blame] | 266 | endif # need_compile_res |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 267 | endif # !custom |
| 268 | LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) |
Dan Willemsen | 829abae | 2019-08-09 09:14:45 -0700 | [diff] [blame] | 269 | LOCAL_PROGUARD_FLAGS_DEPS += $(proguard_options_file) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 270 | |
| 271 | ifeq (true,$(EMMA_INSTRUMENT)) |
| 272 | ifndef LOCAL_EMMA_INSTRUMENT |
Jeff Gaston | aaae43c | 2017-04-11 16:36:46 -0700 | [diff] [blame] | 273 | # No jacoco for test apks. |
Ying Wang | 324ffb2 | 2015-11-06 11:22:28 -0800 | [diff] [blame] | 274 | ifeq (,$(LOCAL_INSTRUMENTATION_FOR)) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 275 | LOCAL_EMMA_INSTRUMENT := true |
| 276 | endif # No test apk |
| 277 | endif # LOCAL_EMMA_INSTRUMENT is not set |
| 278 | else |
| 279 | LOCAL_EMMA_INSTRUMENT := false |
| 280 | endif # EMMA_INSTRUMENT is true |
| 281 | |
| 282 | ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) |
| 283 | ifeq (true,$(EMMA_INSTRUMENT_STATIC)) |
Colin Cross | 11e2d55 | 2018-03-07 15:44:54 -0800 | [diff] [blame] | 284 | ifneq ($(LOCAL_SRC_FILES)$(LOCAL_SRCJARS)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 285 | # Only add jacocoagent if the package contains some java code |
Sebastien Hertz | dfce8ad | 2015-11-19 17:53:00 +0100 | [diff] [blame] | 286 | LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent |
Colin Cross | dc4a6b8 | 2018-01-03 12:39:11 -0800 | [diff] [blame] | 287 | # Exclude jacoco classes from proguard |
| 288 | LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags |
Dan Willemsen | 829abae | 2019-08-09 09:14:45 -0700 | [diff] [blame] | 289 | LOCAL_PROGUARD_FLAGS_DEPS += $(BUILD_SYSTEM)/proguard.jacoco.flags |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 290 | endif # Contains java code |
| 291 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 292 | ifdef LOCAL_SDK_VERSION |
| 293 | ifdef TARGET_BUILD_APPS |
Sebastien Hertz | 2319e56 | 2016-03-31 16:48:26 +0200 | [diff] [blame] | 294 | # In unbundled build, merge the coverage library into the apk. |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 295 | ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) |
| 296 | # Only add jacocoagent if the package contains some java code |
Sebastien Hertz | dfce8ad | 2015-11-19 17:53:00 +0100 | [diff] [blame] | 297 | LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent |
Sebastien Hertz | 2319e56 | 2016-03-31 16:48:26 +0200 | [diff] [blame] | 298 | # Exclude jacoco classes from proguard |
| 299 | LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags |
Dan Willemsen | 829abae | 2019-08-09 09:14:45 -0700 | [diff] [blame] | 300 | LOCAL_PROGUARD_FLAGS_DEPS += $(BUILD_SYSTEM)/proguard.jacoco.flags |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 301 | endif # Contains java code |
Colin Cross | e673deb | 2017-09-27 14:28:41 -0700 | [diff] [blame] | 302 | endif # TARGET_BUILD_APPS |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 303 | endif # LOCAL_SDK_VERSION |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 304 | endif # EMMA_INSTRUMENT_STATIC |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 305 | endif # LOCAL_EMMA_INSTRUMENT |
| 306 | |
| 307 | rs_compatibility_jni_libs := |
| 308 | |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 309 | # If the module is a compressed module, we don't pre-opt it because its final |
| 310 | # installation location will be the data partition. |
| 311 | ifdef LOCAL_COMPRESSED_MODULE |
| 312 | LOCAL_DEX_PREOPT := false |
| 313 | endif |
| 314 | |
Colin Cross | ead7b66 | 2019-02-06 16:36:32 -0800 | [diff] [blame] | 315 | # Default to use uncompressed native libraries in APKs if minSdkVersion >= marshmallow |
| 316 | ifndef LOCAL_USE_EMBEDDED_NATIVE_LIBS |
| 317 | LOCAL_USE_EMBEDDED_NATIVE_LIBS := $(call math_gt_or_eq, \ |
| 318 | $(patsubst $(PLATFORM_VERSION_CODENAME),100,$(call module-min-sdk-version)),23) |
| 319 | endif |
| 320 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 321 | include $(BUILD_SYSTEM)/android_manifest.mk |
| 322 | |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 323 | resource_export_package := |
| 324 | |
| 325 | include $(BUILD_SYSTEM)/java_renderscript.mk |
| 326 | |
| 327 | include $(BUILD_SYSTEM)/aapt_flags.mk |
| 328 | |
| 329 | ifeq ($(need_compile_res),true) |
| 330 | |
| 331 | ############################### |
| 332 | ## APK splits |
| 333 | built_apk_splits := |
| 334 | installed_apk_splits := |
| 335 | my_apk_split_configs := |
| 336 | |
| 337 | ifdef LOCAL_PACKAGE_SPLITS |
| 338 | ifdef LOCAL_COMPRESSED_MODULE |
| 339 | $(error $(LOCAL_MODULE): LOCAL_COMPRESSED_MODULE is not currently supported for split installs) |
| 340 | endif # LOCAL_COMPRESSED_MODULE |
| 341 | |
| 342 | my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS) |
| 343 | my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs)) |
| 344 | built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk) |
| 345 | endif |
| 346 | |
Colin Cross | 18f28c7 | 2019-06-22 13:03:09 -0700 | [diff] [blame] | 347 | $(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(filter-out --legacy,$(LOCAL_AAPT_FLAGS)) |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 348 | $(R_file_stamp) $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS) |
| 349 | $(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME) |
| 350 | $(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR) |
| 351 | |
| 352 | ############################### |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 353 | ## AAPT2 |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 354 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 355 | my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res |
| 356 | ifneq (,$(filter-out current,$(renderscript_target_api))) |
| 357 | ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true) |
| 358 | my_generated_res_zips := $(rs_generated_res_zip) |
| 359 | endif # renderscript_target_api < 21 |
| 360 | endif # renderscript_target_api is set |
| 361 | my_asset_dirs := $(LOCAL_ASSET_DIR) |
| 362 | my_full_asset_paths := $(all_assets) |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 363 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 364 | # Add AAPT2 link specific flags. |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 365 | ifndef LOCAL_AAPT_NAMESPACES |
| 366 | $(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages |
| 367 | endif |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 368 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 369 | include $(BUILD_SYSTEM)/aapt2.mk |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 370 | |
| 371 | endif # need_compile_res |
| 372 | |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 373 | my_dex_jar := $(intermediates.COMMON)/dex.jar |
| 374 | |
Narayan Kamath | bbcdc07 | 2017-08-22 15:47:08 +0100 | [diff] [blame] | 375 | called_from_package_internal := true |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 376 | ################################# |
| 377 | include $(BUILD_SYSTEM)/java.mk |
| 378 | ################################# |
Narayan Kamath | bbcdc07 | 2017-08-22 15:47:08 +0100 | [diff] [blame] | 379 | called_from_package_internal := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 380 | |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 381 | ifeq ($(need_compile_res),true) |
| 382 | |
| 383 | # Other modules should depend on the BUILT module if |
| 384 | # they want to use this module's R.java file. |
| 385 | $(LOCAL_BUILT_MODULE): $(R_file_stamp) |
| 386 | |
Dan Willemsen | e1cbfc7 | 2020-04-28 15:55:49 -0700 | [diff] [blame] | 387 | ifneq ($(full_classes_jar),) |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 388 | # The R.java file must exist by the time the java source |
| 389 | # list is generated |
| 390 | $(java_source_list_file): $(R_file_stamp) |
Dan Willemsen | e1cbfc7 | 2020-04-28 15:55:49 -0700 | [diff] [blame] | 391 | endif |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 392 | |
| 393 | endif # need_compile_res |
| 394 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 395 | LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION)) |
| 396 | ifeq ($(LOCAL_SDK_RES_VERSION),) |
| 397 | LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION) |
| 398 | endif |
| 399 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 400 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
| 401 | PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 402 | |
Adam Lesinski | 6b6283a | 2018-02-14 16:18:12 -0800 | [diff] [blame] | 403 | framework_res_package_export := |
Adam Lesinski | 6b6283a | 2018-02-14 16:18:12 -0800 | [diff] [blame] | 404 | |
| 405 | ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 406 | # Most packages should link against the resources defined by framework-res. |
| 407 | # Even if they don't have their own resources, they may use framework |
| 408 | # resources. |
Dan Willemsen | c51b7b0 | 2018-02-16 13:31:17 -0800 | [diff] [blame] | 409 | ifeq ($(LOCAL_SDK_RES_VERSION),core_current) |
| 410 | # core_current doesn't contain any framework resources. |
Jeongik Cha | d05b57a | 2020-07-08 18:10:38 +0900 | [diff] [blame] | 411 | else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_USE_PREBUILT_SDKS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 412 | # for released sdk versions, the platform resources were built into android.jar. |
| 413 | framework_res_package_export := \ |
Anton Hansson | 66d47b8 | 2018-04-27 14:11:17 +0100 | [diff] [blame] | 414 | $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 415 | else # LOCAL_SDK_RES_VERSION |
| 416 | framework_res_package_export := \ |
| 417 | $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 418 | endif # LOCAL_SDK_RES_VERSION |
Adam Lesinski | 6b6283a | 2018-02-14 16:18:12 -0800 | [diff] [blame] | 419 | endif # LOCAL_NO_STANDARD_LIBRARIES |
| 420 | |
Adam Lesinski | de057c3 | 2014-03-13 18:48:27 -0700 | [diff] [blame] | 421 | all_library_res_package_exports := \ |
| 422 | $(framework_res_package_export) \ |
Adam Lesinski | 5eebe0f | 2014-03-25 15:45:34 -0700 | [diff] [blame] | 423 | $(foreach lib,$(LOCAL_RES_LIBRARIES),\ |
Adam Lesinski | de057c3 | 2014-03-13 18:48:27 -0700 | [diff] [blame] | 424 | $(call intermediates-dir-for,APPS,$(lib),,COMMON)/package-export.apk) |
| 425 | |
| 426 | all_library_res_package_export_deps := \ |
Colin Cross | 6e13692 | 2018-02-20 14:31:33 -0800 | [diff] [blame] | 427 | $(framework_res_package_export) \ |
Adam Lesinski | 5eebe0f | 2014-03-25 15:45:34 -0700 | [diff] [blame] | 428 | $(foreach lib,$(LOCAL_RES_LIBRARIES),\ |
Adam Lesinski | de057c3 | 2014-03-13 18:48:27 -0700 | [diff] [blame] | 429 | $(call intermediates-dir-for,APPS,$(lib),,COMMON)/src/R.stamp) |
Ying Wang | b574564 | 2014-06-19 16:07:30 -0700 | [diff] [blame] | 430 | $(resource_export_package) $(R_file_stamp) $(LOCAL_BUILT_MODULE): $(all_library_res_package_export_deps) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 431 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
Adam Lesinski | de057c3 | 2014-03-13 18:48:27 -0700 | [diff] [blame] | 432 | PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 433 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 434 | $(my_res_package) : $(all_library_res_package_export_deps) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 435 | |
| 436 | ifneq ($(full_classes_jar),) |
| 437 | $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 438 | # Use the jarjar processed arhive as the initial package file. |
Colin Cross | ffbf0a6 | 2017-03-29 12:58:15 -0700 | [diff] [blame] | 439 | $(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar) |
Dan Willemsen | f14179b | 2019-06-12 21:18:31 +0000 | [diff] [blame] | 440 | $(LOCAL_BUILT_MODULE): $(built_dex) $(full_classes_pre_proguard_jar) |
Ying Wang | 33360dd | 2015-01-14 14:23:56 -0800 | [diff] [blame] | 441 | else |
| 442 | $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := |
Colin Cross | 79e2f73 | 2016-12-21 14:29:13 -0800 | [diff] [blame] | 443 | $(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 444 | endif # full_classes_jar |
| 445 | |
Ying Wang | 96bcad4 | 2014-04-17 13:38:04 -0700 | [diff] [blame] | 446 | include $(BUILD_SYSTEM)/install_jni_libs.mk |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 447 | |
| 448 | # Pick a key to sign the package with. If this package hasn't specified |
| 449 | # an explicit certificate, use the default. |
| 450 | # Secure release builds will have their packages signed after the fact, |
| 451 | # so it's ok for these private keys to be in the clear. |
| 452 | ifeq ($(LOCAL_CERTIFICATE),) |
| 453 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 454 | endif |
| 455 | |
| 456 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 457 | # The special value "EXTERNAL" means that we will sign it with the |
| 458 | # default devkey, apply predexopt, but then expect the final .apk |
| 459 | # (after dexopting) to be signed by an outside tool. |
| 460 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 461 | PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1 |
| 462 | endif |
| 463 | |
| 464 | # If this is not an absolute certificate, assign it to a generic one. |
| 465 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 466 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 467 | endif |
Jeongik Cha | b2c4bb7 | 2018-12-17 14:45:15 +0900 | [diff] [blame] | 468 | include $(BUILD_SYSTEM)/app_certificate_validate.mk |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 469 | private_key := $(LOCAL_CERTIFICATE).pk8 |
| 470 | certificate := $(LOCAL_CERTIFICATE).x509.pem |
Shinichiro Hamaji | 641e61c | 2016-05-13 16:03:24 +0900 | [diff] [blame] | 471 | additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 472 | |
Colin Cross | f272adb | 2019-08-08 12:56:01 -0700 | [diff] [blame] | 473 | $(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR) $(SIGNAPK_JNI_LIBRARY_PATH) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 474 | $(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key) |
| 475 | $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate) |
| 476 | |
| 477 | PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key) |
| 478 | PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate) |
| 479 | |
Shinichiro Hamaji | 641e61c | 2016-05-13 16:03:24 +0900 | [diff] [blame] | 480 | $(LOCAL_BUILT_MODULE): $(additional_certificates) |
| 481 | $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 482 | |
Jaewoong Jung | 95445e6 | 2020-04-02 13:01:08 -0700 | [diff] [blame] | 483 | $(LOCAL_BUILT_MODULE): $(LOCAL_CERTIFICATE_LINEAGE) |
| 484 | $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE) |
| 485 | |
Rupert Shuttleworth | a95ab43 | 2021-10-20 11:37:23 -0400 | [diff] [blame] | 486 | $(LOCAL_BUILT_MODULE): PRIVATE_ROTATION_MIN_SDK_VERSION := $(LOCAL_ROTATION_MIN_SDK_VERSION) |
| 487 | |
Bill Peckham | 19c3feb | 2020-03-20 18:31:43 -0700 | [diff] [blame] | 488 | # Set a actual_partition_tag (calculated in base_rules.mk) for the package. |
| 489 | PACKAGES.$(LOCAL_PACKAGE_NAME).PARTITION := $(actual_partition_tag) |
| 490 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 491 | # Define the rule to build the actual package. |
Ying Wang | 8e20ef6 | 2014-06-24 20:01:52 -0700 | [diff] [blame] | 492 | # PRIVATE_JNI_SHARED_LIBRARIES is a list of <abi>:<path_of_built_lib>. |
| 493 | $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) |
| 494 | # PRIVATE_JNI_SHARED_LIBRARIES_ABI is a list of ABI names. |
| 495 | $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 496 | ifneq ($(TARGET_BUILD_APPS),) |
| 497 | # Include all resources for unbundled apps. |
| 498 | LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true |
| 499 | endif |
| 500 | ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true) |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 501 | $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 502 | $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 503 | else |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 504 | $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG) |
Ying Wang | 934008f | 2014-07-30 13:40:14 -0700 | [diff] [blame] | 505 | ifdef LOCAL_PACKAGE_SPLITS |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 506 | $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
Ying Wang | 934008f | 2014-07-30 13:40:14 -0700 | [diff] [blame] | 507 | else |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 508 | $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 509 | endif |
Ying Wang | 934008f | 2014-07-30 13:40:14 -0700 | [diff] [blame] | 510 | endif |
Colin Cross | 303567c | 2017-08-03 03:17:34 +0000 | [diff] [blame] | 511 | |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 512 | # Run veridex on product, system_ext and vendor modules. |
David Brazdil | 825770e | 2018-07-31 11:31:30 +0100 | [diff] [blame] | 513 | # We skip it for unbundled app builds where we cannot build veridex. |
| 514 | module_run_appcompat := |
Jeongik Cha | 83c5032 | 2019-01-18 15:09:09 +0900 | [diff] [blame] | 515 | ifeq (true,$(non_system_module)) |
Dan Willemsen | a3f6632 | 2020-05-28 15:46:33 -0700 | [diff] [blame] | 516 | ifeq (,$(TARGET_BUILD_APPS)) # ! unbundled app build |
Adrian Roos | 21028b7 | 2019-01-15 18:30:51 +0100 | [diff] [blame] | 517 | ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true) |
David Brazdil | 825770e | 2018-07-31 11:31:30 +0100 | [diff] [blame] | 518 | module_run_appcompat := true |
| 519 | endif |
| 520 | endif |
Adrian Roos | 21028b7 | 2019-01-15 18:30:51 +0100 | [diff] [blame] | 521 | endif |
David Brazdil | 825770e | 2018-07-31 11:31:30 +0100 | [diff] [blame] | 522 | |
| 523 | ifeq ($(module_run_appcompat),true) |
Dan Willemsen | b73ccb7 | 2018-09-17 14:36:37 -0700 | [diff] [blame] | 524 | $(LOCAL_BUILT_MODULE) : $(appcompat-files) |
Dario Freni | 716e9b6 | 2018-07-31 15:29:13 +0100 | [diff] [blame] | 525 | $(LOCAL_BUILT_MODULE): PRIVATE_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) |
Dario Freni | 1ecc925 | 2018-07-13 16:44:28 +0100 | [diff] [blame] | 526 | endif |
| 527 | |
Colin Cross | 303567c | 2017-08-03 03:17:34 +0000 | [diff] [blame] | 528 | $(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 529 | $(LOCAL_BUILT_MODULE) : $(jni_shared_libraries) |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 530 | $(LOCAL_BUILT_MODULE) : $(JAR_ARGS) $(SOONG_ZIP) $(MERGE_ZIPS) $(ZIP2ZIP) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 531 | $(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package) |
Dan Willemsen | 288bedf | 2019-05-28 15:36:47 -0700 | [diff] [blame] | 532 | $(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 533 | ifdef LOCAL_COMPRESSED_MODULE |
Elliott Hughes | 97ad120 | 2023-06-20 16:41:58 -0700 | [diff] [blame] | 534 | $(LOCAL_BUILT_MODULE) : $(GZIP) |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 535 | endif |
Colin Cross | dac94ff | 2018-10-07 21:32:07 -0700 | [diff] [blame] | 536 | ifeq (true, $(LOCAL_UNCOMPRESS_DEX)) |
| 537 | $(LOCAL_BUILT_MODULE) : $(ZIP2ZIP) |
| 538 | endif |
Colin Cross | 9644ec8 | 2021-01-12 15:08:08 -0800 | [diff] [blame] | 539 | ifeq ($(full_classes_jar),) |
| 540 | # We don't build jar, need to add the Java resources here. |
| 541 | $(LOCAL_BUILT_MODULE): $(java_resource_sources) |
| 542 | endif |
Colin Cross | ead7b66 | 2019-02-06 16:36:32 -0800 | [diff] [blame] | 543 | $(LOCAL_BUILT_MODULE): PRIVATE_USE_EMBEDDED_NATIVE_LIBS := $(LOCAL_USE_EMBEDDED_NATIVE_LIBS) |
Colin Cross | 53c8f97 | 2018-09-28 16:19:42 -0700 | [diff] [blame] | 544 | $(LOCAL_BUILT_MODULE): |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 545 | @echo "target Package: $(PRIVATE_MODULE) ($@)" |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 546 | rm -rf $@.parts |
| 547 | mkdir -p $@.parts |
Colin Cross | 53c8f97 | 2018-09-28 16:19:42 -0700 | [diff] [blame] | 548 | cp -f $(PRIVATE_RES_PACKAGE) $@.parts/apk.zip |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 549 | ifneq ($(jni_shared_libraries),) |
Colin Cross | ead7b66 | 2019-02-06 16:36:32 -0800 | [diff] [blame] | 550 | $(call create-jni-shared-libs-package,$@.parts/jni.zip,$(PRIVATE_USE_EMBEDDED_NATIVE_LIBS)) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 551 | endif |
Ying Wang | 8b27d18 | 2015-03-27 11:07:17 -0700 | [diff] [blame] | 552 | ifeq ($(full_classes_jar),) |
| 553 | # We don't build jar, need to add the Java resources here. |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 554 | $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call create-java-resources-jar,$@.parts/res.zip)) |
Ying Wang | 3a61eeb | 2016-03-11 10:32:01 -0800 | [diff] [blame] | 555 | else # full_classes_jar |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 556 | $(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE)) |
| 557 | $(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE)) |
Ying Wang | 3a61eeb | 2016-03-11 10:32:01 -0800 | [diff] [blame] | 558 | endif # full_classes_jar |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 559 | $(MERGE_ZIPS) $@ $@.parts/*.zip |
| 560 | rm -rf $@.parts |
Nicolas Geoffray | 3972a47 | 2018-01-09 11:46:30 +0000 | [diff] [blame] | 561 | ifeq (true, $(LOCAL_UNCOMPRESS_DEX)) |
| 562 | @# No need to align, sign-package below will do it. |
| 563 | $(uncompress-dexs) |
| 564 | endif |
Nicolas Geoffray | 2ca0e49 | 2019-10-18 14:47:19 +0100 | [diff] [blame] | 565 | # Run appcompat before signing. |
David Brazdil | 825770e | 2018-07-31 11:31:30 +0100 | [diff] [blame] | 566 | ifeq ($(module_run_appcompat),true) |
Dario Freni | 716e9b6 | 2018-07-31 15:29:13 +0100 | [diff] [blame] | 567 | $(appcompat-header) |
Dario Freni | 1ecc925 | 2018-07-13 16:44:28 +0100 | [diff] [blame] | 568 | $(run-appcompat) |
David Brazdil | 825770e | 2018-07-31 11:31:30 +0100 | [diff] [blame] | 569 | endif # module_run_appcompat |
Kenny Root | dff3755 | 2015-04-15 12:09:32 -0700 | [diff] [blame] | 570 | $(sign-package) |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 571 | ifdef LOCAL_COMPRESSED_MODULE |
| 572 | $(compress-package) |
| 573 | endif # LOCAL_COMPRESSED_MODULE |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 574 | |
Jeongik Cha | ba1b925 | 2023-04-21 22:55:10 +0900 | [diff] [blame] | 575 | my_package_res_pb := $(intermediates.COMMON)/package-res.pb.apk |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 576 | $(my_package_res_pb): $(my_res_package) $(AAPT2) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 577 | $(AAPT2) convert --output-format proto $< -o $@ |
| 578 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 579 | $(my_bundle_module): $(my_package_res_pb) |
| 580 | $(my_bundle_module): PRIVATE_RES_PACKAGE := $(my_package_res_pb) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 581 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 582 | $(my_bundle_module): $(jni_shared_libraries) |
| 583 | $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) |
| 584 | $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 585 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 586 | ifneq ($(full_classes_jar),) |
| 587 | $(my_bundle_module): PRIVATE_DEX_FILE := $(built_dex) |
| 588 | # Use the jarjar processed archive as the initial package file. |
| 589 | $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar) |
| 590 | $(my_bundle_module): $(built_dex) |
| 591 | else |
| 592 | $(my_bundle_module): PRIVATE_DEX_FILE := |
| 593 | $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := |
Colin Cross | 9644ec8 | 2021-01-12 15:08:08 -0800 | [diff] [blame] | 594 | # We don't build jar, need to add the Java resources here. |
| 595 | $(my_bundle_module): $(java_resource_sources) |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 596 | endif # full_classes_jar |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 597 | |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 598 | $(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 599 | @echo "target Bundle: $(PRIVATE_MODULE) ($@)" |
| 600 | rm -rf $@.parts |
| 601 | mkdir -p $@.parts |
| 602 | $(ZIP2ZIP) -i $(PRIVATE_RES_PACKAGE) -o $@.parts/apk.zip AndroidManifest.xml:manifest/AndroidManifest.xml resources.pb "res/**/*" "assets/**/*" |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 603 | ifneq ($(jni_shared_libraries),) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 604 | $(call create-jni-shared-libs-package,$@.parts/jni.zip) |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 605 | endif |
| 606 | ifeq ($(full_classes_jar),) |
| 607 | # We don't build jar, need to add the Java resources here. |
Colin Cross | 85fa3de | 2018-11-05 10:13:10 -0800 | [diff] [blame] | 608 | $(if $(PRIVATE_EXTRA_JAR_ARGS),\ |
| 609 | $(call create-java-resources-jar,$@.parts/res.zip) && \ |
| 610 | $(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/" && \ |
| 611 | mv -f $@.parts/res.zip.tmp $@.parts/res.zip) |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 612 | else # full_classes_jar |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 613 | $(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE)) |
| 614 | $(ZIP2ZIP) -i $@.parts/dex.zip -o $@.parts/dex.zip.tmp "classes*.dex:dex/" |
| 615 | mv -f $@.parts/dex.zip.tmp $@.parts/dex.zip |
| 616 | $(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE)) |
Colin Cross | 85fa3de | 2018-11-05 10:13:10 -0800 | [diff] [blame] | 617 | $(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/" |
| 618 | mv -f $@.parts/res.zip.tmp $@.parts/res.zip |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 619 | endif # full_classes_jar |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 620 | $(MERGE_ZIPS) $@ $@.parts/*.zip |
| 621 | rm -rf $@.parts |
Yo Chiang | 5814247 | 2020-05-08 15:38:46 +0800 | [diff] [blame] | 622 | ALL_MODULES.$(my_register_name).BUNDLE := $(my_bundle_module) |
Colin Cross | 35eb2e3 | 2018-11-01 20:34:08 +0000 | [diff] [blame] | 623 | |
Ying Wang | 8070b20 | 2014-12-01 17:46:56 -0800 | [diff] [blame] | 624 | ifdef TARGET_BUILD_APPS |
Colin Cross | e6210f6 | 2019-02-25 22:21:24 -0800 | [diff] [blame] | 625 | ifdef LOCAL_DPI_VARIANTS |
| 626 | $(call pretty-error,Building DPI-specific APKs is no longer supported) |
| 627 | endif |
Ying Wang | 8070b20 | 2014-12-01 17:46:56 -0800 | [diff] [blame] | 628 | endif |
| 629 | |
| 630 | ############################### |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 631 | ## Rule to build a jar containing dex files to dexpreopt without waiting for |
| 632 | ## the APK |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 633 | ifdef LOCAL_DEX_PREOPT |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 634 | $(my_dex_jar): PRIVATE_DEX_FILE := $(built_dex) |
Dan Willemsen | 0706faa | 2019-06-12 06:05:02 +0000 | [diff] [blame] | 635 | $(my_dex_jar): $(built_dex) $(SOONG_ZIP) |
Ying Wang | 994c226 | 2014-05-28 13:34:59 -0700 | [diff] [blame] | 636 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Colin Cross | c9e4976 | 2018-09-14 13:39:07 -0700 | [diff] [blame] | 637 | $(call create-dex-jar,$@,$(PRIVATE_DEX_FILE)) |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 638 | endif |
| 639 | |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 640 | ############################### |
| 641 | ## APK splits |
| 642 | ifdef LOCAL_PACKAGE_SPLITS |
Ying Wang | 7f625aa | 2014-07-23 10:27:57 -0700 | [diff] [blame] | 643 | # The splits should have been built in the same command building the base apk. |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 644 | # This rule just runs signing. |
Ying Wang | 7f625aa | 2014-07-23 10:27:57 -0700 | [diff] [blame] | 645 | # Note that we explicily check the existence of the split apk and remove the |
| 646 | # built base apk if the split apk isn't there. |
| 647 | # That way the build system will rerun the aapt after the user changes the splitting parameters. |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 648 | $(built_apk_splits): PRIVATE_PRIVATE_KEY := $(private_key) |
| 649 | $(built_apk_splits): PRIVATE_CERTIFICATE := $(certificate) |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 650 | $(built_apk_splits) : $(intermediates)/%.apk : $(LOCAL_BUILT_MODULE) |
Ying Wang | 7f625aa | 2014-07-23 10:27:57 -0700 | [diff] [blame] | 651 | $(hide) if [ ! -f $@ ]; then \ |
| 652 | echo 'No $@ generated, check your apk splitting parameters.' 1>&2; \ |
| 653 | rm $<; exit 1; \ |
| 654 | fi |
| 655 | $(sign-package) |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 656 | |
| 657 | # Rules to install the splits |
Colin Cross | 7a28158 | 2018-03-06 16:21:36 -0800 | [diff] [blame] | 658 | installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk) |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 659 | $(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(intermediates)/package_%.apk |
Ying Wang | 7f625aa | 2014-07-23 10:27:57 -0700 | [diff] [blame] | 660 | @echo "Install: $@" |
| 661 | $(copy-file-to-new-target) |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 662 | |
| 663 | # Register the additional built and installed files. |
| 664 | ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits) |
| 665 | ALL_MODULES.$(my_register_name).BUILT_INSTALLED += \ |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 666 | $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk:$(my_module_path)/$(LOCAL_MODULE)_$(s).apk) |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 667 | |
| 668 | # Make sure to install the splits when you run "make <module_name>". |
Colin Cross | 3388670 | 2016-09-20 16:01:28 -0700 | [diff] [blame] | 669 | $(my_all_targets): $(installed_apk_splits) |
Ying Wang | 1624361 | 2015-06-03 12:43:50 -0700 | [diff] [blame] | 670 | |
| 671 | ifdef LOCAL_COMPATIBILITY_SUITE |
Ying Wang | 1624361 | 2015-06-03 12:43:50 -0700 | [diff] [blame] | 672 | |
Nelson Li | 1f8357f | 2019-03-14 01:04:05 +0000 | [diff] [blame] | 673 | $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ |
| 674 | $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \ |
| 675 | $(foreach s,$(my_split_suffixes),\ |
| 676 | $(call compat-copy-pair,$(intermediates)/package_$(s).apk,$(dir)/$(LOCAL_MODULE)_$(s).apk))))) |
Ying Wang | 1624361 | 2015-06-03 12:43:50 -0700 | [diff] [blame] | 677 | |
Simran Basi | 6bea37c | 2017-02-16 18:04:10 -0800 | [diff] [blame] | 678 | $(call create-suite-dependencies) |
| 679 | |
Ying Wang | 1624361 | 2015-06-03 12:43:50 -0700 | [diff] [blame] | 680 | endif # LOCAL_COMPATIBILITY_SUITE |
Ying Wang | 1425e2d | 2014-07-22 15:42:11 -0700 | [diff] [blame] | 681 | endif # LOCAL_PACKAGE_SPLITS |
| 682 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 683 | # Save information about this package |
| 684 | PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 685 | PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 686 | |
Jiyong Park | 9314d8c | 2020-05-03 10:51:14 +0900 | [diff] [blame] | 687 | ifneq ($(LOCAL_MODULE_STEM),) |
| 688 | PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM) |
| 689 | else |
| 690 | PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE) |
| 691 | endif |
| 692 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 693 | PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME) |
| 694 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 695 | # Reset internal variables. |
| 696 | all_res_assets := |
Jaekyun Seok | 3070610 | 2017-02-02 00:44:58 +0900 | [diff] [blame] | 697 | |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 698 | ifneq (,$(runtime_resource_overlays_product)$(runtime_resource_overlays_vendor)) |
Jaekyun Seok | 3070610 | 2017-02-02 00:44:58 +0900 | [diff] [blame] | 699 | ifdef LOCAL_EXPORT_PACKAGE_RESOURCES |
| 700 | enforce_rro_use_res_lib := true |
| 701 | else |
| 702 | enforce_rro_use_res_lib := false |
| 703 | endif |
| 704 | |
| 705 | ifdef LOCAL_MANIFEST_PACKAGE_NAME |
| 706 | enforce_rro_is_manifest_package_name := true |
| 707 | enforce_rro_manifest_package_info := $(LOCAL_MANIFEST_PACKAGE_NAME) |
| 708 | else |
| 709 | enforce_rro_is_manifest_package_name := false |
| 710 | enforce_rro_manifest_package_info := $(full_android_manifest) |
| 711 | endif |
| 712 | |
Anton Hansson | cb8276f | 2019-03-18 11:43:30 +0000 | [diff] [blame] | 713 | ifdef runtime_resource_overlays_product |
| 714 | $(call append_enforce_rro_sources, \ |
| 715 | $(my_register_name), \ |
| 716 | $(enforce_rro_is_manifest_package_name), \ |
| 717 | $(enforce_rro_manifest_package_info), \ |
| 718 | $(enforce_rro_use_res_lib), \ |
| 719 | $(runtime_resource_overlays_product), \ |
| 720 | product \ |
| 721 | ) |
| 722 | endif |
| 723 | ifdef runtime_resource_overlays_vendor |
| 724 | $(call append_enforce_rro_sources, \ |
| 725 | $(my_register_name), \ |
| 726 | $(enforce_rro_is_manifest_package_name), \ |
| 727 | $(enforce_rro_manifest_package_info), \ |
| 728 | $(enforce_rro_use_res_lib), \ |
| 729 | $(runtime_resource_overlays_vendor), \ |
| 730 | vendor \ |
| 731 | ) |
| 732 | endif |
Anton Hansson | b7ee86f | 2019-03-14 19:48:17 +0000 | [diff] [blame] | 733 | endif |
Wei Li | 0762f5f | 2024-06-17 14:32:45 -0700 | [diff] [blame] | 734 | |
| 735 | $(if $(my_register_name),$(eval ALL_MODULES.$(my_register_name).MAKE_MODULE_TYPE:=PACKAGE)) |