From 3fdfcf2a507667327fc6b0e1c95cc9898fc1f9b6 Mon Sep 17 00:00:00 2001 From: David Waern Date: Thu, 18 Oct 2007 22:03:20 +0000 Subject: Add support for --read-interface again --- src/Main.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index c900529c..8ddea3e9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -105,14 +105,18 @@ main = handleTopExceptions $ do libDir <- handleEasyFlags flags fileArgs -- initialize GHC - let ghcFlags = makeGhcFlags flags + let ghcFlags = getGhcFlags flags (session, dynflags) <- startGhc libDir ghcFlags -- get the -use-package packages, load them in GHC, -- and try to get the corresponding installed HaddockPackages let usePackages = [ pkg | Flag_UsePackage pkg <- flags ] pkgInfos <- loadPackages session usePackages - packages <- getHaddockPackages pkgInfos + packages'' <- getHaddockPackages pkgInfos + + -- get packages via --read-interface + packages' <- getHaddockPackages' (getIfacePairs flags) + let packages = packages'' ++ packages' -- typecheck argument modules using GHC modules <- typecheckFiles session fileArgs @@ -129,7 +133,7 @@ main = handleTopExceptions $ do render flags interfaces -- last but not least, dump the interface file! - dumpInterfaceFile homeLinks flags + dumpInterfaceFile (map ghcModule modules) homeLinks flags ------------------------------------------------------------------------------- @@ -217,14 +221,15 @@ render flags interfaces = do ------------------------------------------------------------------------------- -dumpInterfaceFile :: LinkEnv -> [Flag] -> IO () -dumpInterfaceFile homeLinks flags = +dumpInterfaceFile :: [Module] -> LinkEnv -> [Flag] -> IO () +dumpInterfaceFile modules homeLinks flags = case [str | Flag_DumpInterface str <- flags] of [] -> return () fs -> let filename = last fs in writeInterfaceFile filename ifaceFile where ifaceFile = InterfaceFile { - ifLinkEnv = homeLinks + ifModules = modules, + ifLinkEnv = homeLinks } -- cgit v1.2.3