aboutsummaryrefslogtreecommitdiff
path: root/Distribution
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2015-08-14 03:41:54 +0200
committerDaniel Gröber <dxld@darkboxed.org>2015-08-14 03:41:54 +0200
commit7cf9857f9e67efe0a85d8183ec9deecbbcc11087 (patch)
treeec2e9ad89e27df6a60ecb223411b2df0685ec0d2 /Distribution
parent0477589bf01d99c6e5897e355133bf22030e5787 (diff)
Add prepare command
Diffstat (limited to 'Distribution')
-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