cabal-helper 0.3.2.0 → 0.3.2.1
raw patch · 4 files changed
+47/−15 lines, 4 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CabalHelper/Main.hs +6/−6
- Distribution/Helper.hs +2/−1
- Setup.hs +37/−7
- cabal-helper.cabal +2/−1
CabalHelper/Main.hs view
@@ -57,7 +57,7 @@ import Distribution.ModuleName (components) import qualified Distribution.ModuleName as C (ModuleName) import Distribution.Text (display)-import Distribution.Verbosity (Verbosity, silent, deafening)+import Distribution.Verbosity (Verbosity, silent, deafening, normal) #if CABAL_MAJOR == 1 && CABAL_MINOR >= 22 import Distribution.Utils.NubList@@ -165,7 +165,7 @@ [] -> removeInplaceDeps v lbi pd clbi - opts = componentGhcOptions v lbi bi clbi' outdir+ opts = componentGhcOptions normal lbi bi clbi' outdir in renderGhcOptions' lbi v (opts `mappend` adopts) return $ Just $ ChResponseStrings (res ++ [(ChSetupHsName, [])]) @@ -175,7 +175,7 @@ (clbi', adopts) = case flags of ["--with-inplace"] -> (clbi, mempty) [] -> removeInplaceDeps v lbi pd clbi- opts = componentGhcOptions v lbi bi clbi' outdir+ opts = componentGhcOptions normal lbi bi clbi' outdir comp = compiler lbi opts' = mempty {@@ -199,7 +199,7 @@ (clbi', adopts) = case flags of ["--with-inplace"] -> (clbi, mempty) [] -> removeInplaceDeps v lbi pd clbi- opts = componentGhcOptions v lbi bi clbi' outdir+ opts = componentGhcOptions normal lbi bi clbi' outdir opts' = mempty { ghcOptPackageDBs = ghcOptPackageDBs opts,@@ -216,7 +216,7 @@ (clbi', adopts) = case flags of ["--with-inplace"] -> (clbi, mempty) [] -> removeInplaceDeps v lbi pd clbi- opts = componentGhcOptions v lbi bi clbi' outdir+ opts = componentGhcOptions normal lbi bi clbi' outdir opts' = mempty { ghcOptPackageDBs = [GlobalPackageDB, UserPackageDB],@@ -349,7 +349,7 @@ (lib, libclbi) = getLibraryClbi pd lbi libbi = libBuildInfo lib liboutdir = componentOutDir lbi (CLib lib)- libopts = (componentGhcOptions v lbi libbi libclbi liboutdir) {+ libopts = (componentGhcOptions normal lbi libbi libclbi liboutdir) { ghcOptPackageDBs = [] }
Distribution/Helper.hs view
@@ -63,6 +63,7 @@ import Data.List import Data.Default import Data.Typeable+import Distribution.Simple.BuildPaths (exeExtension) import System.Environment import System.FilePath import System.Directory@@ -241,7 +242,7 @@ findLibexecExe "cabal-helper-wrapper" = do libexecdir <- getLibexecDir let exeName = "cabal-helper-wrapper"- exe = libexecdir </> exeName+ exe = libexecdir </> exeName <.> exeExtension exists <- doesFileExist exe
Setup.hs view
@@ -3,21 +3,52 @@ import Distribution.Simple import Distribution.Simple.Setup import Distribution.Simple.Install+import Distribution.Simple.Register import Distribution.Simple.InstallDirs as ID import Distribution.Simple.LocalBuildInfo import Distribution.PackageDescription import Control.Applicative+import Control.Monad import Data.List import Data.Maybe import System.FilePath main :: IO ()-main = defaultMainWithHooks $ simpleUserHooks { copyHook = xInstallTargetHook }+main = defaultMainWithHooks $ simpleUserHooks {+ instHook = inst,+ copyHook = copy+ } -xInstallTargetHook ::- PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO ()-xInstallTargetHook pd lbi _uh cf = do+-- mostly copypasta from 'defaultInstallHook'+inst ::+ PackageDescription -> LocalBuildInfo -> UserHooks -> InstallFlags -> IO ()+inst pd lbi _uf ifl = do+ let copyFlags = defaultCopyFlags {+ copyDistPref = installDistPref ifl,+ copyDest = toFlag NoCopyDest,+ copyVerbosity = installVerbosity ifl+ }+ xInstallTarget pd lbi (\pd' lbi' -> install pd' lbi' copyFlags)+ let registerFlags = defaultRegisterFlags {+ regDistPref = installDistPref ifl,+ regInPlace = installInPlace ifl,+ regPackageDB = installPackageDB ifl,+ regVerbosity = installVerbosity ifl+ }+ when (hasLibs pd) $ register pd lbi registerFlags++copy :: PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO ()+copy pd lbi _uh cf =+ xInstallTarget pd lbi (\pd' lbi' -> install pd' lbi' cf)++++xInstallTarget :: PackageDescription+ -> LocalBuildInfo+ -> (PackageDescription -> LocalBuildInfo -> IO ())+ -> IO ()+xInstallTarget pd lbi fn = do let (extended, regular) = partition (isJust . installTarget) (executables pd) let pd_regular = pd { executables = regular }@@ -42,10 +73,9 @@ bindir = install_target'' } }-- install pd_extended lbi' cf+ fn pd_extended lbi' - install pd_regular lbi cf+ fn pd_regular lbi where installTarget :: Executable -> Maybe PathTemplate
cabal-helper.cabal view
@@ -1,5 +1,5 @@ name: cabal-helper-version: 0.3.2.0+version: 0.3.2.1 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@@ -44,6 +44,7 @@ , CabalHelper.Types default-language: Haskell2010 Build-Depends: base >= 4.5 && < 5+ , Cabal >= 1.14 && < 1.23 , data-default , directory , filepath