1
1
mirror of https://github.com/google/ormolu.git synced 2024-11-23 22:27:16 +03:00

Make sure we always get both original and formatted files

This commit is contained in:
mrkkrp 2019-07-14 12:24:35 +02:00 committed by Mark Karpov
parent 7a9aab77b3
commit 78e8dd830a
3 changed files with 8 additions and 2 deletions

View File

@ -74,7 +74,9 @@ $ nix-build -A hackage.<package>
```
Then inspect `result/log.txt` for possible problems. The derivation will
also contain formatted files for inspection.
also contain formatted `.hs` files for inspection and original inputs with
`.hs-original` extension (those are with CPP dropped, exactly what is fed
into Ormolu).
## Contributing

View File

@ -13,6 +13,7 @@
'';
installPhase = ''
mkdir "$out"
find . -name '*.hs-original' -exec cp --parents {} $out \;
find . -name '*.hs' -exec cp --parents {} $out \;
cp log.txt $out/log.txt
'';

View File

@ -14,5 +14,8 @@ cpphs "$1" --noline > "$1-nocpp" 2> /dev/null
# annoyingly, cpphs cannot modify files in place
mv "$1-nocpp" "$1"
# preserve the original
cp "$1" "$1-original"
# run ormolu
ormolu -m inplace "$1"
ormolu -m inplace "$1" || ormolu -u -m inplace "$1"