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

Rename autogenModulesDir to autogenComponentModulesDir, in prep for BC fix.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent a300cb2b
......@@ -576,11 +576,11 @@ writeAutogenFiles :: Verbosity
-> ComponentLocalBuildInfo
-> IO ()
writeAutogenFiles verbosity pkg lbi clbi = do
createDirectoryIfMissingVerbose verbosity True (autogenModulesDir lbi clbi)
createDirectoryIfMissingVerbose verbosity True (autogenComponentModulesDir lbi clbi)
let pathsModulePath = autogenModulesDir lbi clbi
let pathsModulePath = autogenComponentModulesDir lbi clbi
</> ModuleName.toFilePath (autogenModuleName pkg) <.> "hs"
rewriteFile pathsModulePath (Build.PathsModule.generate pkg lbi clbi)
let cppHeaderPath = autogenModulesDir lbi clbi </> cppHeaderName
let cppHeaderPath = autogenComponentModulesDir lbi clbi </> cppHeaderName
rewriteFile cppHeaderPath (Build.Macros.generate pkg lbi clbi)
......@@ -14,7 +14,7 @@
module Distribution.Simple.BuildPaths (
defaultDistPref, srcPref,
haddockDirName, hscolourPref, haddockPref,
autogenModulesDir,
autogenComponentModulesDir,
autogenModuleName,
cppHeaderName,
......@@ -63,8 +63,8 @@ haddockPref haddockTarget distPref pkg_descr
= distPref </> "doc" </> "html" </> haddockDirName haddockTarget pkg_descr
-- |The directory in which we put auto-generated modules
autogenModulesDir :: LocalBuildInfo -> ComponentLocalBuildInfo -> String
autogenModulesDir lbi clbi = componentBuildDir lbi clbi </> "autogen"
autogenComponentModulesDir :: LocalBuildInfo -> ComponentLocalBuildInfo -> String
autogenComponentModulesDir lbi clbi = componentBuildDir lbi clbi </> "autogen"
-- NB: Look at 'checkForeignDeps' for where a simplified version of this
-- has been copy-pasted.
......
......@@ -249,7 +249,7 @@ componentCcGhcOptions _verbosity _implInfo lbi bi clbi odir filename =
ghcOptMode = toFlag GhcModeCompile,
ghcOptInputFiles = toNubListR [filename],
ghcOptCppIncludePath = toNubListR $ [autogenModulesDir lbi clbi, odir]
ghcOptCppIncludePath = toNubListR $ [autogenComponentModulesDir lbi clbi, odir]
++ PD.includeDirs bi,
ghcOptPackageDBs = withPackageDB lbi,
ghcOptPackages = toNubListR $ mkGhcOptPackages clbi,
......@@ -284,12 +284,12 @@ componentGhcOptions _verbosity lbi bi clbi odir =
ghcOptSplitObjs = toFlag (splitObjs lbi),
ghcOptSourcePathClear = toFlag True,
ghcOptSourcePath = toNubListR $ [odir] ++ (hsSourceDirs bi)
++ [autogenModulesDir lbi clbi],
ghcOptCppIncludePath = toNubListR $ [autogenModulesDir lbi clbi, odir]
++ [autogenComponentModulesDir lbi clbi],
ghcOptCppIncludePath = toNubListR $ [autogenComponentModulesDir lbi clbi, odir]
++ PD.includeDirs bi,
ghcOptCppOptions = toNubListR $ cppOptions bi,
ghcOptCppIncludes = toNubListR $
[autogenModulesDir lbi clbi </> cppHeaderName],
[autogenComponentModulesDir lbi clbi </> cppHeaderName],
ghcOptFfiIncludes = toNubListR $ PD.includes bi,
ghcOptObjDir = toFlag odir,
ghcOptHiDir = toFlag odir,
......
......@@ -730,7 +730,7 @@ getLibSourceFiles lbi lib clbi = getSourceFiles searchpaths modules
where
bi = libBuildInfo lib
modules = PD.exposedModules lib ++ otherModules bi
searchpaths = autogenModulesDir lbi clbi : buildDir lbi : hsSourceDirs bi
searchpaths = autogenComponentModulesDir lbi clbi : buildDir lbi : hsSourceDirs bi
getExeSourceFiles :: LocalBuildInfo
-> Executable
......@@ -743,7 +743,7 @@ getExeSourceFiles lbi exe clbi = do
where
bi = buildInfo exe
modules = otherModules bi
searchpaths = autogenModulesDir lbi clbi : exeBuildDir lbi exe : hsSourceDirs bi
searchpaths = autogenComponentModulesDir lbi clbi : exeBuildDir lbi exe : hsSourceDirs bi
getSourceFiles :: [FilePath]
-> [ModuleName.ModuleName]
......
......@@ -165,7 +165,7 @@ buildLib verbosity pkg_descr lbi lib clbi = do
runDbProgram verbosity haskellSuiteProgram conf $
[ "compile", "--build-dir", odir ] ++
concat [ ["-i", d] | d <- srcDirs ] ++
concat [ ["-I", d] | d <- [autogenModulesDir lbi clbi, odir] ++ includeDirs bi ] ++
concat [ ["-I", d] | d <- [autogenComponentModulesDir lbi clbi, odir] ++ includeDirs bi ] ++
[ packageDbOpt pkgDb | pkgDb <- dbStack ] ++
[ "--package-name", display pkgid ] ++
concat [ ["--package-id", display ipkgid ]
......
......@@ -143,7 +143,7 @@ constructJHCCmdLine lbi bi clbi _odir verbosity =
++ extensionsToFlags (compiler lbi) (usedExtensions bi)
++ ["--noauto","-i-"]
++ concat [["-i", l] | l <- nub (hsSourceDirs bi)]
++ ["-i", autogenModulesDir lbi clbi]
++ ["-i", autogenComponentModulesDir lbi clbi]
++ ["-optc" ++ opt | opt <- PD.ccOptions bi]
-- It would be better if JHC would accept package names with versions,
-- but JHC-0.7.2 doesn't accept this.
......
......@@ -578,12 +578,12 @@ ghcOptions lbi bi clbi odir
++ ["-i"]
++ ["-i" ++ odir]
++ ["-i" ++ l | l <- nub (hsSourceDirs bi)]
++ ["-i" ++ autogenModulesDir lbi clbi]
++ ["-I" ++ autogenModulesDir lbi clbi]
++ ["-i" ++ autogenComponentModulesDir lbi clbi]
++ ["-I" ++ autogenComponentModulesDir lbi clbi]
++ ["-I" ++ odir]
++ ["-I" ++ dir | dir <- PD.includeDirs bi]
++ ["-optP" ++ opt | opt <- cppOptions bi]
++ [ "-optP-include", "-optP"++ (autogenModulesDir lbi clbi </> cppHeaderName) ]
++ [ "-optP-include", "-optP"++ (autogenComponentModulesDir lbi clbi </> cppHeaderName) ]
++ [ "-#include \"" ++ inc ++ "\"" | inc <- PD.includes bi ]
++ [ "-odir", odir, "-hidir", odir ]
++ (if compilerVersion c >= Version [6,8] []
......
......@@ -146,13 +146,13 @@ preprocessComponent :: PackageDescription
-> IO ()
preprocessComponent pd comp lbi clbi isSrcDist verbosity handlers = case comp of
(CLib lib@Library{ libBuildInfo = bi }) -> do
let dirs = hsSourceDirs bi ++ [autogenModulesDir lbi clbi]
let dirs = hsSourceDirs bi ++ [autogenComponentModulesDir lbi clbi]
setupMessage verbosity "Preprocessing library" (packageId pd)
forM_ (map ModuleName.toFilePath $ libModules lib) $
pre dirs (buildDir lbi) (localHandlers bi)
(CExe exe@Executable { buildInfo = bi, exeName = nm }) -> do
let exeDir = buildDir lbi </> nm </> nm ++ "-tmp"
dirs = hsSourceDirs bi ++ [autogenModulesDir lbi clbi]
dirs = hsSourceDirs bi ++ [autogenComponentModulesDir lbi clbi]
setupMessage verbosity ("Preprocessing executable '" ++ nm ++ "' for") (packageId pd)
forM_ (map ModuleName.toFilePath $ otherModules bi) $
pre dirs exeDir (localHandlers bi)
......@@ -192,7 +192,7 @@ preprocessComponent pd comp lbi clbi isSrcDist verbosity handlers = case comp of
(benchmarkModules bm)
preProcessComponent bi modules exePath dir = do
let biHandlers = localHandlers bi
sourceDirs = hsSourceDirs bi ++ [ autogenModulesDir lbi clbi ]
sourceDirs = hsSourceDirs bi ++ [ autogenComponentModulesDir lbi clbi ]
sequence_ [ preprocessFile sourceDirs dir isSrcDist
(ModuleName.toFilePath modu) verbosity builtinSuffixes
biHandlers
......@@ -343,7 +343,7 @@ ppGhcCpp program xHs extraArgs _bi lbi clbi =
-- double-unlitted. In the future we might switch to
-- using cpphs --unlit instead.
++ (if xHs version then ["-x", "hs"] else [])
++ [ "-optP-include", "-optP"++ (autogenModulesDir lbi clbi </> cppHeaderName) ]
++ [ "-optP-include", "-optP"++ (autogenComponentModulesDir lbi clbi </> cppHeaderName) ]
++ ["-o", outFile, inFile]
++ extraArgs
}
......@@ -359,7 +359,7 @@ ppCpphs extraArgs _bi lbi clbi =
("-O" ++ outFile) : inFile
: "--noline" : "--strip"
: (if cpphsVersion >= Version [1,6] []
then ["--include="++ (autogenModulesDir lbi clbi </> cppHeaderName)]
then ["--include="++ (autogenComponentModulesDir lbi clbi </> cppHeaderName)]
else [])
++ extraArgs
}
......@@ -402,8 +402,8 @@ ppHsc2hs bi lbi clbi =
++ [ "--cflag=" ++ opt | opt <- PD.ccOptions bi
++ PD.cppOptions bi ]
++ [ "--cflag=" ++ opt | opt <-
[ "-I" ++ autogenModulesDir lbi clbi,
"-include", autogenModulesDir lbi clbi </> cppHeaderName ] ]
[ "-I" ++ autogenComponentModulesDir lbi clbi,
"-include", autogenComponentModulesDir lbi clbi </> cppHeaderName ] ]
++ [ "--lflag=-L" ++ opt | opt <- PD.extraLibDirs bi ]
++ [ "--lflag=-Wl,-R," ++ opt | isELF
, opt <- PD.extraLibDirs bi ]
......@@ -467,7 +467,7 @@ ppC2hs bi lbi clbi =
-- Options from the current package:
[ "--cpp=" ++ programPath gccProg, "--cppopts=-E" ]
++ [ "--cppopts=" ++ opt | opt <- getCppOptions bi lbi ]
++ [ "--cppopts=-include" ++ (autogenModulesDir lbi clbi </> cppHeaderName) ]
++ [ "--cppopts=-include" ++ (autogenComponentModulesDir lbi clbi </> cppHeaderName) ]
++ [ "--include=" ++ outBaseDir ]
-- Options from dependent packages
......
......@@ -223,7 +223,7 @@ constructUHCCmdLine user system lbi bi clbi odir verbosity =
-- search paths
++ ["-i" ++ odir]
++ ["-i" ++ l | l <- nub (hsSourceDirs bi)]
++ ["-i" ++ autogenModulesDir lbi clbi]
++ ["-i" ++ autogenComponentModulesDir lbi clbi]
-- cpp options
++ ["--optP=" ++ opt | opt <- cppOptions bi]
-- output path
......
......@@ -19,7 +19,8 @@
only the macros for the library, and is not generated if a
package has no library; to find the macros for an executable
named 'foobar', look in 'dist/build/foobar/autogen/cabal_macros.h'.
Similarly, 'autogenModulesDir' now requires a
Similarly, if you used 'autogenModulesDir' you should now
use 'autogenComponentModulesDir', which now requires a
'ComponentLocalBuildInfo' argument as well in order to
disambiguate which component the autogenerated files are for.
* Backwards incompatible change to 'Component': 'TestSuite' and
......
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