Use componentsConfigs
instead of configDependencies
`configDependencies` was added in Cabal-1.20 but we're using 1.18 on travis.
This commit is contained in:
parent
9d9f66e942
commit
4e4d27e62d
@ -37,6 +37,7 @@ import Distribution.Simple.Program (ghcProgram)
|
|||||||
import Distribution.Simple.Program.Types (programName, programFindVersion)
|
import Distribution.Simple.Program.Types (programName, programFindVersion)
|
||||||
import Distribution.Simple.BuildPaths (defaultDistPref)
|
import Distribution.Simple.BuildPaths (defaultDistPref)
|
||||||
import Distribution.Simple.Configure (localBuildInfoFile)
|
import Distribution.Simple.Configure (localBuildInfoFile)
|
||||||
|
import Distribution.Simple.LocalBuildInfo (ComponentName(..),ComponentLocalBuildInfo(..))
|
||||||
import Distribution.System (buildPlatform)
|
import Distribution.System (buildPlatform)
|
||||||
import Distribution.Text (display)
|
import Distribution.Text (display)
|
||||||
import Distribution.Verbosity (silent)
|
import Distribution.Verbosity (silent)
|
||||||
@ -226,17 +227,22 @@ cabalConfigPath :: FilePath
|
|||||||
cabalConfigPath = localBuildInfoFile defaultDistPref
|
cabalConfigPath = localBuildInfoFile defaultDistPref
|
||||||
|
|
||||||
cabalConfigDependencies :: CabalConfig -> [Package]
|
cabalConfigDependencies :: CabalConfig -> [Package]
|
||||||
cabalConfigDependencies config =
|
cabalConfigDependencies config = cfgDepends
|
||||||
(fromInstalledPackageId . snd) <$> cfgDepends
|
|
||||||
where
|
where
|
||||||
cfgDepends :: [(PackageName, InstalledPackageId)]
|
lbi :: (ComponentName, ComponentLocalBuildInfo, [ComponentName])
|
||||||
cfgDepends =
|
-> ComponentLocalBuildInfo
|
||||||
case extractCabalSetupConfig "configDependencies" config of
|
lbi (_,i,_) = i
|
||||||
Just x -> x
|
components = case extractCabalSetupConfig "componentsConfigs" config of
|
||||||
|
Just comps -> lbi <$> comps
|
||||||
Nothing -> error $
|
Nothing -> error $
|
||||||
"cabalConfigDependencies: Extracting field `configDependencies' from"
|
"cabalConfigDependencies: Extracting field `componentsConfigs' from"
|
||||||
++ " setup-config failed"
|
++ " setup-config failed"
|
||||||
|
|
||||||
|
pids :: [InstalledPackageId]
|
||||||
|
pids = fst <$> componentPackageDeps `concatMap` components
|
||||||
|
cfgDepends = filter (("inplace" /=) . pkgId)
|
||||||
|
$ fromInstalledPackageId <$> pids
|
||||||
|
|
||||||
|
|
||||||
-- | Extract part of cabal's @setup-config@, this is done with a mix of manual
|
-- | Extract part of cabal's @setup-config@, this is done with a mix of manual
|
||||||
-- string processing and use of 'read'. This way we can extract a field from
|
-- string processing and use of 'read'. This way we can extract a field from
|
||||||
@ -244,7 +250,7 @@ cabalConfigDependencies config =
|
|||||||
-- depending on the exact version of Cabal used to configure the project as it
|
-- depending on the exact version of Cabal used to configure the project as it
|
||||||
-- is rather likley that some part of 'LocalBuildInfo' changed.
|
-- is rather likley that some part of 'LocalBuildInfo' changed.
|
||||||
--
|
--
|
||||||
-- Right now 'extractCabalSetupConfig' can only deal with Lists and Tupels in
|
-- Right now 'extractCabalSetupConfig' can only deal with Lists and Tuples in
|
||||||
-- the field!
|
-- the field!
|
||||||
extractCabalSetupConfig :: (Read r) => String -> CabalConfig -> Maybe r
|
extractCabalSetupConfig :: (Read r) => String -> CabalConfig -> Maybe r
|
||||||
extractCabalSetupConfig field config = do
|
extractCabalSetupConfig field config = do
|
||||||
|
Loading…
Reference in New Issue
Block a user