module Distribution.Types.InstalledPackageInfo (
InstalledPackageInfo (..),
emptyInstalledPackageInfo,
mungedPackageId,
mungedPackageName,
AbiDependency (..),
ExposedModule (..),
) where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.Backpack
import Distribution.Compat.Graph (IsNode (..))
import Distribution.License
import Distribution.ModuleName
import Distribution.Package hiding (installedUnitId)
import Distribution.Types.AbiDependency
import Distribution.Types.ExposedModule
import Distribution.Types.LibraryName
import Distribution.Types.LibraryVisibility
import Distribution.Types.MungedPackageId
import Distribution.Types.MungedPackageName
import Distribution.Version (nullVersion)
import qualified Distribution.Package as Package
import qualified Distribution.SPDX as SPDX
data InstalledPackageInfo
= InstalledPackageInfo {
sourcePackageId :: PackageId,
sourceLibName :: LibraryName,
installedComponentId_ :: ComponentId,
installedUnitId :: UnitId,
instantiatedWith :: [(ModuleName, OpenModule)],
compatPackageKey :: String,
license :: Either SPDX.License License,
copyright :: String,
maintainer :: String,
author :: String,
stability :: String,
homepage :: String,
pkgUrl :: String,
synopsis :: String,
description :: String,
category :: String,
abiHash :: AbiHash,
indefinite :: Bool,
exposed :: Bool,
exposedModules :: [ExposedModule],
hiddenModules :: [ModuleName],
trusted :: Bool,
importDirs :: [FilePath],
libraryDirs :: [FilePath],
libraryDynDirs :: [FilePath],
dataDir :: FilePath,
hsLibraries :: [String],
extraLibraries :: [String],
extraGHCiLibraries:: [String],
includeDirs :: [FilePath],
includes :: [String],
depends :: [UnitId],
abiDepends :: [AbiDependency],
ccOptions :: [String],
cxxOptions :: [String],
ldOptions :: [String],
frameworkDirs :: [FilePath],
frameworks :: [String],
haddockInterfaces :: [FilePath],
haddockHTMLs :: [FilePath],
pkgRoot :: Maybe FilePath,
libVisibility :: LibraryVisibility
}
deriving (Eq, Generic, Typeable, Read, Show)
instance Binary InstalledPackageInfo
instance NFData InstalledPackageInfo where rnf = genericRnf
instance Package.HasMungedPackageId InstalledPackageInfo where
mungedId = mungedPackageId
instance Package.Package InstalledPackageInfo where
packageId = sourcePackageId
instance Package.HasUnitId InstalledPackageInfo where
installedUnitId = installedUnitId
instance Package.PackageInstalled InstalledPackageInfo where
installedDepends = depends
instance IsNode InstalledPackageInfo where
type Key InstalledPackageInfo = UnitId
nodeKey = installedUnitId
nodeNeighbors = depends
mungedPackageId :: InstalledPackageInfo -> MungedPackageId
mungedPackageId ipi =
MungedPackageId (mungedPackageName ipi) (packageVersion ipi)
mungedPackageName :: InstalledPackageInfo -> MungedPackageName
mungedPackageName ipi = MungedPackageName (packageName ipi) (sourceLibName ipi)
emptyInstalledPackageInfo :: InstalledPackageInfo
emptyInstalledPackageInfo
= InstalledPackageInfo {
sourcePackageId = PackageIdentifier (mkPackageName "") nullVersion,
sourceLibName = LMainLibName,
installedComponentId_ = mkComponentId "",
installedUnitId = mkUnitId "",
instantiatedWith = [],
compatPackageKey = "",
license = Left SPDX.NONE,
copyright = "",
maintainer = "",
author = "",
stability = "",
homepage = "",
pkgUrl = "",
synopsis = "",
description = "",
category = "",
abiHash = mkAbiHash "",
indefinite = False,
exposed = False,
exposedModules = [],
hiddenModules = [],
trusted = False,
importDirs = [],
libraryDirs = [],
libraryDynDirs = [],
dataDir = "",
hsLibraries = [],
extraLibraries = [],
extraGHCiLibraries= [],
includeDirs = [],
includes = [],
depends = [],
abiDepends = [],
ccOptions = [],
cxxOptions = [],
ldOptions = [],
frameworkDirs = [],
frameworks = [],
haddockInterfaces = [],
haddockHTMLs = [],
pkgRoot = Nothing,
libVisibility = LibraryVisibilityPrivate
}