Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 1 | # Copyright (C) 2017 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | set -e |
| 16 | |
| 17 | if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then |
| 18 | echo "ERROR: ${BASH_SOURCE:-$0} must be sourced" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | readonly PROJECT_ROOT="$(cd -P ${BASH_SOURCE[0]%/*}/..; pwd)" |
| 23 | |
Hector Dearman | 14f0b9f | 2018-01-08 19:21:34 +0000 | [diff] [blame] | 24 | case "$(uname -s | tr '[A-Z]' '[a-z]')" in |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 25 | darwin) |
| 26 | readonly OS="mac";; |
| 27 | linux) |
| 28 | readonly OS="linux64";; |
| 29 | *) |
| 30 | echo "Unsupported platform" |
| 31 | exit 1 |
| 32 | ;; |
| 33 | esac |
| 34 | |
| 35 | BIN_PATH="$PROJECT_ROOT/buildtools/$OS/$CMD" |
| 36 | if [ ! -x "$BIN_PATH" ]; then |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 37 | echo "Cannot find $BIN_PATH. Run tools/install-build-deps first." |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | exec "$BIN_PATH" "$@" |