summaryrefslogtreecommitdiff
path: root/shell_utils.sh
diff options
context:
space:
mode:
author Joe Onorato <joeo@google.com> 2024-12-09 09:38:01 -0800
committer Joe Onorato <joeo@google.com> 2024-12-09 11:22:37 -0800
commit029c50ad32161fc41f698fad013edcd057d5f900 (patch)
tree4d7254bc21ec9350d8d2c1d36a9697328491fd37 /shell_utils.sh
parentc1fc82ffb852b4022024af3c1be9eca3c02ae374 (diff)
Add import_build_vars to shell_utils.sh
Bug: 383124666 Test: treehugger Change-Id: Ibd65da819821a7b0c0e1959aab523e54df8ca258
Diffstat (limited to 'shell_utils.sh')
-rw-r--r--shell_utils.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/shell_utils.sh b/shell_utils.sh
index 9053c42e75..3124db598c 100644
--- a/shell_utils.sh
+++ b/shell_utils.sh
@@ -214,3 +214,19 @@ function log_tool_invocation()
' SIGINT SIGTERM SIGQUIT EXIT
}
+# Import the build variables supplied as arguments into this shell's environment.
+# For absolute variables, prefix the variable name with a '/'. For example:
+# import_build_vars OUT_DIR DIST_DIR /HOST_OUT_EXECUTABLES
+# Returns nonzero if the build command failed. Stderr is passed through.
+function import_build_vars()
+{
+ require_top
+ local script
+ script=$(cd $TOP && build/soong/bin/get_build_vars "$@")
+ local ret=$?
+ if [ $ret -ne 0 ] ; then
+ return $ret
+ fi
+ eval "$script"
+ return $?
+}