on master help sign in
Fix preprocessor integration
commit6421867ea2df0dc0d89612eb28ab25f262d7efc2 authorleon.smith@obsidian.systems <leon.smith@obsidian.systems> dateThu 30 Jan 2020, 22:38 (7 years ago) parent80f019c
2 files changed+6−4
lib/command/src/Obelisk/Command/Preprocessor.hs+4−1 lib/command/src/Obelisk/Command/Run.hs+2−3
lib/command/src/Obelisk/Command/Preprocessor.hs+4−1
@@ -86,7 +86,10 @@ generateHeader origPath packageInfo =
8686 <> mconcat (intersperse (TL.fromText " ") optList)
8787 <> TL.fromText " #-}\n"
8888 else mempty
89− optList = map TL.fromString $ fromMaybe [] $ lookup GHC (_cabalPackageInfo_compilerOptions packageInfo)
89+ optList = map TL.fromString
90+ $ filter (\x -> not (isPrefixOf "-O" x))
91+ $ fromMaybe []
92+ $ lookup GHC (_cabalPackageInfo_compilerOptions packageInfo)
9093
9194lineNumberPragma :: FilePath -> TL.Builder
9295lineNumberPragma origPath =
lib/command/src/Obelisk/Command/Run.hs+2−3
@@ -269,7 +269,7 @@ withGhciScript packageInfos pathBase f = do
269269 ]
270270 dotGhci = unlines
271271 -- TODO: Shell escape
272− [ ":set -pgmF " <> selfExe <> " -optF " <> preprocessorIdentifier <> " " <> unwords (map (("-optF " <>) . _cabalPackageInfo_packageRoot) packageInfos)
272+ [ ":set -F -pgmF " <> selfExe <> " -optF " <> preprocessorIdentifier <> " " <> unwords (map (("-optF " <>) . makeRelative pathBase . _cabalPackageInfo_packageFile) packageInfos)
273273 , ":set -i" <> intercalate ":" (packageInfos >>= rootedSourceDirs)
274274 , if null modulesToLoad then "" else ":load " <> unwords modulesToLoad
275275 , "import qualified Obelisk.Run"
@@ -311,8 +311,7 @@ runGhcid root chdirToRoot dotGhci packages mcmd =
311311 where
312312 opts =
313313 [ "-W"
314− --TODO: The decision of whether to use -fwarn-redundant-constraints should probably be made by the user
315− , "--command='ghci -Wall -ignore-dot-ghci -fwarn-redundant-constraints " <> makeBaseGhciOptions dotGhci <> "' "
314+ , "--command='ghci -ignore-dot-ghci " <> makeBaseGhciOptions dotGhci <> "' "
316315 , "--reload=config"
317316 , "--outputfile=ghcid-output.txt"
318317 ] <> testCmd