Merge "Add soong_config_get" am: e856367da1
am: 88fac99ae6
am: 7e00224e10
Original change: https://android-review.googlesource.com/c/platform/build/+/1883263 Change-Id: I46f84d4796b9d586e713c2919c8e5a0afaeefed9
This commit is contained in:
commit
40886414ba
4 changed files with 19 additions and 2 deletions
|
@ -304,7 +304,7 @@ $(eval SOONG_CONFIG_$(strip $1)_$(strip $2):=$3)
|
|||
endef
|
||||
|
||||
# soong_config_append appends to the value of the variable in the given Soong
|
||||
# config namespace. If the varabile does not exist, it will be defined. If the
|
||||
# config namespace. If the variable does not exist, it will be defined. If the
|
||||
# namespace does not exist, it will be defined.
|
||||
# $1 is the namespace, $2 is the variable name, $3 is the value
|
||||
define soong_config_append
|
||||
|
@ -312,6 +312,14 @@ $(call soong_config_define_internal,$1,$2) \
|
|||
$(eval SOONG_CONFIG_$(strip $1)_$(strip $2):=$(SOONG_CONFIG_$(strip $1)_$(strip $2)) $3)
|
||||
endef
|
||||
|
||||
# soong_config_append gets to the value of the variable in the given Soong
|
||||
# config namespace. If the namespace or variables does not exist, an
|
||||
# empty string will be returned.
|
||||
# $1 is the namespace, $2 is the variable name
|
||||
define soong_config_get
|
||||
$(SOONG_CONFIG_$(strip $1)_$(strip $2))
|
||||
endef
|
||||
|
||||
# Set the extensions used for various packages
|
||||
COMMON_PACKAGE_SUFFIX := .zip
|
||||
COMMON_JAVA_PACKAGE_SUFFIX := .jar
|
||||
|
|
|
@ -321,6 +321,11 @@ def _soong_config_append(g, nsname, var, value):
|
|||
ns[var] += " " + value
|
||||
|
||||
|
||||
def _soong_config_get(g, nsname, var):
|
||||
"""Gets to the value of the variable in the namespace."""
|
||||
return g.get(_soong_config_namespaces_key, {}).get(nsname, {}).get(var, None)
|
||||
|
||||
|
||||
def _abspath(path):
|
||||
"""Provided for compatibility, to be removed later."""
|
||||
return path
|
||||
|
@ -644,6 +649,7 @@ rblf = struct(
|
|||
soong_config_namespace = _soong_config_namespace,
|
||||
soong_config_append = _soong_config_append,
|
||||
soong_config_set = _soong_config_set,
|
||||
soong_config_get = _soong_config_get,
|
||||
abspath = _abspath,
|
||||
addprefix = _addprefix,
|
||||
addsuffix = _addsuffix,
|
||||
|
|
|
@ -61,7 +61,7 @@ else
|
|||
apex_test_module := art-check-release-apex-gen-fakebin
|
||||
endif
|
||||
|
||||
ifeq (true,$(SOONG_CONFIG_art_module_source_build)
|
||||
ifeq (true,$(call soong_config_get,art_module,source_build))
|
||||
PRODUCT_HOST_PACKAGES += $(apex_test_module)
|
||||
endif
|
||||
|
||||
|
|
|
@ -94,3 +94,6 @@ assert_eq(
|
|||
|
||||
assert_eq("S", globals["PLATFORM_VERSION"])
|
||||
assert_eq(30, globals["PLATFORM_SDK_VERSION"])
|
||||
|
||||
assert_eq("xyz", rblf.soong_config_get(globals, "NS2", "v3"))
|
||||
assert_eq(None, rblf.soong_config_get(globals, "NS2", "nonexistant_var"))
|
||||
|
|
Loading…
Reference in a new issue