From 79657520eec053cc06c3f2d323c23aa223240bfe Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 13 Mar 2018 00:04:48 -0700 Subject: [PATCH] Add variables for configuring Soong plugins See the Soong commit for detailed usage. Bug: 76168832 Test: define some variables, use them Change-Id: Ia8af5b6ec1cb3f12cbc1fee582a309eebb340b7c Merged-In: Ia8af5b6ec1cb3f12cbc1fee582a309eebb340b7c (cherry picked from commit eaacf5b2851c6a9aac27b4e6a3c7bc8ce320f1ab) --- core/config.mk | 3 +++ core/main.mk | 4 ++++ core/soong_config.mk | 10 +++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/config.mk b/core/config.mk index d9f14fafb..43f156461 100644 --- a/core/config.mk +++ b/core/config.mk @@ -182,6 +182,9 @@ endef # Set common values # ############################################################### +# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive. +SOONG_CONFIG_NAMESPACES := + # Set the extensions used for various packages COMMON_PACKAGE_SUFFIX := .zip COMMON_JAVA_PACKAGE_SUFFIX := .jar diff --git a/core/main.mk b/core/main.mk index 5675f90fc..bc0165b52 100644 --- a/core/main.mk +++ b/core/main.mk @@ -52,6 +52,10 @@ ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) dont_bother := true endif +.KATI_READONLY := SOONG_CONFIG_NAMESPACES +.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),SOONG_CONFIG_$(n)) +.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),$(foreach k,$(SOONG_CONFIG_$(n)),SOONG_CONFIG_$(n)_$(k))) + include $(SOONG_MAKEVARS_MK) include $(BUILD_SYSTEM)/clang/config.mk diff --git a/core/soong_config.mk b/core/soong_config.mk index 169c62bec..97a5dce06 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -140,7 +140,15 @@ $(call add_json_list, NamespacesToExport, $(PRODUCT_SOONG_NAMESPA $(call add_json_list, PgoAdditionalProfileDirs, $(PGO_ADDITIONAL_PROFILE_DIRS)) -_contents := $(subst $(comma)$(newline)__SV_END,$(newline)}$(newline),$(_contents)__SV_END) +_contents := $(_contents) "VendorVars": {$(newline) +$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\ + $(eval _contents := $$(_contents) "$(namespace)": {$$(newline)) \ + $(foreach key,$(SOONG_CONFIG_$(namespace)),\ + $(eval _contents := $$(_contents) "$(key)": "$(SOONG_CONFIG_$(namespace)_$(key))",$$(newline)))\ + $(eval _contents := $$(_contents)$(if $(strip $(SOONG_CONFIG_$(namespace))),__SV_END) },$$(newline))) +_contents := $(_contents)$(if $(strip $(SOONG_CONFIG_NAMESPACES)),__SV_END) },$(newline) + +_contents := $(subst $(comma)$(newline)__SV_END,$(newline),$(_contents)__SV_END}$(newline)) $(file >$(SOONG_VARIABLES).tmp,$(_contents))