blob: d4848075d31fe2d0042bb555c781c5d7793a5fb5 [file] [log] [blame]
#!/bin/bash
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### build Fuchsia and push to device
## usage: fx build-push [ninja option,...] [target,...]
##
## Build ALL targets. After building all the targets, push the ones that were
## supplied to this command. If no targets were specified push all of them.
## The packages are pushed to the device specified. If no device is supplied
## explictly this will push to the single connected device. If multiple devices
## are connected and no device is specified, pushing will fail.
set -e
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
fx-config-read
function main {
local args=()
local targets=()
while (($#)); do
case "$1" in
-C|-f|-j|-k|-l|-t|-w)
args+=("$1")
shift
args+=("$1")
;;
-n|-v)
args+=("$1")
;;
*)
targets+=("$1")
esac
shift
done
fx-command-run build "${args[@]}"
if [[ -z "$(pgrep -f "amber-files/repository")" ]]; then
echo
echo "WARNING: It looks like serve-updates is not running."
echo "WARNING: You probably need to start \"fx serve\""
echo
fi
fx-command-run push-package "${targets[@]}"
}
main "$@"