From 251205d866d10f6a54b54cb8122ef78de2eb01e3 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Thu, 10 Nov 2022 03:02:13 +0000 Subject: [PATCH] New product config flag to gate blueprint modules Bug: 270654958 Example usage: PRODUCT_INCLUDE_TAGS += use_myspecial_sdk This also populates the allowlist with go/nogo mainline tags. Usage of `PRODUCT_INCLUDE_TAGS` outside this allowlist will raise an error in product config Test: TH Change-Id: Ica82a8f65cbfda600d72fc54fb873c1eaa1666a7 Merged-In: Ica82a8f65cbfda600d72fc54fb873c1eaa1666a7 (cherry picked from commit 055e5f89a7bc5d12877fc6bc8110c1e1e8b6ee59) --- core/product.mk | 3 +++ core/product_config.mk | 8 ++++++++ core/soong_config.mk | 2 ++ 3 files changed, 13 insertions(+) diff --git a/core/product.mk b/core/product.mk index 53fee1c54f..e57ca13b6f 100644 --- a/core/product.mk +++ b/core/product.mk @@ -267,6 +267,9 @@ _product_list_vars += PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION # This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS. _product_single_value_vars += PRODUCT_RETROFIT_DYNAMIC_PARTITIONS +# List of tags that will be used to gate blueprint modules from the build graph +_product_list_vars += PRODUCT_INCLUDE_TAGS + # When this is true, various build time as well as runtime debugfs restrictions are enabled. _product_single_value_vars += PRODUCT_SET_DEBUGFS_RESTRICTIONS diff --git a/core/product_config.mk b/core/product_config.mk index 37146d3a97..b93f5be1d9 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -278,6 +278,14 @@ all_product_makefiles := all_product_configs := ############################################################################# +# Check product include tag allowlist +BLUEPRINT_INCLUDE_TAGS_ALLOWLIST := com.android.mainline_go com.android.mainline +.KATI_READONLY := BLUEPRINT_INCLUDE_TAGS_ALLOWLIST +$(foreach include_tag,$(PRODUCT_INCLUDE_TAGS), \ + $(if $(filter $(include_tag),$(BLUEPRINT_INCLUDE_TAGS_ALLOWLIST)),,\ + $(call pretty-error, $(include_tag) is not in BLUEPRINT_INCLUDE_TAGS_ALLOWLIST: $(BLUEPRINT_INCLUDE_TAGS_ALLOWLIST)))) +############################################################################# + # Quick check and assign default values TARGET_DEVICE := $(PRODUCT_DEVICE) diff --git a/core/soong_config.mk b/core/soong_config.mk index dfbd08ef8b..16b7faecf6 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -292,6 +292,8 @@ $(call add_json_bool, GenerateAidlNdkPlatformBackend, $(filter true,$(NEED_AIDL_ $(call add_json_bool, ForceMultilibFirstOnDevice, $(filter true,$(FORCE_MULTILIB_FIRST_ON_DEVICE))) +$(call add_json_list, IncludeTags, $(PRODUCT_INCLUDE_TAGS)) + $(call json_end) $(file >$(SOONG_VARIABLES).tmp,$(json_contents))