Distribution.Client.DistDirLayout

cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.DistDirLayout

Contents

- `DistDirLayout`
- `ProjectRoot`
- `StoreDirLayout`
- `CabalDirLayout`

Description

The layout of the ./dist/ directory where cabal keeps all of its state and build artifacts.

Synopsis

- data DistDirLayout = DistDirLayout {
  - distProjectRootDirectory :: FilePath
  - distProjectFile :: String -> FilePath
  - distDirectory :: FilePath
  - distBuildDirectory :: DistDirParams -> FilePath
  - distBuildRootDirectory :: FilePath
  - distDownloadSrcDirectory :: FilePath
  - distUnpackedSrcDirectory :: PackageId -> FilePath
  - distUnpackedSrcRootDirectory :: FilePath
  - distProjectCacheFile :: String -> FilePath
  - distProjectCacheDirectory :: FilePath
  - distPackageCacheFile :: DistDirParams -> String -> FilePath
  - distPackageCacheDirectory :: DistDirParams -> FilePath
  - distSdistFile :: PackageId -> FilePath
  - distSdistDirectory :: FilePath
  - distTempDirectory :: FilePath
  - distBinDirectory :: FilePath
  - distPackageDB :: CompilerId -> PackageDB
  - distHaddockOutputDir :: Maybe FilePath
  }
- data DistDirParams = DistDirParams {
  - distParamUnitId :: UnitId
  - distParamPackageId :: PackageId
  - distParamComponentId :: ComponentId
  - distParamComponentName :: Maybe ComponentName
  - distParamCompilerId :: CompilerId
  - distParamPlatform :: Platform
  - distParamOptimization :: OptimisationLevel
  }
- defaultDistDirLayout :: ProjectRoot -> Maybe FilePath -> Maybe FilePath -> DistDirLayout
- data ProjectRoot
  - = ProjectRootImplicit FilePath
  - | ProjectRootExplicit FilePath FilePath
  - | ProjectRootExplicitAbsolute FilePath FilePath
- defaultProjectFile :: FilePath
- data StoreDirLayout = StoreDirLayout {
  - storeDirectory :: Compiler -> FilePath
  - storePackageDirectory :: Compiler -> UnitId -> FilePath
  - storePackageDBPath :: Compiler -> FilePath
  - storePackageDB :: Compiler -> PackageDB
  - storePackageDBStack :: Compiler -> [Maybe PackageDB] -> PackageDBStack
  - storeIncomingDirectory :: Compiler -> FilePath
  - storeIncomingLock :: Compiler -> UnitId -> FilePath
  }
- defaultStoreDirLayout :: FilePath -> StoreDirLayout
- data CabalDirLayout = CabalDirLayout {
  - cabalStoreDirLayout :: StoreDirLayout
  - cabalLogsDirectory :: FilePath
  }
- mkCabalDirLayout :: Maybe FilePath -> Maybe FilePath -> IO CabalDirLayout
- defaultCabalDirLayout :: IO CabalDirLayout

# `DistDirLayout`

data DistDirLayout #

The layout of the project state directory. Traditionally this has been called the `dist` directory.

Constructors

DistDirLayout |
Fields distProjectRootDirectory :: FilePath The root directory of the project. Many other files are relative to this location (e.g. the `cabal.project` file). distProjectFile :: String -> FilePath The `cabal.project` file and related like `cabal.project.freeze`. The parameter is for the extension, like "freeze", or "" for the main file. distDirectory :: FilePath The "dist" directory, which is the root of where cabal keeps all its state including the build artifacts from each package we build. distBuildDirectory :: DistDirParams -> FilePath The directory under dist where we keep the build artifacts for a package we're building from a local directory. This uses a `UnitId` not just a `PackageName` because technically we can have multiple instances of the same package in a solution (e.g. setup deps). distBuildRootDirectory :: FilePath distDownloadSrcDirectory :: FilePath The directory under dist where we download tarballs and source control repos to. distUnpackedSrcDirectory :: PackageId -> FilePath The directory under dist where we put the unpacked sources of packages, in those cases where it makes sense to keep the build artifacts to reduce rebuild times. distUnpackedSrcRootDirectory :: FilePath distProjectCacheFile :: String -> FilePath The location for project-wide cache files (e.g. state used in incremental rebuilds). distProjectCacheDirectory :: FilePath distPackageCacheFile :: DistDirParams -> String -> FilePath The location for package-specific cache files (e.g. state used in incremental rebuilds). distPackageCacheDirectory :: DistDirParams -> FilePath distSdistFile :: PackageId -> FilePath The location that sdists are placed by default. distSdistDirectory :: FilePath distTempDirectory :: FilePath distBinDirectory :: FilePath distPackageDB :: CompilerId -> PackageDB distHaddockOutputDir :: Maybe FilePath Is needed when `--haddock-output-dir` flag is used.

data DistDirParams #

Information which can be used to construct the path to the build directory of a build. This is LESS fine-grained than what goes into the hashed `InstalledPackageId`, and for good reason: we don't want this path to change if the user, say, adds a dependency to their project.

Constructors

DistDirParams |
Fields distParamUnitId :: UnitId distParamPackageId :: PackageId distParamComponentId :: ComponentId distParamComponentName :: Maybe ComponentName distParamCompilerId :: CompilerId distParamPlatform :: Platform distParamOptimization :: OptimisationLevel

defaultDistDirLayout #

Arguments

:: ProjectRoot | the project root
-> Maybe FilePath | the `dist` directory or default (absolute or relative to the root)
-> Maybe FilePath | the documentation directory
-> DistDirLayout |

Make the default `DistDirLayout` based on the project root dir and optional overrides for the location of the `dist` directory, the `cabal.project` file and the documentation directory.

# `ProjectRoot`

data ProjectRoot #

Information about the root directory of the project.

It can either be an implicit project root in the current dir if no `cabal.project` file is found, or an explicit root if either the file is found or the project root directory was specicied.

Constructors

ProjectRootImplicit FilePath | An implicit project root. It contains the absolute project root dir.
ProjectRootExplicit FilePath FilePath | An explicit project root. It contains the absolute project root dir and the relative `cabal.project` file (or explicit override)
ProjectRootExplicitAbsolute FilePath FilePath | An explicit, absolute project root dir and an explicit, absolute `cabal.project` file.

#### Instances

Instances details

Show ProjectRoot # |
Instance details Defined in Distribution.Client.DistDirLayout Methods showsPrec :: Int -> ProjectRoot -> ShowS # show :: ProjectRoot -> String # showList :: [ProjectRoot] -> ShowS #
Eq ProjectRoot # |
Instance details Defined in Distribution.Client.DistDirLayout Methods (==) :: ProjectRoot -> ProjectRoot -> Bool # (/=) :: ProjectRoot -> ProjectRoot -> Bool #

defaultProjectFile :: FilePath #

# `StoreDirLayout`

data StoreDirLayout #

The layout of a cabal nix-style store.

Constructors

StoreDirLayout |
Fields storeDirectory :: Compiler -> FilePath storePackageDirectory :: Compiler -> UnitId -> FilePath storePackageDBPath :: Compiler -> FilePath storePackageDB :: Compiler -> PackageDB storePackageDBStack :: Compiler -> [Maybe PackageDB] -> PackageDBStack storeIncomingDirectory :: Compiler -> FilePath storeIncomingLock :: Compiler -> UnitId -> FilePath

defaultStoreDirLayout :: FilePath -> StoreDirLayout #

# `CabalDirLayout`

data CabalDirLayout #

The layout of the user-wide cabal directory, that is the `~/.cabal` dir on unix, and equivalents on other systems.

At the moment this is just a partial specification, but the idea is eventually to cover it all.

Constructors

CabalDirLayout |
Fields cabalStoreDirLayout :: StoreDirLayout cabalLogsDirectory :: FilePath

mkCabalDirLayout #

Arguments

:: Maybe FilePath | Store directory. Must be absolute
-> Maybe FilePath | Log directory
-> IO CabalDirLayout |

defaultCabalDirLayout :: IO CabalDirLayout #