Remove duplicates from VendorVars maps
Some products access the SOONG_CONFIG variables
directly, instead of using soong_config_set. When
they do that, they could end up with duplicate values
in those variables, causing duplicate keys to be
generated in a json map.
Use $(sort) to dedup the map keys before writing them
out.
Bug: 249685973
Test: Presubmits
Change-Id: If0c16377bdfbd3f836ebec9262bec7cf562f339c
diff --git a/core/soong_config.mk b/core/soong_config.mk
index a89db4f..e6c4d64 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -249,9 +249,9 @@
$(call add_json_list, MissingUsesLibraries, $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES))
$(call add_json_map, VendorVars)
-$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
+$(foreach namespace,$(sort $(SOONG_CONFIG_NAMESPACES)),\
$(call add_json_map, $(namespace))\
- $(foreach key,$(SOONG_CONFIG_$(namespace)),\
+ $(foreach key,$(sort $(SOONG_CONFIG_$(namespace))),\
$(call add_json_str,$(key),$(subst ",\",$(SOONG_CONFIG_$(namespace)_$(key)))))\
$(call end_json_map))
$(call end_json_map)