Make `check` recognise `main-is` in conditional branches (#9768)
[cabal.git] / Cabal / src / Distribution / Types / ParStrat.hs
blob59d8beb3889c579801c3935e49fa2a42e7d2bce3
1 module Distribution.Types.ParStrat where
3 -- | How to control parallelism, e.g. a fixed number of jobs or by using a system semaphore.
4 data ParStratX sem
5 = -- | Compile in parallel with the given number of jobs (`-jN` or `-j`).
6 NumJobs (Maybe Int)
7 | -- | `--semaphore`: use a system semaphore to control parallelism.
8 UseSem sem
9 | -- | No parallelism (neither `-jN` nor `--semaphore`, but could be `-j1`).
10 Serial
11 deriving (Show)
13 -- | Used by Cabal to indicate that we want to use this specific semaphore (created by cabal-install)
14 type ParStrat = ParStratX String
16 -- | Used by cabal-install to say we want to create a semaphore with N slots.
17 type ParStratInstall = ParStratX Int
19 -- | Determine if the parallelism strategy enables parallel builds.
20 isParallelBuild :: ParStratX n -> Bool
21 isParallelBuild Serial = False
22 isParallelBuild (NumJobs (Just 1)) = False
23 isParallelBuild (NumJobs _) = True
24 isParallelBuild UseSem{} = True