xref: /aosp_15_r20/development/build/tools/sdk-preprocess-files.mk (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard WorkerLOCAL_PATH := $(call my-dir)
2*90c8c64dSAndroid Build Coastguard Worker
3*90c8c64dSAndroid Build Coastguard Worker# ===== SDK source.property files =====
4*90c8c64dSAndroid Build Coastguard Worker
5*90c8c64dSAndroid Build Coastguard Worker# Add all files to be generated from the source.prop templates to the SDK pre-requisites
6*90c8c64dSAndroid Build Coastguard Workersdk_props := $(HOST_OUT)/development/sdk/doc_source.properties \
7*90c8c64dSAndroid Build Coastguard Worker             $(HOST_OUT)/development/sdk/platform_source.properties \
8*90c8c64dSAndroid Build Coastguard Worker             $(HOST_OUT)/development/sdk/source_source.properties
9*90c8c64dSAndroid Build Coastguard Workersample_props := $(patsubst \
10*90c8c64dSAndroid Build Coastguard Worker                  $(TOPDIR)development/samples/%_source.prop_template, \
11*90c8c64dSAndroid Build Coastguard Worker                  $(HOST_OUT)/development/samples/%_source.properties, \
12*90c8c64dSAndroid Build Coastguard Worker                  $(wildcard $(TOPDIR)development/samples/*_source.prop_template))
13*90c8c64dSAndroid Build Coastguard Workersys_img_props := $(patsubst \
14*90c8c64dSAndroid Build Coastguard Worker                   $(TOPDIR)development/sys-img/%_source.prop_template, \
15*90c8c64dSAndroid Build Coastguard Worker                   $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties, \
16*90c8c64dSAndroid Build Coastguard Worker                   $(wildcard $(TOPDIR)development/sys-img/*_source.prop_template))
17*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(sdk_props) $(sample_props) $(sys_img_props)
18*90c8c64dSAndroid Build Coastguard Worker
19*90c8c64dSAndroid Build Coastguard Worker# Rule to convert a source.prop template into the desired source.property
20*90c8c64dSAndroid Build Coastguard Worker# This needs to vary based on the CPU ABI for the system-image files.
21*90c8c64dSAndroid Build Coastguard Worker# Rewritten variables:
22*90c8c64dSAndroid Build Coastguard Worker# - ${PLATFORM_VERSION}               e.g. "1.0"
23*90c8c64dSAndroid Build Coastguard Worker# - ${PLATFORM_SDK_VERSION}           e.g. "3", aka the API level
24*90c8c64dSAndroid Build Coastguard Worker# - ${PLATFORM_EXTENSION_SDK_VERSION} e.g. "7" -- the extension sdk level
25*90c8c64dSAndroid Build Coastguard Worker# - ${PLATFORM_IS_BASE_SDK}           bool. -- whether the current extension sdk is the base extension for this api level
26*90c8c64dSAndroid Build Coastguard Worker# - ${PLATFORM_VERSION_CODENAME}      e.g. "REL" (transformed into "") or "Cupcake"
27*90c8c64dSAndroid Build Coastguard Worker# - ${TARGET_ARCH}                    e.g. "arm", "x86", "mips" and their 64-bit variants.
28*90c8c64dSAndroid Build Coastguard Worker# - ${TARGET_CPU_ABI}                 e.g. "armeabi", "x86", "mips" and their 64-bit variants.
29*90c8c64dSAndroid Build Coastguard Workerdefine process_prop_template
30*90c8c64dSAndroid Build Coastguard Worker@echo Generate $@
31*90c8c64dSAndroid Build Coastguard Worker$(hide) mkdir -p $(dir $@)
32*90c8c64dSAndroid Build Coastguard Worker$(hide) sed \
33*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \
34*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \
35*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${PLATFORM_SDK_EXTENSION_VERSION}/$(PLATFORM_SDK_EXTENSION_VERSION)/' \
36*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${PLATFORM_IS_BASE_SDK}/$(if $(filter $(PLATFORM_SDK_EXTENSION_VERSION),$(PLATFORM_BASE_SDK_EXTENSION_VERSION)),true,false)/' \
37*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \
38*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${TARGET_ARCH}/$(TARGET_ARCH)/' \
39*90c8c64dSAndroid Build Coastguard Worker	-e 's/$${TARGET_CPU_ABI}/$(TARGET_CPU_ABI)/' \
40*90c8c64dSAndroid Build Coastguard Worker	$< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@
41*90c8c64dSAndroid Build Coastguard Workerendef
42*90c8c64dSAndroid Build Coastguard Worker
43*90c8c64dSAndroid Build Coastguard Worker$(sys_img_props) : $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties : $(TOPDIR)development/sys-img/%_source.prop_template
44*90c8c64dSAndroid Build Coastguard Worker	$(process_prop_template)
45*90c8c64dSAndroid Build Coastguard Worker
46*90c8c64dSAndroid Build Coastguard Worker$(sdk_props) : $(HOST_OUT)/development/sdk/%_source.properties : $(TOPDIR)development/sdk/%_source.prop_template
47*90c8c64dSAndroid Build Coastguard Worker	$(process_prop_template)
48*90c8c64dSAndroid Build Coastguard Worker
49*90c8c64dSAndroid Build Coastguard Worker$(sample_props) : $(HOST_OUT)/development/samples/%_source.properties : $(TOPDIR)development/samples/%_source.prop_template
50*90c8c64dSAndroid Build Coastguard Worker	$(process_prop_template)
51*90c8c64dSAndroid Build Coastguard Worker
52*90c8c64dSAndroid Build Coastguard Worker# ===== SDK jar file of stubs =====
53*90c8c64dSAndroid Build Coastguard Worker# A.k.a the "current" version of the public SDK (android.jar inside the SDK package).
54*90c8c64dSAndroid Build Coastguard Workerfull_target := $(call intermediates-dir-for,JAVA_LIBRARIES,$(ANDROID_PUBLIC_EXPORTABLE_STUBS),,COMMON)/classes.jar
55*90c8c64dSAndroid Build Coastguard Workerfull_src_target := $(call intermediates-dir-for,ETC,frameworks-base-api-current.srcjar)/frameworks-base-api-current.srcjar
56*90c8c64dSAndroid Build Coastguard Worker
57*90c8c64dSAndroid Build Coastguard Worker# android.jar is what we put in the SDK package.
58*90c8c64dSAndroid Build Coastguard Workerandroid_jar_intermediates := $(call intermediates-dir-for,PACKAGING,android_jar,,COMMON)
59*90c8c64dSAndroid Build Coastguard Workerandroid_jar_full_target := $(android_jar_intermediates)/android.jar
60*90c8c64dSAndroid Build Coastguard Workerandroid_jar_src_target := $(android_jar_intermediates)/android-stubs-src.jar
61*90c8c64dSAndroid Build Coastguard Worker
62*90c8c64dSAndroid Build Coastguard Worker# unzip and zip android.jar before packaging it. (workaround for b/127733650)
63*90c8c64dSAndroid Build Coastguard Workerfull_target_repackaged := $(android_jar_intermediates)/repackaged/repackaged.jar
64*90c8c64dSAndroid Build Coastguard Worker$(full_target_repackaged): $(full_target) | $(ZIPTIME)
65*90c8c64dSAndroid Build Coastguard Worker	@echo Repackaging SDK jar: $@
66*90c8c64dSAndroid Build Coastguard Worker	$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
67*90c8c64dSAndroid Build Coastguard Worker	unzip -q $< -d $(dir $@)
68*90c8c64dSAndroid Build Coastguard Worker	cd $(dir $@) && zip -rqX $(notdir $@) *
69*90c8c64dSAndroid Build Coastguard Worker	$(remove-timestamps-from-package)
70*90c8c64dSAndroid Build Coastguard Worker
71*90c8c64dSAndroid Build Coastguard Worker$(android_jar_full_target): $(full_target_repackaged)
72*90c8c64dSAndroid Build Coastguard Worker	@echo Package SDK Stubs: $@
73*90c8c64dSAndroid Build Coastguard Worker	$(copy-file-to-target)
74*90c8c64dSAndroid Build Coastguard Worker
75*90c8c64dSAndroid Build Coastguard Worker$(android_jar_src_target): $(full_src_target)
76*90c8c64dSAndroid Build Coastguard Worker	@echo Package SDK Stubs Source: $@
77*90c8c64dSAndroid Build Coastguard Worker	$(hide)mkdir -p $(dir $@)
78*90c8c64dSAndroid Build Coastguard Worker	$(hide)$(ACP) $< $@
79*90c8c64dSAndroid Build Coastguard Worker
80*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(android_jar_full_target)
81*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(android_jar_src_target)
82*90c8c64dSAndroid Build Coastguard Worker
83*90c8c64dSAndroid Build Coastguard Worker# ===== SDK for system modules =====
84*90c8c64dSAndroid Build Coastguard Worker# A subset of the public SDK to convert to system modules for use with javac -source 9 -target 9
85*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(call intermediates-dir-for,JAVA_LIBRARIES,core-current-stubs-for-system-modules-exportable,,COMMON)/classes.jar
86*90c8c64dSAndroid Build Coastguard Worker
87*90c8c64dSAndroid Build Coastguard Worker# ====================================================
88*90c8c64dSAndroid Build Coastguard Worker
89*90c8c64dSAndroid Build Coastguard Worker# The uiautomator stubs
90*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/classes.jar
91*90c8c64dSAndroid Build Coastguard Worker
92*90c8c64dSAndroid Build Coastguard Worker# org.apache.http.legacy.jar stubs
93*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/org.apache.http.legacy.stubs_intermediates/classes.jar
94*90c8c64dSAndroid Build Coastguard Worker
95*90c8c64dSAndroid Build Coastguard Worker# Android Automotive OS stubs
96*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.car-stubs_intermediates/classes.jar
97*90c8c64dSAndroid Build Coastguard Worker
98*90c8c64dSAndroid Build Coastguard Worker# test stubs
99*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/classes.jar
100*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.base.stubs_intermediates/classes.jar
101*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/classes.jar
102*90c8c64dSAndroid Build Coastguard Worker
103*90c8c64dSAndroid Build Coastguard Worker# ======= Lint API XML (complete API) ===========
104*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_public_generated-api-versions.xml
105*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(full_target)
106*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):data/api-versions.xml)
107*90c8c64dSAndroid Build Coastguard Worker
108*90c8c64dSAndroid Build Coastguard Worker# ======= Lint Annotations zip (complete API) ===========
109*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/sdk-annotations.zip
110*90c8c64dSAndroid Build Coastguard Worker$(eval $(call copy-one-file,$(call intermediates-dir-for,ETC,sdk-annotations.zip)/sdk-annotations.zip,$(full_target)))
111*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(full_target)
112*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):data/annotations.zip)
113*90c8c64dSAndroid Build Coastguard Worker
114*90c8c64dSAndroid Build Coastguard Worker# ======= Lint system API XML (complete API) ===========
115*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_system_generated-api-versions.xml
116*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):system-data/api-versions.xml)
117*90c8c64dSAndroid Build Coastguard Worker
118*90c8c64dSAndroid Build Coastguard Worker# ======= Lint system Annotations zip (complete API) ===========
119*90c8c64dSAndroid Build Coastguard Workerfull_target := $(call intermediates-dir-for,ETC,sdk-annotations-system.zip)/sdk-annotations-system.zip
120*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):system-data/annotations.zip)
121*90c8c64dSAndroid Build Coastguard Worker
122*90c8c64dSAndroid Build Coastguard Worker# ======= Lint module-lib API XML (non-updatable APIs only) ===========
123*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_module_lib_generated-api-versions.xml
124*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):module-lib-data/api-versions.xml)
125*90c8c64dSAndroid Build Coastguard Worker
126*90c8c64dSAndroid Build Coastguard Worker# ======= Lint module-lib API XML (complete API) ===========
127*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_module_lib_complete_generated-api-versions.xml
128*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):module-lib-data/api-versions-complete.xml)
129*90c8c64dSAndroid Build Coastguard Worker
130*90c8c64dSAndroid Build Coastguard Worker# ======= Lint module-lib Annotations zip (complete API) ===========
131*90c8c64dSAndroid Build Coastguard Workerfull_target := $(call intermediates-dir-for,ETC,sdk-annotations-module-lib.zip)/sdk-annotations-module-lib.zip
132*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):module-lib-data/annotations.zip)
133*90c8c64dSAndroid Build Coastguard Worker
134*90c8c64dSAndroid Build Coastguard Worker# ======= Lint system-server API XML (non-updatable APIs only) ===========
135*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_system_server_generated-api-versions.xml
136*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):system-server-data/api-versions.xml)
137*90c8c64dSAndroid Build Coastguard Worker
138*90c8c64dSAndroid Build Coastguard Worker# ======= Lint system-server API XML (complete API) ===========
139*90c8c64dSAndroid Build Coastguard Workerfull_target := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api_versions_system_server_complete_generated-api-versions.xml
140*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):system-server-data/api-versions-complete.xml)
141*90c8c64dSAndroid Build Coastguard Worker
142*90c8c64dSAndroid Build Coastguard Worker# ======= Lint system-server Annotations zip (complete API) ===========
143*90c8c64dSAndroid Build Coastguard Workerfull_target := $(call intermediates-dir-for,ETC,sdk-annotations-system-server.zip)/sdk-annotations-system-server.zip
144*90c8c64dSAndroid Build Coastguard Worker$(call dist-for-goals,sdk,$(full_target):system-server-data/annotations.zip)
145*90c8c64dSAndroid Build Coastguard Worker
146*90c8c64dSAndroid Build Coastguard Worker# ============ SDK AIDL ============
147*90c8c64dSAndroid Build Coastguard Worker$(eval $(call copy-one-file,$(FRAMEWORK_AIDL),$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework.aidl))
148*90c8c64dSAndroid Build Coastguard WorkerALL_SDK_FILES += $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework.aidl
149