Commit 9d8c49e0 authored by ijones's avatar ijones
Browse files

cleaned up use of knownSuffixHandlers

parent 3605e9bd
......@@ -77,7 +77,7 @@ preprocessSources :: PackageDescription
preprocessSources pkg_descr _ handlers =
do
setupMessage "Preprocessing" pkg_descr
allSources <- findAllSourceFiles pkg_descr (ppSuffixes knownSuffixHandlers)
allSources <- findAllSourceFiles pkg_descr (ppSuffixes handlers)
sequence [dispatchPP src handlers | src <- allSources] -- FIX: output errors?
return ()
......
......@@ -121,7 +121,7 @@ defaultMainNoRead pkg_descr
(_, args) <- parseBuildArgs args []
no_extra_flags args
localbuildinfo <- getPersistBuildConfig
build buildPref pkg_descr localbuildinfo
build buildPref pkg_descr localbuildinfo knownSuffixHandlers
writeInstalledConfig pkg_descr localbuildinfo
CleanCmd -> do
......
......@@ -51,7 +51,7 @@ import Distribution.Misc (extensionsToGHCFlag, extensionsToNHCFlag)
import Distribution.Setup (Compiler(..), CompilerFlavor(..))
import Distribution.Package (PackageIdentifier(..), PackageDescription(..),
BuildInfo(..), showPackageId, Executable(..))
import Distribution.PreProcess (preprocessSources, knownSuffixHandlers)
import Distribution.PreProcess (preprocessSources, PPSuffixHandler)
import Distribution.Simple.Configure (LocalBuildInfo(..), compiler, exeDeps)
import Distribution.Simple.Utils (rawSystemExit, setupMessage,
die, rawSystemPathExit,
......@@ -76,10 +76,13 @@ import HUnit (Test)
-- Build the library
build :: FilePath -- ^Build location
-> PackageDescription -> LocalBuildInfo -> IO ()
build pref pkg_descr lbi = do
-> PackageDescription
-> LocalBuildInfo
-> [ PPSuffixHandler ]
-> IO ()
build pref pkg_descr lbi suffixes = do
createIfNotExists True pref
preprocessSources pkg_descr lbi knownSuffixHandlers
preprocessSources pkg_descr lbi suffixes
setupMessage "Building" pkg_descr
case compilerFlavor (compiler lbi) of
GHC -> buildGHC pref pkg_descr lbi
......
......@@ -53,7 +53,7 @@ module Distribution.Simple.SrcDist (
import Distribution.Package(PackageDescription(..), BuildInfo(..), showPackageId)
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Simple.Utils(setupMessage, moveSources, die, pathJoin)
import Distribution.PreProcess (PPSuffixHandler, ppSuffixes, knownSuffixHandlers, removePreprocessed)
import Distribution.PreProcess (PPSuffixHandler, ppSuffixes, removePreprocessed)
import Control.Monad(when)
import System.Cmd (system)
......@@ -68,7 +68,8 @@ import HUnit (Test)
sdist :: FilePath -- ^build prefix (temp dir)
-> FilePath -- ^TargetPrefix
-> [PPSuffixHandler] -- ^ extra preprocessors (includes suffixes)
-> PackageDescription -> LocalBuildInfo -> IO ()
-> PackageDescription
-> LocalBuildInfo -> IO ()
sdist tmpDir targetPref pps pkg_descr _ = do
setupMessage "Building source dist for" pkg_descr
ex <- doesDirectoryExist tmpDir
......@@ -76,10 +77,8 @@ sdist tmpDir targetPref pps pkg_descr _ = do
case library pkg_descr of
Just lib -> let srcDir = hsSourceDir lib
tmpLoc1 = pathJoin [tmpDir, nameVersion pkg_descr, srcDir]
in do moveSources srcDir tmpLoc1 (modules lib)
(ppSuffixes (knownSuffixHandlers ++ pps))
in do moveSources srcDir tmpLoc1 (modules lib) (ppSuffixes pps)
removePreprocessed tmpLoc1 (modules lib) (ppSuffixes pps)
Nothing -> return ()
-- FIX: move executables!
-- removePreprocessed tmpLoc1 (allModules pkg_descr) (ppSuffixes pps) (for execs)
......
** make sure we have consistent behavior, either we pass in the
knownPreprocessors or we require the user to pass them in...
** bug in srcDist where it doesn't move exe sources into place
** change all concat $ map to concatMap and sequence $ map to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment