Remove the out/soong/.bootstrap directory.
It's better not to have state hidden in dotfiles (or rather,
dotdirectories) if we can help.
It's questionable whether the "linux-x86" path segment makes sense since
soong_build only ever runs on one operating system, but I didn't want to
rock the boat now.
Drive-by fixed some quoting fixes in rbc-run. Notably, I didn't wrap
`$@` into double quotes because I don't know whether the lack of double
quotes was intended or not.
Also drive-by fixed the fact that "out/soong" was added twice to the
directory name of bpglob. This turned out not to be a problem because
bpglob doesn't need to be explicitly built: if it's needed, it's
declared as an input of the glob files so it'll be built automatically
(at the cost of the first "null build" not actually being a null build)
Test: Presubmits.
Change-Id: I710d8d16cd8212059a0ca1ee95378505303eed83
diff --git a/scripts/rbc-run b/scripts/rbc-run
index a0907cf..9d30199 100755
--- a/scripts/rbc-run
+++ b/scripts/rbc-run
@@ -4,12 +4,26 @@
# that will be passed to rbcrun.
[[ $# -gt 0 && -f "$1" ]] || { echo "Usage: ${0##*/} product.mk [Additional rbcrun arguments]" >&2; exit 1; }
set -eu
-declare -r output_root=${OUT_DIR:-out}
-declare -r runner="$output_root/soong/.bootstrap/bin/rbcrun"
-declare -r converter="$output_root/soong/.bootstrap/bin/mk2rbc"
-declare -r launcher=$output_root/launchers/run.rbc
-declare -r makefile=$1
+
+case $(uname -s) in
+ Linux)
+ declare -r os="linux-x86";
+ ;;
+ Darwin)
+ declare -r os="darwin-x86";
+ ;;
+ *)
+ echo "Unknown OS: $(uname -s)" >&2;
+ exit 1;
+ ;;
+esac
+
+declare -r output_root="${OUT_DIR:-out}"
+declare -r runner="${output_root}/soong/host/${os}/bin/rbcrun"
+declare -r converter="${output_root}/soong/host/${os}/bin/mk2rbc"
+declare -r launcher="$output_root/launchers/run.rbc"
+declare -r makefile="$1"
shift
-$converter -mode=write -r --outdir $output_root --launcher=$launcher $makefile
-$runner RBC_OUT="make,global" RBC_DEBUG="${RBC_DEBUG:-}" $@ $launcher
+"$converter" -mode=write -r --outdir "$output_root" --launcher="$launcher" "$makefile"
+"$runner" RBC_OUT="make,global" RBC_DEBUG="${RBC_DEBUG:-}" $@ "$launcher"