blob: 93eadb06ac9bbef68f9dbd5a3a48e7205fcd2384 [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# 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
15set -e
16
17if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then
18 echo "ERROR: ${BASH_SOURCE:-$0} must be sourced"
19 exit 1
20fi
21
22readonly PROJECT_ROOT="$(cd -P ${BASH_SOURCE[0]%/*}/..; pwd)"
23
Hector Dearman14f0b9f2018-01-08 19:21:34 +000024case "$(uname -s | tr '[A-Z]' '[a-z]')" in
Primiano Tucciae2879e2017-09-27 11:02:09 +090025 darwin)
26 readonly OS="mac";;
27 linux)
28 readonly OS="linux64";;
29 *)
30 echo "Unsupported platform"
31 exit 1
32 ;;
33esac
34
35BIN_PATH="$PROJECT_ROOT/buildtools/$OS/$CMD"
36if [ ! -x "$BIN_PATH" ]; then
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000037 echo "Cannot find $BIN_PATH. Run tools/install-build-deps first."
Primiano Tucciae2879e2017-09-27 11:02:09 +090038 exit 1
39fi
40
41exec "$BIN_PATH" "$@"