Skip to content

Commit

Permalink
Add projectConfigUseSemaphore to FieldGrammar
Browse files Browse the repository at this point in the history
  • Loading branch information
jgotoh committed Nov 10, 2023
1 parent 9fd5b4e commit d3b6381
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Distribution.Client.ProjectConfig.FieldGrammar

import qualified Data.Set as Set
import qualified Distribution.Client.ProjectConfig.Lens as L
import Distribution.Client.ProjectConfig.Types (ProjectConfig (..), ProjectConfigBuildOnly (..), ProjectConfigProvenance (..), ProjectConfigShared (..), PackageConfig (..))
import Distribution.Client.ProjectConfig.Types (PackageConfig (..), ProjectConfig (..), ProjectConfigBuildOnly (..), ProjectConfigProvenance (..), ProjectConfigShared (..))
import Distribution.Client.Utils.Parsec
import Distribution.Compat.Prelude
import Distribution.FieldGrammar
Expand All @@ -26,13 +26,14 @@ projectConfigFieldGrammar source =
<*> blurFieldGrammar L.projectConfigShared (projectConfigSharedFieldGrammar source)
<*> pure provenance
<*> pure mempty
-- ^ PackageConfig to be applied to all packages, specified inside 'package *' stanza
-- \^ PackageConfig to be applied to all packages, specified inside 'package *' stanza
-- <*> blurFieldGrammar L.projectConfigLocalPackages packageConfigFieldGrammar
<*> pure mempty
-- ^ PackageConfig to be applied to locally built packages, specified not inside a stanza
-- \^ PackageConfig to be applied to locally built packages, specified not inside a stanza
<*> pure mempty
-- ^ PackageConfig applied to explicitly named packages
where
-- \^ PackageConfig applied to explicitly named packages

provenance = Set.singleton (Explicit source)

formatPackageVersionConstraints :: [PackageVersionConstraint] -> List CommaVCat (Identity PackageVersionConstraint) PackageVersionConstraint
Expand All @@ -51,6 +52,7 @@ projectConfigBuildOnlyFieldGrammar =
<*> optionalFieldDef "report-planning-failure" L.projectConfigReportPlanningFailure mempty
<*> monoidalFieldAla "symlink-bindir" (alaFlag FilePathNT) L.projectConfigSymlinkBinDir
<*> monoidalFieldAla "jobs" (alaFlag NumJobs) L.projectConfigNumJobs
<*> optionalFieldDef "semaphore" L.projectConfigUseSemaphore mempty
<*> optionalFieldDef "keep-going" L.projectConfigKeepGoing mempty
<*> optionalFieldDef "offline" L.projectConfigOfflineMode mempty
<*> optionalFieldDef "haddock-keep-temp-files" L.projectConfigKeepTempFiles mempty
Expand Down
4 changes: 4 additions & 0 deletions cabal-install/src/Distribution/Client/ProjectConfig/Lens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ projectConfigNumJobs :: Lens' ProjectConfigBuildOnly (Flag (Maybe Int))
projectConfigNumJobs f s = fmap (\x -> s{T.projectConfigNumJobs = x}) (f (T.projectConfigNumJobs s))
{-# INLINEABLE projectConfigNumJobs #-}

projectConfigUseSemaphore :: Lens' ProjectConfigBuildOnly (Flag Bool)
projectConfigUseSemaphore f s = fmap (\x -> s{T.projectConfigUseSemaphore = x}) (f (T.projectConfigUseSemaphore s))
{-# INLINEABLE projectConfigUseSemaphore #-}

projectConfigKeepGoing :: Lens' ProjectConfigBuildOnly (Flag Bool)
projectConfigKeepGoing f s = fmap (\x -> s{T.projectConfigKeepGoing = x}) (f (T.projectConfigKeepGoing s))
{-# INLINEABLE projectConfigKeepGoing #-}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ testProjectConfigBuildOnly = do
projectConfigReportPlanningFailure = toFlag True
projectConfigSymlinkBinDir = toFlag "some-bindir"
projectConfigNumJobs = toFlag $ Just 4
projectConfigUseSemaphore = toFlag True
projectConfigKeepGoing = toFlag True
projectConfigOfflineMode = toFlag True
projectConfigKeepTempFiles = toFlag True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-log: myLog.log
report-planning-failure: true
symlink-bindir: some-bindir
jobs: 4
semphore: True
keep-going: true
offline: true
haddock-keep-temp-files: true
Expand Down

0 comments on commit d3b6381

Please sign in to comment.