@@ -39,6 +39,10 @@ module Distribution.Simple.Build
39
39
, writeBuiltinAutogenFiles
40
40
, writeAutogenFiles
41
41
42
+ -- ** Legacy functions
43
+ , componentInitialBuildSteps
44
+ , initialBuildSteps
45
+
42
46
-- * Internal package database creation
43
47
, createInternalPackageDB
44
48
) where
@@ -1029,6 +1033,59 @@ replFLib flags pkg_descr lbi exe clbi =
1029
1033
GHC -> GHC. replFLib flags NoFlag pkg_descr lbi exe clbi
1030
1034
_ -> dieWithException verbosity REPLNotSupported
1031
1035
1036
+ -- | Runs 'componentInitialBuildSteps' on every configured component.
1037
+ --
1038
+ -- Legacy function: does not run pre-build hooks or pre-processors. This function
1039
+ -- is insufficient on its own to prepare the build for a package.
1040
+ --
1041
+ -- Consumers wanting to prepare the sources of a package, e.g. in order to
1042
+ -- launch a REPL session, are advised to run @Setup repl --repl-multi-file=<fn>@
1043
+ -- instead.
1044
+ initialBuildSteps
1045
+ :: FilePath
1046
+ -- ^ "dist" prefix
1047
+ -> PackageDescription
1048
+ -- ^ mostly information from the .cabal file
1049
+ -> LocalBuildInfo
1050
+ -- ^ Configuration information
1051
+ -> Verbosity
1052
+ -- ^ The verbosity to use
1053
+ -> IO ()
1054
+ initialBuildSteps distPref pkg_descr lbi verbosity =
1055
+ withAllComponentsInBuildOrder pkg_descr lbi $ \ _comp clbi ->
1056
+ componentInitialBuildSteps distPref pkg_descr lbi clbi verbosity
1057
+ {-# DEPRECATED initialBuildSteps
1058
+ "This function does not prepare all source files for a package. Suggestion: use 'Setup repl --repl-multi-file=<fn>'."
1059
+ #-}
1060
+
1061
+ -- | Creates the autogenerated files for a particular configured component.
1062
+ --
1063
+ -- Legacy function: does not run pre-build hooks or pre-processors. This function
1064
+ -- is insufficient on its own to prepare the build for a component.
1065
+ --
1066
+ -- Consumers wanting to prepare the sources of a component, e.g. in order to
1067
+ -- launch a REPL session, are advised to run
1068
+ -- @Setup repl <compName> --repl-multi-file=<fn>@ instead.
1069
+ componentInitialBuildSteps
1070
+ :: FilePath
1071
+ -- ^ "dist" prefix
1072
+ -> PackageDescription
1073
+ -- ^ mostly information from the .cabal file
1074
+ -> LocalBuildInfo
1075
+ -- ^ Configuration information
1076
+ -> ComponentLocalBuildInfo
1077
+ -- ^ Build info about the component
1078
+ -> Verbosity
1079
+ -- ^ The verbosity to use
1080
+ -> IO ()
1081
+ componentInitialBuildSteps _distPref pkg_descr lbi clbi verbosity = do
1082
+ let compBuildDir = interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi
1083
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
1084
+ writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
1085
+ {-# DEPRECATED componentInitialBuildSteps
1086
+ "This function does not prepare all source files for a component. Suggestion: use 'Setup repl <compName> --repl-multi-file=<fn>'."
1087
+ #-}
1088
+
1032
1089
-- | Creates the autogenerated files for a particular configured component,
1033
1090
-- and runs the pre-build hook.
1034
1091
preBuildComponent
@@ -1042,7 +1099,8 @@ preBuildComponent
1042
1099
preBuildComponent preBuildHook verbosity lbi tgt = do
1043
1100
let pkg_descr = localPkgDescr lbi
1044
1101
clbi = targetCLBI tgt
1045
- createDirectoryIfMissingVerbose verbosity True (interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi)
1102
+ compBuildDir = interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi
1103
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
1046
1104
writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
1047
1105
preBuildHook lbi tgt
1048
1106
0 commit comments