From 48c492ed9fbebd14657fdcea91725d02d750134d Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Thu, 26 Aug 2021 17:07:09 +0100 Subject: [PATCH] Add sdk extension version info to prop templates This adds two new properties alongside AndroidVersion.ApiLevel: - AndroidVersion.ExtensionLevel: The sdk extension version if the SDK - AndroidVersion.IsBaseSdk: Whether the extension level is the the one that the ApiLevel shipped with (true), or if is an extension SDK release (false). While we're here, dedupe the recipe that processes these templates. Bug: 195281582 Test: m out/host/linux-x86/development/sdk/platform_source.properties and inspect the substitution is working Change-Id: Ieea20731aed2e0f35bbe4cfd8ca596cf11f4b3bc Merged-In: Ieea20731aed2e0f35bbe4cfd8ca596cf11f4b3bc (cherry picked from commit cf2f42c36b7997e9ce87682bb3a5511bdb72936f) --- build/Android.mk | 53 +++++++++---------- samples/samples_source.prop_template | 2 + sdk/doc_source.prop_template | 2 + sdk/platform_source.prop_template | 2 + sdk/source_source.prop_template | 2 + sys-img/images_arm64-v8a_source.prop_template | 2 + .../images_armeabi-v7a_source.prop_template | 2 + sys-img/images_armeabi_source.prop_template | 2 + sys-img/images_mips64_source.prop_template | 2 + sys-img/images_mips_source.prop_template | 2 + sys-img/images_x86_64_source.prop_template | 2 + sys-img/images_x86_source.prop_template | 2 + 12 files changed, 46 insertions(+), 29 deletions(-) diff --git a/build/Android.mk b/build/Android.mk index f548c3dce..49e1bef82 100644 --- a/build/Android.mk +++ b/build/Android.mk @@ -20,40 +20,35 @@ ALL_SDK_FILES += $(sdk_props) $(sample_props) $(sys_img_props) # Rule to convert a source.prop template into the desired source.property # This needs to vary based on the CPU ABI for the system-image files. # Rewritten variables: -# - ${PLATFORM_VERSION} e.g. "1.0" -# - ${PLATFORM_SDK_VERSION} e.g. "3", aka the API level -# - ${PLATFORM_VERSION_CODENAME} e.g. "REL" (transformed into "") or "Cupcake" -# - ${TARGET_ARCH} e.g. "arm", "x86", "mips" and their 64-bit variants. -# - ${TARGET_CPU_ABI} e.g. "armeabi", "x86", "mips" and their 64-bit variants. +# - ${PLATFORM_VERSION} e.g. "1.0" +# - ${PLATFORM_SDK_VERSION} e.g. "3", aka the API level +# - ${PLATFORM_EXTENSION_SDK_VERSION} e.g. "7" -- the extension sdk level +# - ${PLATFORM_IS_BASE_SDK} bool. -- whether the current extension sdk is the base extension for this api level +# - ${PLATFORM_VERSION_CODENAME} e.g. "REL" (transformed into "") or "Cupcake" +# - ${TARGET_ARCH} e.g. "arm", "x86", "mips" and their 64-bit variants. +# - ${TARGET_CPU_ABI} e.g. "armeabi", "x86", "mips" and their 64-bit variants. +define process_prop_template +@echo Generate $@ +$(hide) mkdir -p $(dir $@) +$(hide) sed \ + -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ + -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ + -e 's/$${PLATFORM_SDK_EXTENSION_VERSION}/$(PLATFORM_SDK_EXTENSION_VERSION)/' \ + -e 's/$${PLATFORM_IS_BASE_SDK}/$(if $(filter $(PLATFORM_SDK_EXTENSION_VERSION),$(PLATFORM_BASE_SDK_EXTENSION_VERSION)),true,false)/' \ + -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ + -e 's/$${TARGET_ARCH}/$(TARGET_ARCH)/' \ + -e 's/$${TARGET_CPU_ABI}/$(TARGET_CPU_ABI)/' \ + $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ +endef + $(sys_img_props) : $(HOST_OUT)/development/sys-img-$(TARGET_CPU_ABI)/%_source.properties : $(TOPDIR)development/sys-img/%_source.prop_template - @echo Generate $@ - $(hide) mkdir -p $(dir $@) - $(hide) sed \ - -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ - -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ - -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ - -e 's/$${TARGET_ARCH}/$(TARGET_ARCH)/' \ - -e 's/$${TARGET_CPU_ABI}/$(TARGET_CPU_ABI)/' \ - $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ + $(process_prop_template) $(sdk_props) : $(HOST_OUT)/development/sdk/%_source.properties : $(TOPDIR)development/sdk/%_source.prop_template - @echo Generate $@ - $(hide) mkdir -p $(dir $@) - $(hide) sed \ - -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ - -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ - -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ - $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ + $(process_prop_template) $(sample_props) : $(HOST_OUT)/development/samples/%_source.properties : $(TOPDIR)development/samples/%_source.prop_template - @echo Generate $@ - $(hide) mkdir -p $(dir $@) - $(hide) sed\ - -e 's/$${PLATFORM_VERSION}/$(PLATFORM_VERSION)/' \ - -e 's/$${PLATFORM_SDK_VERSION}/$(PLATFORM_SDK_VERSION)/' \ - -e 's/$${PLATFORM_VERSION_CODENAME}/$(subst REL,,$(PLATFORM_VERSION_CODENAME))/' \ - $< > $@ && sed -i -e '/^AndroidVersion.CodeName=\s*$$/d' $@ - + $(process_prop_template) # ===== SDK jar file of stubs ===== # A.k.a the "current" version of the public SDK (android.jar inside the SDK package). diff --git a/samples/samples_source.prop_template b/samples/samples_source.prop_template index 523d6bda8..1b08968c7 100644 --- a/samples/samples_source.prop_template +++ b/samples/samples_source.prop_template @@ -2,3 +2,5 @@ Pkg.UserSrc=false Pkg.Revision=2 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} diff --git a/sdk/doc_source.prop_template b/sdk/doc_source.prop_template index d3cdfd5ee..61a9923be 100644 --- a/sdk/doc_source.prop_template +++ b/sdk/doc_source.prop_template @@ -2,3 +2,5 @@ Pkg.UserSrc=false Pkg.Revision=1 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} diff --git a/sdk/platform_source.prop_template b/sdk/platform_source.prop_template index 35a00af81..fa996c7e3 100644 --- a/sdk/platform_source.prop_template +++ b/sdk/platform_source.prop_template @@ -5,6 +5,8 @@ Platform.CodeName= Pkg.Revision=1 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} Layoutlib.Api=15 Layoutlib.Revision=1 Platform.MinToolsRev=22 diff --git a/sdk/source_source.prop_template b/sdk/source_source.prop_template index d3cdfd5ee..61a9923be 100644 --- a/sdk/source_source.prop_template +++ b/sdk/source_source.prop_template @@ -2,3 +2,5 @@ Pkg.UserSrc=false Pkg.Revision=1 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} diff --git a/sys-img/images_arm64-v8a_source.prop_template b/sys-img/images_arm64-v8a_source.prop_template index e553746a5..decf56567 100644 --- a/sys-img/images_arm64-v8a_source.prop_template +++ b/sys-img/images_arm64-v8a_source.prop_template @@ -4,6 +4,8 @@ Pkg.Revision=2 Pkg.Dependencies=emulator#29.1.11 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=arm64-v8a SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_armeabi-v7a_source.prop_template b/sys-img/images_armeabi-v7a_source.prop_template index 2851d28fb..87e606757 100644 --- a/sys-img/images_armeabi-v7a_source.prop_template +++ b/sys-img/images_armeabi-v7a_source.prop_template @@ -4,6 +4,8 @@ Pkg.Revision=2 Pkg.Dependencies=emulator#29.1.11 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=armeabi-v7a SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_armeabi_source.prop_template b/sys-img/images_armeabi_source.prop_template index fb4e8088b..bbedcc0e5 100644 --- a/sys-img/images_armeabi_source.prop_template +++ b/sys-img/images_armeabi_source.prop_template @@ -4,6 +4,8 @@ Pkg.Revision=2 Pkg.Dependencies=emulator#29.1.11 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=armeabi SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_mips64_source.prop_template b/sys-img/images_mips64_source.prop_template index 9778f9763..89a29ed5c 100644 --- a/sys-img/images_mips64_source.prop_template +++ b/sys-img/images_mips64_source.prop_template @@ -3,6 +3,8 @@ Pkg.UserSrc=false Pkg.Revision=1 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=mips64 SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_mips_source.prop_template b/sys-img/images_mips_source.prop_template index 7c3ede315..617949ca0 100644 --- a/sys-img/images_mips_source.prop_template +++ b/sys-img/images_mips_source.prop_template @@ -3,6 +3,8 @@ Pkg.UserSrc=false Pkg.Revision=1 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=mips SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_x86_64_source.prop_template b/sys-img/images_x86_64_source.prop_template index fe8ba6981..8329473bf 100644 --- a/sys-img/images_x86_64_source.prop_template +++ b/sys-img/images_x86_64_source.prop_template @@ -4,6 +4,8 @@ Pkg.Revision=2 Pkg.Dependencies=emulator#29.1.11 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=x86_64 SystemImage.GpuSupport=true SystemImage.TagId=default diff --git a/sys-img/images_x86_source.prop_template b/sys-img/images_x86_source.prop_template index 76daa9f48..af6b0e2d0 100644 --- a/sys-img/images_x86_source.prop_template +++ b/sys-img/images_x86_source.prop_template @@ -4,6 +4,8 @@ Pkg.Revision=2 Pkg.Dependencies=emulator#29.1.11 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +AndroidVersion.ExtensionLevel=${PLATFORM_SDK_EXTENSION_VERSION} +AndroidVersion.IsBaseSdk=${PLATFORM_IS_BASE_SDK} SystemImage.Abi=x86 SystemImage.GpuSupport=true SystemImage.TagId=default