chore: bazel run //:format (#682)
This commit is contained in:
parent
bb64a79dc3
commit
b1c342a96f
|
@ -0,0 +1,3 @@
|
|||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -1,12 +1,19 @@
|
|||
# --- begin runfiles.bash initialization v2 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v2.
|
||||
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
set -uo pipefail
|
||||
set +e
|
||||
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$0.runfiles/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
{
|
||||
echo >&2 "ERROR: cannot find $f"
|
||||
exit 1
|
||||
}
|
||||
f=
|
||||
set -e
|
||||
# --- end runfiles.bash initialization v2 ---
|
||||
|
||||
# Read external directory and make sure it exists with a file.
|
||||
|
|
|
@ -12,4 +12,3 @@ case "$(uname -s)" in
|
|||
bazel run $BZLMOD_FLAG @jq//:jq -- --null-input .a=5
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o errexit -o nounset -o pipefail
|
||||
escape() {
|
||||
echo "$1" \
|
||||
| sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' \
|
||||
| awk 1 ORS=' ' # preserve newlines
|
||||
echo "$1" |
|
||||
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' |
|
||||
awk 1 ORS=' ' # preserve newlines
|
||||
}
|
||||
fail() {
|
||||
cat <<EOF >"${XML_OUTPUT_FILE:-/dev/null}"
|
||||
|
|
|
@ -4,8 +4,7 @@ set -o errexit -o nounset -o pipefail
|
|||
mkdir -p $(dirname $1)
|
||||
outfile=$1
|
||||
rm -f $outfile
|
||||
for each in $@
|
||||
do
|
||||
for each in $@; do
|
||||
sanitized=${each/darwin/PLATFORM}
|
||||
sanitized=${sanitized/k8/PLATFORM}
|
||||
echo $sanitized >>$outfile
|
||||
|
|
|
@ -3,13 +3,20 @@
|
|||
|
||||
# --- begin runfiles.bash initialization v3 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v3.
|
||||
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
set -uo pipefail
|
||||
set +e
|
||||
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$0.runfiles/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
{
|
||||
echo >&2 "ERROR: cannot find $f"
|
||||
exit 1
|
||||
}
|
||||
f=
|
||||
set -e
|
||||
# --- end runfiles.bash initialization v3 ---
|
||||
|
||||
cat $(rlocation aspect_bazel_lib/lib/tests/tar/src_file)
|
||||
|
|
|
@ -26,7 +26,6 @@ make_err_msg() {
|
|||
echo "${err_msg}"
|
||||
}
|
||||
|
||||
|
||||
# Asserts that the actual value equals the expected value.
|
||||
#
|
||||
# Args:
|
||||
|
@ -41,9 +40,9 @@ assert_equal() {
|
|||
local expected="${1}"
|
||||
local actual="${2}"
|
||||
local err_msg
|
||||
err_msg="$(\
|
||||
err_msg="$(
|
||||
make_err_msg \
|
||||
"Expected to be equal. expected: ${expected}, actual: ${actual}" "${3:-}" \
|
||||
"Expected to be equal. expected: ${expected}, actual: ${actual}" "${3:-}"
|
||||
)"
|
||||
if [[ "${expected}" != "${actual}" ]]; then
|
||||
fail "${err_msg}"
|
||||
|
@ -64,9 +63,9 @@ assert_match() {
|
|||
local pattern=${1}
|
||||
local actual="${2}"
|
||||
local err_msg
|
||||
err_msg="$(\
|
||||
err_msg="$(
|
||||
make_err_msg \
|
||||
"Expected to match. pattern: ${pattern}, actual: ${actual}" "${3:-}" \
|
||||
"Expected to match. pattern: ${pattern}, actual: ${actual}" "${3:-}"
|
||||
)"
|
||||
if [[ ! "${actual}" =~ ${pattern} ]]; then
|
||||
fail "${err_msg}"
|
||||
|
@ -87,9 +86,9 @@ assert_no_match() {
|
|||
local pattern=${1}
|
||||
local actual="${2}"
|
||||
local err_msg
|
||||
err_msg="$(\
|
||||
err_msg="$(
|
||||
make_err_msg \
|
||||
"Expected not to match. pattern: ${pattern}, actual: ${actual}" "${3:-}" \
|
||||
"Expected not to match. pattern: ${pattern}, actual: ${actual}" "${3:-}"
|
||||
)"
|
||||
if [[ "${actual}" =~ ${pattern} ]]; then
|
||||
fail "${err_msg}"
|
||||
|
|
|
@ -2,29 +2,34 @@
|
|||
|
||||
# --- begin runfiles.bash initialization v2 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v2.
|
||||
set -o nounset -o pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
set -o nounset -o pipefail
|
||||
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
# shellcheck disable=SC1090
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$0.runfiles/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
{
|
||||
echo >&2 "ERROR: cannot find $f"
|
||||
exit 1
|
||||
}
|
||||
f=
|
||||
set -e
|
||||
# --- end runfiles.bash initialization v2 ---
|
||||
|
||||
assertions_sh_location=aspect_bazel_lib/shlib/lib/assertions.sh
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" || \
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/../../../lib/assertions.sh
|
||||
source "${assertions_sh}"
|
||||
|
||||
assert_fail_sh_location=aspect_bazel_lib/shlib/tests/lib_tests/assertions_tests/assert_fail.sh
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" || \
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assert_fail_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/assert_fail.sh
|
||||
source "${assert_fail_sh}"
|
||||
|
||||
|
||||
# MARK - Test assert_equal
|
||||
|
||||
reset_fail_err_msgs
|
||||
|
|
|
@ -20,17 +20,17 @@ new_fail(){
|
|||
|
||||
assert_fail() {
|
||||
local pattern=${1}
|
||||
[[ ${#FAIL_ERR_MSGS[@]} == 0 ]] && \
|
||||
[[ ${#FAIL_ERR_MSGS[@]} == 0 ]] &&
|
||||
new_fail "Expected a failure. None found. pattern: ${pattern}"
|
||||
[[ ${#FAIL_ERR_MSGS[@]} -gt 1 ]] && \
|
||||
[[ ${#FAIL_ERR_MSGS[@]} -gt 1 ]] &&
|
||||
new_fail "Expected a single failure. Found ${#FAIL_ERR_MSGS[@]}. pattern: ${pattern}"
|
||||
[[ "${FAIL_ERR_MSGS[0]}" =~ ${pattern} ]] || \
|
||||
[[ "${FAIL_ERR_MSGS[0]}" =~ ${pattern} ]] ||
|
||||
new_fail "Unexpected failure. Found '${FAIL_ERR_MSGS[0]}'. pattern: ${pattern}"
|
||||
}
|
||||
|
||||
assert_no_fail() {
|
||||
[[ ${#FAIL_ERR_MSGS[@]} == 0 ]] || ( \
|
||||
err_msg=$("${FAIL_ERR_MSGS[@]}") && \
|
||||
new_fail "Expected no failures. Found ${#FAIL_ERR_MSGS[@]}. '${err_msg}'" \
|
||||
[[ ${#FAIL_ERR_MSGS[@]} == 0 ]] || (
|
||||
err_msg=$("${FAIL_ERR_MSGS[@]}") &&
|
||||
new_fail "Expected no failures. Found ${#FAIL_ERR_MSGS[@]}. '${err_msg}'"
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2,24 +2,30 @@
|
|||
|
||||
# --- begin runfiles.bash initialization v2 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v2.
|
||||
set -o nounset -o pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
set -o nounset -o pipefail
|
||||
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
# shellcheck disable=SC1090
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$0.runfiles/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
{
|
||||
echo >&2 "ERROR: cannot find $f"
|
||||
exit 1
|
||||
}
|
||||
f=
|
||||
set -e
|
||||
# --- end runfiles.bash initialization v2 ---
|
||||
|
||||
assertions_sh_location=aspect_bazel_lib/shlib/lib/assertions.sh
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" || \
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/../../../lib/assertions.sh
|
||||
source "${assertions_sh}"
|
||||
|
||||
assert_fail_sh_location=aspect_bazel_lib/shlib/tests/lib_tests/assertions_tests/assert_fail.sh
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" || \
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assert_fail_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/assert_fail.sh
|
||||
source "${assert_fail_sh}"
|
||||
|
|
|
@ -2,24 +2,30 @@
|
|||
|
||||
# --- begin runfiles.bash initialization v2 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v2.
|
||||
set -o nounset -o pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
set -o nounset -o pipefail
|
||||
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
# shellcheck disable=SC1090
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$0.runfiles/$f" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
||||
{
|
||||
echo >&2 "ERROR: cannot find $f"
|
||||
exit 1
|
||||
}
|
||||
f=
|
||||
set -e
|
||||
# --- end runfiles.bash initialization v2 ---
|
||||
|
||||
assertions_sh_location=aspect_bazel_lib/shlib/lib/assertions.sh
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" || \
|
||||
assertions_sh="$(rlocation "${assertions_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/../../../lib/assertions.sh
|
||||
source "${assertions_sh}"
|
||||
|
||||
assert_fail_sh_location=aspect_bazel_lib/shlib/tests/lib_tests/assertions_tests/assert_fail.sh
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" || \
|
||||
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" ||
|
||||
(echo >&2 "Failed to locate ${assert_fail_sh_location}" && exit 1)
|
||||
# shellcheck source=SCRIPTDIR/assert_fail.sh
|
||||
source "${assert_fail_sh}"
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
set -o errexit -o nounset -o pipefail
|
||||
|
||||
JQ_FILTER=\
|
||||
'map({
|
||||
JQ_FILTER='map({
|
||||
"key": .tag_name,
|
||||
"value": .assets
|
||||
| map(select(
|
||||
|
@ -41,10 +40,8 @@ JQ_FILTER=\
|
|||
}) | from_entries
|
||||
'
|
||||
|
||||
|
||||
INFO="$(curl --silent -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/uutils/coreutils/releases?per_page=1 | jq "$JQ_FILTER")"
|
||||
|
||||
|
||||
for VERSION in $(jq -r 'keys | join("\n")' <<<$INFO); do
|
||||
for PLATFORM in $(jq -r ".[\"$VERSION\"] | keys | join(\"\n\")" <<<$INFO); do
|
||||
FILENAME=$(jq -r ".[\"$VERSION\"][\"$PLATFORM\"].filename" <<<$INFO)
|
||||
|
|
|
@ -24,6 +24,5 @@ EOF
|
|||
shift
|
||||
done
|
||||
|
||||
|
||||
echo -n "}"
|
||||
echo ""
|
||||
|
|
Loading…
Reference in New Issue