aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Distribution/Helper.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Distribution/Helper.hs b/Distribution/Helper.hs
index 3544d2e..ca189a3 100644
--- a/Distribution/Helper.hs
+++ b/Distribution/Helper.hs
@@ -50,6 +50,7 @@ module Distribution.Helper (
, Distribution.Helper.getSandboxPkgDb
-- * Managing @dist/@
+ , prepare
, reconfigure
, writeAutogenFiles
@@ -261,6 +262,20 @@ getSomeConfigState = ask >>= \(QueryEnv readProc progs projdir distdir) -> do
return $ SomeLocalBuildInfo
pkgDbs eps srcDirs ghcOpts ghcSrcOpts ghcPkgOpts ghcMergedPkgOpts ghcLangOpts
+-- | Make sure the appropriate helper executable for the given project is
+-- installed and ready to run queries.
+prepare :: MonadIO m
+ => (FilePath -> [String] -> String -> IO String)
+ -> FilePath
+ -- ^ Path to project directory, i.e. the one containing the
+ -- @project.cabal@ file
+ -> FilePath
+ -- ^ Path to the @dist/@ directory
+ -> m ()
+prepare readProc projdir distdir = liftIO $ do
+ exe <- findLibexecExe "cabal-helper-wrapper"
+ void $ readProc exe [projdir, distdir] ""
+
-- | Create @cabal_macros.h@ and @Paths_\<pkg\>@ possibly other generated files
-- in the usual place.
writeAutogenFiles :: MonadIO m