Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New option in Params to prevent name shadowing.

By default Dyre included current directory in the list of include dirs.
It causes a problem when running configurable program in its own project
directory (particularly natural for an editor.)

This patch adds an option includeCurrentDirectory that stops it from
happening, if set to False. Behaviour is unchanged by default.
  • Loading branch information...
commit 4fcc1ba60b2c93f17db169d8842cb0d90d8ff4dc 1 parent 1d71735
Michal J. Gajda authored
View
1  Config/Dyre.hs
@@ -127,6 +127,7 @@ defaultParams = Params
, forceRecomp = True
, statusOut = hPutStrLn stderr
, rtsOptsHandling = RTSAppend []
+ , includeCurrentDirectory = True
}
-- | 'wrapMain' is how Dyre recieves control of the program. It is expected
View
8 Config/Dyre/Compile.hs
@@ -59,13 +59,17 @@ customCompile params@Params{statusOut = output} = do
-- | Assemble the arguments to GHC so everything compiles right.
makeFlags :: Params cfgType -> FilePath -> FilePath -> FilePath
-> FilePath -> IO [String]
-makeFlags Params{ghcOpts = flags, hidePackages = hides, forceRecomp = force}
+makeFlags Params{ghcOpts = flags, hidePackages = hides, forceRecomp = force, includeCurrentDirectory = includeCurDir}
cfgFile tmpFile cacheDir libsDir = do
currentDir <- getCurrentDirectory
- return . concat $ [ ["-v0", "-i" ++ currentDir, "-i" ++ libsDir]
+ return . concat $ [ ["-v0", "-i" ++ libsDir]
+ , if includeCurDir
+ then ["-i" ++ currentDir]
+ else []
, ["-outputdir", cacheDir]
, prefix "-hide-package" hides, flags
, ["--make", cfgFile, "-o", tmpFile]
, ["-fforce-recomp" | force] -- Only if force is true
]
where prefix y = concatMap $ \x -> [y,x]
+
View
3  Config/Dyre/Params.hs
@@ -46,6 +46,9 @@ data Params cfgType = Params
, rtsOptsHandling :: RTSOptionHandling
-- ^ Whether to append, or replace GHC runtime system options
-- with others.
+ , includeCurrentDirectory :: Bool
+ -- ^ Whether to add current directory to include list (set False to
+ -- prevent name shadowing within project directory.) --
}
data RTSOptionHandling = RTSReplace [String] -- replaces RTS options with given list
Please sign in to comment.
Something went wrong with that request. Please try again.