summaryrefslogtreecommitdiff
path: root/soong_ui.bash
diff options
context:
space:
mode:
author Joe Onorato <joeo@google.com> 2022-12-05 15:02:29 -0800
committer Joe Onorato <joeo@google.com> 2023-01-03 14:50:36 -0800
commitfa5fc26ce279299ba116cdd968ff207daba201c4 (patch)
treeac9232810c08879329241776e58249e135c3fdc8 /soong_ui.bash
parent2266e02a3a643b138feb6f1ff94d88ec46dfda6d (diff)
Move common functions to script_utils.sh
Test: m Bug: 260003429 Change-Id: Iac401eeaf97c904ea751583bf80091d50526f695
Diffstat (limited to 'soong_ui.bash')
-rwxr-xr-xsoong_ui.bash30
1 files changed, 2 insertions, 28 deletions
diff --git a/soong_ui.bash b/soong_ui.bash
index 49c4b78c4..7bddb586b 100755
--- a/soong_ui.bash
+++ b/soong_ui.bash
@@ -18,34 +18,8 @@
# that's detected in the Go code, which skips calculating the startup time.
export TRACE_BEGIN_SOONG=$(date +%s%N)
-# Function to find top of the source tree (if $TOP isn't set) by walking up the
-# tree.
-function gettop
-{
- local TOPFILE=build/soong/root.bp
- if [ -n "${TOP-}" -a -f "${TOP-}/${TOPFILE}" ] ; then
- # The following circumlocution ensures we remove symlinks from TOP.
- (cd $TOP; PWD= /bin/pwd)
- else
- if [ -f $TOPFILE ] ; then
- # The following circumlocution (repeated below as well) ensures
- # that we record the true directory name and not one that is
- # faked up with symlink names.
- PWD= /bin/pwd
- else
- local HERE=$PWD
- T=
- while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
- \cd ..
- T=`PWD= /bin/pwd -P`
- done
- \cd $HERE
- if [ -f "$T/$TOPFILE" ]; then
- echo $T
- fi
- fi
- fi
-}
+source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../make/shell_utils.sh
+require_top
# Save the current PWD for use in soong_ui
export ORIGINAL_PWD=${PWD}