1LOCAL_PATH := $(call my-dir) 2 3# ===== SDK source.property files ===== 4 5# Add all files to be generated from the source.prop templates to the SDK pre-requisites 6sdk_props := $(patsubst \ 7 $(TOPDIR)development/sdk/%_source.prop_template, \ 8 $(HOST_OUT)/development/sdk/%_source.properties, \ 9 $(wildcard $(TOPDIR)development/sdk/*_source.prop_template)) 10sample_props := $(patsubst \ 11 $(TOPDIR)development/samples/%_source.prop_template, \ 12 $(HOST_OUT)/development/samples/%_source.properties, \ 13 $(wildcard $(TOPDIR)development/samples/*_source.prop_template)) 14sys_img_props := $(patsubst \ 15 $(TOPDIR)development/sys-img/%_source.prop_template, \ 16 $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties, \ 17 $(wildcard $(TOPDIR)development/sys-img/*_source.prop_template)) 18ALL_SDK_FILES += $(sdk_props) $(sample_props) $(sys_img_props) 19 20# Rule to convert a source.prop template into the desired source.property 21# This needs to vary based on the CPU ABI for the system-image files. 22# Rewritten variables: 23# - ${PLATFORM_VERSION} e.g. "1.0" 24# - ${PLATFORM_SDK_VERSION} e.g. "3", aka the API level 25# - ${PLATFORM_VERSION_CODENAME} e.g. "REL" (transformed into "") or "Cupcake" 26# - ${TARGET_ARCH} e.g. "arm", "x86", "mips" and their 64-bit variants. 27# - ${TARGET_CPU_ABI} e.g. "armeabi", "x86", "mips" and their 64-bit variants. 28$(sys_img_props) : $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties : $(TOPDIR)development/sys-img/%_source.prop_template 29 @echo Generate $@ 30 $(hide) mkdir -p $(dir $@) 31 $(hide) sed \ 32 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 33 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 34 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 35 -e 's/$${TARGET_ARCH}/$(TARGET_ARCH)/' \ 36 -e 's/$${TARGET_CPU_ABI}/$(TARGET_CPU_ABI)/' \ 37 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 38 39$(sdk_props) : $(HOST_OUT)/development/sdk/%_source.properties : $(TOPDIR)development/sdk/%_source.prop_template 40 @echo Generate $@ 41 $(hide) mkdir -p $(dir $@) 42 $(hide) sed \ 43 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 44 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 45 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 46 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 47 48$(sample_props) : $(HOST_OUT)/development/samples/%_source.properties : $(TOPDIR)development/samples/%_source.prop_template 49 @echo Generate $@ 50 $(hide) mkdir -p $(dir $@) 51 $(hide) sed\ 52 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 53 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 54 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 55 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 56 57 58# ===== SDK jar file of stubs ===== 59# A.k.a the "current" version of the public SDK (android.jar inside the SDK package). 60full_target := $(call intermediates-dir-for,JAVA_LIBRARIES,android_stubs_current,,COMMON)/classes.jar 61full_src_target := $(call intermediates-dir-for,ETC,frameworks-base-api-current.srcjar)/frameworks-base-api-current.srcjar 62 63# android.jar is what we put in the SDK package. 64android_jar_intermediates := $(call intermediates-dir-for,PACKAGING,android_jar,,COMMON) 65android_jar_full_target := $(android_jar_intermediates)/android.jar 66android_jar_src_target := $(android_jar_intermediates)/android-stubs-src.jar 67 68# unzip and zip android.jar before packaging it. (workaround for b/127733650) 69full_target_repackaged := $(android_jar_intermediates)/repackaged/repackaged.jar 70$(full_target_repackaged): $(full_target) | $(ZIPTIME) 71 @echo Repackaging SDK jar: $@ 72 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) 73 unzip -q $< -d $(dir $@) 74 cd $(dir $@) && zip -rqX $(notdir $@) * 75 $(remove-timestamps-from-package) 76 77$(android_jar_full_target): $(full_target_repackaged) 78 @echo Package SDK Stubs: $@ 79 $(copy-file-to-target) 80 81$(android_jar_src_target): $(full_src_target) 82 @echo Package SDK Stubs Source: $@ 83 $(hide)mkdir -p $(dir $@) 84 $(hide)$(ACP) $< $@ 85 86ALL_SDK_FILES += $(android_jar_full_target) 87ALL_SDK_FILES += $(android_jar_src_target) 88 89# ===== SDK for system modules ===== 90# A subset of the public SDK to convert to system modules for use with javac -source 9 -target 9 91ALL_SDK_FILES += $(call intermediates-dir-for,JAVA_LIBRARIES,core-current-stubs-for-system-modules,,COMMON)/classes.jar 92 93# ==================================================== 94 95# The uiautomator stubs 96ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/classes.jar 97 98# org.apache.http.legacy.jar stubs 99ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/org.apache.http.legacy.stubs_intermediates/classes.jar 100 101# Android Automotive OS stubs 102ALL_SDK_FILES += $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android.car-stubs_intermediates/classes.jar 103 104# test stubs 105ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/classes.jar 106ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.base.stubs_intermediates/classes.jar 107ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/classes.jar 108 109# core-lambda-stubs 110ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/core-lambda-stubs_intermediates/classes.jar 111 112# shrinkedAndroid.jar for multidex support 113ALL_SDK_FILES += $(HOST_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/shrinkedAndroid_intermediates/shrinkedAndroid.jar 114 115# ======= Lint API XML =========== 116full_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs_generated-api-versions.xml 117ALL_SDK_FILES += $(full_target) 118$(call dist-for-goals,sdk win_sdk,$(full_target):data/api-versions.xml) 119 120# ======= Lint Annotations zip =========== 121full_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs_annotations.zip 122ALL_SDK_FILES += $(full_target) 123$(call dist-for-goals,sdk win_sdk,$(full_target):data/annotations.zip) 124 125# ============ SDK AIDL ============ 126$(eval $(call copy-one-file,$(FRAMEWORK_AIDL),$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework.aidl)) 127ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework.aidl 128