Add --skip-go and --skip-soong-tests options am: 7d013d5316 am: d8841033df am: 0f36c41d7f

Original change: https://android-review.googlesource.com/c/platform/prebuilts/build-tools/+/2016819

Change-Id: Iac1d9107637bb74b6cd0757fb13f84583b1fe967
diff --git a/build-prebuilts.sh b/build-prebuilts.sh
index a4e7838..0bbb4ef 100755
--- a/build-prebuilts.sh
+++ b/build-prebuilts.sh
@@ -41,6 +41,8 @@
             case "${OPTARG}" in
                 resume) clean= ;;
                 musl) use_musl=true ;;
+                skip-go) unset build_go ;;
+                skip-soong-tests) skip_soong_tests=--skip-soong-tests ;;
                 *) echo "Unknown option --${OPTARG}"; exit 1 ;;
             esac;;
         *) echo "'${opt}' '${OPTARG}'"
@@ -55,7 +57,7 @@
 # Use toybox and other prebuilts even outside of the build (test running, go, etc)
 export PATH=${TOP}/prebuilts/build-tools/path/${OS}-x86:$PATH
 
-if [ -n ${build_soong} ]; then
+if [ -n "${build_soong}" ]; then
     SOONG_OUT=${OUT_DIR}/soong
     SOONG_HOST_OUT=${OUT_DIR}/soong/host/${OS}-x86
     [[ -z "${clean}" ]] || rm -rf ${SOONG_OUT}
@@ -153,7 +155,7 @@
     fi
 
     # Build everything
-    build/soong/soong_ui.bash --make-mode --soong-only --skip-config \
+    build/soong/soong_ui.bash --make-mode --soong-only --skip-config ${skip_soong_tests} \
         ${binaries} \
         ${wrappers} \
         ${jars} \
@@ -216,7 +218,7 @@
         rm -rf ${SOONG_HOST_OUT}
 
         # Build everything with ASAN
-        build/soong/soong_ui.bash --make-mode --soong-only --skip-config \
+        build/soong/soong_ui.bash --make-mode --soong-only --skip-config ${skip_soong_tests} \
             ${asan_binaries} \
             ${SOONG_HOST_OUT}/nativetest64/ninja_test/ninja_test \
             ${SOONG_HOST_OUT}/nativetest64/ckati_test/find_test
@@ -247,7 +249,7 @@
 fi
 
 # Go
-if [ -n ${build_go} ]; then
+if [ -n "${build_go}" ]; then
     GO_OUT=${OUT_DIR}/obj/go
     rm -rf ${GO_OUT}
     mkdir -p ${GO_OUT}
@@ -271,7 +273,7 @@
 if [ -n "${DIST_DIR}" ]; then
     mkdir -p ${DIST_DIR} || true
 
-    if [ -n ${build_soong} ]; then
+    if [ -n "${build_soong}" ]; then
         cp ${SOONG_OUT}/dist/build-prebuilts.zip ${DIST_DIR}/
         cp ${SOONG_OUT}/dist-common/build-common-prebuilts.zip ${DIST_DIR}/
         cp ${SOONG_OUT}/docs/*.html ${DIST_DIR}/
@@ -280,7 +282,7 @@
             cp ${SOONG_OUT}/musl-sysroot32.zip ${DIST_DIR}/
         fi
     fi
-    if [ -n ${build_go} ]; then
+    if [ -n "${build_go}" ]; then
         cp ${GO_OUT}/go.zip ${DIST_DIR}/
     fi
 fi