Skip to content

Commit 44e2b28

Browse files
alt-romesmergify[bot]
authored andcommitted
Account for .buildinfo in repl when build-type: Configure (#9440)
In `autoconfUserHooks` we were not updating the `preRepl` hook to read additional build information from /package/@.buildinfo@. Additionally updates `autoconfUserHooks` to read additional build info information for the remaining pre-hooks that are not pre-conf. Fixes #9401 (cherry picked from commit ee1e6b8) # Conflicts: # Cabal/src/Distribution/Simple.hs
1 parent f1a168a commit 44e2b28

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

Cabal/src/Distribution/Simple.hs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,14 +576,14 @@ simpleUserHooks =
576576
--
577577
-- * 'postConf' runs @.\/configure@, if present.
578578
--
579-
-- * the pre-hooks 'preBuild', 'preClean', 'preCopy', 'preInst',
580-
-- 'preReg' and 'preUnreg' read additional build information from
579+
-- * the pre-hooks, except for pre-conf, read additional build information from
581580
-- /package/@.buildinfo@, if present.
582581
--
583582
-- Thus @configure@ can use local system information to generate
584583
-- /package/@.buildinfo@ and possibly other files.
585584

586585
autoconfUserHooks :: UserHooks
586+
<<<<<<< HEAD
587587
autoconfUserHooks
588588
= simpleUserHooks
589589
{
@@ -608,6 +608,45 @@ autoconfUserHooks
608608
then runConfigureScript verbosity
609609
flags lbi
610610
else die' verbosity "configure script not found."
611+
=======
612+
autoconfUserHooks =
613+
simpleUserHooks
614+
{ postConf = defaultPostConf
615+
, preBuild = readHookWithArgs buildVerbosity buildDistPref
616+
, preRepl = readHookWithArgs replVerbosity replDistPref
617+
, preCopy = readHookWithArgs copyVerbosity copyDistPref
618+
, preClean = readHook cleanVerbosity cleanDistPref
619+
, preInst = readHook installVerbosity installDistPref
620+
, preHscolour = readHook hscolourVerbosity hscolourDistPref
621+
, preHaddock = readHookWithArgs haddockVerbosity haddockDistPref
622+
, preReg = readHook regVerbosity regDistPref
623+
, preUnreg = readHook regVerbosity regDistPref
624+
, preTest = readHookWithArgs testVerbosity testDistPref
625+
, preBench = readHookWithArgs benchmarkVerbosity benchmarkDistPref
626+
}
627+
where
628+
defaultPostConf
629+
:: Args
630+
-> ConfigFlags
631+
-> PackageDescription
632+
-> LocalBuildInfo
633+
-> IO ()
634+
defaultPostConf args flags pkg_descr lbi =
635+
do
636+
let verbosity = fromFlag (configVerbosity flags)
637+
baseDir lbi' =
638+
fromMaybe
639+
""
640+
(takeDirectory <$> cabalFilePath lbi')
641+
confExists <- doesFileExist $ (baseDir lbi) </> "configure"
642+
if confExists
643+
then
644+
runConfigureScript
645+
verbosity
646+
flags
647+
lbi
648+
else dieWithException verbosity ConfigureScriptNotFound
649+
>>>>>>> ee1e6b81c (Account for .buildinfo in repl when build-type: Configure (#9440))
611650

612651
pbi <- getHookedBuildInfo verbosity (buildDir lbi)
613652
sanityCheckHookedBuildInfo verbosity pkg_descr pbi

changelog.d/issue-9401

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: Account for .buildinfo in repl, test, and bench
2+
packages: Cabal
3+
prs: #9440
4+
issues: #9401
5+
6+
description: {
7+
8+
Generated <project>.buildinfo is now respected in cabal repl, cabal test and cabal bench.
9+
10+
}
11+

0 commit comments

Comments
 (0)