fixup: fail extraction after first failed command
Print out the executed commands and exit the script after the first failed
command to make debugging easier and to help avoid silent failures in an early
step that cause unexpected failures in a later step.
# Also assumes you have extractors installed as per
# kythe/extractors/bazel/extractors.bazelrc.
+# Print our commands for easier debugging and exit after our first failed
+# command so we avoid silent failures.
+set -ex
+
: ${KYTHE_OUTPUT_DIRECTORY:?Missing output directory}
if [ -n "$KYTHE_SYSTEM_DEPS" ]; then
@@ -54,7 +58,10 @@ if [ -n "$KYTHE_SYSTEM_DEPS" ]; then
apt-get clean
fi
-/kythe/bazelisk --bazelrc=/kythe/bazelrc "$@"
+# It is ok if targets fail to build. We build using --keep_going and don't
+# care if some targets fail, but bazel will return a failure code if any
+# targets fail.
+/kythe/bazelisk --bazelrc=/kythe/bazelrc "$@" || true
# Collect any extracted compilations.
mkdir -p "$KYTHE_OUTPUT_DIRECTORY"
