blob: 0470d6d24c9912a69887425d8baf8d2e2cf5debf [file] [log] [blame]
Alex Light680cbf22018-10-31 11:00:19 -07001#!/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
Martin Stjernholm1048bb72022-04-13 16:22:30 +010017set -e
Alex Light680cbf22018-10-31 11:00:19 -070018
19if [ ! -d art ]; then
20 echo "Script needs to be run at the root of the android tree"
21 exit 1
22fi
23
Martin Stjernholm69069102020-06-16 13:26:40 +010024# Switch the build system to unbundled mode in the reduced manifest branch.
Martin Stjernholm69069102020-06-16 13:26:40 +010025if [ ! -d frameworks/base ]; then
Martin Stjernholm0ef7c522022-04-13 19:34:36 +010026 export TARGET_BUILD_UNBUNDLED=true
Martin Stjernholm69069102020-06-16 13:26:40 +010027fi
28
Martin Stjernholm1048bb72022-04-13 16:22:30 +010029vars="$(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
Alex Light680cbf22018-10-31 11:00:19 -070033
Alex Light680cbf22018-10-31 11:00:19 -070034# 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).
Martin Stjernholm0ef7c522022-04-13 19:34:36 +010036build/soong/soong_ui.bash --make-mode "$@" test-art-host-run-test-dependencies build-art-host-tests
Alex Light680cbf22018-10-31 11:00:19 -070037
Martin Stjernholm0ef7c522022-04-13 19:34:36 +010038# Next build the Linux host Bionic targets in --soong-only mode.
39export TARGET_PRODUCT=linux_bionic
Alex Light680cbf22018-10-31 11:00:19 -070040
Martin Stjernholm0ef7c522022-04-13 19:34:36 +010041# 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
Alex Light680cbf22018-10-31 11:00:19 -070045
Martin Stjernholm1048bb72022-04-13 16:22:30 +010046soong_out=$OUT_DIR/soong/host/linux_bionic-x86
Alex Light680cbf22018-10-31 11:00:19 -070047declare -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
Andreas Gampe148c1602019-06-10 16:47:46 -070062 $soong_out/bin/signal_dumper
Ivan Lozanoe3de71c2020-02-18 15:52:56 -050063 $soong_out/lib64/libclang_rt.ubsan_standalone-x86_64-android.so
Martin Stjernholm1048bb72022-04-13 16:22:30 +010064 $(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"))
Alex Light680cbf22018-10-31 11:00:19 -070067
68echo building ${bionic_targets[*]}
69
Martin Stjernholm0ef7c522022-04-13 19:34:36 +010070build/soong/soong_ui.bash --make-mode --soong-only "$@" ${bionic_targets[*]}