Commit 58c9693a authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Eliminate now-redundant Bool flag on smartCopySources

and simplfy the implementation to be a simple composition of
findFileWithExtension' and copyFiles with some additonal error checking.
parent 2edfa269
......@@ -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"] False
ifProf $ smartCopySources verbosity [buildPref] pref (libModules pd) ["p_hi"] False
ifVanilla $ smartCopySources verbosity [buildPref] pref (libModules pd) ["hi"]
ifProf $ smartCopySources verbosity [buildPref] pref (libModules pd) ["p_hi"]
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 False
smartCopySources verbosity [buildPref] libDir (libModules pkg_descr) hugsInstallSuffixes
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 False
("Main" : autogenModuleName pkg_descr : otherModules (buildInfo exe)) hugsInstallSuffixes
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"] False
smartCopySources verbosity [buildPref] pref modules ["hi"]
let name = pkgName pkgid
libTargetLoc = mkLibName pref name
copyFileVerbose verbosity (mkLibName buildPref name) libTargetLoc
......@@ -401,16 +401,9 @@ smartCopySources :: Verbosity -- ^verbosity
-> FilePath -- ^Target directory
-> [String] -- ^Modules
-> [String] -- ^search suffixes
-> Bool -- ^Preserve directory structure
-> IO ()
smartCopySources verbosity srcDirs targetDir sources searchSuffixes preserveDirs
= do allLocations <- mapM moduleToFPErr sources
let copies = [(srcDir,
if preserveDirs
then srcDir </> name
else name)
| (srcDir, name) <- allLocations]
copyFiles verbosity targetDir copies
smartCopySources verbosity srcDirs targetDir sources searchSuffixes
= mapM moduleToFPErr sources >>= copyFiles verbosity targetDir
where moduleToFPErr m
= findFileWithExtension' searchSuffixes srcDirs (dotToSep m)
......
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