Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
Copy generated files to old build directories.
Browse files Browse the repository at this point in the history
See #98.
  • Loading branch information
snowleopard committed Feb 7, 2016
1 parent 7f2c6a1 commit 90c59d1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Rules/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Rules.Generate (
includesDependencies, derivedConstantsPath, generatedDependencies
) where

import qualified System.Directory as IO

import Base
import Expression
import GHC
Expand Down Expand Up @@ -144,19 +146,32 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
, "*.hs-incl" ] |%> \file -> do
need [primopsTxt stage]
build $ fullTarget target GenPrimopCode [primopsTxt stage] [file]
-- TODO: this is temporary hack, get rid of this (#113)
let oldPath = pkgPath pkg -/- targetDirectory stage pkg -/- "build"
newFile = oldPath ++ (drop (length buildPath) file)
createDirectory $ takeDirectory newFile
liftIO $ IO.copyFile file newFile
putSuccess $ "| Duplicate file " ++ file ++ " -> " ++ newFile

when (pkg == rts) $ buildPath -/- "AutoApply.cmm" %> \file -> do
build $ fullTarget target GenApply [] [file]

priority 2.0 $ do
-- TODO: this is temporary hack, get rid of this (#113)
let oldPath = pkgPath pkg -/- targetDirectory stage pkg -/- "build"
olden f = oldPath ++ (drop (length buildPath) f)

when (pkg == compiler) $ buildPath -/- "Config.hs" %> \file -> do
file <~ generateConfigHs
olden file <~ generateConfigHs -- TODO: get rid of this (#113)

when (pkg == compiler) $ platformH stage %> \file -> do
file <~ generateGhcBootPlatformH
olden file <~ generateGhcBootPlatformH -- TODO: get rid of this (#113)

when (pkg == ghcPkg) $ buildPath -/- "Version.hs" %> \file -> do
file <~ generateVersionHs
olden file <~ generateVersionHs -- TODO: get rid of this (#113)

when (pkg == runGhc) $ buildPath -/- "Main.hs" %> \file -> do
copyFileChanged (pkgPath pkg -/- "runghc.hs") file
Expand Down

0 comments on commit 90c59d1

Please sign in to comment.