@@ -459,13 +459,28 @@ findDistPrefOrDefault
459459findDistPrefOrDefault = findDistPref defaultDistPref
460460
461461-- | Perform the \"@.\/setup configure@\" action.
462- -- Returns the @.setup-config@ file.
462+ --
463+ -- Returns the @LocalBuildInfo@, also writing it to the @setup-config@ file.
463464configure
464465 :: (GenericPackageDescription , HookedBuildInfo )
465466 -> ConfigFlags
466467 -> IO LocalBuildInfo
467- configure p = configure_setupHooks noConfigureHooks p defaultVerbosityHandles
468+ configure p cfg = do
469+ lbi <- configure_setupHooks noConfigureHooks p defaultVerbosityHandles cfg
470+ -- Write the 'LocalBuildInfo' to the @setup-config@ file.
471+ --
472+ -- NB: the shared 'configure_setupHooks'/'configureFinal' functions deliberately
473+ -- don't include this logic, as it is the responsibility of each top-level
474+ -- configure entry point.
475+ let distPref = fromFlag $ configDistPref cfg
476+ mbWorkDir = flagToMaybe $ configWorkingDir cfg
477+ writePersistBuildConfig mbWorkDir distPref lbi
478+ return lbi
468479
480+ -- | Run the @Cabal@ library configure phase.
481+ --
482+ -- NB: this function does /not/ persist the resulting 'LocalBuildInfo' to the
483+ -- @setup-config@ file; that is the responsibility of callers.
469484configure_setupHooks
470485 :: ConfigureHooks
471486 -> (GenericPackageDescription , HookedBuildInfo )
@@ -546,8 +561,6 @@ configureFinal
546561 } =
547562 do
548563 let verbosity = mkVerbosity verbHandles (fromFlag (configVerbosity cfg))
549- distPref = fromFlag $ configDistPref cfg
550- mbWorkDir = flagToMaybe $ configWorkingDir cfg
551564
552565 -- Apply compiler capability checks to the incoming build options
553566 -- (idempotent).
@@ -608,10 +621,7 @@ configureFinal
608621 pkgInfo
609622 pkgDescr
610623 enabledComps
611- lbi <- configureComponents verbHandles lbc2 pbd3 installedPkgSet promisedDeps externalPkgDeps
612- writePersistBuildConfig mbWorkDir distPref lbi
613-
614- return lbi
624+ configureComponents verbHandles lbc2 pbd3 installedPkgSet promisedDeps externalPkgDeps
615625
616626runPreConfPackageHook
617627 :: ConfigFlags
0 commit comments