dynamic-cabal 0.3.4 → 0.3.5
raw patch · 7 files changed
+19/−10 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Distribution.Client.Dynamic.Query: instance [overlap ok] Applicative (Query s)
- Distribution.Client.Dynamic.Query: instance [overlap ok] Category Selector
- Distribution.Client.Dynamic.Query: instance [overlap ok] Exception e => Exception (LeftoverTempDir e)
- Distribution.Client.Dynamic.Query: instance [overlap ok] Functor (Query s)
- Distribution.Client.Dynamic.Query: instance [overlap ok] Read LocalBuildInfo
- Distribution.Client.Dynamic.Query: instance [overlap ok] Show e => Show (LeftoverTempDir e)
- Distribution.Client.Dynamic.Query: instance [overlap ok] Typeable LeftoverTempDir
- Distribution.Client.Dynamic.Query: instance [overlap ok] Typeable LocalBuildInfo
+ Distribution.Client.Dynamic.Query: instance Applicative (Query s)
+ Distribution.Client.Dynamic.Query: instance Category Selector
+ Distribution.Client.Dynamic.Query: instance Exception e => Exception (LeftoverTempDir e)
+ Distribution.Client.Dynamic.Query: instance Functor (Query s)
+ Distribution.Client.Dynamic.Query: instance Read LocalBuildInfo
+ Distribution.Client.Dynamic.Query: instance Show e => Show (LeftoverTempDir e)
+ Distribution.Client.Dynamic.Query: instance Typeable LeftoverTempDir
+ Distribution.Client.Dynamic.Query: instance Typeable LocalBuildInfo
Files
- .ghci +1/−1
- .travis.yml +4/−3
- README.md +2/−0
- dynamic-cabal.cabal +3/−2
- src/Distribution/Client/Dynamic/PackageDescription.hs +1/−0
- src/Distribution/Client/Dynamic/Query.hs +7/−2
- tests/doctests.hsc +1/−2
.ghci view
@@ -1,1 +1,1 @@-:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h+:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h -package ghc
.travis.yml view
@@ -2,11 +2,12 @@ - GHCVER=7.4.2 CABALVER=1.16 CABALFLAGS="" - GHCVER=7.6.3 CABALVER=1.18 CABALFLAGS="" - GHCVER=7.8.3 CABALVER=1.20 CABALFLAGS="--enable-shared --enable-executable-dynamic"- - GHCVER=7.8.4 CABALVER=1.22 CABALFLAGS="--enable-shared --enable-executable-dynamic"+ - GHCVER=7.8.4 CABALVER=1.22 CABALFLAGS="--enable-shared --enable-executable-dynamic --constraint mtl<2.2"+ - GHCVER=7.10.1 CABALVER=1.22 CABALFLAGS="--enable-shared --enable-executable-dynamic" before_install: - sudo add-apt-repository -y ppa:hvr/ghc- - sudo apt-get update+ - travis_retry sudo apt-get update - sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER hlint - cabal-$CABALVER update - export PATH=/opt/ghc/$GHCVER/bin:~/.cabal/bin:$PATH@@ -14,7 +15,7 @@ # The cabal-install packages from hvr's ppa are outdated for cabal 1.22 - | if [ "$CABALVER" = "1.22" ]; then- cabal-$CABALVER install cabal-install $CABALFLAGS --constraint "mtl < 2.2" --constraint="Cabal ==$CABALVER.*" --constraint="cabal-install ==$CABALVER.*"+ cabal-$CABALVER install cabal-install $CABALFLAGS --constraint="Cabal ==$CABALVER.*" --constraint="cabal-install ==$CABALVER.*" else export PATH=/opt/cabal/$CABALVER/bin:$PATH fi
README.md view
@@ -3,6 +3,8 @@ [](http://travis-ci.org/bennofs/dynamic-cabal) +*Note*: The problem this library solves no longer exists starting with GHC 7.10, since versions later than that do not depend on the Cabal library. You only need this library if you like to support older GHC versions.+ If you've ever used Cabal together with the GHC-API, you know the problem. Because GHC depends on a version of Cabal, which is often outdated, there is no way to parse the setup-config file generated by newer cabal versions. This library attemps to solve the problem by dynamically generating code that performs the action you want, and then compiling and loading that with GHC. With this method, you don't need to depend on Cabal at compile time and so you can use any version of Cabal. ## Usage
dynamic-cabal.cabal view
@@ -1,5 +1,5 @@ name: dynamic-cabal-version: 0.3.4+version: 0.3.5 license: BSD3 category: Distribution cabal-version: >= 1.10@@ -9,7 +9,7 @@ stability: experimental homepage: http://github.com/bennofs/dynamic-cabal/ bug-reports: http://github.com/bennofs/dynamic-cabal/issues-copyright: Copyright (C) 2013 Benno Fünfstück+copyright: Copyright (C) 2013-2015 Benno Fünfstück synopsis: Access the functions from the Cabal library without depending on it description: This library allows you to extract information from cabal files without depending on the Cabal library. Since@@ -17,6 +17,7 @@ solves that problem by using the GHC API itself to interface with Cabal, which means that it can use whatever Cabal version the user has installed, at run time (the version is not fixed at compile time). For a short tutorial, see <https://github.com/bennofs/dynamic-cabal>.+ Note: As of GHC 7.10, the ghc library no longer depends on Cabal. So you only need this package if you want to support older GHC versions. build-type: Custom extra-source-files: .ghci
src/Distribution/Client/Dynamic/PackageDescription.hs view
@@ -21,6 +21,7 @@ import Distribution.Client.Dynamic.Query import Language.Haskell.Exts.Syntax import Language.Haskell.Generate+import Prelude -- Type tags that we can use to make sure we don't accidently generate code that -- use a function for a PackageDescription on a BuildInfo value.
src/Distribution/Client/Dynamic/Query.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE CPP #-}-{-# LANGUAGE OverlappingInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE TypeFamilies #-}@@ -184,10 +183,16 @@ writeFile "DynamicCabalQuery.hs" s GHC.runGhc (Just GHC.Paths.libdir) $ do dflags <- GHC.getSessionDynFlags+ let cabalPkg = "Cabal-" ++ showVersion version+#if __GLASGOW_HASKELL__ >= 709+ let cabalFlag = DynFlags.ExposePackage (DynFlags.PackageArg cabalPkg) (DynFlags.ModRenaming True [])+#else+ let cabalFlag = DynFlags.ExposePackage cabalPkg+#endif void $ GHC.setSessionDynFlags $ dflags { GHC.ghcLink = GHC.LinkInMemory , GHC.hscTarget = GHC.HscInterpreted- , GHC.packageFlags = [DynFlags.ExposePackage $ "Cabal-" ++ showVersion version]+ , GHC.packageFlags = [cabalFlag] , GHC.ctxtStkDepth = 1000 } dflags' <- GHC.getSessionDynFlags
tests/doctests.hsc view
@@ -20,18 +20,17 @@ import System.Directory import System.FilePath import Test.DocTest+import Prelude ##ifdef mingw32_HOST_ARCH ##ifdef i386_HOST_ARCH ##define USE_CP-import Control.Applicative import Control.Exception import Foreign.C.Types foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt ##elif defined(x86_64_HOST_ARCH) ##define USE_CP-import Control.Applicative import Control.Exception import Foreign.C.Types foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool