Enable TARGET_BUILD_UNBUNDLED in master-art (reland).

This is the way to disable assumptions in the build system that a full
system image is to be built.

Soong internally checks for the absence of frameworks/base to detect a
reduced master-art tree and disable some dependencies. That check is at
odds with TARGET_BUILD_UNBUNDLED=true, so for now let's enable
TARGET_BUILD_UNBUNDLED only on the same condition.

This relands https://r.android.com/1337182 with changes in two
testrunner scripts that were missed.

Test: art/tools/buildbot-build.sh --host
  on AOSP master and master-art
Test: art/tools/buildbot-build.sh --target
  on AOSP master and master-art
Test: m installclean && art/build/apex/runtests.sh
  on AOSP master and master-art
Test: rm -rf out && \
      art/test/testrunner/run_build_test_target.py art-linux-bionic-x64
  on AOSP master and master-art
Test: art/test/testrunner/run_build_test_target.py art-test
  on AOSP master and master-art
Test: art/test/testrunner/testrunner.py --target --64 --optimizing && \
      art/tools/run-gtests.sh
  in test chroot on device
  on AOSP master and master-art
Test: art/tools/golem/build-target.sh \
      --machine-type=android-armv8 --golem=art-jit
  on AOSP master and master-art
Bug: 159109002
Bug: 157549171
Change-Id: Ie98af1098ea1132d3db7ed0a8bf47b54e0848e57
diff --git a/tools/build_linux_bionic.sh b/tools/build_linux_bionic.sh
index 89e72b2..b9472ee 100755
--- a/tools/build_linux_bionic.sh
+++ b/tools/build_linux_bionic.sh
@@ -31,13 +31,21 @@
   exit 1
 fi
 
+soong_args=""
+
+# Switch the build system to unbundled mode in the reduced manifest branch.
+# TODO(b/159109002): Clean this up.
+if [ ! -d frameworks/base ]; then
+  soong_args="$soong_args TARGET_BUILD_UNBUNDLED=true"
+fi
+
 source build/envsetup.sh >&/dev/null # for get_build_var
 # Soong needs a bunch of variables set and will not run if they are missing.
 # The default values of these variables is only contained in make, so use
 # nothing to create the variables then remove all the other artifacts.
 # Lunch since it seems we cannot find the build-number otherwise.
 lunch aosp_x86-eng
-build/soong/soong_ui.bash --make-mode nothing
+build/soong/soong_ui.bash --make-mode $soong_args nothing
 
 if [ $? != 0 ]; then
   exit 1
@@ -86,4 +94,4 @@
 # Write a new build-number
 echo ${tmp_build_number}_SOONG_ONLY_BUILD > ${out_dir}/soong/build_number.txt
 
-build/soong/soong_ui.bash --make-mode --skip-make $@
+build/soong/soong_ui.bash --make-mode --skip-make $soong_args $@