| David Ostrovsky | f4f1ac2 | 2016-11-21 01:18:56 +0100 | [diff] [blame] | 1 | #!/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 | |
| 17 | if [[ "$#" != "1" ]] ; then |
| 18 | cat <<EOF |
| 19 | Usage: run "$0 COMMAND" from the top of your workspace, |
| 20 | where COMMAND is one of |
| 21 | |
| 22 | install |
| 23 | deploy |
| 24 | |
| 25 | Set VERBOSE in the environment to get more information. |
| 26 | |
| 27 | EOF |
| 28 | |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | set -o errexit |
| 33 | set -o nounset |
| 34 | |
| 35 | case "$1" in |
| 36 | install) |
| 37 | command="api_install" |
| 38 | ;; |
| 39 | deploy) |
| 40 | command="api_deploy" |
| 41 | ;; |
| 42 | *) |
| 43 | echo "unknown command $1" |
| 44 | exit 1 |
| 45 | ;; |
| 46 | esac |
| 47 | |
| 48 | if [[ "${VERBOSE:-x}" != "x" ]]; then |
| 49 | set -o xtrace |
| 50 | fi |
| 51 | |
| 52 | bazel build //tools/maven:gen_${command} || \ |
| 53 | { echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; } |
| 54 | |
| 55 | export OUTPUT_BASE=`bazel info output_base` |
| 56 | ./bazel-genfiles/tools/maven/${command}.sh |