blob: 93bef01642955af0a7526b0b75eba11c7a2ffb17 [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
52bazel build //tools/maven:gen_${command} || \
53 { echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; }
54
55export OUTPUT_BASE=`bazel info output_base`
56./bazel-genfiles/tools/maven/${command}.sh