{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
module Distribution.Types.LocalBuildInfo
(
LocalBuildInfo
( LocalBuildInfo
, configFlags
, flagAssignment
, componentEnabledSpec
, extraConfigArgs
, installDirTemplates
, compiler
, hostPlatform
, pkgDescrFile
, componentGraph
, componentNameMap
, promisedPkgs
, installedPkgs
, localPkgDescr
, withPrograms
, withPackageDB
, withVanillaLib
, withProfLib
, withSharedLib
, withStaticLib
, withDynExe
, withFullyStaticExe
, withProfExe
, withProfLibDetail
, withProfExeDetail
, withOptimization
, withDebugInfo
, withGHCiLib
, splitSections
, splitObjs
, stripExes
, stripLibs
, exeCoverage
, libCoverage
, extraCoverageFor
, relocatable
, ..
)
, localComponentId
, localUnitId
, localCompatPackageKey
, localPackage
, buildDir
, buildDirPBD
, configFlagsBuildDir
, cabalFilePath
, progPrefix
, progSuffix
, componentNameCLBIs
, componentNameTargets'
, unitIdTarget'
, allTargetsInBuildOrder'
, withAllTargetsInBuildOrder'
, neededTargetsInBuildOrder'
, withNeededTargetsInBuildOrder'
, testCoverage
, componentNameTargets
, unitIdTarget
, allTargetsInBuildOrder
, withAllTargetsInBuildOrder
, neededTargetsInBuildOrder
, withNeededTargetsInBuildOrder
) where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.Types.ComponentId
import Distribution.Types.ComponentLocalBuildInfo
import Distribution.Types.ComponentRequestedSpec
import qualified Distribution.Types.LocalBuildConfig as LBC
import Distribution.Types.PackageDescription
import Distribution.Types.PackageId
import Distribution.Types.TargetInfo
import Distribution.Types.UnitId
import Distribution.PackageDescription
import Distribution.Pretty
import Distribution.Simple.Compiler
import Distribution.Simple.Flag
import Distribution.Simple.InstallDirs hiding
( absoluteInstallDirs
, prefixRelativeInstallDirs
, substPathTemplate
)
import Distribution.Simple.PackageIndex
import Distribution.Simple.Program
import Distribution.Simple.Setup.Config
import Distribution.System
import qualified Data.Map as Map
import Distribution.Compat.Graph (Graph)
import qualified Distribution.Compat.Graph as Graph
import System.FilePath ((</>))
data LocalBuildInfo = NewLocalBuildInfo
{ LocalBuildInfo -> LocalBuildDescr
localBuildDescr :: LBC.LocalBuildDescr
, LocalBuildInfo -> LocalBuildConfig
localBuildConfig :: LBC.LocalBuildConfig
}
deriving ((forall x. LocalBuildInfo -> Rep LocalBuildInfo x)
-> (forall x. Rep LocalBuildInfo x -> LocalBuildInfo)
-> Generic LocalBuildInfo
forall x. Rep LocalBuildInfo x -> LocalBuildInfo
forall x. LocalBuildInfo -> Rep LocalBuildInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LocalBuildInfo -> Rep LocalBuildInfo x
from :: forall x. LocalBuildInfo -> Rep LocalBuildInfo x
$cto :: forall x. Rep LocalBuildInfo x -> LocalBuildInfo
to :: forall x. Rep LocalBuildInfo x -> LocalBuildInfo
Generic, ReadPrec [LocalBuildInfo]
ReadPrec LocalBuildInfo
Int -> ReadS LocalBuildInfo
ReadS [LocalBuildInfo]
(Int -> ReadS LocalBuildInfo)
-> ReadS [LocalBuildInfo]
-> ReadPrec LocalBuildInfo
-> ReadPrec [LocalBuildInfo]
-> Read LocalBuildInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LocalBuildInfo
readsPrec :: Int -> ReadS LocalBuildInfo
$creadList :: ReadS [LocalBuildInfo]
readList :: ReadS [LocalBuildInfo]
$creadPrec :: ReadPrec LocalBuildInfo
readPrec :: ReadPrec LocalBuildInfo
$creadListPrec :: ReadPrec [LocalBuildInfo]
readListPrec :: ReadPrec [LocalBuildInfo]
Read, Int -> LocalBuildInfo -> ShowS
[LocalBuildInfo] -> ShowS
LocalBuildInfo -> String
(Int -> LocalBuildInfo -> ShowS)
-> (LocalBuildInfo -> String)
-> ([LocalBuildInfo] -> ShowS)
-> Show LocalBuildInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LocalBuildInfo -> ShowS
showsPrec :: Int -> LocalBuildInfo -> ShowS
$cshow :: LocalBuildInfo -> String
show :: LocalBuildInfo -> String
$cshowList :: [LocalBuildInfo] -> ShowS
showList :: [LocalBuildInfo] -> ShowS
Show, Typeable)
{-# COMPLETE LocalBuildInfo #-}
pattern LocalBuildInfo
:: ConfigFlags
-> FlagAssignment
-> ComponentRequestedSpec
-> [String]
-> InstallDirTemplates
-> Compiler
-> Platform
-> Maybe FilePath
-> Graph ComponentLocalBuildInfo
-> Map ComponentName [ComponentLocalBuildInfo]
-> Map (PackageName, ComponentName) ComponentId
-> InstalledPackageIndex
-> PackageDescription
-> ProgramDb
-> PackageDBStack
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> ProfDetailLevel
-> ProfDetailLevel
-> OptimisationLevel
-> DebugInfoLevel
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> [UnitId]
-> Bool
-> LocalBuildInfo
pattern $mLocalBuildInfo :: forall {r}.
LocalBuildInfo
-> (ConfigFlags
-> FlagAssignment
-> ComponentRequestedSpec
-> [String]
-> InstallDirTemplates
-> Compiler
-> Platform
-> Maybe String
-> Graph ComponentLocalBuildInfo
-> Map ComponentName [ComponentLocalBuildInfo]
-> Map (PackageName, ComponentName) ComponentId
-> InstalledPackageIndex
-> PackageDescription
-> ProgramDb
-> PackageDBStack
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> ProfDetailLevel
-> ProfDetailLevel
-> OptimisationLevel
-> DebugInfoLevel
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> [UnitId]
-> Bool
-> r)
-> ((# #) -> r)
-> r
$bLocalBuildInfo :: ConfigFlags
-> FlagAssignment
-> ComponentRequestedSpec
-> [String]
-> InstallDirTemplates
-> Compiler
-> Platform
-> Maybe String
-> Graph ComponentLocalBuildInfo
-> Map ComponentName [ComponentLocalBuildInfo]
-> Map (PackageName, ComponentName) ComponentId
-> InstalledPackageIndex
-> PackageDescription
-> ProgramDb
-> PackageDBStack
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> ProfDetailLevel
-> ProfDetailLevel
-> OptimisationLevel
-> DebugInfoLevel
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> [UnitId]
-> Bool
-> LocalBuildInfo
LocalBuildInfo
{ LocalBuildInfo -> ConfigFlags
configFlags
, LocalBuildInfo -> FlagAssignment
flagAssignment
, LocalBuildInfo -> ComponentRequestedSpec
componentEnabledSpec
,
, LocalBuildInfo -> InstallDirTemplates
installDirTemplates
, LocalBuildInfo -> Compiler
compiler
, LocalBuildInfo -> Platform
hostPlatform
, LocalBuildInfo -> Maybe String
pkgDescrFile
, LocalBuildInfo -> Graph ComponentLocalBuildInfo
componentGraph
, LocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo]
componentNameMap
, LocalBuildInfo -> Map (PackageName, ComponentName) ComponentId
promisedPkgs
, LocalBuildInfo -> InstalledPackageIndex
installedPkgs
, LocalBuildInfo -> PackageDescription
localPkgDescr
, LocalBuildInfo -> ProgramDb
withPrograms
, LocalBuildInfo -> PackageDBStack
withPackageDB
, LocalBuildInfo -> Bool
withVanillaLib
, LocalBuildInfo -> Bool
withProfLib
, LocalBuildInfo -> Bool
withSharedLib
, LocalBuildInfo -> Bool
withStaticLib
, LocalBuildInfo -> Bool
withDynExe
, LocalBuildInfo -> Bool
withFullyStaticExe
, LocalBuildInfo -> Bool
withProfExe
, LocalBuildInfo -> ProfDetailLevel
withProfLibDetail
, LocalBuildInfo -> ProfDetailLevel
withProfExeDetail
, LocalBuildInfo -> OptimisationLevel
withOptimization
, LocalBuildInfo -> DebugInfoLevel
withDebugInfo
, LocalBuildInfo -> Bool
withGHCiLib
, LocalBuildInfo -> Bool
splitSections
, LocalBuildInfo -> Bool
splitObjs
, LocalBuildInfo -> Bool
stripExes
, LocalBuildInfo -> Bool
stripLibs
, LocalBuildInfo -> Bool
exeCoverage
, LocalBuildInfo -> Bool
libCoverage
,
, LocalBuildInfo -> Bool
relocatable
} =
NewLocalBuildInfo
{ localBuildDescr =
LBC.LocalBuildDescr
{ packageBuildDescr =
LBC.PackageBuildDescr
{ configFlags
, flagAssignment
, componentEnabledSpec
, compiler
, hostPlatform
, localPkgDescr
, installDirTemplates
, withPackageDB
, pkgDescrFile
, extraCoverageFor
}
, componentBuildDescr =
LBC.ComponentBuildDescr
{ componentGraph
, componentNameMap
, promisedPkgs
, installedPkgs
}
}
, localBuildConfig =
LBC.LocalBuildConfig
{ extraConfigArgs
, withPrograms
, withBuildOptions =
LBC.BuildOptions
{ withVanillaLib
, withProfLib
, withSharedLib
, withStaticLib
, withDynExe
, withFullyStaticExe
, withProfExe
, withProfLibDetail
, withProfExeDetail
, withOptimization
, withDebugInfo
, withGHCiLib
, splitSections
, splitObjs
, stripExes
, stripLibs
, exeCoverage
, libCoverage
, relocatable
}
}
}
instance Binary LocalBuildInfo
instance Structured LocalBuildInfo
buildDir :: LocalBuildInfo -> FilePath
buildDir :: LocalBuildInfo -> String
buildDir LocalBuildInfo
lbi =
PackageBuildDescr -> String
buildDirPBD (PackageBuildDescr -> String) -> PackageBuildDescr -> String
forall a b. (a -> b) -> a -> b
$ LocalBuildDescr -> PackageBuildDescr
LBC.packageBuildDescr (LocalBuildDescr -> PackageBuildDescr)
-> LocalBuildDescr -> PackageBuildDescr
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> LocalBuildDescr
localBuildDescr LocalBuildInfo
lbi
buildDirPBD :: LBC.PackageBuildDescr -> FilePath
buildDirPBD :: PackageBuildDescr -> String
buildDirPBD (LBC.PackageBuildDescr{configFlags :: PackageBuildDescr -> ConfigFlags
configFlags = ConfigFlags
cfg}) =
ConfigFlags -> String
configFlagsBuildDir ConfigFlags
cfg
configFlagsBuildDir :: ConfigFlags -> FilePath
configFlagsBuildDir :: ConfigFlags -> String
configFlagsBuildDir ConfigFlags
cfg = Flag String -> String
forall a. WithCallStack (Flag a -> a)
fromFlag (ConfigFlags -> Flag String
configDistPref ConfigFlags
cfg) String -> ShowS
</> String
"build"
cabalFilePath :: LocalBuildInfo -> Maybe FilePath
cabalFilePath :: LocalBuildInfo -> Maybe String
cabalFilePath (LocalBuildInfo{configFlags :: LocalBuildInfo -> ConfigFlags
configFlags = ConfigFlags
cfg}) =
Flag String -> Maybe String
forall a. Flag a -> Maybe a
flagToMaybe (ConfigFlags -> Flag String
configCabalFilePath ConfigFlags
cfg)
progPrefix, progSuffix :: LocalBuildInfo -> PathTemplate
progPrefix :: LocalBuildInfo -> PathTemplate
progPrefix (LocalBuildInfo{configFlags :: LocalBuildInfo -> ConfigFlags
configFlags = ConfigFlags
cfg}) =
Flag PathTemplate -> PathTemplate
forall a. WithCallStack (Flag a -> a)
fromFlag (Flag PathTemplate -> PathTemplate)
-> Flag PathTemplate -> PathTemplate
forall a b. (a -> b) -> a -> b
$ ConfigFlags -> Flag PathTemplate
configProgPrefix ConfigFlags
cfg
progSuffix :: LocalBuildInfo -> PathTemplate
progSuffix (LocalBuildInfo{configFlags :: LocalBuildInfo -> ConfigFlags
configFlags = ConfigFlags
cfg}) =
Flag PathTemplate -> PathTemplate
forall a. WithCallStack (Flag a -> a)
fromFlag (Flag PathTemplate -> PathTemplate)
-> Flag PathTemplate -> PathTemplate
forall a b. (a -> b) -> a -> b
$ ConfigFlags -> Flag PathTemplate
configProgSuffix ConfigFlags
cfg
localComponentId :: LocalBuildInfo -> ComponentId
localComponentId :: LocalBuildInfo -> ComponentId
localComponentId LocalBuildInfo
lbi =
case LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs LocalBuildInfo
lbi (LibraryName -> ComponentName
CLibName LibraryName
LMainLibName) of
[LibComponentLocalBuildInfo{componentComponentId :: ComponentLocalBuildInfo -> ComponentId
componentComponentId = ComponentId
cid}] ->
ComponentId
cid
[ComponentLocalBuildInfo]
_ -> String -> ComponentId
mkComponentId (PackageId -> String
forall a. Pretty a => a -> String
prettyShow (LocalBuildInfo -> PackageId
localPackage LocalBuildInfo
lbi))
localPackage :: LocalBuildInfo -> PackageId
localPackage :: LocalBuildInfo -> PackageId
localPackage (LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) = PackageDescription -> PackageId
package PackageDescription
pkg
localUnitId :: LocalBuildInfo -> UnitId
localUnitId :: LocalBuildInfo -> UnitId
localUnitId LocalBuildInfo
lbi =
case LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs LocalBuildInfo
lbi (LibraryName -> ComponentName
CLibName LibraryName
LMainLibName) of
[LibComponentLocalBuildInfo{componentUnitId :: ComponentLocalBuildInfo -> UnitId
componentUnitId = UnitId
uid}] ->
UnitId
uid
[ComponentLocalBuildInfo]
_ -> PackageId -> UnitId
mkLegacyUnitId (PackageId -> UnitId) -> PackageId -> UnitId
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> PackageId
localPackage LocalBuildInfo
lbi
localCompatPackageKey :: LocalBuildInfo -> String
localCompatPackageKey :: LocalBuildInfo -> String
localCompatPackageKey LocalBuildInfo
lbi =
case LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs LocalBuildInfo
lbi (LibraryName -> ComponentName
CLibName LibraryName
LMainLibName) of
[LibComponentLocalBuildInfo{componentCompatPackageKey :: ComponentLocalBuildInfo -> String
componentCompatPackageKey = String
pk}] ->
String
pk
[ComponentLocalBuildInfo]
_ -> PackageId -> String
forall a. Pretty a => a -> String
prettyShow (LocalBuildInfo -> PackageId
localPackage LocalBuildInfo
lbi)
mkTargetInfo :: PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo :: PackageDescription
-> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo PackageDescription
pkg_descr LocalBuildInfo
_lbi ComponentLocalBuildInfo
clbi =
TargetInfo
{ targetCLBI :: ComponentLocalBuildInfo
targetCLBI = ComponentLocalBuildInfo
clbi
,
targetComponent :: Component
targetComponent =
PackageDescription -> ComponentName -> Component
getComponent
PackageDescription
pkg_descr
(ComponentLocalBuildInfo -> ComponentName
componentLocalName ComponentLocalBuildInfo
clbi)
}
componentNameTargets' :: PackageDescription -> LocalBuildInfo -> ComponentName -> [TargetInfo]
componentNameTargets' :: PackageDescription
-> LocalBuildInfo -> ComponentName -> [TargetInfo]
componentNameTargets' PackageDescription
pkg_descr lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{componentNameMap :: LocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo]
componentNameMap = Map ComponentName [ComponentLocalBuildInfo]
comps}) ComponentName
cname =
case ComponentName
-> Map ComponentName [ComponentLocalBuildInfo]
-> Maybe [ComponentLocalBuildInfo]
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup ComponentName
cname Map ComponentName [ComponentLocalBuildInfo]
comps of
Just [ComponentLocalBuildInfo]
clbis -> (ComponentLocalBuildInfo -> TargetInfo)
-> [ComponentLocalBuildInfo] -> [TargetInfo]
forall a b. (a -> b) -> [a] -> [b]
map (PackageDescription
-> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo PackageDescription
pkg_descr LocalBuildInfo
lbi) [ComponentLocalBuildInfo]
clbis
Maybe [ComponentLocalBuildInfo]
Nothing -> []
unitIdTarget' :: PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo
unitIdTarget' :: PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo
unitIdTarget' PackageDescription
pkg_descr lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{componentGraph :: LocalBuildInfo -> Graph ComponentLocalBuildInfo
componentGraph = Graph ComponentLocalBuildInfo
compsGraph}) UnitId
uid =
case Key ComponentLocalBuildInfo
-> Graph ComponentLocalBuildInfo -> Maybe ComponentLocalBuildInfo
forall a. IsNode a => Key a -> Graph a -> Maybe a
Graph.lookup Key ComponentLocalBuildInfo
UnitId
uid Graph ComponentLocalBuildInfo
compsGraph of
Just ComponentLocalBuildInfo
clbi -> TargetInfo -> Maybe TargetInfo
forall a. a -> Maybe a
Just (PackageDescription
-> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo PackageDescription
pkg_descr LocalBuildInfo
lbi ComponentLocalBuildInfo
clbi)
Maybe ComponentLocalBuildInfo
Nothing -> Maybe TargetInfo
forall a. Maybe a
Nothing
componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs (LocalBuildInfo{componentNameMap :: LocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo]
componentNameMap = Map ComponentName [ComponentLocalBuildInfo]
comps}) ComponentName
cname =
case ComponentName
-> Map ComponentName [ComponentLocalBuildInfo]
-> Maybe [ComponentLocalBuildInfo]
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup ComponentName
cname Map ComponentName [ComponentLocalBuildInfo]
comps of
Just [ComponentLocalBuildInfo]
clbis -> [ComponentLocalBuildInfo]
clbis
Maybe [ComponentLocalBuildInfo]
Nothing -> []
allTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder' PackageDescription
pkg_descr lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{componentGraph :: LocalBuildInfo -> Graph ComponentLocalBuildInfo
componentGraph = Graph ComponentLocalBuildInfo
compsGraph}) =
(ComponentLocalBuildInfo -> TargetInfo)
-> [ComponentLocalBuildInfo] -> [TargetInfo]
forall a b. (a -> b) -> [a] -> [b]
map (PackageDescription
-> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo PackageDescription
pkg_descr LocalBuildInfo
lbi) (Graph ComponentLocalBuildInfo -> [ComponentLocalBuildInfo]
forall a. Graph a -> [a]
Graph.revTopSort Graph ComponentLocalBuildInfo
compsGraph)
withAllTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
withAllTargetsInBuildOrder' :: PackageDescription
-> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
withAllTargetsInBuildOrder' PackageDescription
pkg_descr LocalBuildInfo
lbi TargetInfo -> IO ()
f =
[IO ()] -> IO ()
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [TargetInfo -> IO ()
f TargetInfo
target | TargetInfo
target <- PackageDescription -> LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder' PackageDescription
pkg_descr LocalBuildInfo
lbi]
neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder' PackageDescription
pkg_descr lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{componentGraph :: LocalBuildInfo -> Graph ComponentLocalBuildInfo
componentGraph = Graph ComponentLocalBuildInfo
compsGraph}) [UnitId]
uids =
case Graph ComponentLocalBuildInfo
-> [Key ComponentLocalBuildInfo] -> Maybe [ComponentLocalBuildInfo]
forall a. Graph a -> [Key a] -> Maybe [a]
Graph.closure Graph ComponentLocalBuildInfo
compsGraph [Key ComponentLocalBuildInfo]
[UnitId]
uids of
Maybe [ComponentLocalBuildInfo]
Nothing -> String -> [TargetInfo]
forall a. HasCallStack => String -> a
error (String -> [TargetInfo]) -> String -> [TargetInfo]
forall a b. (a -> b) -> a -> b
$ String
"localBuildPlan: missing uids " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
", " ((UnitId -> String) -> [UnitId] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map UnitId -> String
forall a. Pretty a => a -> String
prettyShow [UnitId]
uids)
Just [ComponentLocalBuildInfo]
clos -> (ComponentLocalBuildInfo -> TargetInfo)
-> [ComponentLocalBuildInfo] -> [TargetInfo]
forall a b. (a -> b) -> [a] -> [b]
map (PackageDescription
-> LocalBuildInfo -> ComponentLocalBuildInfo -> TargetInfo
mkTargetInfo PackageDescription
pkg_descr LocalBuildInfo
lbi) (Graph ComponentLocalBuildInfo -> [ComponentLocalBuildInfo]
forall a. Graph a -> [a]
Graph.revTopSort ([ComponentLocalBuildInfo] -> Graph ComponentLocalBuildInfo
forall a. (IsNode a, Show (Key a)) => [a] -> Graph a
Graph.fromDistinctList [ComponentLocalBuildInfo]
clos))
withNeededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
withNeededTargetsInBuildOrder' :: PackageDescription
-> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
withNeededTargetsInBuildOrder' PackageDescription
pkg_descr LocalBuildInfo
lbi [UnitId]
uids TargetInfo -> IO ()
f =
[IO ()] -> IO ()
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [TargetInfo -> IO ()
f TargetInfo
target | TargetInfo
target <- PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder' PackageDescription
pkg_descr LocalBuildInfo
lbi [UnitId]
uids]
testCoverage :: LocalBuildInfo -> Bool
testCoverage :: LocalBuildInfo -> Bool
testCoverage (LocalBuildInfo{exeCoverage :: LocalBuildInfo -> Bool
exeCoverage = Bool
exes, libCoverage :: LocalBuildInfo -> Bool
libCoverage = Bool
libs}) =
Bool
exes Bool -> Bool -> Bool
&& Bool
libs
{-# WARNING componentNameTargets, unitIdTarget, allTargetsInBuildOrder, withAllTargetsInBuildOrder, neededTargetsInBuildOrder, withNeededTargetsInBuildOrder "By using this function, you may be introducing a bug where you retrieve a 'Component' which does not have 'HookedBuildInfo' applied to it. See the documentation for 'HookedBuildInfo' for an explanation of the issue. If you have a 'PackageDescription' handy (NOT from the 'LocalBuildInfo'), try using the primed version of the function, which takes it as an extra argument." #-}
componentNameTargets :: LocalBuildInfo -> ComponentName -> [TargetInfo]
componentNameTargets :: LocalBuildInfo -> ComponentName -> [TargetInfo]
componentNameTargets lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription
-> LocalBuildInfo -> ComponentName -> [TargetInfo]
componentNameTargets' PackageDescription
pkg LocalBuildInfo
lbi
unitIdTarget :: LocalBuildInfo -> UnitId -> Maybe TargetInfo
unitIdTarget :: LocalBuildInfo -> UnitId -> Maybe TargetInfo
unitIdTarget lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo
unitIdTarget' PackageDescription
pkg LocalBuildInfo
lbi
allTargetsInBuildOrder :: LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder :: LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription -> LocalBuildInfo -> [TargetInfo]
allTargetsInBuildOrder' PackageDescription
pkg LocalBuildInfo
lbi
withAllTargetsInBuildOrder :: LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
withAllTargetsInBuildOrder :: LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
withAllTargetsInBuildOrder lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription
-> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
withAllTargetsInBuildOrder' PackageDescription
pkg LocalBuildInfo
lbi
neededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
neededTargetsInBuildOrder' PackageDescription
pkg LocalBuildInfo
lbi
withNeededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
withNeededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
withNeededTargetsInBuildOrder lbi :: LocalBuildInfo
lbi@(LocalBuildInfo{localPkgDescr :: LocalBuildInfo -> PackageDescription
localPkgDescr = PackageDescription
pkg}) =
PackageDescription
-> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
withNeededTargetsInBuildOrder' PackageDescription
pkg LocalBuildInfo
lbi