cabal-helper 0.3.2.1 → 0.3.3.0
raw patch · 4 files changed
+21/−20 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CabalHelper/Main.hs +8/−2
- CabalHelper/Types.hs +2/−0
- CabalHelper/Wrapper.hs +10/−17
- cabal-helper.cabal +1/−1
CabalHelper/Main.hs view
@@ -52,8 +52,9 @@ import Distribution.Simple.Setup (ConfigFlags(..),Flag(..)) import Distribution.Simple.Build (initialBuildSteps) import Distribution.Simple.BuildPaths (autogenModuleName, cppHeaderName, exeExtension)-import Distribution.Simple.Compiler (PackageDB(..))+import Distribution.Simple.Compiler (PackageDB(..), compilerId) +import Distribution.Compiler (CompilerId(..)) import Distribution.ModuleName (components) import qualified Distribution.ModuleName as C (ModuleName) import Distribution.Text (display)@@ -89,6 +90,7 @@ ++"DIST_DIR ( version\n" ++" | print-lbi\n" ++" | write-autogen-files\n"+ ++" | compiler-version" ++" | ghc-options [--with-inplace]\n" ++" | ghc-src-options [--with-inplace]\n" ++" | ghc-pkg-options [--with-inplace]\n"@@ -100,7 +102,7 @@ commands :: [String] commands = [ "print-bli" , "write-autogen-files"- , "component-from-file"+ , "compiler-version" , "ghc-options" , "ghc-src-options" , "ghc-pkg-options"@@ -156,6 +158,10 @@ -- calls writeAutogenFiles initialBuildSteps distdir pd lbi v return Nothing++ "compiler-version":[] -> do+ let CompilerId comp ver = compilerId $ compiler lbi+ return $ Just $ ChResponseVersion (show comp) ver "ghc-options":flags -> do res <- componentsMap lbi v distdir $ \c clbi bi -> let
CabalHelper/Types.hs view
@@ -18,6 +18,7 @@ module CabalHelper.Types where import GHC.Generics+import Data.Version newtype ChModuleName = ChModuleName String deriving (Eq, Ord, Read, Show, Generic)@@ -33,6 +34,7 @@ = ChResponseStrings [(ChComponentName, [String])] | ChResponseEntrypoints [(ChComponentName, ChEntrypoint)] | ChResponseLbi String+ | ChResponseVersion String Version deriving (Eq, Ord, Read, Show, Generic) data ChEntrypoint = ChSetupEntrypoint -- ^ Almost like 'ChExeEntrypoint' but
CabalHelper/Wrapper.hs view
@@ -119,23 +119,16 @@ \Could not read Cabal's persistent setup configuration header\n\ \- Check first line of: %s\n\ \- Maybe try: $ cabal configure" cfgf- Just (hdrCabalVersion, (_compilerName, hdrCompilerVersion)) -> do- ghcVer <- ghcVersion opts- if not $ ghcVer `sameMajorVersionAs` hdrCompilerVersion- then panic $ printf "\-\GHC major version changed! (was %s, now %s)\n\-\- Reconfigure the project: $ cabal clean && cabal configure\-\ " (showVersion hdrCompilerVersion) (showVersion ghcVer)- else do- eexe <- compileHelper opts hdrCabalVersion distdir- case eexe of- Left e -> exitWith e- Right exe ->- case args' of- "print-exe":_ -> putStrLn exe- _ -> do- (_,_,_,h) <- createProcess $ proc exe args- exitWith =<< waitForProcess h+ Just (hdrCabalVersion, _) -> do+ eexe <- compileHelper opts hdrCabalVersion distdir+ case eexe of+ Left e -> exitWith e+ Right exe ->+ case args' of+ "print-exe":_ -> putStrLn exe+ _ -> do+ (_,_,_,h) <- createProcess $ proc exe args+ exitWith =<< waitForProcess h appDataDir :: IO FilePath appDataDir = (</> "cabal-helper") <$> getAppUserDataDirectory "ghc-mod"
cabal-helper.cabal view
@@ -1,5 +1,5 @@ name: cabal-helper-version: 0.3.2.1+version: 0.3.3.0 synopsis: Simple interface to Cabal's configuration state used by ghc-mod description: @cabal-helper@ provides a library which wraps the internal use of executables