1 LOCAL_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 6 ALL_SDK_FILES += $(patsubst \ 7 $(TOPDIR)development/sdk/%_source.prop_template, \ 8 $(HOST_OUT)/development/sdk/%_source.properties, \ 9 $(wildcard $(TOPDIR)development/sdk/*_source.prop_template)) \ 10 $(patsubst \ 11 $(TOPDIR)development/samples/%_source.prop_template, \ 12 $(HOST_OUT)/development/samples/%_source.properties, \ 13 $(wildcard $(TOPDIR)development/samples/*_source.prop_template)) \ 14 $(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)) 18 19 # Rule to convert a source.prop template into the desired source.property 20 # This needs to vary based on the CPU ABI for the system-image files. 21 # Rewritten variables: 22 # - ${PLATFORM_VERSION} e.g. "1.0" 23 # - ${PLATFORM_SDK_VERSION} e.g. "3", aka the API level 24 # - ${PLATFORM_VERSION_CODENAME} e.g. "REL" (transformed into "") or "Cupcake" 25 # - ${TARGET_ARCH} e.g. "arm", "x86", "mips" and their 64-bit variants. 26 # - ${TARGET_CPU_ABI} e.g. "armeabi", "x86", "mips" and their 64-bit variants. 27 $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties : $(TOPDIR)development/sys-img/%_source.prop_template 28 @echo Generate $@ 29 $(hide) mkdir -p $(dir $@) 30 $(hide) sed \ 31 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 32 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 33 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 34 -e 's/$${TARGET_ARCH}/$(TARGET_ARCH)/' \ 35 -e 's/$${TARGET_CPU_ABI}/$(TARGET_CPU_ABI)/' \ 36 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 37 38 $(HOST_OUT)/development/sdk/%_source.properties : $(TOPDIR)development/sdk/%_source.prop_template 39 @echo Generate $@ 40 $(hide) mkdir -p $(dir $@) 41 $(hide) sed \ 42 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 43 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 44 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 45 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 46 47 $(HOST_OUT)/development/samples/%_source.properties : $(TOPDIR)development/samples/%_source.prop_template 48 @echo Generate $@ 49 $(hide) mkdir -p $(dir $@) 50 $(hide) sed\ 51 -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ 52 -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ 53 -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ 54 $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ 55 56 57 # ===== SDK jar file of stubs ===== 58 # A.k.a the "current" version of the public SDK (android.jar inside the SDK package). 59 sdk_stub_name := android_stubs_current 60 stub_timestamp := $(OUT_DOCS)/api-stubs-timestamp 61 include $(LOCAL_PATH)/build_android_stubs.mk 62 63 .PHONY: android_stubs 64 android_stubs: $(full_target) 65 66 # The real rules create a javalib.jar that contains a classes.dex file. This 67 # code is never going to be run anywhere, so just make a copy of the file. 68 # The package installation stuff doesn't know about this file, so nobody will 69 # ever be able to write a rule that installs it to a device. 70 $(dir $(full_target))javalib.jar: $(full_target) 71 $(hide)$(ACP) $< $@ 72 73 # android.jar is what we put in the SDK package. 74 android_jar_intermediates := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/android_jar_intermediates 75 android_jar_full_target := $(android_jar_intermediates)/android.jar 76 77 $(android_jar_full_target): $(full_target) 78 @echo Package SDK Stubs: $@ 79 $(hide)mkdir -p $(dir $@) 80 $(hide)$(ACP) $< $@ 81 82 ALL_SDK_FILES += $(android_jar_full_target) 83 84 # ==================================================== 85 86 # The uiautomator stubs 87 ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/javalib.jar 88 89 # org.apache.http.legacy.jar stubs 90 ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/org.apache.http.legacy_intermediates/javalib.jar 91 92 # $(1): the Java library name 93 define _package_sdk_library 94 $(eval _psm_build_module := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/$(1)_intermediates/javalib.jar) 95 $(eval _psm_packaging_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(1)_intermediates/$(1).jar) 96 $(_psm_packaging_target) : $(_psm_build_module) | $(ACP) 97 @echo "Package $(1).jar: $$@" 98 $(hide) mkdir -p $$(dir $$@) 99 $(hide) $(ACP) $$< $$@ 100 101 ALL_SDK_FILES += $(_psm_packaging_target) 102 $(eval _psm_build_module :=) 103 $(eval _psm_packaging_target :=) 104 endef 105 106 ANDROID_SUPPORT_LIBRARIES := \ 107 android-support-annotations \ 108 android-support-v4 \ 109 android-support-v7-appcompat \ 110 android-support-v7-cardview \ 111 android-support-v7-gridlayout \ 112 android-support-v7-mediarouter \ 113 android-support-v7-palette \ 114 android-support-v7-recyclerview \ 115 android-support-v13 \ 116 android-support-v17-leanback \ 117 android-support-multidex \ 118 android-support-multidex-instrumentation \ 119 android-support-design \ 120 android-support-percent 121 122 $(foreach lib, $(ANDROID_SUPPORT_LIBRARIES), $(eval $(call _package_sdk_library,$(lib)))) 123 124 # ======= Lint API XML =========== 125 126 ALL_SDK_FILES += $(HOST_OUT)/development/sdk/generated-api-versions.xml 127 128 api_gen_jar := $(TOPDIR)prebuilts/tools/common/api-generator/api-generator-22.9.2.jar 129 api_gen_deps := \ 130 $(TOPDIR)prebuilts/tools/common/kxml2-tools/kxml2-2.3.0.jar \ 131 $(TOPDIR)prebuilts/tools/common/asm-tools/asm-4.0.jar \ 132 $(TOPDIR)prebuilts/tools/common/asm-tools/asm-tree-4.0.jar \ 133 $(TOPDIR)prebuilts/devtools/tools/lib/common.jar 134 api_gen_classpath := $(subst $(space),:,$(api_gen_jar) $(api_gen_deps)) 135 136 137 $(HOST_OUT)/development/sdk/generated-api-versions.xml : 138 java -cp $(api_gen_classpath) \ 139 com.android.apigenerator.Main \ 140 --pattern $(TOPDIR)prebuilts/tools/common/api-versions/android-%/android.jar \ 141 --pattern $(TOPDIR)prebuilts/sdk/%/android.jar \ 142 $@ 143 144 145 # ============ System SDK ============ 146 sdk_stub_name := android_system_stubs_current 147 stub_timestamp := $(OUT_DOCS)/system-api-stubs-timestamp 148 include $(LOCAL_PATH)/build_android_stubs.mk 149 150 .PHONY: android_system_stubs 151 android_system_stubs: $(full_target) 152 153 # Build and store the android_system.jar. 154 $(call dist-for-goals,sdk win_sdk,$(full_target):android_system.jar) 155