| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cabal.Plan
Description
Utilities for reading cabal's plan.json file
plan.json are generated when using cabal
Nix-style Local Builds.
Synopsis
- data PlanJson = PlanJson {
- pjCabalVersion :: !Ver
- pjCabalLibVersion :: !Ver
- pjCompilerId :: !PkgId
- pjArch :: !Text
- pjOs :: !Text
- pjUnits :: !(Map UnitId Unit)
- data Unit = Unit {}
- data CompName
- = CompNameLib
- | CompNameSubLib !Text
- | CompNameFLib !Text
- | CompNameExe !Text
- | CompNameTest !Text
- | CompNameBench !Text
- | CompNameSetup
- dispCompName :: CompName -> Text
- data CompInfo = CompInfo {}
- data UnitType
- newtype Ver = Ver [Int]
- dispVer :: Ver -> Text
- newtype PkgName = PkgName Text
- data PkgId = PkgId !PkgName !Ver
- dispPkgId :: PkgId -> Text
- newtype UnitId = UnitId Text
- newtype FlagName = FlagName Text
- data Sha256
- dispSha256 :: Sha256 -> Text
- parseSha256 :: Text -> Maybe Sha256
- sha256ToByteString :: Sha256 -> ByteString
- sha256FromByteString :: ByteString -> Maybe Sha256
- planJsonIdGraph :: PlanJson -> Map UnitId (Set UnitId)
- planJsonIdRoots :: PlanJson -> Set UnitId
- data SearchPlanJson
- = ProjectRelativeToDir FilePath
- | InBuildDir FilePath
- findAndDecodePlanJson :: SearchPlanJson -> IO PlanJson
- findProjectRoot :: FilePath -> IO (Maybe FilePath)
- decodePlanJson :: FilePath -> IO PlanJson
Documentation
Represents the information contained in cabal's plan.json file.
This comprises basic information describing the environment as well
as the install/build plan computed by cabal.
Constructors
| PlanJson | |
Fields
| |
Represents a build-plan unit uniquely identified by its UnitId
Constructors
| Unit | |
Fields
| |
Component name inside a build-plan unit
A similiar type exists in Cabal codebase, see
Distribution.Simple.LocalBuildInfo.ComponentName
Constructors
| CompNameLib | |
| CompNameSubLib !Text | |
| CompNameFLib !Text | Since: 0.3.0.0 |
| CompNameExe !Text | |
| CompNameTest !Text | |
| CompNameBench !Text | |
| CompNameSetup |
Instances
| Eq CompName Source # | |
| Ord CompName Source # | |
| Show CompName Source # | |
| FromJSON CompName Source # | |
Defined in Cabal.Plan | |
| FromJSONKey CompName Source # | |
Defined in Cabal.Plan | |
| ToJSON CompName Source # | |
Defined in Cabal.Plan Methods toEncoding :: CompName -> Encoding toJSONList :: [CompName] -> Value toEncodingList :: [CompName] -> Encoding | |
| ToJSONKey CompName Source # | |
Defined in Cabal.Plan | |
dispCompName :: CompName -> Text Source #
Pretty print CompName
Describes kind of build unit and its provenance
Constructors
| UnitTypeBuiltin | Lives in global (non-nix-style) package db |
| UnitTypeGlobal | Lives in Nix-store cache |
| UnitTypeLocal | Local package |
| UnitTypeInplace | Local in-place package |
Basic types
Equivalent to Cabal's Distribution.Package.Version
Constructors
| Ver [Int] |
Instances
| Eq Ver Source # | |
| Ord Ver Source # | |
| Show Ver Source # | |
| FromJSON Ver Source # | |
Defined in Cabal.Plan | |
| ToJSON Ver Source # | |
Defined in Cabal.Plan | |
Equivalent to Cabal's Distribution.Package.PackageName
Constructors
| PkgName Text |
Instances
| Eq PkgName Source # | |
| Ord PkgName Source # | |
| Show PkgName Source # | |
| FromJSON PkgName Source # | |
Defined in Cabal.Plan | |
| FromJSONKey PkgName Source # | |
Defined in Cabal.Plan | |
| ToJSON PkgName Source # | |
Defined in Cabal.Plan Methods toEncoding :: PkgName -> Encoding toJSONList :: [PkgName] -> Value toEncodingList :: [PkgName] -> Encoding | |
| ToJSONKey PkgName Source # | |
Defined in Cabal.Plan | |
Equivalent to Cabal's Distribution.Package.PackageIdentifier
Instances
| Eq PkgId Source # | |
| Ord PkgId Source # | |
| Show PkgId Source # | |
| FromJSON PkgId Source # | |
Defined in Cabal.Plan | |
| FromJSONKey PkgId Source # | |
Defined in Cabal.Plan | |
| ToJSON PkgId Source # | |
Defined in Cabal.Plan Methods toEncoding :: PkgId -> Encoding toJSONList :: [PkgId] -> Value toEncodingList :: [PkgId] -> Encoding | |
| ToJSONKey PkgId Source # | |
Defined in Cabal.Plan | |
Equivalent to Cabal's Distribution.Package.UnitId
Constructors
| UnitId Text |
Instances
| Eq UnitId Source # | |
| Ord UnitId Source # | |
| Show UnitId Source # | |
| FromJSON UnitId Source # | |
Defined in Cabal.Plan | |
| FromJSONKey UnitId Source # | |
Defined in Cabal.Plan | |
| ToJSON UnitId Source # | |
Defined in Cabal.Plan Methods toEncoding :: UnitId -> Encoding toJSONList :: [UnitId] -> Value toEncodingList :: [UnitId] -> Encoding | |
| ToJSONKey UnitId Source # | |
Defined in Cabal.Plan | |
Equivalent to Cabal's Distribution.PackageDescription.FlagName
Since: 0.3.0.0
Constructors
| FlagName Text |
Instances
| Eq FlagName Source # | |
| Ord FlagName Source # | |
| Show FlagName Source # | |
| FromJSON FlagName Source # | |
Defined in Cabal.Plan | |
| FromJSONKey FlagName Source # | |
Defined in Cabal.Plan | |
| ToJSON FlagName Source # | |
Defined in Cabal.Plan Methods toEncoding :: FlagName -> Encoding toJSONList :: [FlagName] -> Value toEncodingList :: [FlagName] -> Encoding | |
| ToJSONKey FlagName Source # | |
Defined in Cabal.Plan | |
SHA-256
SHA-256 hash
Instances
| Eq Sha256 Source # | |
| Ord Sha256 Source # | |
| Show Sha256 Source # | |
| FromJSON Sha256 Source # | |
Defined in Cabal.Plan | |
| ToJSON Sha256 Source # | |
Defined in Cabal.Plan Methods toEncoding :: Sha256 -> Encoding toJSONList :: [Sha256] -> Value toEncodingList :: [Sha256] -> Encoding | |
dispSha256 :: Sha256 -> Text Source #
Pretty print Sha256 as base-16.
parseSha256 :: Text -> Maybe Sha256 Source #
sha256ToByteString :: Sha256 -> ByteString Source #
Export the Sha256 digest to a 32-byte ByteString.
Since: 0.3.0.0
sha256FromByteString :: ByteString -> Maybe Sha256 Source #
Import the Sha256 digest from a 32-byte ByteString.
Returns Nothing if input ByteString has incorrect length.
Since: 0.3.0.0
Utilities
planJsonIdRoots :: PlanJson -> Set UnitId Source #
Extract UnitId root nodes from dependency graph computed by planJsonIdGraph
Convenience functions
data SearchPlanJson Source #
Where/how to search for the plan.json file.
Constructors
| ProjectRelativeToDir FilePath | Find the project root relative to specified directory and look for plan.json there. |
| InBuildDir FilePath | Look for plan.json in specified build directory. |
Instances
| Eq SearchPlanJson Source # | |
Defined in Cabal.Plan Methods (==) :: SearchPlanJson -> SearchPlanJson -> Bool (/=) :: SearchPlanJson -> SearchPlanJson -> Bool | |
| Read SearchPlanJson Source # | |
Defined in Cabal.Plan Methods readsPrec :: Int -> ReadS SearchPlanJson readList :: ReadS [SearchPlanJson] readPrec :: ReadPrec SearchPlanJson readListPrec :: ReadPrec [SearchPlanJson] | |
| Show SearchPlanJson Source # | |
Defined in Cabal.Plan Methods showsPrec :: Int -> SearchPlanJson -> ShowS show :: SearchPlanJson -> String showList :: [SearchPlanJson] -> ShowS | |
findAndDecodePlanJson :: SearchPlanJson -> IO PlanJson Source #
Locates the project root for cabal project relative to specified directory.
plan.json is located from either the optional build dir argument, or in
the default directory (dist-newstyle) relative to the project root.
The folder assumed to be the project-root is returned as well.
This function determines the project root in a slightly more liberal manner than cabal-install. If no cabal.project is found, cabal-install assumes an implicit cabal.project if the current directory contains any *.cabal files.
This function looks for any *.cabal files in directories above the current one and behaves as if there is an implicit cabal.project in that directory when looking for a plan.json.
Throws IO exceptions on errors.
findProjectRoot :: FilePath -> IO (Maybe FilePath) Source #
Find project root relative to a directory, this emulates cabal's current heuristic, but is slightly more liberal. If no cabal.project is found, cabal-install looks for *.cabal files in the specified directory only. This function also considers *.cabal files in directories higher up in the hierarchy.
decodePlanJson :: FilePath -> IO PlanJson Source #
Decodes plan.json file location provided as FilePath
This is a trivial convenience function so that the caller doesn't
have to depend on aeson directly
Throws IO exceptions on errors.