Ying Wang | 78e75a9 | 2014-06-03 10:40:10 -0700 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
| 2 | |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 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, \ |
Xavier Ducrohet | bea50d3 | 2012-02-15 18:31:46 -0800 | [diff] [blame] | 9 | $(wildcard $(TOPDIR)development/sdk/*_source.prop_template)) \ |
| 10 | $(patsubst \ |
| 11 | $(TOPDIR)development/samples/%_source.prop_template, \ |
| 12 | $(HOST_OUT)/development/samples/%_source.properties, \ |
Raphael Moll | 26bcf6a | 2014-06-03 10:44:56 -0700 | [diff] [blame] | 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)) |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 18 | |
| 19 | # Rule to convert a source.prop template into the desired source.property |
Raphael Moll | 26bcf6a | 2014-06-03 10:44:56 -0700 | [diff] [blame] | 20 | # This needs to vary based on the CPU ABI for the system-image files. |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 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" |
Raphael Moll | 26bcf6a | 2014-06-03 10:44:56 -0700 | [diff] [blame] | 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 |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 28 | @echo Generate $@ |
| 29 | $(hide) mkdir -p $(dir $@) |
Raphael Moll | 40c7126 | 2014-05-16 11:40:45 -0700 | [diff] [blame] | 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' $@ |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 37 | |
Raphael Moll | 26bcf6a | 2014-06-03 10:44:56 -0700 | [diff] [blame] | 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 | |
Xavier Ducrohet | bea50d3 | 2012-02-15 18:31:46 -0800 | [diff] [blame] | 47 | $(HOST_OUT)/development/samples/%_source.properties : $(TOPDIR)development/samples/%_source.prop_template |
| 48 | @echo Generate $@ |
| 49 | $(hide) mkdir -p $(dir $@) |
Raphael Moll | 40c7126 | 2014-05-16 11:40:45 -0700 | [diff] [blame] | 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' $@ |
Xavier Ducrohet | bea50d3 | 2012-02-15 18:31:46 -0800 | [diff] [blame] | 55 | |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 56 | |
Ying Wang | 78e75a9 | 2014-06-03 10:40:10 -0700 | [diff] [blame] | 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 |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 62 | |
| 63 | .PHONY: android_stubs |
Narayan Kamath | e54bbd8 | 2016-02-05 13:56:15 +0000 | [diff] [blame] | 64 | android_stubs: $(full_target) $(full_src_target) |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 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 | |
Ying Wang | 78e75a9 | 2014-06-03 10:40:10 -0700 | [diff] [blame] | 73 | # android.jar is what we put in the SDK package. |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 74 | android_jar_intermediates := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/android_jar_intermediates |
| 75 | android_jar_full_target := $(android_jar_intermediates)/android.jar |
Narayan Kamath | e54bbd8 | 2016-02-05 13:56:15 +0000 | [diff] [blame] | 76 | android_jar_src_target := $(android_jar_intermediates)/android-stubs-src.jar |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 77 | |
| 78 | $(android_jar_full_target): $(full_target) |
| 79 | @echo Package SDK Stubs: $@ |
| 80 | $(hide)mkdir -p $(dir $@) |
| 81 | $(hide)$(ACP) $< $@ |
| 82 | |
Narayan Kamath | e54bbd8 | 2016-02-05 13:56:15 +0000 | [diff] [blame] | 83 | $(android_jar_src_target): $(full_src_target) |
| 84 | @echo Package SDK Stubs Source: $@ |
| 85 | $(hide)mkdir -p $(dir $@) |
| 86 | $(hide)$(ACP) $< $@ |
| 87 | |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 88 | ALL_SDK_FILES += $(android_jar_full_target) |
Narayan Kamath | e54bbd8 | 2016-02-05 13:56:15 +0000 | [diff] [blame] | 89 | ALL_SDK_FILES += $(android_jar_src_target) |
Ying Wang | d46eaa6 | 2011-03-01 17:12:12 -0800 | [diff] [blame] | 90 | |
Ying Wang | 78e75a9 | 2014-06-03 10:40:10 -0700 | [diff] [blame] | 91 | # ==================================================== |
| 92 | |
Yohann Roussel | 7ca5ad6 | 2015-07-21 16:37:58 +0200 | [diff] [blame] | 93 | # The Jack & Jill compiler jars |
Yohann Roussel | 26707bf | 2016-03-17 12:00:04 +0100 | [diff] [blame] | 94 | ALL_SDK_FILES += prebuilts/sdk/tools/jacks/jack-$(JACK_SDKTOOL_VERSION).jar |
| 95 | ALL_SDK_FILES += prebuilts/sdk/tools/jills/jill-$(JACK_SDKTOOL_VERSION).jar |
Yohann Roussel | 7ca5ad6 | 2015-07-21 16:37:58 +0200 | [diff] [blame] | 96 | |
Sebastien Hertz | 524a11e | 2016-04-04 10:23:57 +0200 | [diff] [blame] | 97 | # The Jack reporter tool for code coverage |
| 98 | ALL_SDK_FILES += prebuilts/sdk/tools/jack-jacoco-reporter.jar |
Sebastien Hertz | 882fd85 | 2016-05-24 19:02:31 +0200 | [diff] [blame] | 99 | ALL_SDK_FILES += prebuilts/sdk/tools/jack-coverage-plugin.jar |
Sebastien Hertz | 524a11e | 2016-04-04 10:23:57 +0200 | [diff] [blame] | 100 | |
Ying Wang | 020d4ab | 2012-08-14 16:38:02 -0700 | [diff] [blame] | 101 | # The uiautomator stubs |
| 102 | ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/javalib.jar |
Ying Wang | d46eaa6 | 2011-03-01 17:12:12 -0800 | [diff] [blame] | 103 | |
Ying Wang | a89998d | 2015-04-21 16:56:05 -0700 | [diff] [blame] | 104 | # org.apache.http.legacy.jar stubs |
| 105 | ALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/org.apache.http.legacy_intermediates/javalib.jar |
| 106 | |
Ying Wang | e4ccbd6 | 2011-06-07 11:25:07 -0700 | [diff] [blame] | 107 | # $(1): the Java library name |
| 108 | define _package_sdk_library |
| 109 | $(eval _psm_build_module := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/$(1)_intermediates/javalib.jar) |
| 110 | $(eval _psm_packaging_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(1)_intermediates/$(1).jar) |
| 111 | $(_psm_packaging_target) : $(_psm_build_module) | $(ACP) |
| 112 | @echo "Package $(1).jar: $$@" |
| 113 | $(hide) mkdir -p $$(dir $$@) |
| 114 | $(hide) $(ACP) $$< $$@ |
Ying Wang | b97dd87 | 2016-05-11 17:44:20 -0700 | [diff] [blame] | 115 | @# Delete resource generated classes from the jar files. |
| 116 | $(hide) zip -d $$@ "*/R.class" "*/R\$$$$*.class" "*/Manifest.class" "*/Manifest\$$$$*.class" >/dev/null 2>&1 || true |
Ying Wang | d46eaa6 | 2011-03-01 17:12:12 -0800 | [diff] [blame] | 117 | |
Ying Wang | e4ccbd6 | 2011-06-07 11:25:07 -0700 | [diff] [blame] | 118 | ALL_SDK_FILES += $(_psm_packaging_target) |
| 119 | $(eval _psm_build_module :=) |
| 120 | $(eval _psm_packaging_target :=) |
| 121 | endef |
Xavier Ducrohet | 80f8442 | 2011-06-06 17:39:44 -0700 | [diff] [blame] | 122 | |
Jeff Brown | 34fd8af | 2013-03-20 18:55:58 -0700 | [diff] [blame] | 123 | ANDROID_SUPPORT_LIBRARIES := \ |
Alan Viverette | 52d949c | 2016-09-22 11:18:17 -0400 | [diff] [blame] | 124 | android-support-animatedvectordrawable \ |
Xavier Ducrohet | dcb2c53 | 2014-03-26 10:49:13 -0700 | [diff] [blame] | 125 | android-support-annotations \ |
Kirill Grouchnikov | ce69622 | 2016-05-02 13:56:18 -0400 | [diff] [blame] | 126 | android-support-compat \ |
Kirill Grouchnikov | ce69622 | 2016-05-02 13:56:18 -0400 | [diff] [blame] | 127 | android-support-core-ui \ |
Kirill Grouchnikov | ce69622 | 2016-05-02 13:56:18 -0400 | [diff] [blame] | 128 | android-support-core-utils \ |
Alan Viverette | 52d949c | 2016-09-22 11:18:17 -0400 | [diff] [blame] | 129 | android-support-customtabs \ |
| 130 | android-support-design \ |
| 131 | android-support-documents-archive \ |
| 132 | android-support-fragment \ |
| 133 | android-support-media-compat \ |
| 134 | android-support-multidex \ |
| 135 | android-support-multidex-instrumentation \ |
| 136 | android-support-percent \ |
| 137 | android-support-recommendation \ |
| 138 | android-support-transition \ |
Jeff Brown | 34fd8af | 2013-03-20 18:55:58 -0700 | [diff] [blame] | 139 | android-support-v4 \ |
Jeff Brown | 34fd8af | 2013-03-20 18:55:58 -0700 | [diff] [blame] | 140 | android-support-v7-appcompat \ |
Xavier Ducrohet | 9a258bc | 2014-06-17 16:12:38 -0700 | [diff] [blame] | 141 | android-support-v7-cardview \ |
| 142 | android-support-v7-gridlayout \ |
Jeff Brown | a18be31 | 2013-07-09 00:35:10 +0000 | [diff] [blame] | 143 | android-support-v7-mediarouter \ |
Chris Banes | 8028b39 | 2014-05-19 15:09:16 +0100 | [diff] [blame] | 144 | android-support-v7-palette \ |
Tony Mantler | fab9a1f | 2015-08-28 10:15:28 -0700 | [diff] [blame] | 145 | android-support-v7-preference \ |
Tim Kilbourn | 349ba52 | 2014-03-12 15:28:23 -0700 | [diff] [blame] | 146 | android-support-v7-recyclerview \ |
Yohann Roussel | 9e27887 | 2013-08-21 14:21:57 +0200 | [diff] [blame] | 147 | android-support-v13 \ |
Tony Mantler | fab9a1f | 2015-08-28 10:15:28 -0700 | [diff] [blame] | 148 | android-support-v14-preference \ |
Tim Kilbourn | 957fa65 | 2014-03-12 17:27:10 -0700 | [diff] [blame] | 149 | android-support-v17-leanback \ |
Tony Mantler | fab9a1f | 2015-08-28 10:15:28 -0700 | [diff] [blame] | 150 | android-support-v17-preference-leanback \ |
Alan Viverette | 52d949c | 2016-09-22 11:18:17 -0400 | [diff] [blame] | 151 | android-support-vectordrawable |
Xavier Ducrohet | 80f8442 | 2011-06-06 17:39:44 -0700 | [diff] [blame] | 152 | |
Ying Wang | e4ccbd6 | 2011-06-07 11:25:07 -0700 | [diff] [blame] | 153 | $(foreach lib, $(ANDROID_SUPPORT_LIBRARIES), $(eval $(call _package_sdk_library,$(lib)))) |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 154 | |
| 155 | # ======= Lint API XML =========== |
| 156 | |
| 157 | ALL_SDK_FILES += $(HOST_OUT)/development/sdk/generated-api-versions.xml |
| 158 | |
Tor Norbye | 4a3b43c | 2016-02-18 08:19:27 -0800 | [diff] [blame] | 159 | api_gen_jar := $(TOPDIR)prebuilts/tools/common/api-generator/api-generator-25.0.0.jar |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 160 | api_gen_deps := \ |
Tor Norbye | 1d7a69a | 2016-02-02 19:49:24 -0800 | [diff] [blame] | 161 | $(TOPDIR)prebuilts/tools/common/m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar \ |
| 162 | $(TOPDIR)prebuilts/tools/common/m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar \ |
| 163 | $(TOPDIR)prebuilts/tools/common/m2/repository/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.jar \ |
| 164 | $(TOPDIR)prebuilts/tools/common/m2/repository/com/google/guava/guava/17.0/guava-17.0.jar |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 165 | api_gen_classpath := $(subst $(space),:,$(api_gen_jar) $(api_gen_deps)) |
| 166 | |
| 167 | |
Tor Norbye | fbe6c81 | 2015-08-21 12:55:15 -0700 | [diff] [blame] | 168 | $(HOST_OUT)/development/sdk/generated-api-versions.xml: $(android_jar_full_target) |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 169 | java -cp $(api_gen_classpath) \ |
| 170 | com.android.apigenerator.Main \ |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 171 | --pattern $(TOPDIR)prebuilts/tools/common/api-versions/android-%/android.jar \ |
Raphael Moll | 7d86138 | 2014-06-10 11:10:57 -0700 | [diff] [blame] | 172 | --pattern $(TOPDIR)prebuilts/sdk/%/android.jar \ |
Tor Norbye | fbe6c81 | 2015-08-21 12:55:15 -0700 | [diff] [blame] | 173 | --current-version $(PLATFORM_SDK_VERSION) \ |
| 174 | --current-codename $(PLATFORM_VERSION_CODENAME) \ |
| 175 | --current-jar $(android_jar_full_target) \ |
Raphael Moll | 4f8a38e | 2014-06-04 23:19:19 -0700 | [diff] [blame] | 176 | $@ |
| 177 | |
| 178 | |
Ying Wang | 78e75a9 | 2014-06-03 10:40:10 -0700 | [diff] [blame] | 179 | # ============ System SDK ============ |
| 180 | sdk_stub_name := android_system_stubs_current |
| 181 | stub_timestamp := $(OUT_DOCS)/system-api-stubs-timestamp |
| 182 | include $(LOCAL_PATH)/build_android_stubs.mk |
| 183 | |
| 184 | .PHONY: android_system_stubs |
| 185 | android_system_stubs: $(full_target) |
Ying Wang | c41276e | 2014-07-14 20:39:54 -0700 | [diff] [blame] | 186 | |
| 187 | # Build and store the android_system.jar. |
Ying Wang | 567a46b | 2014-07-18 09:16:40 -0700 | [diff] [blame] | 188 | $(call dist-for-goals,sdk win_sdk,$(full_target):android_system.jar) |
Michael Wright | a2595fc | 2015-11-06 15:26:17 +0000 | [diff] [blame] | 189 | |
| 190 | # ============ Test SDK ============ |
| 191 | sdk_stub_name := android_test_stubs_current |
| 192 | stub_timestamp := $(OUT_DOCS)/test-api-stubs-timestamp |
| 193 | include $(LOCAL_PATH)/build_android_stubs.mk |
| 194 | |
| 195 | .PHONY: android_test_stubs |
| 196 | android_test_stubs: $(full_target) |
| 197 | |
| 198 | # Build and store the android_test.jar. |
| 199 | $(call dist-for-goals,sdk win_sdk,$(full_target):android_test.jar) |