Skip to content

Commit eef6bcc

Browse files
sheafMikolaj
authored andcommitted
Provide Cabal-hooks in test environment
This commit ensures the test-suite driver also provides the Cabal-hooks package, on top of Cabal and Cabal-syntax.
1 parent 20547b5 commit eef6bcc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cabal-testsuite/main/cabal-tests.hs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ Where are these environments specified:
5757
2. The build-depends of `test-runtime-deps` executable in `cabal-testsuite.cabal`
5858
These dependencies are injected in a special module (`Test.Cabal.ScriptEnv0`) which
5959
then is consulted in `Test.Cabal.Monad` in order to pass the right environmnet.
60-
This is mechanism by which the `./Setup` tests have access to the in-tree `Cabal`
61-
and `Cabal-syntax` libraries.
60+
This is the mechanism by which the `./Setup` tests have access to the in-tree
61+
`Cabal`, `Cabal-syntax` and `Cabal-hooks` libraries.
6262
3. No specification, only the `GlobalPackageDb` is available (see
6363
`testPackageDBStack`) unless the test itself augments the environment with
6464
`withPackageDb`.
@@ -142,7 +142,8 @@ buildCabalLibsProject projString verb mbGhc dir = do
142142
, "--project-file=" ++ dir </> "cabal.project-test"
143143
, "build"
144144
, "-w", programPath ghc
145-
, "Cabal", "Cabal-syntax"] ) { progInvokeCwd = Just dir })
145+
, "Cabal", "Cabal-syntax", "Cabal-hooks"
146+
] ) { progInvokeCwd = Just dir })
146147
return final_package_db
147148

148149

@@ -157,15 +158,18 @@ buildCabalLibsSpecific ver verb mbGhc builddir_rel = do
157158
csgot <- doesDirectoryExist (dir </> "Cabal-syntax-" ++ ver)
158159
unless csgot $
159160
runProgramInvocation verb ((programInvocation cabal ["get", "Cabal-syntax-" ++ ver]) { progInvokeCwd = Just dir })
160-
161-
buildCabalLibsProject ("packages: Cabal-" ++ ver ++ " Cabal-syntax-" ++ ver) verb mbGhc dir
161+
let hooksVerFromVer _ = "0.1"
162+
hooksVer = hooksVerFromVer ver
163+
chgot <- doesDirectoryExist (dir </> "Cabal-hooks-" ++ hooksVer)
164+
unless chgot $
165+
runProgramInvocation verb ((programInvocation cabal ["get", "Cabal-hooks-" ++ hooksVer]) { progInvokeCwd = Just dir })
166+
buildCabalLibsProject ("packages: Cabal-" ++ ver ++ " Cabal-syntax-" ++ ver ++ " Cabal-hooks-" ++ hooksVer) verb mbGhc dir
162167

163168

164169
buildCabalLibsIntree :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO FilePath
165170
buildCabalLibsIntree root verb mbGhc builddir_rel = do
166171
dir <- canonicalizePath (builddir_rel </> "intree")
167-
buildCabalLibsProject ("packages: " ++ root </> "Cabal" ++ " " ++ root </> "Cabal-syntax") verb mbGhc dir
168-
172+
buildCabalLibsProject ("packages: " ++ root </> "Cabal" ++ " " ++ root </> "Cabal-syntax" ++ " " ++ root </> "Cabal-hooks") verb mbGhc dir
169173

170174
main :: IO ()
171175
main = do

0 commit comments

Comments
 (0)