blob: 5ef66d196a3d0700fc879c1f6f45832098ee065b [file] [log] [blame]
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +01001#!/bin/bash
2#
3# Copyright (C) 2015 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
17if [ ! -d art ]; then
18 echo "Script needs to be run at the root of the android tree"
19 exit 1
20fi
21
Nicolas Geoffray4b29f382015-10-07 09:28:52 +010022out_dir=${OUT_DIR-out}
23java_libraries_dir=${out_dir}/target/common/obj/JAVA_LIBRARIES
Tobias Thiererb3ec0892016-08-03 16:13:04 +010024common_targets="vogar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests mockito-target ${out_dir}/host/linux-x86/bin/jack"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010025mode="target"
26j_arg="-j$(nproc)"
Roland Levillainb8b93562015-08-20 17:49:56 +010027showcommands=
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010028make_command=
29
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010030while true; do
31 if [[ "$1" == "--host" ]]; then
32 mode="host"
33 shift
34 elif [[ "$1" == "--target" ]]; then
35 mode="target"
36 shift
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010037 elif [[ "$1" == -j* ]]; then
Nicolas Geoffray667b99e2015-05-29 12:17:06 +010038 j_arg=$1
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010039 shift
Roland Levillainb8b93562015-08-20 17:49:56 +010040 elif [[ "$1" == "--showcommands" ]]; then
41 showcommands="showcommands"
42 shift
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010043 elif [[ "$1" == "" ]]; then
44 break
45 fi
46done
47
Nicolas Geoffrayd062ac52016-09-13 13:36:32 +010048# Workaround for repo incompatibilities on the Chromium buildbot.
49# TODO: Remove this workaround once https://bugs.chromium.org/p/chromium/issues/detail?id=646329
50# is addressed.
51repo=$(which repo)
52if [[ $repo == *"depot_tools"* ]]; then
Nicolas Geoffray4177c6c2016-09-13 14:08:31 +010053 ln -s build/soong/root.bp Android.bp
54 ln -s build/soong/bootstrap.bash bootstrap.bash
55 echo "include build/core/main.mk" > Makefile
Nicolas Geoffrayd062ac52016-09-13 13:36:32 +010056fi
57
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010058if [[ $mode == "host" ]]; then
Nicolas Geoffrayf8137452016-04-28 11:58:03 +010059 make_command="make $j_arg $showcommands build-art-host-tests $common_targets"
60 make_command+=" ${out_dir}/host/linux-x86/lib/libjavacoretests.so "
61 make_command+=" ${out_dir}/host/linux-x86/lib64/libjavacoretests.so"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010062elif [[ $mode == "target" ]]; then
Nicolas Geoffrayf8137452016-04-28 11:58:03 +010063 make_command="make $j_arg $showcommands build-art-target-tests $common_targets"
Nicolas Geoffrayb3dab272016-06-13 15:28:38 +010064 make_command+=" libjavacrypto libjavacoretests libnetd_client linker toybox toolbox sh"
Nicolas Geoffrayf8137452016-04-28 11:58:03 +010065 make_command+=" ${out_dir}/host/linux-x86/bin/adb libstdc++ "
66 make_command+=" ${out_dir}/target/product/${TARGET_PRODUCT}/system/etc/public.libraries.txt"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010067fi
68
Nicolas Geoffrayaadc9862015-09-29 14:56:31 +010069echo "Executing $make_command"
70$make_command