Add variables for configuring Soong plugins

See the Soong commit for detailed usage.

Bug: 76168832
Test: define some variables, use them
Change-Id: Ia8af5b6ec1cb3f12cbc1fee582a309eebb340b7c
diff --git a/core/soong_config.mk b/core/soong_config.mk
index bf40fe3..ab493d9 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -137,7 +137,15 @@
 
 $(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))