From 4ec64a62b19c9fbb83e27f70ba575c3bee96d99a Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Fri, 19 Jul 2024 14:51:06 +0200 Subject: [PATCH] Fix formatting scripts for MSYS2 --- scripts/ci/run-cabal-gild.sh | 12 +++++++++++- scripts/ci/run-stylish.sh | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/ci/run-cabal-gild.sh b/scripts/ci/run-cabal-gild.sh index 9f08e799f0..cb352ed8c9 100755 --- a/scripts/ci/run-cabal-gild.sh +++ b/scripts/ci/run-cabal-gild.sh @@ -14,4 +14,14 @@ if ! command -v "$fdcmd" &> /dev/null; then fi fi -$fdcmd --full-path "$(pwd)/(ouroboros-consensus|sop-extras|strict-sop-core)" -e cabal -x cabal-gild -i {} -o {} +case "$(uname -s)" in + MINGW*) path="$(pwd -W | sed 's_/_\\\\_g')\\\\(ouroboros-consensus|sop-extras|strict-sop-core)";; + *) path="$(pwd)/(ouroboros-consensus|sop-extras|strict-sop-core)";; +esac + +$fdcmd --full-path "$path" -e cabal -x cabal-gild -i {} -o {} + +case "$(uname -s)" in + MINGW*) git ls-files --eol | grep "w/crlf" | awk '{print $4}' | xargs dos2unix;; + *) ;; +esac diff --git a/scripts/ci/run-stylish.sh b/scripts/ci/run-stylish.sh index 5ebbe2911d..43190a0333 100755 --- a/scripts/ci/run-stylish.sh +++ b/scripts/ci/run-stylish.sh @@ -18,7 +18,13 @@ if ! command -v "$fdcmd" &> /dev/null; then exit 1 fi fi -$fdcmd --full-path "$(pwd)/(ouroboros-consensus|scripts|sop-extras|strict-sop-core)" \ + +case "$(uname -s)" in + MINGW*) path="$(pwd -W | sed 's_/_\\\\_g')\\\\(ouroboros-consensus|sop-extras|strict-sop-core)";; + *) path="$(pwd)/(ouroboros-consensus|sop-extras|strict-sop-core)";; +esac + +$fdcmd --full-path "$path" \ --extension hs \ --exclude Setup.hs \ --exclude ouroboros-consensus-cardano/app/DBAnalyser/Parsers.hs \ @@ -28,3 +34,8 @@ $fdcmd --full-path "$(pwd)/(ouroboros-consensus|scripts|sop-extras|strict-sop-co grep "#if __GLASGOW_HASKELL__ < 900 import Data.Foldable (asum) #endif" ouroboros-consensus-cardano/app/DBAnalyser/Parsers.hs >/dev/null 2>&1 + +case "$(uname -s)" in + MINGW*) git ls-files --eol | grep "w/crlf" | awk '{print $4}' | xargs dos2unix;; + *) ;; +esac