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 | |
| 22 | common_targets="vogar vogar.jar core-tests apache-harmony-jdwp-tests-hostdex out/host/linux-x86/bin/adb jsr166-tests" |
| 23 | android_root="/data/local/tmp/system" |
| 24 | linker="linker" |
| 25 | mode="target" |
| 26 | j_arg="-j$(nproc)" |
| 27 | make_command= |
| 28 | |
| 29 | if [[ "$TARGET_PRODUCT" == "armv8" ]]; then |
| 30 | linker="linker64" |
| 31 | fi |
| 32 | |
| 33 | if [[ "$ART_TEST_ANDROID_ROOT" != "" ]]; then |
| 34 | android_root="$ART_TEST_ANDROID_ROOT" |
| 35 | fi |
| 36 | |
| 37 | while true; do |
| 38 | if [[ "$1" == "--host" ]]; then |
| 39 | mode="host" |
| 40 | shift |
| 41 | elif [[ "$1" == "--target" ]]; then |
| 42 | mode="target" |
| 43 | shift |
| 44 | elif [[ "$1" == "--32" ]]; then |
| 45 | linker="linker" |
| 46 | shift |
| 47 | elif [[ "$1" == "--64" ]]; then |
| 48 | linker="linker64" |
| 49 | shift |
| 50 | elif [[ "$1" == "--android-root" ]]; then |
| 51 | shift |
| 52 | android_root=$1 |
| 53 | shift |
| 54 | elif [[ "$1" == -j* ]]; then |
| 55 | j_arg = $1 |
| 56 | shift |
| 57 | elif [[ "$1" == "" ]]; then |
| 58 | break |
| 59 | fi |
| 60 | done |
| 61 | |
| 62 | if [[ $mode == "host" ]]; then |
| 63 | make_command="make $j_arg build-art-host-tests $common_targets" |
| 64 | echo "Executing $make_command" |
| 65 | $make_command |
| 66 | elif [[ $mode == "target" ]]; then |
| 67 | # We need to provide our own linker in case the linker on the device |
| 68 | # is out of date. |
| 69 | env="TARGET_GLOBAL_LDFLAGS=-Wl,-dynamic-linker=$android_root/bin/$linker" |
| 70 | # Use '-e' to force the override of TARGET_GLOBAL_LDFLAGS. |
| 71 | # Also, we build extra tools that will be used by tests, so that |
| 72 | # they are compiled with our own linker. |
| 73 | make_command="make -e $j_arg build-art-target-tests $common_targets libjavacrypto linker toybox toolbox sh" |
| 74 | echo "Executing env $env $make_command" |
| 75 | env $env $make_command |
| 76 | fi |
| 77 | |