Commit 8586ab84 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Merge branch 'master' of https://github.com/snowleopard/hadrian

parents 4b6707a6 942ed27a
{-# LANGUAGE TypeFamilies #-}
module Hadrian.Oracles.DirectoryContents (
directoryContents, copyDirectoryContents, directoryContentsOracle,
directoryContents, copyDirectoryContents, directoryContentsOracle, copyDirectoryContentsUntracked,
Match (..), matches, matchAll
) where
......@@ -45,6 +45,14 @@ copyDirectoryContents expr source target = do
let cp file = copyFile file $ target -/- makeRelative source file
mapM_ cp =<< directoryContents expr source
-- | Copy the contents of the source directory that matches a given 'Match'
-- expression into the target directory. The copied contents is untracked.
copyDirectoryContentsUntracked :: Match -> FilePath -> FilePath -> Action ()
copyDirectoryContentsUntracked expr source target = do
putProgressInfo =<< renderAction "Copy directory contents (untracked)" source target
let cp file = copyFileUntracked file $ target -/- makeRelative source file
mapM_ cp =<< directoryContents expr source
newtype DirectoryContents = DirectoryContents (Match, FilePath)
deriving (Binary, Eq, Hashable, NFData, Show, Typeable)
type instance RuleResult DirectoryContents = [FilePath]
......
......@@ -186,7 +186,9 @@ installPackages = do
withLatestBuildStage pkg $ \stage -> do
let context = vanillaContext stage pkg
top <- topDirectory
installDistDir <- (top -/-) <$> buildPath context
installDistDir <- buildPath context
let absInstallDistDir = top -/- installDistDir
need =<< packageTargets stage pkg
docDir <- installDocDir
ghclibDir <- installGhcLibDir
......@@ -203,7 +205,7 @@ installPackages = do
need [cabalFile, pkgConf] -- TODO: check if need pkgConf
-- HACK (#318): copy stuff back to the place favored by ghc-cabal
quietly $ copyDirectoryContents (Not excluded)
quietly $ copyDirectoryContentsUntracked (Not excluded)
installDistDir (installDistDir -/- "build")
whenM (isSpecified HsColour) $
......@@ -212,7 +214,7 @@ installPackages = do
pref <- setting InstallPrefix
unit $ cmd ghcCabalInplace [ "copy"
, pkgPath pkg
, installDistDir
, absInstallDistDir
, strip
, destDir
, pref
......
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