diff options
| author | Daniel Gröber <dxld@darkboxed.org> | 2016-05-16 22:54:52 +0200 | 
|---|---|---|
| committer | Daniel Gröber <dxld@darkboxed.org> | 2016-05-17 00:23:48 +0200 | 
| commit | ab083b93cfe9ef630a9ea296a8eda6db67210ec5 (patch) | |
| tree | 3a841be0c5318f24362f156be25aa0b0e9c75807 | |
| parent | 863309ef591ee7437651a8d9d36a2d1e581c41ed (diff) | |
Add version to wrapper exe to ease upgrades
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | Distribution/Helper.hs | 18 | ||||
| -rw-r--r-- | cabal-helper.cabal | 4 | 
3 files changed, 12 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml index ae37669..12113c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,5 +42,5 @@ script:    - if [ -n "$(ghc --version | awk '{ print $8 }' | sed -n '/^7.8/p')" ]; then export WERROR="--ghc-option=-Werror"; fi    - cabal configure --enable-tests $WERROR    - cabal build -  - ./dist/build/cabal-helper-wrapper/cabal-helper-wrapper . dist "compiler-version" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options" +  - ./dist/build/cabal-helper-wrapper-v0.7/cabal-helper-wrapper-v0.7 . dist "compiler-version" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options"    - ./dist/build/spec/spec diff --git a/Distribution/Helper.hs b/Distribution/Helper.hs index a847567..b16e989 100644 --- a/Distribution/Helper.hs +++ b/Distribution/Helper.hs @@ -95,7 +95,7 @@ import Text.Printf  import GHC.Generics  import Prelude -import Paths_cabal_helper (getLibexecDir) +import Paths_cabal_helper (getLibexecDir, version)  import CabalHelper.Types hiding (Options(..))  import CabalHelper.Sandbox @@ -295,7 +295,7 @@ invokeHelper QueryEnv {..} args = do                   , "--with-ghc-pkg=" ++ ghcPkgProgram qePrograms                   , "--with-cabal="   ++ cabalProgram qePrograms                   ] -  exe  <- findLibexecExe "cabal-helper-wrapper" +  exe  <- findLibexecExe    let args' = progArgs ++ qeProjectDir:qeDistDir:args    out <- qeReadProcess exe args' ""    (Right <$> evaluate out) `E.catch` \(SomeException _) -> @@ -353,7 +353,7 @@ prepare :: MonadIO m          -> FilePath          -> m ()  prepare readProc projdir distdir = liftIO $ do -  exe  <- findLibexecExe "cabal-helper-wrapper" +  exe  <- findLibexecExe    void $ readProc exe [projdir, distdir] ""  {-# DEPRECATED prepare @@ -374,7 +374,7 @@ writeAutogenFiles :: MonadIO m                    -- ^ Path to the @dist/@ directory                    -> m ()  writeAutogenFiles readProc projdir distdir = liftIO $ do -  exe  <- findLibexecExe "cabal-helper-wrapper" +  exe  <- findLibexecExe    void $ readProc exe [projdir, distdir, "write-autogen-files"] ""  {-# DEPRECATED writeAutogenFiles @@ -398,7 +398,7 @@ getSandboxPkgDb readProc =  buildPlatform :: (FilePath -> [String] -> String -> IO String) -> IO String  buildPlatform readProc = do -  exe  <- findLibexecExe "cabal-helper-wrapper" +  exe  <- findLibexecExe    CabalHelper.Sandbox.dropWhileEnd isSpace <$> readProc exe ["print-build-platform"] ""  -- | This exception is thrown by all 'runQuery' functions if the internal @@ -412,10 +412,11 @@ instance Show LibexecNotFoundError where    show (LibexecNotFoundError exe dir) =      libexecNotFoundError exe dir "https://github.com/DanielG/cabal-helper/issues" -findLibexecExe :: String -> IO FilePath -findLibexecExe "cabal-helper-wrapper" = do +findLibexecExe :: IO FilePath +findLibexecExe = do      libexecdir <- getLibexecDir -    let exeName = "cabal-helper-wrapper" +    let Version (mj:mi:_) _ = version +        exeName = "cabal-helper-wrapper-v" ++ show mj ++ "." ++ show mi          exe = libexecdir </> exeName <.> exeExtension'      exists <- doesFileExist exe @@ -429,7 +430,6 @@ findLibexecExe "cabal-helper-wrapper" = do                 error $ throw $ LibexecNotFoundError exeName libexecdir             Just dir ->                 return $ dir </> "dist" </> "build" </> exeName </> exeName -findLibexecExe exe = error $ "findLibexecExe: Unknown executable: " ++ exe  tryFindCabalHelperTreeLibexecDir :: IO (Maybe FilePath)  tryFindCabalHelperTreeLibexecDir = do diff --git a/cabal-helper.cabal b/cabal-helper.cabal index 054ec1d..40defed 100644 --- a/cabal-helper.cabal +++ b/cabal-helper.cabal @@ -1,5 +1,5 @@  name:                cabal-helper -version:             0.7.0.1 +version:             0.7.1.0  synopsis:            Simple interface to some of Cabal's configuration state used by ghc-mod  description:      @cabal-helper@ provides a library which wraps the internal use of an @@ -57,7 +57,7 @@ library                       , process                       , ghc-prim -Executable cabal-helper-wrapper +Executable cabal-helper-wrapper-v0.7    Default-Language:    Haskell2010    Other-Extensions:    TemplateHaskell    Main-Is:             CabalHelper/Wrapper.hs  | 
