From 43d2a1b26ff9378c8ca6e0d466e02940b280ed70 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Sun, 25 Jun 2023 19:48:38 +0900 Subject: [PATCH] soong: Add `aapt_version_code` default This appends `--version_code=$(date -u +%Y%m%d)` to aapt flags, which is useful for flushing some caches upon system updates. Change-Id: I6575b878f09c1c3138e12abc34d39405f51245e7 Signed-off-by: Omkar Chandorkar --- soong/Android.bp | 20 ++++++++++++++++++++ target/board/BoardConfigSoong.mk | 2 ++ 2 files changed, 22 insertions(+) diff --git a/soong/Android.bp b/soong/Android.bp index 58680d4a..b5beb7f1 100644 --- a/soong/Android.bp +++ b/soong/Android.bp @@ -154,3 +154,23 @@ uses_miui_camera { }, }, } + +soong_config_module_type { + name: "aapt_version_code", + module_type: "java_defaults", + config_namespace: "aospaGlobalVars", + value_variables: ["aapt_version_code"], + properties: ["aaptflags"], +} + +aapt_version_code { + name: "aapt_version_code_defaults", + soong_config_variables: { + aapt_version_code: { + aaptflags: [ + "--version-code", + "%s", + ], + }, + }, +} diff --git a/target/board/BoardConfigSoong.mk b/target/board/BoardConfigSoong.mk index db9e4b9c..0a85f325 100644 --- a/target/board/BoardConfigSoong.mk +++ b/target/board/BoardConfigSoong.mk @@ -17,6 +17,7 @@ $(foreach v,$(EXPORT_TO_SOONG),$(eval $(call addVar,$(v)))) SOONG_CONFIG_NAMESPACES += aospaGlobalVars SOONG_CONFIG_aospaGlobalVars += \ + aapt_version_code \ needs_camera_boottime \ powershare_node \ target_init_vendor_lib \ @@ -32,6 +33,7 @@ TARGET_INIT_VENDOR_LIB ?= vendor_init TARGET_SURFACEFLINGER_UDFPS_LIB ?= surfaceflinger_udfps_lib # Soong value variables +SOONG_CONFIG_aospaGlobalVars_aapt_version_code := $(shell date -u +%Y%m%d) SOONG_CONFIG_aospaGlobalVars_needs_camera_boottime := $(TARGET_CAMERA_BOOTTIME_TIMESTAMP) SOONG_CONFIG_aospaGlobalVars_powershare_node := $(TARGET_POWERSHARE_NODE) SOONG_CONFIG_aospaGlobalVars_target_init_vendor_lib := $(TARGET_INIT_VENDOR_LIB)