Commit bc32262d authored by Zhen Zhang's avatar Zhen Zhang Committed by Andrey Mokhov
Browse files

Add copyFileUntracked (#313)

parent 4952e802
......@@ -39,7 +39,7 @@ configureEnvironment = do
libffiRules :: Rules ()
libffiRules = do
libffiDependencies &%> \_ -> do
(libffiLibrary : libffiDependencies) &%> \_ -> do
useSystemFfi <- flag UseSystemFfi
if useSystemFfi
then do
......@@ -57,7 +57,7 @@ libffiRules = do
ways <- interpretInContext libffiContext (getLibraryWays <> getRtsWays)
forM_ (nubOrd ways) $ \way ->
copyFile libffiLibrary =<< rtsLibffiLibrary way
copyFileUntracked libffiLibrary =<< rtsLibffiLibrary way
putSuccess $ "| Successfully built custom library 'libffi'"
......
......@@ -3,7 +3,7 @@ module Util (
removeFile, copyDirectory, copyDirectoryContents, createDirectory,
moveDirectory, removeDirectory, applyPatch, runBuilder, runBuilderWith,
makeExecutable, renderProgram, renderLibrary, Match(..), builderEnvironment,
needBuilder
needBuilder, copyFileUntracked
) where
import qualified System.Directory.Extra as IO
......@@ -94,10 +94,18 @@ copyFile :: FilePath -> FilePath -> Action ()
copyFile source target = do
need [source] -- Guarantee source is built before printing progress info.
let dir = takeDirectory target
unlessM (liftIO $ IO.doesDirectoryExist dir) $ createDirectory dir
liftIO $ IO.createDirectoryIfMissing True dir
putProgressInfo $ renderAction "Copy file" source target
copyFileChanged source target
-- Same as copyFile, but not tracking the source as a build dependency
copyFileUntracked :: FilePath -> FilePath -> Action ()
copyFileUntracked source target = do
let dir = takeDirectory target
liftIO $ IO.createDirectoryIfMissing True dir
putProgressInfo $ renderAction "Copy file (Untracked)" source target
liftIO $ IO.copyFile source target
-- | Move a file; we cannot track the source, because it is moved.
moveFile :: FilePath -> FilePath -> Action ()
moveFile source target = 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