1*333d2b36SAndroid Build Coastguard Worker#!/bin/bash 2*333d2b36SAndroid Build Coastguard Worker 3*333d2b36SAndroid Build Coastguard Worker# Generates the golang source file of upload.proto file. 4*333d2b36SAndroid Build Coastguard Worker 5*333d2b36SAndroid Build Coastguard Workerset -e 6*333d2b36SAndroid Build Coastguard Worker 7*333d2b36SAndroid Build Coastguard Workerfunction die() { echo "ERROR: $1" >&2; exit 1; } 8*333d2b36SAndroid Build Coastguard Worker 9*333d2b36SAndroid Build Coastguard Workerreadonly error_msg="Maybe you need to run 'lunch aosp_arm-eng && m aprotoc blueprint_tools'?" 10*333d2b36SAndroid Build Coastguard Worker 11*333d2b36SAndroid Build Coastguard Workerif ! hash aprotoc &>/dev/null; then 12*333d2b36SAndroid Build Coastguard Worker die "could not find aprotoc. ${error_msg}" 13*333d2b36SAndroid Build Coastguard Workerfi 14*333d2b36SAndroid Build Coastguard Worker 15*333d2b36SAndroid Build Coastguard Workerif ! aprotoc --go_out=paths=source_relative:. upload.proto; then 16*333d2b36SAndroid Build Coastguard Worker die "build failed. ${error_msg}" 17*333d2b36SAndroid Build Coastguard Workerfi 18