From 40a8c5c85569d8f60f0108438b5f80894601d235 Mon Sep 17 00:00:00 2001 From: Max Podkorytov <4273004+tenpercent@users.noreply.github.com> Date: Wed, 6 Aug 2025 10:15:44 -0700 Subject: [PATCH] modernize scripts for running cmake and clang-format (#2503) Co-authored-by: Aviral Goel [ROCm/composable_kernel commit: 1824d65758beeb6af10c02a2c35f959414348bc9] --- script/clang-format-overwrite.sh | 5 +++++ script/cmake-ck-dev.sh | 3 +++ script/cmake-ck-release.sh | 3 +++ 3 files changed, 11 insertions(+) diff --git a/script/clang-format-overwrite.sh b/script/clang-format-overwrite.sh index a770970fef..ea2834ae62 100755 --- a/script/clang-format-overwrite.sh +++ b/script/clang-format-overwrite.sh @@ -1,2 +1,7 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + + find . -name deps -prune -o -name build -prune -o -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' -o -iname '*.h.in' -o -iname '*.hpp.in' -o -iname '*.cpp.in' -o -iname '*.cl' -o -iname '*.cuh' -o -iname '*.cu' -o -iname '*.inc' | xargs -n 1 -P 16 -I{} -t sh -c 'clang-format-18 -i -style=file {}' git status --porcelain | awk '$1 != "D" && (match($2, "\\.cpp|.hpp|.inc")) {print $2}' | xargs -n 1 -P 16 -I{} -t sh -c 'clang-format-18 -i -style=file {}' diff --git a/script/cmake-ck-dev.sh b/script/cmake-ck-dev.sh index c45bb4330d..25a1590808 100755 --- a/script/cmake-ck-dev.sh +++ b/script/cmake-ck-dev.sh @@ -1,4 +1,7 @@ #!/bin/bash +set -euo pipefail +IFS=$'\n\t' + rm -f CMakeCache.txt rm -f *.cmake rm -rf CMakeFiles diff --git a/script/cmake-ck-release.sh b/script/cmake-ck-release.sh index 311ea91822..5263de92c8 100755 --- a/script/cmake-ck-release.sh +++ b/script/cmake-ck-release.sh @@ -1,4 +1,7 @@ #!/bin/bash +set -euo pipefail +IFS=$'\n\t' + rm -f CMakeCache.txt rm -f *.cmake rm -rf CMakeFiles