Commit 73492bd2 authored by Oleg Grenrus's avatar Oleg Grenrus
Browse files

Use parsec version in D.Simple (when flagged)

parent ee5ea156
......@@ -195,8 +195,15 @@ parseGenericPackageDescription' lexWarnings fs = do
let gpd' = gpd { condLibrary = Just l }
pure gpd'
-- Sublibraries
| name == "library" = do
name' <- parseName pos args
lib <- parseCondTree libFieldDescrs storeXFieldsLib (targetBuildDepends . libBuildInfo) emptyLibrary fields
-- TODO check duplicate name here?
let gpd' = gpd { condSubLibraries = condSubLibraries gpd ++ [(name', lib)] }
pure gpd'
| name == "executable" = do
-- TODO: make a combinator for this, repeated in tests and bench
name' <- parseName pos args
-- Note: we don't parse the "executable" field here, hence the tail hack. Duncan 2010
exe <- parseCondTree (tail executableFieldDescrs) storeXFieldsExe (targetBuildDepends . buildInfo) emptyExecutable fields
......
......@@ -461,6 +461,9 @@ binfoFieldDescrs =
, listFieldWithSep vcat "other-modules"
disp (parsecMaybeQuoted parsec)
otherModules (\val binfo -> binfo{otherModules=val})
, listFieldWithSep vcat "autogen-modules"
disp (parsecMaybeQuoted parsec)
autogenModules (\val binfo -> binfo{autogenModules=val})
, optsField "ghc-prof-options" GHC
profOptions (\val binfo -> binfo{profOptions=val})
, optsField "ghcjs-prof-options" GHCJS
......
......@@ -51,7 +51,7 @@ import Distribution.Types.SourceRepo
import Distribution.Types.TestType (TestType (..))
import Distribution.Version
(Version, mkVersion, VersionRange (..), anyVersion, earlierVersion,
intersectVersionRanges, laterVersion, noVersion,
intersectVersionRanges, laterVersion, majorBoundVersion, noVersion,
orEarlierVersion, orLaterVersion, thisVersion,
unionVersionRanges, withinVersion)
import Language.Haskell.Extension
......@@ -180,6 +180,7 @@ instance Parsec VersionRange where
("<=", orEarlierVersion),
(">", laterVersion),
(">=", orLaterVersion),
("^>=", majorBoundVersion),
("==", thisVersion) ]
instance Parsec Language where
......
......@@ -19,7 +19,7 @@ import Distribution.Types.GenericPackageDescription
(Condition (..), ConfVar (..))
import Distribution.Version
(mkVersion, anyVersion, earlierVersion,
intersectVersionRanges, laterVersion, noVersion,
intersectVersionRanges, laterVersion, noVersion, majorBoundVersion,
orEarlierVersion, orLaterVersion, thisVersion,
unionVersionRanges, withinVersion)
......@@ -97,6 +97,7 @@ parser = condOr
("<=", orEarlierVersion),
(">", laterVersion),
(">=", orLaterVersion),
("^>=", majorBoundVersion),
("==", thisVersion) ]
-- numbers are weird: SecArgNum (Position 65 15) "7.6.1"
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
......@@ -65,7 +66,6 @@ import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.UserHooks
import Distribution.Package
import Distribution.PackageDescription hiding (Flag)
import Distribution.PackageDescription.Parse
import Distribution.PackageDescription.Configuration
import Distribution.Simple.Program
import Distribution.Simple.Program.Db
......@@ -104,6 +104,13 @@ import Distribution.Compat.GetShortPathName (getShortPathName)
import Data.List (unionBy, (\\))
#ifdef CABAL_PARSEC
import Distribution.PackageDescription.Parsec
import Distribution.PackageDescription.Parse (readHookedBuildInfo)
#else
import Distribution.PackageDescription.Parse
#endif
-- | A simple implementation of @main@ for a Cabal setup script.
-- It reads the package description file using IO, and performs the
-- action specified on the command line.
......@@ -228,7 +235,11 @@ confPkgDescr hooks verbosity mb_path = do
pdfile <- case mb_path of
Nothing -> defaultPackageDesc verbosity
Just path -> return path
#ifdef CABAL_PARSEC
descr <- readGenericPackageDescription verbosity pdfile
#else
descr <- readPackageDescription verbosity pdfile
#endif
return (Just pdfile, descr)
buildAction :: UserHooks -> BuildFlags -> Args -> IO ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment