@@ -34,6 +34,10 @@ module Distribution.Simple.Build
34
34
, writeBuiltinAutogenFiles
35
35
, writeAutogenFiles
36
36
37
+ -- ** Legacy functions
38
+ , componentInitialBuildSteps
39
+ , initialBuildSteps
40
+
37
41
-- * Internal package database creation
38
42
, createInternalPackageDB
39
43
) where
@@ -928,6 +932,61 @@ replFLib flags pkg_descr lbi exe clbi =
928
932
GHC -> GHC. replFLib flags NoFlag pkg_descr lbi exe clbi
929
933
_ -> dieWithException verbosity REPLNotSupported
930
934
935
+ -- | Runs 'componentInitialBuildSteps' on every configured component.
936
+ --
937
+ -- Legacy function: does not run pre-build hooks or pre-processors. This function
938
+ -- is insufficient on its own to prepare the build for a package.
939
+ --
940
+ -- Consumers wanting to prepare the sources of a package, e.g. in order to
941
+ -- launch a REPL session, are advised to run @Setup repl --repl-multi-file=<fn>@
942
+ -- instead.
943
+ initialBuildSteps
944
+ :: FilePath
945
+ -- ^ "dist" prefix
946
+ -> PackageDescription
947
+ -- ^ mostly information from the .cabal file
948
+ -> LocalBuildInfo
949
+ -- ^ Configuration information
950
+ -> Verbosity
951
+ -- ^ The verbosity to use
952
+ -> IO ()
953
+ initialBuildSteps distPref pkg_descr lbi verbosity =
954
+ withAllComponentsInBuildOrder pkg_descr lbi $ \ _comp clbi ->
955
+ componentInitialBuildSteps distPref pkg_descr lbi clbi verbosity
956
+ {-# DEPRECATED
957
+ initialBuildSteps
958
+ "This function does not prepare all source files for a package. Suggestion: use 'Setup repl --repl-multi-file=<fn>'."
959
+ #-}
960
+
961
+ -- | Creates the autogenerated files for a particular configured component.
962
+ --
963
+ -- Legacy function: does not run pre-build hooks or pre-processors. This function
964
+ -- is insufficient on its own to prepare the build for a component.
965
+ --
966
+ -- Consumers wanting to prepare the sources of a component, e.g. in order to
967
+ -- launch a REPL session, are advised to run
968
+ -- @Setup repl <compName> --repl-multi-file=<fn>@ instead.
969
+ componentInitialBuildSteps
970
+ :: FilePath
971
+ -- ^ "dist" prefix
972
+ -> PackageDescription
973
+ -- ^ mostly information from the .cabal file
974
+ -> LocalBuildInfo
975
+ -- ^ Configuration information
976
+ -> ComponentLocalBuildInfo
977
+ -- ^ Build info about the component
978
+ -> Verbosity
979
+ -- ^ The verbosity to use
980
+ -> IO ()
981
+ componentInitialBuildSteps _distPref pkg_descr lbi clbi verbosity = do
982
+ let compBuildDir = componentBuildDir lbi clbi
983
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
984
+ writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
985
+ {-# DEPRECATED
986
+ componentInitialBuildSteps
987
+ "This function does not prepare all source files for a component. Suggestion: use 'Setup repl <compName> --repl-multi-file=<fn>'."
988
+ #-}
989
+
931
990
-- | Pre-build steps for a component: creates the autogenerated files
932
991
-- for a particular configured component.
933
992
preBuildComponent
@@ -939,7 +998,8 @@ preBuildComponent
939
998
preBuildComponent verbosity lbi tgt = do
940
999
let pkg_descr = localPkgDescr lbi
941
1000
clbi = targetCLBI tgt
942
- createDirectoryIfMissingVerbose verbosity True (componentBuildDir lbi clbi)
1001
+ compBuildDir = componentBuildDir lbi clbi
1002
+ createDirectoryIfMissingVerbose verbosity True compBuildDir
943
1003
writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
944
1004
945
1005
-- | Generate and write to disk all built-in autogenerated files
0 commit comments