soong_config: Add add_json_str_omitempty function
* This function wraps add_json_str so that it does not add the soong
variable key:value pair to json structure if the second argument
(value) is empty/unset, preventing the need for more complex
conditional logic in the middle the code that builds the struct
* This concept allows us to make use of the omitempty field option
for purposes like single variables controlling ifdef blocks as well
as carrying the desired value
Change-Id: I99c8c162069c2aa8ff3d0bab2636b01181e74a9d
diff --git a/build/soong/soong_config.mk b/build/soong/soong_config.mk
index 66ad453..577d29d 100644
--- a/build/soong/soong_config.mk
+++ b/build/soong/soong_config.mk
@@ -1,3 +1,5 @@
+add_json_str_omitempty = $(if $(strip $(2)),$(call add_json_str, $(1), $(2)))
+
_contents := $(_contents) "Lineage":{$(newline)
# See build/core/soong_config.mk for the add_json_* functions you can use here.