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
Merged-In: Ie748d1963ff6f525f8d9e551b73846c3e1c7f9a2
(cherry picked from commit d60401a59b)
This commit is contained in:
Colin Cross 2019-04-18 14:46:48 -07:00
parent 5180722c5e
commit dc47df6439
2 changed files with 19 additions and 31 deletions

View File

@ -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)" \
@ -2386,7 +2361,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
@ -2419,7 +2394,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

View File

@ -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)