1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-08-17 00:40:27 +03:00

Format files in parallel

There is no explicit configuration for this, but it is possible for users to
override by changing the RTS options to the `ormolu` executable.
This commit is contained in:
Michael Peyton Jones 2024-07-08 10:59:36 +01:00 committed by Mark Karpov
parent 3f2e3180d7
commit 7c6355b6df
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
## Unreleased
* Format multiple files in parallel. [Issue
1128](https://github.com/tweag/ormolu/issues/1128).
## Ormolu 0.7.7.0
* Use single-line layout for parens around single-line content. [Issue

View File

@ -33,6 +33,7 @@ import System.Directory
import System.Exit (ExitCode (..), exitWith)
import System.FilePath qualified as FP
import System.IO (hPutStrLn, stderr)
import UnliftIO.Async (pooledMapConcurrently)
-- | Entry point of the program.
main :: IO ()
@ -53,7 +54,8 @@ main = do
ExitSuccess -> Nothing
ExitFailure n -> Just n
errorCodes <-
mapMaybe selectFailure <$> mapM (formatOne' . Just) (sort xs)
mapMaybe selectFailure
<$> pooledMapConcurrently (formatOne' . Just) (sort xs)
return $
if null errorCodes
then ExitSuccess

View File

@ -153,6 +153,14 @@ executable ormolu
ormolu,
text >=2.1 && <3,
th-env >=0.1.1 && <0.2,
unliftio >=0.2.10 && <0.3,
-- We use parallelism so we need a threaded runtime to get any
-- benefit.
ghc-options:
-threaded
-rtsopts
-with-rtsopts=-N
if flag(dev)
ghc-options:
@ -166,7 +174,6 @@ executable ormolu
ghc-options:
-O2
-Wall
-rtsopts
test-suite tests
type: exitcode-stdio-1.0