• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi)
6dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name))
7built_dpi_apk := $(dpi_intermediate)/package.apk
8additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
9
10# Set up all the target-specific variables.
11$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name)
12$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --pseudo-localize $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi))
13# Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default.
14$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG :=
15$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi)
16$(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
17$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
18$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
19$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
20$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
21$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call module-target-sdk-version)
22$(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
23$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
24$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
25$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
26$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
27$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
28$(built_dpi_apk): $(additional_certificates)
29$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
30
31$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
32ifneq ($(full_classes_jar),)
33$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
34# Use the jarjar processed arhive as the initial package file.
35$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
36$(built_dpi_apk): $(built_dex)
37else
38$(built_dpi_apk): PRIVATE_DEX_FILE :=
39endif # full_classes_jar
40
41# Set up dependenncies and the build recipe.
42$(built_dpi_apk) : $(R_file_stamp)
43$(built_dpi_apk) : $(all_library_res_package_export_deps)
44$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
45$(built_dpi_apk) : $(AAPT)
46$(built_dpi_apk) : $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
47$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
48	@echo "target Package: $(PRIVATE_MODULE) ($@)"
49	rm -rf $@.parts
50	mkdir -p $@.parts
51	$(call create-assets-package,$@.parts/apk.zip)
52ifneq ($(jni_shared_libraries),)
53	$(call create-jni-shared-libs-package,$@.parts/jni.zip)
54endif
55ifeq ($(full_classes_jar),)
56# We don't build jar, need to add the Java resources here.
57	$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call create-java-resources-jar,$@.parts/res.zip))
58else
59	$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
60	$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
61endif
62	$(MERGE_ZIPS) $@ $@.parts/*.zip
63	rm -rf $@.parts
64	$(sign-package)
65
66# Set up global variables to register this apk to the higher-level dependency graph.
67ALL_MODULES += $(dpi_apk_name)
68ALL_MODULES.$(dpi_apk_name).CLASS := APPS
69ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk)
70ALL_MODULES.$(dpi_apk_name).TARGET_BUILT := $(built_dpi_apk)
71PACKAGES := $(PACKAGES) $(dpi_apk_name)
72PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key)
73PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate)
74
75# Phony targets used by "apps_only".
76.PHONY: $(dpi_apk_name)
77$(dpi_apk_name) : $(built_dpi_apk)
78