blob: deda565b040994d33b4e263d9eb0a6f4dce69e3e [file] [log] [blame]
David Ostrovskyf4f1ac22016-11-21 01:18:56 +01001#!/bin/bash -e
2
3# Copyright (C) 2016 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 [[ "$#" != "1" ]] ; then
18 cat <<EOF
19Usage: run "$0 COMMAND" from the top of your workspace,
20where COMMAND is one of
21
22 install
23 deploy
24
25Set VERBOSE in the environment to get more information.
26
27EOF
28
29 exit 1
30fi
31
32set -o errexit
33set -o nounset
34
35case "$1" in
36install)
37 command="api_install"
38 ;;
39deploy)
40 command="api_deploy"
41 ;;
42*)
43 echo "unknown command $1"
44 exit 1
45 ;;
46esac
47
48if [[ "${VERBOSE:-x}" != "x" ]]; then
49 set -o xtrace
50fi
51
David Ostrovskyaf6c6602019-10-17 10:16:50 +020052if [[ `which bazelisk` ]]; then
53 BAZEL_CMD=bazelisk
54else
55 BAZEL_CMD=bazel
56fi
57
58${BAZEL_CMD} build //tools/maven:gen_${command} || \
59 { echo "${BAZEL_CMD} failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; }
David Ostrovskyf4f1ac22016-11-21 01:18:56 +010060
David Ostrovsky560543e2022-01-30 15:54:41 +010061export OUTPUT_BASE=`${BAZEL_CMD} info output_base`
David Ostrovskyda3dd892019-10-17 10:12:38 +020062./bazel-bin/tools/maven/${command}.sh