Commit 095b0631 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Remove one Bool parameter to smartCopySources which was True in all uses

The remaining Bool parameter is False for all uses except in SrcDirs
parent cf6a16ed
......@@ -683,8 +683,8 @@ installLib verbosity lbi pref dynPref buildPref
pd@PackageDescription{library=Just _,
package=p}
= do let programConf = withPrograms lbi
ifVanilla $ smartCopySources verbosity [buildPref] pref (libModules pd) ["hi"] True False
ifProf $ smartCopySources verbosity [buildPref] pref (libModules pd) ["p_hi"] True False
ifVanilla $ smartCopySources verbosity [buildPref] pref (libModules pd) ["hi"] False
ifProf $ smartCopySources verbosity [buildPref] pref (libModules pd) ["p_hi"] False
let libTargetLoc = mkLibName pref (showPackageId p)
profLibTargetLoc = mkProfLibName pref (showPackageId p)
libGHCiTargetLoc = mkGHCiLibName pref (showPackageId p)
......
......@@ -352,7 +352,7 @@ install
-> IO ()
install verbosity libDir installProgDir binDir targetProgDir buildPref (progprefix,progsuffix) pkg_descr = do
try $ removeDirectoryRecursive libDir
smartCopySources verbosity [buildPref] libDir (libModules pkg_descr) hugsInstallSuffixes True False
smartCopySources verbosity [buildPref] libDir (libModules pkg_descr) hugsInstallSuffixes False
let buildProgDir = buildPref </> "programs"
when (any (buildable . buildInfo) (executables pkg_descr)) $
createDirectoryIfMissingVerbose verbosity True binDir
......@@ -362,7 +362,7 @@ install verbosity libDir installProgDir binDir targetProgDir buildPref (progpref
let targetDir = targetProgDir </> exeName exe
try $ removeDirectoryRecursive installDir
smartCopySources verbosity [theBuildDir] installDir
("Main" : autogenModuleName pkg_descr : otherModules (buildInfo exe)) hugsInstallSuffixes True False
("Main" : autogenModuleName pkg_descr : otherModules (buildInfo exe)) hugsInstallSuffixes False
let targetName = "\"" ++ (targetDir </> hugsMainFilename exe) ++ "\""
-- FIX (HUGS): use extensions, and options from file too?
-- see http://hackage.haskell.org/trac/hackage/ticket/43
......
......@@ -247,7 +247,7 @@ installLib :: Verbosity -- ^verbosity
installLib verbosity pref buildPref pkgid lib
= do let bi = libBuildInfo lib
modules = exposedModules lib ++ otherModules bi
smartCopySources verbosity [buildPref] pref modules ["hi"] True False
smartCopySources verbosity [buildPref] pref modules ["hi"] False
let name = pkgName pkgid
libTargetLoc = mkLibName pref name
copyFileVerbose verbosity (mkLibName buildPref name) libTargetLoc
......@@ -238,7 +238,7 @@ prepareDir :: Verbosity -- ^verbosity
-> IO ()
prepareDir verbosity inPref pps mods BuildInfo{hsSourceDirs=srcDirs, otherModules=mods', cSources=cfiles}
= do let suff = ppSuffixes pps ++ ["hs", "lhs"]
smartCopySources verbosity srcDirs inPref (mods++mods') suff True True
smartCopySources verbosity srcDirs inPref (mods++mods') suff True
mapM_ (copyFileTo verbosity inPref) cfiles
copyFileTo :: Verbosity -> FilePath -> FilePath -> IO ()
......
......@@ -401,25 +401,22 @@ smartCopySources :: Verbosity -- ^verbosity
-> FilePath -- ^Target directory
-> [String] -- ^Modules
-> [String] -- ^search suffixes
-> Bool -- ^Exit if no such modules
-> Bool -- ^Preserve directory structure
-> IO ()
smartCopySources verbosity srcDirs targetDir sources searchSuffixes exitIfNone preserveDirs
smartCopySources verbosity srcDirs targetDir sources searchSuffixes preserveDirs
= do allLocations <- mapM moduleToFPErr sources
let copies = [(srcDir,
if preserveDirs
then srcDir </> name
else name)
| Just (srcDir, name) <- allLocations]
| (srcDir, name) <- allLocations]
copyFiles verbosity targetDir copies
where moduleToFPErr m
= do p <- findFileWithExtension' searchSuffixes srcDirs (dotToSep m)
case p of
Nothing | exitIfNone ->
die $ "Error: Could not find module: " ++ m
++ " with any suffix: " ++ show searchSuffixes
_ -> return p
= findFileWithExtension' searchSuffixes srcDirs (dotToSep m)
>>= maybe notFound return
where notFound = die $ "Error: Could not find module: " ++ m
++ " with any suffix: " ++ show searchSuffixes
createDirectoryIfMissingVerbose :: Verbosity -> Bool -> FilePath -> IO ()
createDirectoryIfMissingVerbose verbosity parentsToo dir = do
......
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