From 7cf9857f9e67efe0a85d8183ec9deecbbcc11087 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Fri, 14 Aug 2015 03:41:54 +0200 Subject: Add prepare command --- Distribution/Helper.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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_\@ possibly other generated files -- in the usual place. writeAutogenFiles :: MonadIO m -- cgit v1.2.3