Commit 6243ac23 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

delete removePreprocessed function, it's unused except for cleaning jhc files

and jhc should just be putting its generated files under dist/ anyway.
The latter issue is filed as bug #219.
parent b3acdd75
......@@ -74,7 +74,6 @@ import Distribution.Simple.Program
( ProgramConfiguration, defaultProgramConfiguration, addKnownProgram
, userSpecifyArgs, pfesetupProgram, rawSystemProgramConf )
import Distribution.Simple.PreProcess (knownSuffixHandlers,
removePreprocessedPackage,
preprocessSources, PPSuffixHandler)
import Distribution.Simple.Setup
import Distribution.Simple.Command
......@@ -384,23 +383,10 @@ clean pkg_descr maybeLbi flags = do
-- Any extra files the user wants to remove
mapM_ removeFileOrDirectory (extraTmpFiles pkg_descr)
-- FIXME: put all JHC's generated files under dist/ so they get cleaned
case maybeLbi of
Nothing -> return ()
Just lbi -> do
case compilerFlavor (compiler lbi) of
JHC -> cleanJHCExtras lbi
_ -> return ()
-- If the user wanted to save the config, write it back
maybe (return ()) writePersistBuildConfig maybeConfig
where
-- JHC FIXME remove exe-sources
cleanJHCExtras lbi = do
chattyTry "removing jhc-pkg.conf" $
removeFile (buildDir lbi </> "jhc-pkg.conf")
removePreprocessedPackage pkg_descr currentDir ["ho"]
removeFileOrDirectory :: FilePath -> IO ()
removeFileOrDirectory fname = do
isDir <- doesDirectoryExist fname
......
......@@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.PreProcess (preprocessSources, knownSuffixHandlers,
ppSuffixes, PPSuffixHandler, PreProcessor(..),
mkSimplePreProcessor, runSimplePreProcessor,
removePreprocessed, removePreprocessedPackage,
ppCpp, ppCpp', ppGreenCard, ppC2hs, ppHsc2hs,
ppHappy, ppAlex, ppUnlit
)
......@@ -248,33 +247,6 @@ preprocessModule searchLoc buildLoc forSDist modu verbosity builtinSuffixes hand
tailNotNull [] = []
tailNotNull x = tail x
removePreprocessedPackage :: PackageDescription
-> FilePath -- ^root of source tree (where to look for hsSources)
-> [String] -- ^suffixes
-> IO ()
removePreprocessedPackage pkg_descr r suff
= do withLib pkg_descr () (\lib -> do
let bi = libBuildInfo lib
removePreprocessed (map (r </>) (hsSourceDirs bi)) (libModules pkg_descr) suff)
withExe pkg_descr (\theExe -> do
let bi = buildInfo theExe
removePreprocessed (map (r </>) (hsSourceDirs bi)) (otherModules bi) suff)
-- |Remove the preprocessed .hs files. (do we need to get some .lhs files too?)
removePreprocessed :: [FilePath] -- ^search Location
-> [String] -- ^Modules
-> [String] -- ^suffixes
-> IO ()
removePreprocessed searchLocs mods suffixesIn
= mapM_ removePreprocessedModule mods
where removePreprocessedModule m = do
-- collect related files
fs <- moduleToFilePath searchLocs m otherSuffixes
-- does M.hs also exist?
hs <- moduleToFilePath searchLocs m ["hs"]
unless (null fs) (mapM_ removeFile hs)
otherSuffixes = filter (/= "hs") suffixesIn
-- ------------------------------------------------------------
-- * known preprocessors
-- ------------------------------------------------------------
......
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