Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove curator prefix from Curator field names #6430

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,8 @@ installPackage name ps minstalled = do
where
expectedTestOrBenchFailures maybeCurator = fromMaybe False $ do
curator <- maybeCurator
pure $ Set.member name curator.curatorExpectTestFailure
|| Set.member name curator.curatorExpectBenchmarkFailure
pure $ Set.member name curator.expectTestFailure
|| Set.member name curator.expectBenchmarkFailure

resolveDepsAndInstall ::
Bool
Expand Down
8 changes: 4 additions & 4 deletions src/Stack/Build/ExecutePackage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ singleBuild
&& mainLibraryHasExposedModules package
-- Special help for the curator tool to avoid haddocks that are known
-- to fail
&& maybe True (Set.notMember pname . (.curatorSkipHaddock)) mcurator
&& maybe True (Set.notMember pname . (.skipHaddock)) mcurator
expectHaddockFailure =
maybe False (Set.member pname . (.curatorExpectHaddockFailure))
maybe False (Set.member pname . (.expectHaddockFailure))
isHaddockForHackage = ee.buildOpts.haddockForHackage
fulfillHaddockExpectations mcurator action
| expectHaddockFailure mcurator = do
Expand Down Expand Up @@ -1285,11 +1285,11 @@ taskComponents task =

expectTestFailure :: PackageName -> Maybe Curator -> Bool
expectTestFailure pname =
maybe False (Set.member pname . (.curatorExpectTestFailure))
maybe False (Set.member pname . (.expectTestFailure))

expectBenchmarkFailure :: PackageName -> Maybe Curator -> Bool
expectBenchmarkFailure pname =
maybe False (Set.member pname . (.curatorExpectBenchmarkFailure))
maybe False (Set.member pname . (.expectBenchmarkFailure))

fulfillCuratorBuildExpectations ::
(HasCallStack, HasTerm env)
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ loadLocalPackage pp = do
Just (TargetAll _packageType) ->
( buildableExes pkg
, if bopts.tests
&& maybe True (Set.notMember name . (.curatorSkipTest)) mcurator
&& maybe True (Set.notMember name . (.skipTest)) mcurator
then buildableTestSuites pkg
else Set.empty
, if bopts.benchmarks
&& maybe
True
(Set.notMember name . (.curatorSkipBenchmark))
(Set.notMember name . (.skipBenchmark))
mcurator
then buildableBenchmarks pkg
else Set.empty
Expand Down
27 changes: 14 additions & 13 deletions src/Stack/Types/Curator.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}

Expand All @@ -18,32 +19,32 @@ import Stack.Prelude
-- | Type representing configuration options which support the needs of the
-- [@curator@ tool](https://github.com/commercialhaskell/curator).
data Curator = Curator
{ curatorSkipTest :: !(Set PackageName)
{ skipTest :: !(Set PackageName)
-- ^ Packages for which Stack should ignore test suites.
, curatorExpectTestFailure :: !(Set PackageName)
, expectTestFailure :: !(Set PackageName)
-- ^ Packages for which Stack should expect building test suites to fail.
, curatorSkipBenchmark :: !(Set PackageName)
, skipBenchmark :: !(Set PackageName)
-- ^ Packages for which Stack should ignore benchmarks.
, curatorExpectBenchmarkFailure :: !(Set PackageName)
, expectBenchmarkFailure :: !(Set PackageName)
-- ^ Packages for which Stack should expect building benchmarks to fail.
, curatorSkipHaddock :: !(Set PackageName)
, skipHaddock :: !(Set PackageName)
-- ^ Packages for which Stack should ignore creating Haddock documentation.
, curatorExpectHaddockFailure :: !(Set PackageName)
, expectHaddockFailure :: !(Set PackageName)
-- ^ Packages for which Stack should expect creating Haddock documentation
-- to fail.
}
deriving Show

instance ToJSON Curator where
toJSON c = object
[ "skip-test" .= Set.map CabalString c.curatorSkipTest
, "expect-test-failure" .= Set.map CabalString c.curatorExpectTestFailure
, "skip-bench" .= Set.map CabalString c.curatorSkipBenchmark
toJSON curator = object
[ "skip-test" .= Set.map CabalString curator.skipTest
, "expect-test-failure" .= Set.map CabalString curator.expectTestFailure
, "skip-bench" .= Set.map CabalString curator.skipBenchmark
, "expect-benchmark-failure" .=
Set.map CabalString c.curatorExpectTestFailure
, "skip-haddock" .= Set.map CabalString c.curatorSkipHaddock
Set.map CabalString curator.expectTestFailure
, "skip-haddock" .= Set.map CabalString curator.skipHaddock
, "expect-haddock-failure" .=
Set.map CabalString c.curatorExpectHaddockFailure
Set.map CabalString curator.expectHaddockFailure
]

instance FromJSON (WithJSONWarnings Curator) where
Expand Down
Loading