From d60401a59b1c03fc748d9068e13e6da1033529ca Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 18 Apr 2019 14:46:48 -0700 Subject: [PATCH] Allow codename.fingerprint format for targetSdkVersion Use codename.fingerprint format for targetSdkVersion if it is unset in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true. Test: manual Bug: 130541924 Change-Id: Ie748d1963ff6f525f8d9e551b73846c3e1c7f9a2 --- core/Makefile | 35 +++++------------------------------ core/android_manifest.mk | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/core/Makefile b/core/Makefile index 5e9fb2972..21029aa45 100644 --- a/core/Makefile +++ b/core/Makefile @@ -127,32 +127,7 @@ ndk-docs: $(ndk_doxygen_out)/index.html .PHONY: ndk-docs endif -# ----------------------------------------------------------------- -# generate preview API fingerprint -api_fingerprint := $(call intermediates-dir-for,PACKAGING,api_fingerprint)/api_fingerprint.txt -.KATI_READONLY := api_fingerprint - -ifeq (REL,$(PLATFORM_VERSION_CODENAME)) - $(api_fingerprint): - echo REL >$@ -else ifneq ($(TARGET_BUILD_APPS),) - # TODO: use a prebuilt api_fingerprint.txt from prebuilts/sdk/current.txt once we have one - #$(eval $(call copy-one-file,prebuilts/sdk/current/api_fingerprint.txt,$(api_fingerprint))) - $(api_fingerprint): - echo $(PLATFORM_PREVIEW_SDK_VERSION) >$@ -else ifneq ($(TARGET_BUILD_PDK),) - $(eval $(call copy-one-file,$(_pdk_fusion_intermediates)/api_fingerprint.txt,$(api_fingerprint))) -else - ifeq ($(HOST_OS),darwin) - $(api_fingerprint): PRIVATE_HASH := md5 - else - $(api_fingerprint): PRIVATE_HASH := md5sum - endif - $(api_fingerprint): $(sort $(wildcard frameworks/base/api/*current.txt)) - cat $^ | $(PRIVATE_HASH) | cut -d' ' -f1 >$@ - - $(call dist-for-goals,sdk,$(api_fingerprint)) -endif +$(call dist-for-goals,sdk,$(API_FINGERPRINT)) # ----------------------------------------------------------------- # property_overrides_split_enabled @@ -418,7 +393,7 @@ system_prop_file := $(TARGET_SYSTEM_PROP) else system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop) endif -$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(api_fingerprint) +$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) @echo Target buildinfo: $@ @mkdir -p $(dir $@) $(hide) echo > $@ @@ -454,7 +429,7 @@ endif PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \ - PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \ + PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \ PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ @@ -2407,7 +2382,7 @@ $(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk) $(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP) # dependencies for the other partitions are defined below after their file lists # are known -$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint) +$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(API_FINGERPRINT) $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)") rm -f $@ $@.lst echo "-C $(PRODUCT_OUT)" >> $@.lst @@ -2440,7 +2415,7 @@ endif @# Add dex-preopt files and config. $(if $(PRIVATE_DEX_FILES),\ echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst - echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst + echo "-C $(dir $(API_FINGERPRINT)) -f $(API_FINGERPRINT)" >> $@.lst touch $(PRODUCT_OUT)/pdk.mk echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst diff --git a/core/android_manifest.mk b/core/android_manifest.mk index 931b1b187..1f7acf1a0 100644 --- a/core/android_manifest.mk +++ b/core/android_manifest.mk @@ -47,8 +47,21 @@ else fixed_android_manifest := $(full_android_manifest) endif +my_target_sdk_version := $(call module-target-sdk-version) + +ifdef TARGET_BUILD_APPS + ifndef TARGET_BUILD_APPS_USE_PREBUILT_SDK + ifeq ($(my_target_sdk_version),$(PLATFORM_VERSION_CODENAME)) + ifdef UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT + my_target_sdk_version := $(my_target_sdk_version).$$(cat $(API_FINGERPRINT)) + $(fixed_android_manifest): $(API_FINGERPRINT) + endif + endif + endif +endif + $(fixed_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call module-min-sdk-version) -$(fixed_android_manifest): PRIVATE_TARGET_SDK_VERSION := $(call module-target-sdk-version) +$(fixed_android_manifest): PRIVATE_TARGET_SDK_VERSION := $(my_target_sdk_version) my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs $(fixed_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)