Skip to content

Commit

Permalink
Fix formatting scripts for MSYS2 (#1185)
Browse files Browse the repository at this point in the history
The path from `pwd` doesn't work, it is a `/c/Users/...` path.

Also using this opportunity to ensure `LF` line endings.
  • Loading branch information
jasagredo authored Jul 22, 2024
2 parents ad53873 + 4ec64a6 commit 486753d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 11 additions & 1 deletion scripts/ci/run-cabal-gild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 12 additions & 1 deletion scripts/ci/run-stylish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

0 comments on commit 486753d

Please sign in to comment.