aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CabalHelper/Main.hs2
-rw-r--r--Distribution/Helper.hs10
-rw-r--r--cabal-helper.cabal1
-rw-r--r--tests/Spec.hs3
4 files changed, 10 insertions, 6 deletions
diff --git a/CabalHelper/Main.hs b/CabalHelper/Main.hs
index 0177cf5..290584d 100644
--- a/CabalHelper/Main.hs
+++ b/CabalHelper/Main.hs
@@ -159,8 +159,6 @@ main = do
print =<< flip mapM cmds $$ \cmd -> do
case cmd of
"write-autogen-files":[] -> do
- -- can't use @projdir@ here
- let pd = localPkgDescr lbi
-- calls writeAutogenFiles
initialBuildSteps distdir pd lbi v
return Nothing
diff --git a/Distribution/Helper.hs b/Distribution/Helper.hs
index da07510..3544d2e 100644
--- a/Distribution/Helper.hs
+++ b/Distribution/Helper.hs
@@ -265,11 +265,15 @@ getSomeConfigState = ask >>= \(QueryEnv readProc progs projdir distdir) -> do
-- in the usual place.
writeAutogenFiles :: MonadIO m
=> (FilePath -> [String] -> String -> IO String)
- -> FilePath -- ^ Path to the @dist/@ directory
+ -> FilePath
+ -- ^ Path to project directory, i.e. the one containing the
+ -- @project.cabal@ file
+ -> FilePath
+ -- ^ Path to the @dist/@ directory
-> m ()
-writeAutogenFiles readProc distdir = liftIO $ do
+writeAutogenFiles readProc projdir distdir = liftIO $ do
exe <- findLibexecExe "cabal-helper-wrapper"
- void $ readProc exe ["/nowhere/../..", distdir, "write-autogen-files"] ""
+ void $ readProc exe [projdir, distdir, "write-autogen-files"] ""
-- | Get the path to the sandbox package-db in a project
getSandboxPkgDb :: (FilePath -> [String] -> String -> IO String)
diff --git a/cabal-helper.cabal b/cabal-helper.cabal
index c7fe730..9b0f455 100644
--- a/cabal-helper.cabal
+++ b/cabal-helper.cabal
@@ -90,3 +90,4 @@ Test-Suite spec
, cabal-helper
, extra
, unix
+ , process
diff --git a/tests/Spec.hs b/tests/Spec.hs
index b1a0313..296702e 100644
--- a/tests/Spec.hs
+++ b/tests/Spec.hs
@@ -1,10 +1,11 @@
import Distribution.Helper
import System.Environment.Extra (lookupEnv)
import System.Posix.Env (setEnv)
+import System.Process
import Data.Maybe
import Data.Functor
main :: IO ()
main = do
flip (setEnv "HOME") True =<< fromMaybe "/tmp" <$> lookupEnv "TMPDIR"
- writeAutogenFiles "./dist"
+ writeAutogenFiles readProcess "." "./dist"