blob: 61087389ff9e541fb13182defad506416acc52a4 [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
## explicitly 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 $?
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/updates.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[@]}"
check-for-amber-server || return -1
fx-command-run push-package "${targets[@]}"
}
main "$@"