Commit beff9e87 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Pre-build, make empty .hsig files for each requirement of the library

Part of the GHC/Cabal contract is that we always have a source file
for everything GHC works on.
parent 5173c9e4
......@@ -70,7 +70,7 @@ import Distribution.Compat.Graph (IsNode(..))
import qualified Data.Set as Set
import Data.List ( intersect )
import System.FilePath ( (</>), (<.>) )
import System.FilePath ( (</>), (<.>), takeDirectory )
import System.Directory ( getCurrentDirectory )
-- -----------------------------------------------------------------------------
......@@ -587,5 +587,16 @@ writeAutogenFiles verbosity pkg lbi clbi = do
</> ModuleName.toFilePath (autogenPathsModuleName pkg) <.> "hs"
rewriteFile pathsModulePath (Build.PathsModule.generate pkg lbi clbi)
--TODO: document what we're doing here, and move it to its own function
case clbi of
LibComponentLocalBuildInfo { componentInstantiatedWith = insts } ->
-- Harmless enough to do things even when they exist
for_ (map fst insts) $ \mod_name -> do
let sigPath = autogenComponentModulesDir lbi clbi
</> ModuleName.toFilePath mod_name <.> "hsig"
createDirectoryIfMissingVerbose verbosity True (takeDirectory sigPath)
rewriteFile sigPath $ "signature " ++ display mod_name ++ " where"
_ -> return ()
let cppHeaderPath = autogenComponentModulesDir lbi clbi </> cppHeaderName
rewriteFile cppHeaderPath (Build.Macros.generate pkg lbi clbi)
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