Produce ro.build.version.preview_sdk_fingerprint

This is just a hash of the current.txt and system-current.txt right now,
though it may expand to include other API surfaces in the future.

Once prebuilts/sdk/current is populated with api_fingerprint.txt files,
we can use those for unbundled builds, but until then, just use the
PLATFORM_PREVIEW_SDK_VERSION as a placeholder.

MD5 was just the most convenient, since we don't have a sha tool that we
can use on Mac currently. I'm hoping we can get a toybox-based tool in
the future that standardizes that, but we aren't currently using sha*sum
from toybox on Linux, much less on Darwin yet.

Test: m dist out/dist/api_fingerprint.txt
Test: m out/target/product/.../system/build.prop
Change-Id: If69f270560d05135cb81a9bb2d1b208ea78f86df
This commit is contained in:
Dan Willemsen
2018-12-14 01:04:19 -08:00
parent 7264a0daab
commit ad6a15433e
2 changed files with 32 additions and 2 deletions

View File

@@ -121,6 +121,33 @@ 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
# -----------------------------------------------------------------
# property_overrides_split_enabled
property_overrides_split_enabled :=
@@ -368,7 +395,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)
$(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 > $@
@@ -401,6 +428,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_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)" \
@@ -2199,7 +2227,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)
$(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
@@ -2232,6 +2260,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
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

@@ -8,6 +8,7 @@ echo "ro.build.display.id=$BUILD_DISPLAY_ID"
echo "ro.build.version.incremental=$BUILD_NUMBER"
echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION"
echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION"
echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
echo "ro.build.version.release=$PLATFORM_VERSION"