summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 $?
+}