Commit 0ddf3b4d authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Minor revision.

See #207.
parent 84782844
...@@ -61,15 +61,16 @@ packageRules = do ...@@ -61,15 +61,16 @@ packageRules = do
let readPackageDb = [(packageDb, 1)] let readPackageDb = [(packageDb, 1)]
writePackageDb = [(packageDb, maxConcurrentReaders)] writePackageDb = [(packageDb, maxConcurrentReaders)]
let contexts = liftM3 Context allStages knownPackages allWays let contexts = liftM3 Context allStages knownPackages allWays
vanillaContexts = liftM2 vanillaContext allStages knownPackages
traverse_ (compilePackage readPackageDb) contexts traverse_ (compilePackage readPackageDb) contexts
traverse_ (buildPackageDependencies readPackageDb) vanillaContexts
for_ allStages $ \stage -> for_ allStages $ \stage ->
for_ knownPackages $ \package -> do for_ knownPackages $ \package -> do
let context = vanillaContext stage package let context = vanillaContext stage package
buildPackageData context buildPackageData context
buildPackageDependencies readPackageDb context
buildPackageDocumentation context buildPackageDocumentation context
generatePackageCode context generatePackageCode context
buildPackageLibrary context buildPackageLibrary context
......
...@@ -7,7 +7,7 @@ import Expression ...@@ -7,7 +7,7 @@ import Expression
import Oracles.Dependencies import Oracles.Dependencies
import Rules.Actions import Rules.Actions
import Settings import Settings
import Target hiding (context) import Target
compilePackage :: [(Resource, Int)] -> Context -> Rules () compilePackage :: [(Resource, Int)] -> Context -> Rules ()
compilePackage rs context @ (Context {..}) = do compilePackage rs context @ (Context {..}) = do
......
...@@ -19,7 +19,7 @@ buildPackageDependencies rs context @ (Context {..}) = ...@@ -19,7 +19,7 @@ buildPackageDependencies rs context @ (Context {..}) =
dropBuild = (pkgPath package ++) . drop (length buildPath) dropBuild = (pkgPath package ++) . drop (length buildPath)
hDepFile = buildPath -/- ".hs-dependencies" hDepFile = buildPath -/- ".hs-dependencies"
in do in do
fmap (buildPath++) fmap (buildPath ++)
[ "//*.c.deps", "//*.cmm.deps", "//*.S.deps" ] |%> \out -> do [ "//*.c.deps", "//*.cmm.deps", "//*.S.deps" ] |%> \out -> do
let srcFile = if "//AutoApply.*" ?== out let srcFile = if "//AutoApply.*" ?== out
then dropExtension out then dropExtension out
...@@ -32,19 +32,18 @@ buildPackageDependencies rs context @ (Context {..}) = ...@@ -32,19 +32,18 @@ buildPackageDependencies rs context @ (Context {..}) =
need srcs need srcs
if srcs == [] if srcs == []
then writeFileChanged out "" then writeFileChanged out ""
else buildWithResources rs $ else buildWithResources rs $ Target context (GhcM stage) srcs [out]
Target context (GhcM stage) srcs [out]
removeFileIfExists $ out <.> "bak" removeFileIfExists $ out <.> "bak"
-- TODO: don't accumulate *.deps into .dependencies -- TODO: don't accumulate *.deps into .dependencies
(buildPath -/- ".dependencies") %> \out -> do buildPath -/- ".dependencies" %> \out -> do
cSrcs <- pkgDataList $ CSrcs path cSrcs <- pkgDataList $ CSrcs path
let cDepFiles = [ buildPath -/- src <.> "deps" | src <- cSrcs let cDepFiles = [ buildPath -/- src <.> "deps" | src <- cSrcs
, not ("//AutoApply.cmm" ?== src) ] , not ("//AutoApply.cmm" ?== src) ]
++ [ src <.> "deps" | src <- cSrcs, "//AutoApply.cmm" ?== src ] ++ [ src <.> "deps" | src <- cSrcs, "//AutoApply.cmm" ?== src ]
need $ hDepFile : cDepFiles -- need all for more parallelism need $ hDepFile : cDepFiles -- need all for more parallelism
cDeps <- fmap concat $ mapM readFile' cDepFiles cDeps <- fmap concat $ traverse readFile' cDepFiles
hDeps <- readFile' hDepFile hDeps <- readFile' hDepFile
let result = unlines let result = unlines
. map (\(src, deps) -> unwords $ src : deps) . map (\(src, deps) -> unwords $ src : deps)
......
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