aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2018-01-29 18:22:04 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-01-29 17:22:04 +0100
commit09e2236679739547984e2e29db23e160a3a80890 (patch)
treead16f90ffa32dbf31bcf088b5541c59e15e47d88
parenta43c1015efbbd3e1387b38534f04ba749cf7de74 (diff)
Revert hsSourceDirs hackery (#43)
Move hack to GhcSession test for now, the corresponding logic should be moved into c-h instead of living in ghc-mod instead.
-rw-r--r--cabal-helper.cabal2
-rw-r--r--src/CabalHelper/Runtime/Main.hs6
-rw-r--r--tests/GhcSession.hs14
3 files changed, 14 insertions, 8 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal
index 50cbe0e..51f6a83 100644
--- a/cabal-helper.cabal
+++ b/cabal-helper.cabal
@@ -1,5 +1,5 @@
name: cabal-helper
-version: 0.8.0.0
+version: 0.8.0.1
synopsis:
Simple interface to some of Cabal's configuration state, mainly used by ghc-mod
description:
diff --git a/src/CabalHelper/Runtime/Main.hs b/src/CabalHelper/Runtime/Main.hs
index 49c6789..336650a 100644
--- a/src/CabalHelper/Runtime/Main.hs
+++ b/src/CabalHelper/Runtime/Main.hs
@@ -760,13 +760,7 @@ componentEntrypoints (CFLib (ForeignLib{..}))
#endif
componentEntrypoints (CExe Executable {..})
= ChExeEntrypoint
-#if CH_MIN_VERSION_Cabal(2,0,0)
- --
- ( head ((hsSourceDirs buildInfo) ++ ["."]) </> modulePath)
- -- modulePath
-#else
modulePath
-#endif
(map gmModuleName $ otherModules buildInfo)
componentEntrypoints (CTest TestSuite { testInterface = TestSuiteExeV10 _ fp, ..})
= ChExeEntrypoint fp (map gmModuleName $ otherModules testBuildInfo)
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs
index a1c164f..4845565 100644
--- a/tests/GhcSession.hs
+++ b/tests/GhcSession.hs
@@ -144,8 +144,20 @@ compileModule nb ep opts = do
ts <- mapM (\t -> guessTarget t Nothing) $
case ep of
ChLibEntrypoint ms ms' ss -> map unChModuleName $ ms ++ ms' ++ ss
- ChExeEntrypoint m ms -> [m] ++ map unChModuleName ms
+ ChExeEntrypoint m' ms ->
+ let
+
+ -- The options first clear out includes, then put in the build dir. We want the
+ -- first one after that, so "regex-example" in the following case
+ --
+ -- ,"-i"
+ -- ,"-idist/build/regex-example"
+ -- ,"-iregex-example"
+ firstInclude = drop 2 $ head $ drop 2 $ filter (isPrefixOf "-i") opts
+ m = firstInclude </> m'
+ in [m] ++ map unChModuleName ms
ChSetupEntrypoint -> ["Setup.hs"]
+
let ts' = case nb of
NoBuildOutput -> map (\t -> t { targetAllowObjCode = False }) ts
ProduceBuildOutput -> ts