aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-07-12 15:00:05 -0700
committerDan Willemsen <dwillemsen@google.com>2017-07-12 16:41:09 -0700
commit1b822867360844bea1c30facb95492ff21eb4e6b (patch)
tree3c982962dd19a7cf03c78d840ef08dfa5ff1da89
parentc40e10bd6beb2be8ecb2f1ce478b70ddc04fd328 (diff)
downloadandroid_build_soong-1b822867360844bea1c30facb95492ff21eb4e6b.tar.gz
android_build_soong-1b822867360844bea1c30facb95492ff21eb4e6b.tar.bz2
android_build_soong-1b822867360844bea1c30facb95492ff21eb4e6b.zip
Support running soong_ui.bash from anywhere in the tree
It will cd to $TOP before running soong_ui itself, so that soong_ui still runs from the top of the tree. ORIGINAL_PWD is saved so that we can reference that later (for example, to move 'mma' implementation into Go). Test: cd system; ../build/soong/soong_ui.bash Test: Set absolute / relative OUT_DIR or OUT_DIR_COMMON_BASE and repeat Change-Id: Icb67a3ee6a3358cca50300755c8953419fc19437
-rw-r--r--cmd/microfactory/microfactory.bash5
-rwxr-xr-xsoong_ui.bash6
2 files changed, 9 insertions, 2 deletions
diff --git a/cmd/microfactory/microfactory.bash b/cmd/microfactory/microfactory.bash
index 7489fe39..6bd0f400 100644
--- a/cmd/microfactory/microfactory.bash
+++ b/cmd/microfactory/microfactory.bash
@@ -39,9 +39,12 @@ function getoutdir
if [ "${OUT_DIR_COMMON_BASE-}" ]; then
out_dir="${OUT_DIR_COMMON_BASE}/$(basename ${TOP})"
else
- out_dir="${TOP}/out"
+ out_dir="out"
fi
fi
+ if [[ "${out_dir}" != /* ]]; then
+ out_dir="${TOP}/${out_dir}"
+ fi
echo "${out_dir}"
}
diff --git a/soong_ui.bash b/soong_ui.bash
index 105af9f4..34c44a48 100755
--- a/soong_ui.bash
+++ b/soong_ui.bash
@@ -47,8 +47,12 @@ function gettop
fi
}
+# Save the current PWD for use in soong_ui
+export ORIGINAL_PWD=${PWD}
export TOP=$(gettop)
-source build/soong/cmd/microfactory/microfactory.bash
+source ${TOP}/build/soong/cmd/microfactory/microfactory.bash
build_go soong_ui android/soong/cmd/soong_ui
+
+cd ${TOP}
exec "$(getoutdir)/soong_ui" "$@"