cabal-cargs 0.8.1 → 0.9.0
raw patch · 4 files changed
+31/−22 lines, 4 filesdep ~Cabaldep ~cabal-lensesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, cabal-lenses
API changes (from Hackage documentation)
Files
- CHANGELOG +8/−0
- cabal-cargs.cabal +3/−3
- lib/CabalCargs/CompilerArgs.hs +16/−15
- lib/CabalCargs/Spec.hs +4/−4
CHANGELOG view
@@ -1,3 +1,11 @@+0.9.0+-----+* Support cabal 2.0++0.8.2+-----+* Update to cabal-lenses-0.5.0+ 0.8.1 ----- * Fix tests
cabal-cargs.cabal view
@@ -1,5 +1,5 @@ name: cabal-cargs-version: 0.8.1+version: 0.9.0 cabal-version: >=1.9.2 build-type: Simple license: BSD3@@ -56,8 +56,8 @@ system-filepath >=0.4.9 && <0.5, system-fileio >=0.3.12 && <0.4, unordered-containers >=0.2.3.3 && <0.3,- cabal-lenses >=0.4.6 && <0.5,- Cabal >=1.16 && <1.25+ cabal-lenses >=0.6.0 && <0.7,+ Cabal >=2.0.0.2 && <2.1 cpp-options: -DCABAL hs-source-dirs: lib other-modules:
lib/CabalCargs/CompilerArgs.hs view
@@ -26,7 +26,7 @@ -- | The collected compiler args from the cabal file. Till the field 'packageDB' -- all fields represent the equaliy named fields ('-' replaced by CamelCase) -- from the cabal file.-data CompilerArgs = CompilerArgs +data CompilerArgs = CompilerArgs { hsSourceDirs :: [FilePath] , ghcOptions :: [String] , defaultExtensions :: [String]@@ -79,24 +79,25 @@ -- | Create a 'CompilerArgs' and collect the compiler args specified by 'Spec'. fromSpec :: Spec -> CompilerArgs-fromSpec spec = absolutePaths $ foldl' collectFromSection defaultCompilerArgs (Spec.sections spec)+fromSpec spec = changePaths $ foldl' collectFromSection defaultCompilerArgs (Spec.sections spec) where- absolutePaths cargs+ changePaths cargs | Spec.relativePaths spec- = cargs+ = cargs & hsSourceDirsL %~ map stripCabalDir+ & cSourcesL %~ map stripCabalDir+ & extraLibDirsL %~ map stripCabalDir+ & includeDirsL %~ map stripCabalDir+ & autogenHsSourceDirsL %~ map stripCabalDir+ & autogenIncludeDirsL %~ map stripCabalDir+ & packageDBL . _Just %~ stripCabalDir+ & hdevtoolsSocketL . _Just %~ stripCabalDir | otherwise- = cargs & hsSourceDirsL %~ map prependCabalDir- & cSourcesL %~ map prependCabalDir- & extraLibDirsL %~ map prependCabalDir- & includeDirsL %~ map prependCabalDir- & autogenHsSourceDirsL %~ map prependCabalDir- & autogenIncludeDirsL %~ map prependCabalDir- & packageDBL . _Just %~ prependCabalDir- & hdevtoolsSocketL . _Just %~ prependCabalDir+ = cargs+ where- prependCabalDir path = FP.encodeString $ cabalDir </> FP.decodeString path- cabalDir = FP.directory . FP.decodeString $ Spec.cabalFile spec+ stripCabalDir path = maybe path FP.encodeString (FP.stripPrefix cabalDir (FP.decodeString path))+ cabalDir = FP.directory . FP.decodeString $ Spec.cabalFile spec collectFromSection cargs section = foldl' addCarg cargs (Spec.fields spec)@@ -129,7 +130,7 @@ cargs & hdevtoolsSocketL .~ Just ".hdevtools.sock" addCarg cargs F.Build_Depends =- cargs & buildDependsL %~ nub . (++ dependencies) + cargs & buildDependsL %~ nub . (++ dependencies) addCarg cargs field = cargs & fieldL field %~ nub . (++ buildInfoFields)
lib/CabalCargs/Spec.hs view
@@ -6,7 +6,7 @@ ) where import Distribution.PackageDescription (GenericPackageDescription)-import Distribution.PackageDescription.Parse (parsePackageDescription, ParseResult(..))+import Distribution.PackageDescription.Parse (parseGenericPackageDescription, ParseResult(..)) import qualified Distribution.System as Sys import CabalCargs.Args (Args) import qualified CabalCargs.Args as A@@ -36,8 +36,8 @@ , condVars :: CL.CondVars -- ^ used for the evaluation of the conditional fields in the cabal file , pkgDescrp :: GenericPackageDescription -- ^ the package description of the read in cabal file , cabalFile :: FilePath -- ^ the cabal file read from- , distDir :: Maybe FilePath -- ^ the dist directory of the cabal build, a relative path to the directory of the cabal file- , packageDB :: Maybe FilePath -- ^ the directory of package database of the cabal sandbox, a relative path to the directory of the cabal file+ , distDir :: Maybe FilePath -- ^ the dist directory of the cabal build+ , packageDB :: Maybe FilePath -- ^ the directory of package database of the cabal sandbox , relativePaths :: Bool -- ^ if all returned paths are relative to the directory of the cabal file, otherwise all paths are absolute } @@ -182,7 +182,7 @@ packageDescription :: FilePath -> EitherT Error IO GenericPackageDescription packageDescription file = do contents <- io $ Strict.readFile file- case parsePackageDescription contents of+ case parseGenericPackageDescription contents of ParseFailed error -> left $ show error ParseOk _ pkgDescrp -> right pkgDescrp