• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright (C) 2018 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -e
18
19if [ ! -d art ]; then
20  echo "Script needs to be run at the root of the android tree"
21  exit 1
22fi
23
24# Switch the build system to unbundled mode in the reduced manifest branch.
25if [ ! -d frameworks/base ]; then
26  export TARGET_BUILD_UNBUNDLED=true
27fi
28
29vars="$(build/soong/soong_ui.bash --dumpvars-mode --vars="OUT_DIR HOST_OUT")"
30# Assign to a variable and eval that, since bash ignores any error status from
31# the command substitution if it's directly on the eval line.
32eval $vars
33
34# First build all the targets still in .mk files (also build normal glibc host
35# targets so we know what's needed to run the tests).
36build/soong/soong_ui.bash --make-mode "$@" test-art-host-run-test-dependencies build-art-host-tests
37
38# Next build the Linux host Bionic targets in --soong-only mode.
39export TARGET_PRODUCT=linux_bionic
40
41# Avoid Soong error about invalid dependencies on disabled libLLVM_android,
42# which we get due to the --soong-only mode. (Another variant is to set
43# SOONG_ALLOW_MISSING_DEPENDENCIES).
44export FORCE_BUILD_LLVM_COMPONENTS=true
45
46soong_out=$OUT_DIR/soong/host/linux_bionic-x86
47declare -a bionic_targets
48# These are the binaries actually used in tests. Since some of the files are
49# java targets or 32 bit we cannot just do the same find for the bin files.
50#
51# We look at what the earlier build generated to figure out what to ask soong to
52# build since we cannot use the .mk defined phony targets.
53bionic_targets=(
54  $soong_out/bin/dalvikvm
55  $soong_out/bin/dalvikvm64
56  $soong_out/bin/dex2oat
57  $soong_out/bin/dex2oatd
58  $soong_out/bin/profman
59  $soong_out/bin/profmand
60  $soong_out/bin/hiddenapi
61  $soong_out/bin/hprof-conv
62  $soong_out/bin/signal_dumper
63  $soong_out/lib64/libclang_rt.ubsan_standalone-x86_64-android.so
64  $(find $HOST_OUT/apex/com.android.art.host.zipapex -type f | sed "s:$HOST_OUT:$soong_out:g")
65  $(find $HOST_OUT/lib64 -type f | sed "s:$HOST_OUT:$soong_out:g")
66  $(find $HOST_OUT/nativetest64 -type f | sed "s:$HOST_OUT:$soong_out:g"))
67
68echo building ${bionic_targets[*]}
69
70build/soong/soong_ui.bash --make-mode --soong-only "$@" ${bionic_targets[*]}
71