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