on master help sign in
Merge pull request #635 from obsidiansystems/ls-fix-commit

Fix preprocessor integration

commit0bc03746ba5727880c13b53de76a592a669d0bf0 authorElliot Cameron <3noch@users.noreply.github.com> dateThu 30 Jan 2020, 23:10 (7 years ago) parent134403736e2002
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
@@ -272,7 +272,7 @@ withGhciScript packageInfos pathBase f = do
272272 ]
273273 dotGhci = unlines
274274 -- TODO: Shell escape
275− [ ":set -pgmF " <> selfExe <> " -optF " <> preprocessorIdentifier <> " " <> unwords (map (("-optF " <>) . _cabalPackageInfo_packageRoot) packageInfos)
275+ [ ":set -F -pgmF " <> selfExe <> " -optF " <> preprocessorIdentifier <> " " <> unwords (map (("-optF " <>) . makeRelative pathBase . _cabalPackageInfo_packageFile) packageInfos)
276276 , ":set -i" <> intercalate ":" (packageInfos >>= rootedSourceDirs)
277277 , if null modulesToLoad then "" else ":load " <> unwords modulesToLoad
278278 , "import qualified Obelisk.Run"
@@ -314,8 +314,7 @@ runGhcid root chdirToRoot dotGhci packages mcmd =
314314 where
315315 opts =
316316 [ "-W"
317− --TODO: The decision of whether to use -fwarn-redundant-constraints should probably be made by the user
318− , "--command='ghci -Wall -ignore-dot-ghci -fwarn-redundant-constraints " <> makeBaseGhciOptions dotGhci <> "' "
317+ , "--command='ghci -ignore-dot-ghci " <> makeBaseGhciOptions dotGhci <> "' "
319318 , "--reload=config"
320319 , "--outputfile=ghcid-output.txt"
321320 ] <> testCmd