Ying Wang | 8070b20 | 2014-12-01 17:46:56 -0800 | [diff] [blame] | 1 | # Set up rules to build dpi-specific apk, with whatever else from the base apk. |
| 2 | # Input variable: my_dpi, and all other variables set up in package_internal.mk. |
| 3 | # |
| 4 | |
| 5 | dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi) |
| 6 | dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name)) |
| 7 | built_dpi_apk := $(dpi_intermediate)/package.apk |
| 8 | |
| 9 | # Set up all the target-specific variables. |
| 10 | $(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name) |
Ying Wang | 7ecc76a | 2015-01-29 18:08:00 -0800 | [diff] [blame^] | 11 | $(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi)) |
Ying Wang | 8070b20 | 2014-12-01 17:46:56 -0800 | [diff] [blame] | 12 | # Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default. |
| 13 | $(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 14 | $(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi) |
| 15 | $(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) |
| 16 | $(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) |
| 17 | $(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) |
| 18 | $(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports) |
| 19 | ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION))) |
| 20 | $(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) |
| 21 | else |
| 22 | $(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) |
| 23 | endif |
| 24 | $(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME) |
| 25 | $(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR) |
| 26 | $(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) |
| 27 | $(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) |
| 28 | $(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) |
| 29 | # Note that PRIVATE_CLASS_INTERMEDIATES_DIR points to the base apk's intermediate dir. |
| 30 | $(built_dpi_apk): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes |
| 31 | $(built_dpi_apk): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) |
| 32 | $(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key) |
| 33 | $(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate) |
| 34 | $(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ |
| 35 | $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) |
| 36 | |
| 37 | # Set up dependenncies and the build recipe. |
| 38 | $(built_dpi_apk) : $(R_file_stamp) |
| 39 | $(built_dpi_apk) : $(all_library_res_package_export_deps) |
| 40 | $(built_dpi_apk) : $(built_dex) |
| 41 | $(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR) |
| 42 | $(built_dpi_apk) : $(AAPT) | $(ZIPALIGN) |
| 43 | $(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) |
| 44 | @echo "target Package: $(PRIVATE_MODULE) ($@)" |
| 45 | $(create-empty-package) |
| 46 | $(add-assets-to-package) |
| 47 | ifneq ($(jni_shared_libraries),) |
| 48 | $(add-jni-shared-libs-to-package) |
| 49 | endif |
| 50 | ifneq ($(full_classes_jar),) |
| 51 | $(add-dex-to-package) |
| 52 | endif |
| 53 | $(add-carried-java-resources) |
| 54 | ifneq ($(extra_jar_args),) |
| 55 | $(add-java-resources-to-package) |
| 56 | endif |
| 57 | $(sign-package) |
| 58 | $(align-package) |
| 59 | |
| 60 | # Set up global variables to register this apk to the higher-level dependency graph. |
| 61 | ALL_MODULES += $(dpi_apk_name) |
| 62 | ALL_MODULES.$(dpi_apk_name).CLASS := APPS |
| 63 | ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk) |
| 64 | PACKAGES := $(PACKAGES) $(dpi_apk_name) |
| 65 | PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key) |
| 66 | PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate) |
| 67 | |
| 68 | # Phony targets used by "apps_only". |
| 69 | .PHONY: $(dpi_apk_name) |
| 70 | $(dpi_apk_name) : $(built_dpi_apk) |