From d79eab5a39486d73eb0f3445a52ae74ebd313b72 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 15 Nov 2011 16:30:14 -0800 Subject: [PATCH] SDK: source.properties templates. This adds support for "templates" source.properties files that can inherit the platform version/codename/api level from the build. The purpose is for a given build to always generate SDK files that match the platform generated in the same branch. Change-Id: Id623bbef45a04d953da8eade7e8c34c77709f9c3 --- build/Android.mk | 24 +++++++++++++++++++++ build/sdk-android-armeabi-v7a.atree | 2 +- build/sdk-android-armeabi.atree | 2 +- build/sdk-android-x86.atree | 2 +- build/sdk.atree | 4 ++-- build/tools/sdk_repo.mk | 4 ++-- sdk/doc_source.prop_template | 4 ++++ sdk/doc_source.properties | 5 ----- sdk/images_armeabi-v7a_source.prop_template | 6 ++++++ sdk/images_armeabi-v7a_source.properties | 6 ------ sdk/images_armeabi_source.prop_template | 6 ++++++ sdk/images_armeabi_source.properties | 6 ------ sdk/images_x86_source.prop_template | 6 ++++++ sdk/images_x86_source.properties | 6 ------ sdk/platform_source.prop_template | 9 ++++++++ sdk/platform_source.properties | 9 -------- sdk/source_source.prop_template | 4 ++++ sdk/source_source.properties | 4 ---- sdk/support_source.properties | 1 - 19 files changed, 66 insertions(+), 44 deletions(-) create mode 100644 sdk/doc_source.prop_template delete mode 100644 sdk/doc_source.properties create mode 100644 sdk/images_armeabi-v7a_source.prop_template delete mode 100644 sdk/images_armeabi-v7a_source.properties create mode 100644 sdk/images_armeabi_source.prop_template delete mode 100644 sdk/images_armeabi_source.properties create mode 100644 sdk/images_x86_source.prop_template delete mode 100644 sdk/images_x86_source.properties create mode 100644 sdk/platform_source.prop_template delete mode 100644 sdk/platform_source.properties create mode 100644 sdk/source_source.prop_template delete mode 100644 sdk/source_source.properties diff --git a/build/Android.mk b/build/Android.mk index e4eeb0a12..1cb065379 100644 --- a/build/Android.mk +++ b/build/Android.mk @@ -1,3 +1,27 @@ +# ===== SDK source.property files ===== + +# Add all files to be generated from the source.prop templates to the SDK pre-requisites +ALL_SDK_FILES += $(patsubst \ + $(TOPDIR)development/sdk/%_source.prop_template, \ + $(HOST_OUT)/development/sdk/%_source.properties, \ + $(wildcard $(TOPDIR)development/sdk/*_source.prop_template)) + +# Rule to convert a source.prop template into the desired source.property +# 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" +$(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))/' \ + $< > $@ + + +# ===== Android Support/Compatibility Library ===== + LOCAL_PATH := $(call my-dir) # The source files for this library are _all_ generated, something we don't do diff --git a/build/sdk-android-armeabi-v7a.atree b/build/sdk-android-armeabi-v7a.atree index 8867bf7b2..e58694575 100644 --- a/build/sdk-android-armeabi-v7a.atree +++ b/build/sdk-android-armeabi-v7a.atree @@ -18,4 +18,4 @@ prebuilt/android-${TARGET_ARCH}/kernel/kernel-qemu-armv7 system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-qemu # version files for the SDK updater, from development.git -development/sdk/images_armeabi-v7a_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties +${HOST_OUT}/development/sdk/images_armeabi-v7a_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties diff --git a/build/sdk-android-armeabi.atree b/build/sdk-android-armeabi.atree index a31eca6fd..15f1f58e8 100644 --- a/build/sdk-android-armeabi.atree +++ b/build/sdk-android-armeabi.atree @@ -17,4 +17,4 @@ prebuilt/android-${TARGET_ARCH}/kernel/kernel-qemu system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-qemu # version files for the SDK updater, from development.git -development/sdk/images_armeabi_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties +${HOST_OUT}/development/sdk/images_armeabi_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties diff --git a/build/sdk-android-x86.atree b/build/sdk-android-x86.atree index 748478a01..a309149f8 100644 --- a/build/sdk-android-x86.atree +++ b/build/sdk-android-x86.atree @@ -17,4 +17,4 @@ prebuilt/android-${TARGET_ARCH}/kernel/kernel-qemu system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-qemu # version files for the SDK updater, from development.git -development/sdk/images_x86_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties +${HOST_OUT}/development/sdk/images_x86_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties diff --git a/build/sdk.atree b/build/sdk.atree index 16c518437..afbffd8d3 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -61,7 +61,7 @@ external/clang/LICENSE.TXT platform-tools/renderscript/clang- ############################################################################## # version files for the SDK updater, from development.git -development/sdk/platform_source.properties platforms/${PLATFORM_NAME}/source.properties +${HOST_OUT}/development/sdk/platform_source.properties platforms/${PLATFORM_NAME}/source.properties # copy build prop from out/.../sdk/ sdk/sdk-build.prop platforms/${PLATFORM_NAME}/build.prop @@ -132,7 +132,7 @@ system/build.prop system-images/${PLATFORM_NAME}/${TARG ############################################################################## # version files for the SDK updater, from sdk.git -development/sdk/doc_source.properties docs/source.properties +${HOST_OUT}/development/sdk/doc_source.properties docs/source.properties # the docs docs/offline-sdk docs diff --git a/build/tools/sdk_repo.mk b/build/tools/sdk_repo.mk index de48e57e4..a0d93de7e 100644 --- a/build/tools/sdk_repo.mk +++ b/build/tools/sdk_repo.mk @@ -88,10 +88,10 @@ endef # $3=package to create, must be "sources" # define mk-sdk-repo-sources -$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(TOPDIR)development/sdk/source_source.properties +$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(HOST_OUT)/development/sdk/source_source.properties @echo "Building SDK sources package" $(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py \ - $(TOPDIR)development/sdk/source_source.properties \ + $(HOST_OUT)/development/sdk/source_source.properties \ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \ $(TOPDIR). $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) diff --git a/sdk/doc_source.prop_template b/sdk/doc_source.prop_template new file mode 100644 index 000000000..d3cdfd5ee --- /dev/null +++ b/sdk/doc_source.prop_template @@ -0,0 +1,4 @@ +Pkg.UserSrc=false +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} diff --git a/sdk/doc_source.properties b/sdk/doc_source.properties deleted file mode 100644 index 5b3dce6e3..000000000 --- a/sdk/doc_source.properties +++ /dev/null @@ -1,5 +0,0 @@ -Pkg.UserSrc=false -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= - diff --git a/sdk/images_armeabi-v7a_source.prop_template b/sdk/images_armeabi-v7a_source.prop_template new file mode 100644 index 000000000..ae6764755 --- /dev/null +++ b/sdk/images_armeabi-v7a_source.prop_template @@ -0,0 +1,6 @@ +Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION} +Pkg.UserSrc=false +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +SystemImage.Abi=armeabi-v7a diff --git a/sdk/images_armeabi-v7a_source.properties b/sdk/images_armeabi-v7a_source.properties deleted file mode 100644 index 9280fdda3..000000000 --- a/sdk/images_armeabi-v7a_source.properties +++ /dev/null @@ -1,6 +0,0 @@ -Pkg.Desc=Android SDK Platform 4.1 -Pkg.UserSrc=false -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= -SystemImage.Abi=armeabi-v7a diff --git a/sdk/images_armeabi_source.prop_template b/sdk/images_armeabi_source.prop_template new file mode 100644 index 000000000..b100e535f --- /dev/null +++ b/sdk/images_armeabi_source.prop_template @@ -0,0 +1,6 @@ +Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION} +Pkg.UserSrc=false +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +SystemImage.Abi=armeabi diff --git a/sdk/images_armeabi_source.properties b/sdk/images_armeabi_source.properties deleted file mode 100644 index 63fc67726..000000000 --- a/sdk/images_armeabi_source.properties +++ /dev/null @@ -1,6 +0,0 @@ -Pkg.Desc=Android SDK Platform 4.1 -Pkg.UserSrc=false -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= -SystemImage.Abi=armeabi diff --git a/sdk/images_x86_source.prop_template b/sdk/images_x86_source.prop_template new file mode 100644 index 000000000..62e2e0d05 --- /dev/null +++ b/sdk/images_x86_source.prop_template @@ -0,0 +1,6 @@ +Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION} +Pkg.UserSrc=false +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +SystemImage.Abi=x86 diff --git a/sdk/images_x86_source.properties b/sdk/images_x86_source.properties deleted file mode 100644 index bb825778e..000000000 --- a/sdk/images_x86_source.properties +++ /dev/null @@ -1,6 +0,0 @@ -Pkg.Desc=Android SDK Platform 4.1 -Pkg.UserSrc=false -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= -SystemImage.Abi=x86 diff --git a/sdk/platform_source.prop_template b/sdk/platform_source.prop_template new file mode 100644 index 000000000..17a5e4e43 --- /dev/null +++ b/sdk/platform_source.prop_template @@ -0,0 +1,9 @@ +Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION} +Pkg.UserSrc=false +Platform.Version=${PLATFORM_VERSION} +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} +Layoutlib.Api=7 +Layoutlib.Revision=1 +Platform.MinToolsRev=15 diff --git a/sdk/platform_source.properties b/sdk/platform_source.properties deleted file mode 100644 index 0e70356e8..000000000 --- a/sdk/platform_source.properties +++ /dev/null @@ -1,9 +0,0 @@ -Pkg.Desc=Android SDK Platform 4.1 -Pkg.UserSrc=false -Platform.Version=4.1 -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= -Layoutlib.Api=7 -Layoutlib.Revision=1 -Platform.MinToolsRev=15 diff --git a/sdk/source_source.prop_template b/sdk/source_source.prop_template new file mode 100644 index 000000000..d3cdfd5ee --- /dev/null +++ b/sdk/source_source.prop_template @@ -0,0 +1,4 @@ +Pkg.UserSrc=false +Pkg.Revision=1 +AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} +AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} diff --git a/sdk/source_source.properties b/sdk/source_source.properties deleted file mode 100644 index d0b390b1d..000000000 --- a/sdk/source_source.properties +++ /dev/null @@ -1,4 +0,0 @@ -Pkg.UserSrc=false -Pkg.Revision=1 -AndroidVersion.ApiLevel=15 -#AndroidVersion.CodeName= diff --git a/sdk/support_source.properties b/sdk/support_source.properties index 16d5cd8a0..28d3579b8 100644 --- a/sdk/support_source.properties +++ b/sdk/support_source.properties @@ -3,4 +3,3 @@ Pkg.Revision=4 Extra.Vendor=android Extra.Path=support Extra.OldPaths=compatibility -