Skip to content

Commit 91930b3

Browse files
committed
Fix #6448 "hspec-iscover" -> "hspec-discover"
Also removes sbi prefix from StackBuildInfo field names.
1 parent 6103fc5 commit 91930b3

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

src/Stack/Component.hs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ stackTestFromCabal cabalTest = StackTestSuite
106106
}
107107

108108
isComponentBuildable :: HasBuildInfo component => component -> Bool
109-
isComponentBuildable componentRec = componentRec.buildInfo.sbiBuildable
109+
isComponentBuildable componentRec = componentRec.buildInfo.buildable
110110

111111
stackBuildInfoFromCabal :: BuildInfo -> StackBuildInfo
112112
stackBuildInfoFromCabal buildInfoV = gatherComponentToolsAndDepsFromCabal
113113
buildInfoV.buildTools
114114
buildInfoV.buildToolDepends
115115
buildInfoV.targetBuildDepends
116116
StackBuildInfo
117-
{ sbiBuildable = buildInfoV.buildable
118-
, sbiOtherModules = buildInfoV.otherModules
117+
{ buildable = buildInfoV.buildable
118+
, otherModules = buildInfoV.otherModules
119119
, jsSources = buildInfoV.jsSources
120120
, hsSourceDirs = buildInfoV.hsSourceDirs
121121
, cSources = buildInfoV.cSources
122-
, sbiDependency = mempty
123-
, sbiUnknownTools = mempty
122+
, dependency = mempty
123+
, unknownTools = mempty
124124
, cppOptions = buildInfoV.cppOptions
125125
, targetBuildDepends = buildInfoV.targetBuildDepends
126126
, options = buildInfoV.options
@@ -171,23 +171,21 @@ gatherComponentToolsAndDepsFromCabal legacyBuildTools buildTools targetDeps =
171171
sbi
172172
(Cabal.ExeDependency pName (Cabal.mkUnqualComponentName exeName) range)
173173
Nothing -> sbi
174-
{sbiUnknownTools = Set.insert (pack exeName) sbi.sbiUnknownTools}
174+
{ unknownTools = Set.insert (pack exeName) sbi.unknownTools }
175175
processExeDependency sbi exeDep@(Cabal.ExeDependency pName _ _)
176176
| isPreInstalledPackages pName = sbi
177177
| otherwise = sbi
178-
{ sbiDependency =
179-
Map.insert pName (cabalExeToStackDep exeDep) sbi.sbiDependency
178+
{ dependency =
179+
Map.insert pName (cabalExeToStackDep exeDep) sbi.dependency
180180
}
181181
processDependency sbi dep@(Cabal.Dependency pName _ _) = sbi
182-
{ sbiDependency =
183-
Map.insert pName (cabalToStackDep dep) sbi.sbiDependency
184-
}
182+
{ dependency = Map.insert pName (cabalToStackDep dep) sbi.dependency }
185183

186184
componentDependencyMap ::
187-
(HasField "buildInfo" r1 r2, HasField "sbiDependency" r2 a)
185+
(HasField "buildInfo" r1 r2, HasField "dependency" r2 a)
188186
=> r1
189187
-> a
190-
componentDependencyMap component = component.buildInfo.sbiDependency
188+
componentDependencyMap component = component.buildInfo.dependency
191189

192190
-- | A hard-coded map for tool dependencies. If a dependency is within this map
193191
-- it's considered "known" (the exe will be found at the execution stage). The
@@ -201,7 +199,7 @@ isKnownLegacyExe input = case input of
201199
"greencard" -> justPck "greencard"
202200
"c2hs" -> justPck "c2hs"
203201
"hscolour" -> justPck "hscolour"
204-
"hspec-iscover" -> justPck "hspec-discover"
202+
"hspec-discover" -> justPck "hspec-discover"
205203
"hsx2hs" -> justPck "hsx2hs"
206204
"gtk2hsC2hs" -> justPck "gtk2hs-buildtools"
207205
"gtk2hsHookGenerator" -> justPck "gtk2hs-buildtools"

src/Stack/ComponentFile.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import Stack.Types.Component
5555
( StackBenchmark (..), StackBuildInfo (..)
5656
, StackExecutable (..), StackLibrary (..)
5757
, StackTestSuite (..), StackUnqualCompName (..)
58-
, sbiOtherModules
5958
)
6059
import Stack.Types.Config
6160
( Config (..), HasConfig (..), prettyStackDevL )
@@ -86,7 +85,7 @@ stackBenchmarkFiles bench =
8685
case bench.interface of
8786
BenchmarkExeV10 _ fp -> [DotCabalMain fp]
8887
BenchmarkUnsupported _ -> []
89-
bnames = map DotCabalModule build.sbiOtherModules
88+
bnames = map DotCabalModule build.otherModules
9089
build = bench.buildInfo
9190

9291
-- | Get all files referenced by the test.
@@ -102,7 +101,7 @@ stackTestSuiteFiles test =
102101
TestSuiteExeV10 _ fp -> [DotCabalMain fp]
103102
TestSuiteLibV09 _ mn -> [DotCabalModule mn]
104103
TestSuiteUnsupported _ -> []
105-
bnames = map DotCabalModule build.sbiOtherModules
104+
bnames = map DotCabalModule build.otherModules
106105
build = test.buildInfo
107106

108107
-- | Get all files referenced by the executable.
@@ -114,7 +113,7 @@ stackExecutableFiles exe =
114113
where
115114
build = exe.buildInfo
116115
names =
117-
map DotCabalModule build.sbiOtherModules ++ [DotCabalMain exe.modulePath]
116+
map DotCabalModule build.otherModules ++ [DotCabalMain exe.modulePath]
118117

119118
-- | Get all files referenced by the library. Handle all libraries (CLib and
120119
-- SubLib), based on empty name or not.
@@ -131,7 +130,7 @@ stackLibraryFiles lib =
131130
build = lib.buildInfo
132131
names = bnames ++ exposed
133132
exposed = map DotCabalModule lib.exposedModules
134-
bnames = map DotCabalModule build.sbiOtherModules
133+
bnames = map DotCabalModule build.otherModules
135134

136135
-- | Get all files referenced by the component.
137136
resolveComponentFiles ::

src/Stack/Package.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ mainLibraryHasExposedModules package =
649649

650650
-- | Aggregate all unknown tools from all components. Mostly meant for
651651
-- build tools specified in the legacy manner (build-tools:) that failed the
652-
-- hard-coded lookup. See 'Stack.Types.Component.sbiUnknownTools' for more
652+
-- hard-coded lookup. See 'Stack.Types.Component.unknownTools' for more
653653
-- information.
654654
packageUnknownTools :: Package -> Set Text
655655
packageUnknownTools pkg = lib (bench <> tests <> flib <> sublib <> exe)
@@ -663,7 +663,7 @@ packageUnknownTools pkg = lib (bench <> tests <> flib <> sublib <> exe)
663663
sublib = gatherUnknownTools pkg.subLibraries
664664
exe = gatherUnknownTools pkg.executables
665665
addUnknownTools :: HasBuildInfo x => x -> Set Text -> Set Text
666-
addUnknownTools = (<>) . (.buildInfo.sbiUnknownTools)
666+
addUnknownTools = (<>) . (.buildInfo.unknownTools)
667667
gatherUnknownTools :: HasBuildInfo x => CompCollection x -> Set Text
668668
gatherUnknownTools = foldr' addUnknownTools mempty
669669

src/Stack/Types/CompCollection.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ foldAndMakeCollection mapFn = foldl' compIterator mempty
121121
compIterator existingCollection component =
122122
compCreator existingCollection (mapFn component)
123123
compCreator existingCollection component
124-
| component.buildInfo.sbiBuildable = existingCollection
124+
| component.buildInfo.buildable = existingCollection
125125
{ buildableOnes =
126126
addComponent component existingCollection.buildableOnes
127127
}

src/Stack/Types/Component.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,21 @@ newtype ExeName = ExeName Text
114114
-- dependencies, and Stack needs a Map and only a small subset of all the
115115
-- information in Cabal-syntax type.
116116
data StackBuildInfo = StackBuildInfo
117-
{ sbiBuildable :: !Bool
117+
{ buildable :: !Bool
118118
-- ^ Corresponding to Cabal-syntax's
119119
-- 'Distribution.Types.BuildInfo.buildable'. The component is buildable
120120
-- here.
121-
, sbiDependency :: !(Map PackageName DepValue)
121+
, dependency :: !(Map PackageName DepValue)
122122
-- ^ Corresponding to Cabal-syntax's
123123
-- 'Distribution.Types.BuildInfo.targetBuildDepends'. Dependencies specific
124124
-- to a library or executable target.
125-
, sbiUnknownTools :: Set Text
125+
, unknownTools :: Set Text
126126
-- ^ From Cabal-syntax's 'Distribution.Types.BuildInfo.buildTools'. We only
127127
-- keep the legacy build tool depends that we know (from a hardcoded list).
128128
-- We only use the deduplication aspect of the Set here, as this field is
129129
-- only used for error reporting in the end. This is lazy because it's an
130130
-- error reporting field only.
131-
, sbiOtherModules :: [ModuleName]
131+
, otherModules :: [ModuleName]
132132
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.
133133
, jsSources :: [FilePath]
134134
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.

0 commit comments

Comments
 (0)