Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 1 | #!/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 | |
| 17 | if [ ! -d art ]; then |
| 18 | echo "Script needs to be run at the root of the android tree" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
Fredrik Roubert | ad9c4a3 | 2016-11-11 19:28:18 -0800 | [diff] [blame] | 22 | # Logic for setting out_dir from build/make/core/envsetup.mk: |
| 23 | if [[ -z $OUT_DIR ]]; then |
| 24 | if [[ -z $OUT_DIR_COMMON_BASE ]]; then |
| 25 | out_dir=out |
| 26 | else |
| 27 | out_dir=${OUT_DIR_COMMON_BASE}/${PWD##*/} |
| 28 | fi |
| 29 | else |
| 30 | out_dir=${OUT_DIR} |
| 31 | fi |
| 32 | |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 33 | using_jack=true |
| 34 | if [[ $ANDROID_COMPILE_WITH_JACK == false ]]; then |
| 35 | using_jack=false |
| 36 | fi |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 37 | |
Nicolas Geoffray | 4b29f38 | 2015-10-07 09:28:52 +0100 | [diff] [blame] | 38 | java_libraries_dir=${out_dir}/target/common/obj/JAVA_LIBRARIES |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 39 | common_targets="vogar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests mockito-target" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 40 | mode="target" |
| 41 | j_arg="-j$(nproc)" |
Roland Levillain | b8b9356 | 2015-08-20 17:49:56 +0100 | [diff] [blame] | 42 | showcommands= |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 43 | make_command= |
| 44 | |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 45 | while true; do |
| 46 | if [[ "$1" == "--host" ]]; then |
| 47 | mode="host" |
| 48 | shift |
| 49 | elif [[ "$1" == "--target" ]]; then |
| 50 | mode="target" |
| 51 | shift |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 52 | elif [[ "$1" == -j* ]]; then |
Nicolas Geoffray | 667b99e | 2015-05-29 12:17:06 +0100 | [diff] [blame] | 53 | j_arg=$1 |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 54 | shift |
Roland Levillain | b8b9356 | 2015-08-20 17:49:56 +0100 | [diff] [blame] | 55 | elif [[ "$1" == "--showcommands" ]]; then |
| 56 | showcommands="showcommands" |
| 57 | shift |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 58 | elif [[ "$1" == "" ]]; then |
| 59 | break |
Andreas Gampe | 0dcee91 | 2017-02-01 22:07:45 -0800 | [diff] [blame] | 60 | else |
| 61 | echo "Unknown options $@" |
| 62 | exit 1 |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 63 | fi |
| 64 | done |
| 65 | |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 66 | if $using_jack; then |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 67 | common_targets="$common_targets ${out_dir}/host/linux-x86/bin/jack" |
| 68 | fi |
| 69 | |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 70 | if [[ $mode == "host" ]]; then |
Orion Hodson | d0c3e83 | 2017-06-28 14:34:26 +0100 | [diff] [blame] | 71 | make_command="make $j_arg $showcommands build-art-host-tests $common_targets dx-tests" |
Nicolas Geoffray | f813745 | 2016-04-28 11:58:03 +0100 | [diff] [blame] | 72 | make_command+=" ${out_dir}/host/linux-x86/lib/libjavacoretests.so " |
| 73 | make_command+=" ${out_dir}/host/linux-x86/lib64/libjavacoretests.so" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 74 | elif [[ $mode == "target" ]]; then |
Nicolas Geoffray | f813745 | 2016-04-28 11:58:03 +0100 | [diff] [blame] | 75 | make_command="make $j_arg $showcommands build-art-target-tests $common_targets" |
Nicolas Geoffray | b3dab27 | 2016-06-13 15:28:38 +0100 | [diff] [blame] | 76 | make_command+=" libjavacrypto libjavacoretests libnetd_client linker toybox toolbox sh" |
Nicolas Geoffray | f813745 | 2016-04-28 11:58:03 +0100 | [diff] [blame] | 77 | make_command+=" ${out_dir}/host/linux-x86/bin/adb libstdc++ " |
| 78 | make_command+=" ${out_dir}/target/product/${TARGET_PRODUCT}/system/etc/public.libraries.txt" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 79 | fi |
| 80 | |
Nicolas Geoffray | aadc986 | 2015-09-29 14:56:31 +0100 | [diff] [blame] | 81 | echo "Executing $make_command" |
| 82 | $make_command |