module Distribution.Types.ComponentLocalBuildInfo (
ComponentLocalBuildInfo(..),
componentIsIndefinite,
maybeComponentInstantiatedWith,
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.ModuleName
import Distribution.Backpack
import Distribution.Compat.Graph
import Distribution.Types.ComponentId
import Distribution.Types.MungedPackageId
import Distribution.Types.UnitId
import Distribution.Types.ComponentName
import Distribution.Types.MungedPackageName
import Distribution.PackageDescription
import qualified Distribution.InstalledPackageInfo as Installed
data ComponentLocalBuildInfo
= LibComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentComponentId :: ComponentId,
componentUnitId :: UnitId,
componentIsIndefinite_ :: Bool,
componentInstantiatedWith :: [(ModuleName, OpenModule)],
componentPackageDeps :: [(UnitId, MungedPackageId)],
componentIncludes :: [(OpenUnitId, ModuleRenaming)],
componentExeDeps :: [UnitId],
componentInternalDeps :: [UnitId],
componentCompatPackageKey :: String,
componentCompatPackageName :: MungedPackageName,
componentExposedModules :: [Installed.ExposedModule],
componentIsPublic :: Bool
}
| FLibComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentComponentId :: ComponentId,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, MungedPackageId)],
componentIncludes :: [(OpenUnitId, ModuleRenaming)],
componentExeDeps :: [UnitId],
componentInternalDeps :: [UnitId]
}
| ExeComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentComponentId :: ComponentId,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, MungedPackageId)],
componentIncludes :: [(OpenUnitId, ModuleRenaming)],
componentExeDeps :: [UnitId],
componentInternalDeps :: [UnitId]
}
| TestComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentComponentId :: ComponentId,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, MungedPackageId)],
componentIncludes :: [(OpenUnitId, ModuleRenaming)],
componentExeDeps :: [UnitId],
componentInternalDeps :: [UnitId]
}
| BenchComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentComponentId :: ComponentId,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, MungedPackageId)],
componentIncludes :: [(OpenUnitId, ModuleRenaming)],
componentExeDeps :: [UnitId],
componentInternalDeps :: [UnitId]
}
deriving (Generic, Read, Show, Typeable)
instance Binary ComponentLocalBuildInfo
instance Structured ComponentLocalBuildInfo
instance IsNode ComponentLocalBuildInfo where
type Key ComponentLocalBuildInfo = UnitId
nodeKey = componentUnitId
nodeNeighbors = componentInternalDeps
componentIsIndefinite :: ComponentLocalBuildInfo -> Bool
componentIsIndefinite LibComponentLocalBuildInfo{ componentIsIndefinite_ = b } = b
componentIsIndefinite _ = False
maybeComponentInstantiatedWith :: ComponentLocalBuildInfo -> Maybe [(ModuleName, OpenModule)]
maybeComponentInstantiatedWith
LibComponentLocalBuildInfo { componentInstantiatedWith = insts } = Just insts
maybeComponentInstantiatedWith _ = Nothing