diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/taskcluster/scripts/source-test-clang-format.sh | |
parent | Initial commit. (diff) | |
download | thunderbird-59f4b6b6d49b15c5a468f3fe34f3cfa4dd956ce2.tar.xz thunderbird-59f4b6b6d49b15c5a468f3fe34f3cfa4dd956ce2.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/taskcluster/scripts/source-test-clang-format.sh')
-rwxr-xr-x | comm/taskcluster/scripts/source-test-clang-format.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/comm/taskcluster/scripts/source-test-clang-format.sh b/comm/taskcluster/scripts/source-test-clang-format.sh new file mode 100755 index 0000000000..90f449a03b --- /dev/null +++ b/comm/taskcluster/scripts/source-test-clang-format.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +# Run the Firefox setup script +source "$HOME/checkouts/gecko/taskcluster/scripts/misc/source-test-clang-setup.sh" + +# Append comm/.clang-format-ignore contents to $topsrcdir/.clang-format-ignore +sed -e 's%^\([a-z]\)%comm/\1%' comm/.clang-format-ignore >> .clang-format-ignore + +# Update mozconfig file with Thunderbird build options +cat <<EOT >> "$MOZCONFIG" +ac_add_options --enable-project=comm/mail +EOT + +# Run mach clang-format +# shellcheck disable=SC2068 +./mach --log-no-times clang-format --output "$HOME/clang-format.json" --format json -p $@ +# shellcheck disable=SC2068 +./mach --log-no-times clang-format --output "$HOME/clang-format.diff" --format diff -p $@ + +# Exit with an error code if clang-format.diff contains a proper diff. +# Needed because mach clang-format will exit 0 regardless of outcome. +# If no formatting is needed, clang-format.diff will have a single \n, +# so check for a file size > 1 byte. +DIFF_SIZE=$(stat -c %s "$HOME/clang-format.diff") +if [[ "$DIFF_SIZE" -gt 1 ]]; then + echo "Exiting with error status. DIFF_SIZE is $DIFF_SIZE." + exit 1 +else + exit 0 +fi |