cabal-plan-0.7.3.0: Library and utility for processing cabal's plan.json file
LicenseGPL-2.0-or-later
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cabal.Plan

Description

Utilities for reading cabal's plan.json file

plan.json are generated when using cabal Nix-style Local Builds.

Synopsis

Documentation

data PlanJson Source #

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

Instances

Instances details
FromJSON PlanJson Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser PlanJson

parseJSONList :: Value -> Parser [PlanJson]

Show PlanJson Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> PlanJson -> ShowS

show :: PlanJson -> String

showList :: [PlanJson] -> ShowS

data Unit Source #

Represents a build-plan unit uniquely identified by its UnitId

Constructors

Unit 

Fields

  • uId :: !UnitId

    Unit ID uniquely identifying a Unit in install plan

  • uPId :: !PkgId

    Package name and version (not necessarily unique within plan)

  • uType :: !UnitType

    Describes type of build item, see UnitType

  • uSha256 :: !(Maybe Sha256)

    SHA256 source tarball checksum (as used by e.g. hackage-security)

  • uCabalSha256 :: !(Maybe Sha256)

    SHA256 package description metadata checksum

    In other words, the checksum of the .cabal file that was used as input to the build planning

    NOTE: This meta-information is available only for pjCabalVersion >= 2.4.1.0

    Since: 0.5.0.0

  • uComps :: !(Map CompName CompInfo)

    Components identified by UnitId

    When cabal needs to fall back to legacy-mode (currently for custom build-types or obsolete cabal-version values), uComps may contain more than one element.

  • uFlags :: !(Map FlagName Bool)

    cabal flag settings (not available for UnitTypeBuiltin)

  • uDistDir :: !(Maybe FilePath)

    In-place dist-dir (if available)

    Since: 0.3.0.0

  • uPkgSrc :: !(Maybe PkgLoc)

    Source of the package

    NOTE: This meta-information is available only for pjCabalVersion >= 2.4.0.0

    Since: 0.5.0.0

Instances

Instances details
FromJSON Unit Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser Unit

parseJSONList :: Value -> Parser [Unit]

Show Unit Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> Unit -> ShowS

show :: Unit -> String

showList :: [Unit] -> ShowS

data CompName Source #

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

Instances details
FromJSON CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser CompName

parseJSONList :: Value -> Parser [CompName]

FromJSONKey CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction CompName

fromJSONKeyList :: FromJSONKeyFunction [CompName]

ToJSON CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: CompName -> Value

toEncoding :: CompName -> Encoding

toJSONList :: [CompName] -> Value

toEncodingList :: [CompName] -> Encoding

ToJSONKey CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction CompName

toJSONKeyList :: ToJSONKeyFunction [CompName]

Show CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> CompName -> ShowS

show :: CompName -> String

showList :: [CompName] -> ShowS

Eq CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: CompName -> CompName -> Bool

(/=) :: CompName -> CompName -> Bool

Ord CompName Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: CompName -> CompName -> Ordering

(<) :: CompName -> CompName -> Bool

(<=) :: CompName -> CompName -> Bool

(>) :: CompName -> CompName -> Bool

(>=) :: CompName -> CompName -> Bool

max :: CompName -> CompName -> CompName

min :: CompName -> CompName -> CompName

dispCompName :: CompName -> Text Source #

Pretty print CompName in the same syntax that is used in plan.json. Note that this string can not be used as a target-selector on the cabal command-line. See dispCompNameTarget for a target-selector compatible pretty printer.

dispCompNameTarget :: PkgName -> CompName -> Text Source #

Pretty print CompName in cabal's target-selector syntax.

Since: 0.5.0.0

data CompInfo Source #

Describes component-specific information inside a Unit

Constructors

CompInfo 

Fields

Instances

Instances details
FromJSON CompInfo Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser CompInfo

parseJSONList :: Value -> Parser [CompInfo]

Show CompInfo Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> CompInfo -> ShowS

show :: CompInfo -> String

showList :: [CompInfo] -> ShowS

data UnitType Source #

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

Instances

Instances details
Show UnitType Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> UnitType -> ShowS

show :: UnitType -> String

showList :: [UnitType] -> ShowS

Eq UnitType Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: UnitType -> UnitType -> Bool

(/=) :: UnitType -> UnitType -> Bool

Basic types

newtype Ver Source #

Equivalent to Cabal's Distribution.Package.Version

Constructors

Ver [Int] 

Instances

Instances details
FromJSON Ver Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser Ver

parseJSONList :: Value -> Parser [Ver]

ToJSON Ver Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: Ver -> Value

toEncoding :: Ver -> Encoding

toJSONList :: [Ver] -> Value

toEncodingList :: [Ver] -> Encoding

Show Ver Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> Ver -> ShowS

show :: Ver -> String

showList :: [Ver] -> ShowS

Eq Ver Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: Ver -> Ver -> Bool

(/=) :: Ver -> Ver -> Bool

Ord Ver Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: Ver -> Ver -> Ordering

(<) :: Ver -> Ver -> Bool

(<=) :: Ver -> Ver -> Bool

(>) :: Ver -> Ver -> Bool

(>=) :: Ver -> Ver -> Bool

max :: Ver -> Ver -> Ver

min :: Ver -> Ver -> Ver

dispVer :: Ver -> Text Source #

Pretty print Ver

newtype PkgName Source #

Equivalent to Cabal's Distribution.Package.PackageName

Constructors

PkgName Text 

Instances

Instances details
FromJSON PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser PkgName

parseJSONList :: Value -> Parser [PkgName]

FromJSONKey PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction PkgName

fromJSONKeyList :: FromJSONKeyFunction [PkgName]

ToJSON PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: PkgName -> Value

toEncoding :: PkgName -> Encoding

toJSONList :: [PkgName] -> Value

toEncodingList :: [PkgName] -> Encoding

ToJSONKey PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction PkgName

toJSONKeyList :: ToJSONKeyFunction [PkgName]

Show PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> PkgName -> ShowS

show :: PkgName -> String

showList :: [PkgName] -> ShowS

Eq PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: PkgName -> PkgName -> Bool

(/=) :: PkgName -> PkgName -> Bool

Ord PkgName Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: PkgName -> PkgName -> Ordering

(<) :: PkgName -> PkgName -> Bool

(<=) :: PkgName -> PkgName -> Bool

(>) :: PkgName -> PkgName -> Bool

(>=) :: PkgName -> PkgName -> Bool

max :: PkgName -> PkgName -> PkgName

min :: PkgName -> PkgName -> PkgName

data PkgId Source #

Equivalent to Cabal's Distribution.Package.PackageIdentifier

Constructors

PkgId !PkgName !Ver 

Instances

Instances details
FromJSON PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser PkgId

parseJSONList :: Value -> Parser [PkgId]

FromJSONKey PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction PkgId

fromJSONKeyList :: FromJSONKeyFunction [PkgId]

ToJSON PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: PkgId -> Value

toEncoding :: PkgId -> Encoding

toJSONList :: [PkgId] -> Value

toEncodingList :: [PkgId] -> Encoding

ToJSONKey PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction PkgId

toJSONKeyList :: ToJSONKeyFunction [PkgId]

Show PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> PkgId -> ShowS

show :: PkgId -> String

showList :: [PkgId] -> ShowS

Eq PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: PkgId -> PkgId -> Bool

(/=) :: PkgId -> PkgId -> Bool

Ord PkgId Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: PkgId -> PkgId -> Ordering

(<) :: PkgId -> PkgId -> Bool

(<=) :: PkgId -> PkgId -> Bool

(>) :: PkgId -> PkgId -> Bool

(>=) :: PkgId -> PkgId -> Bool

max :: PkgId -> PkgId -> PkgId

min :: PkgId -> PkgId -> PkgId

dispPkgId :: PkgId -> Text Source #

Pretty print PkgId

newtype UnitId Source #

Equivalent to Cabal's Distribution.Package.UnitId

Constructors

UnitId Text 

Instances

Instances details
FromJSON UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser UnitId

parseJSONList :: Value -> Parser [UnitId]

FromJSONKey UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction UnitId

fromJSONKeyList :: FromJSONKeyFunction [UnitId]

ToJSON UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: UnitId -> Value

toEncoding :: UnitId -> Encoding

toJSONList :: [UnitId] -> Value

toEncodingList :: [UnitId] -> Encoding

ToJSONKey UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction UnitId

toJSONKeyList :: ToJSONKeyFunction [UnitId]

Show UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> UnitId -> ShowS

show :: UnitId -> String

showList :: [UnitId] -> ShowS

Eq UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: UnitId -> UnitId -> Bool

(/=) :: UnitId -> UnitId -> Bool

Ord UnitId Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: UnitId -> UnitId -> Ordering

(<) :: UnitId -> UnitId -> Bool

(<=) :: UnitId -> UnitId -> Bool

(>) :: UnitId -> UnitId -> Bool

(>=) :: UnitId -> UnitId -> Bool

max :: UnitId -> UnitId -> UnitId

min :: UnitId -> UnitId -> UnitId

newtype FlagName Source #

Equivalent to Cabal's Distribution.PackageDescription.FlagName

Since: 0.3.0.0

Constructors

FlagName Text 

Instances

Instances details
FromJSON FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser FlagName

parseJSONList :: Value -> Parser [FlagName]

FromJSONKey FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction FlagName

fromJSONKeyList :: FromJSONKeyFunction [FlagName]

ToJSON FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: FlagName -> Value

toEncoding :: FlagName -> Encoding

toJSONList :: [FlagName] -> Value

toEncodingList :: [FlagName] -> Encoding

ToJSONKey FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction FlagName

toJSONKeyList :: ToJSONKeyFunction [FlagName]

Show FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> FlagName -> ShowS

show :: FlagName -> String

showList :: [FlagName] -> ShowS

Eq FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: FlagName -> FlagName -> Bool

(/=) :: FlagName -> FlagName -> Bool

Ord FlagName Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: FlagName -> FlagName -> Ordering

(<) :: FlagName -> FlagName -> Bool

(<=) :: FlagName -> FlagName -> Bool

(>) :: FlagName -> FlagName -> Bool

(>=) :: FlagName -> FlagName -> Bool

max :: FlagName -> FlagName -> FlagName

min :: FlagName -> FlagName -> FlagName

SHA-256

data Sha256 Source #

SHA-256 hash

Instances

Instances details
FromJSON Sha256 Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser Sha256

parseJSONList :: Value -> Parser [Sha256]

ToJSON Sha256 Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: Sha256 -> Value

toEncoding :: Sha256 -> Encoding

toJSONList :: [Sha256] -> Value

toEncodingList :: [Sha256] -> Encoding

Show Sha256 Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> Sha256 -> ShowS

show :: Sha256 -> String

showList :: [Sha256] -> ShowS

Eq Sha256 Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: Sha256 -> Sha256 -> Bool

(/=) :: Sha256 -> Sha256 -> Bool

Ord Sha256 Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: Sha256 -> Sha256 -> Ordering

(<) :: Sha256 -> Sha256 -> Bool

(<=) :: Sha256 -> Sha256 -> Bool

(>) :: Sha256 -> Sha256 -> Bool

(>=) :: Sha256 -> Sha256 -> Bool

max :: Sha256 -> Sha256 -> Sha256

min :: Sha256 -> Sha256 -> Sha256

dispSha256 :: Sha256 -> Text Source #

Pretty print Sha256 as base-16.

parseSha256 :: Text -> Maybe Sha256 Source #

Parse base-16 encoded Sha256.

Returns Nothing in case of parsing failure.

Since: 0.3.0.0

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

PkgLoc

data PkgLoc Source #

Equivalent to Cabal's Distribution.Client.Types.PackageLocation

Since: 0.5.0.0

Instances

Instances details
FromJSON PkgLoc Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser PkgLoc

parseJSONList :: Value -> Parser [PkgLoc]

Show PkgLoc Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> PkgLoc -> ShowS

show :: PkgLoc -> String

showList :: [PkgLoc] -> ShowS

Eq PkgLoc Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: PkgLoc -> PkgLoc -> Bool

(/=) :: PkgLoc -> PkgLoc -> Bool

Ord PkgLoc Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: PkgLoc -> PkgLoc -> Ordering

(<) :: PkgLoc -> PkgLoc -> Bool

(<=) :: PkgLoc -> PkgLoc -> Bool

(>) :: PkgLoc -> PkgLoc -> Bool

(>=) :: PkgLoc -> PkgLoc -> Bool

max :: PkgLoc -> PkgLoc -> PkgLoc

min :: PkgLoc -> PkgLoc -> PkgLoc

data Repo Source #

Equivalent to Cabal's Distribution.Types.SourceRepo

Since: 0.5.0.0

Constructors

RepoLocal !FilePath 
RepoRemote !URI 
RepoSecure !URI 
RepoLocalNoIndex !FilePath 

Instances

Instances details
FromJSON Repo Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser Repo

parseJSONList :: Value -> Parser [Repo]

Show Repo Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> Repo -> ShowS

show :: Repo -> String

showList :: [Repo] -> ShowS

Eq Repo Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: Repo -> Repo -> Bool

(/=) :: Repo -> Repo -> Bool

Ord Repo Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: Repo -> Repo -> Ordering

(<) :: Repo -> Repo -> Bool

(<=) :: Repo -> Repo -> Bool

(>) :: Repo -> Repo -> Bool

(>=) :: Repo -> Repo -> Bool

max :: Repo -> Repo -> Repo

min :: Repo -> Repo -> Repo

data SourceRepo Source #

Equivalent to Cabal's Distribution.Client.Types.Repo

Since: 0.5.0.0

Constructors

SourceRepo 

Fields

Instances

Instances details
FromJSON SourceRepo Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser SourceRepo

parseJSONList :: Value -> Parser [SourceRepo]

Show SourceRepo Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> SourceRepo -> ShowS

show :: SourceRepo -> String

showList :: [SourceRepo] -> ShowS

Eq SourceRepo Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: SourceRepo -> SourceRepo -> Bool

(/=) :: SourceRepo -> SourceRepo -> Bool

Ord SourceRepo Source # 
Instance details

Defined in Cabal.Plan

newtype URI Source #

Represents an URI (used e.g. by Repo)

Since: 0.5.0.0

Constructors

URI Text 

Instances

Instances details
FromJSON URI Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser URI

parseJSONList :: Value -> Parser [URI]

FromJSONKey URI Source # 
Instance details

Defined in Cabal.Plan

Methods

fromJSONKey :: FromJSONKeyFunction URI

fromJSONKeyList :: FromJSONKeyFunction [URI]

ToJSON URI Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSON :: URI -> Value

toEncoding :: URI -> Encoding

toJSONList :: [URI] -> Value

toEncodingList :: [URI] -> Encoding

ToJSONKey URI Source # 
Instance details

Defined in Cabal.Plan

Methods

toJSONKey :: ToJSONKeyFunction URI

toJSONKeyList :: ToJSONKeyFunction [URI]

Show URI Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> URI -> ShowS

show :: URI -> String

showList :: [URI] -> ShowS

Eq URI Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: URI -> URI -> Bool

(/=) :: URI -> URI -> Bool

Ord URI Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: URI -> URI -> Ordering

(<) :: URI -> URI -> Bool

(<=) :: URI -> URI -> Bool

(>) :: URI -> URI -> Bool

(>=) :: URI -> URI -> Bool

max :: URI -> URI -> URI

min :: URI -> URI -> URI

data RepoType Source #

Equivalent to Cabal's Distribution.Client.SourceRepo.RepoType

Since: 0.5.0.0

Instances

Instances details
FromJSON RepoType Source # 
Instance details

Defined in Cabal.Plan

Methods

parseJSON :: Value -> Parser RepoType

parseJSONList :: Value -> Parser [RepoType]

Show RepoType Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> RepoType -> ShowS

show :: RepoType -> String

showList :: [RepoType] -> ShowS

Eq RepoType Source # 
Instance details

Defined in Cabal.Plan

Methods

(==) :: RepoType -> RepoType -> Bool

(/=) :: RepoType -> RepoType -> Bool

Ord RepoType Source # 
Instance details

Defined in Cabal.Plan

Methods

compare :: RepoType -> RepoType -> Ordering

(<) :: RepoType -> RepoType -> Bool

(<=) :: RepoType -> RepoType -> Bool

(>) :: RepoType -> RepoType -> Bool

(>=) :: RepoType -> RepoType -> Bool

max :: RepoType -> RepoType -> RepoType

min :: RepoType -> RepoType -> RepoType

Utilities

planJsonIdGraph :: PlanJson -> Map UnitId (Set UnitId) Source #

Extract directed UnitId dependency graph edges from pjUnits

This graph contains both, library and executable dependencies edges

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.

ExactPath FilePath

Exact location of plan.json

Instances

Instances details
Read SearchPlanJson Source # 
Instance details

Defined in Cabal.Plan

Methods

readsPrec :: Int -> ReadS SearchPlanJson

readList :: ReadS [SearchPlanJson]

readPrec :: ReadPrec SearchPlanJson

readListPrec :: ReadPrec [SearchPlanJson]

Show SearchPlanJson Source # 
Instance details

Defined in Cabal.Plan

Methods

showsPrec :: Int -> SearchPlanJson -> ShowS

show :: SearchPlanJson -> String

showList :: [SearchPlanJson] -> ShowS

Eq SearchPlanJson Source # 
Instance details

Defined in Cabal.Plan

findPlanJson :: SearchPlanJson -> IO FilePath Source #

Find plan.json.

When ProjectRelativeToDir is passed 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.

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.

Since: 0.6.2.0

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.