Created
February 24, 2024 16:07
-
-
Save ptxmac/75620c520c75d32e7cc74836f67b863b to your computer and use it in GitHub Desktop.
bazel wrapper to automatically trigger gazelle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Small bazel wrapper than will trigger gazelle if bazel returns a missing dependencies error. | |
tempfile=$($BAZEL_REAL info command_log) | |
$BAZEL_REAL "$@" | |
res=$? | |
if [[ $res -gt 0 ]]; then | |
if grep "missing strict dependencies" $tempfile; then | |
echo "Bazel failed with missing strict dependencies. Running gazelle, then rerunning." | |
$BAZEL_REAL run //:gazelle | |
$BAZEL_REAL "$@" | |
res=$? | |
fi | |
exit $res | |
else | |
exit $res | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this as
tools/bazel
. All calls tobazel
will automatically be replaced by this script.