blob: eaaa9d929ebeb95c7aa875a15e012ae48555c75d [file]
#!/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.
#### CATEGORY=Build
### clean the current Fuchsia build artifacts
## Delete the contents of the output directory except for args.gn and
## create a Ninja build environment sufficient to regenerate the build.
##
## This is equivalent to running `gn clean` on FUCHSIA_BUILD_DIR, then
## invoking `fx gen` to regenerate critical build files.
# shellcheck source=/dev/null
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
fx-config-read
set -e
if [[ $# -gt 0 ]]; then
case "$1" in
-h|--help)
fx-command-help
exit 0
;;
*)
fx-error "Unknown argument: $1"
fx-command-help
exit 1
;;
esac
fi
(set -x; fx-gn clean "$FUCHSIA_BUILD_DIR")
# Ensure //build/regenerator is invoked to regenerate a working Bazel workspace.
fx-command-run gen