@@ -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,61 @@ 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
1058
+ initialBuildSteps
1059
+ "This function does not prepare all source files for a package. Suggestion: use 'Setup repl --repl-multi-file=<fn>'."
1060
+ #-}
1061
+
1062
+ -- | Creates the autogenerated files for a particular configured component.
1063
+ --
1064
+ -- Legacy function: does not run pre-build hooks or pre-processors. This function
1065
+ -- is insufficient on its own to prepare the build for a component.
1066
+ --
1067
+ -- Consumers wanting to prepare the sources of a component, e.g. in order to
1068
+ -- launch a REPL session, are advised to run
1069
+ -- @Setup repl <compName> --repl-multi-file=<fn>@ instead.
1070
+ componentInitialBuildSteps
1071
+ :: FilePath
1072
+ -- ^ "dist" prefix
1073
+ -> PackageDescription
1074
+ -- ^ mostly information from the .cabal file
1075
+ -> LocalBuildInfo
1076
+ -- ^ Configuration information
1077
+ -> ComponentLocalBuildInfo
1078
+ -- ^ Build info about the component
1079
+ -> Verbosity
1080
+ -- ^ The verbosity to use
1081
+ -> IO ()
1082
+ componentInitialBuildSteps _distPref pkg_descr lbi clbi verbosity = do
1083
+ let compBuildDir = interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi
1084
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
1085
+ writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
1086
+ {-# DEPRECATED
1087
+ componentInitialBuildSteps
1088
+ "This function does not prepare all source files for a component. Suggestion: use 'Setup repl <compName> --repl-multi-file=<fn>'."
1089
+ #-}
1090
+
1032
1091
-- | Creates the autogenerated files for a particular configured component,
1033
1092
-- and runs the pre-build hook.
1034
1093
preBuildComponent
@@ -1042,7 +1101,8 @@ preBuildComponent
1042
1101
preBuildComponent preBuildHook verbosity lbi tgt = do
1043
1102
let pkg_descr = localPkgDescr lbi
1044
1103
clbi = targetCLBI tgt
1045
- createDirectoryIfMissingVerbose verbosity True (interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi)
1104
+ compBuildDir = interpretSymbolicPathLBI lbi $ componentBuildDir lbi clbi
1105
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
1046
1106
writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
1047
1107
preBuildHook lbi tgt
1048
1108
0 commit comments