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