Distribution.Client.ProjectBuilding.PackageFileMonitor

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

Safe Haskell | None
Language | Haskell2010

Distribution.Client.ProjectBuilding.PackageFileMonitor

Synopsis

- data PackageFileMonitor = PackageFileMonitor {
  - pkgFileMonitorConfig :: FileMonitor ElaboratedConfiguredPackage ()
  - pkgFileMonitorBuild :: FileMonitor (Set ComponentName) BuildResultMisc
  - pkgFileMonitorReg :: FileMonitor () (Maybe InstalledPackageInfo)
  }
- type BuildResultMisc = (DocsResult, TestsResult)
- newPackageFileMonitor :: ElaboratedSharedConfig -> DistDirLayout -> DistDirParams -> PackageFileMonitor
- packageFileMonitorKeyValues :: ElaboratedConfiguredPackage -> (ElaboratedConfiguredPackage, Set ComponentName)
- checkPackageFileMonitorChanged :: PackageFileMonitor -> ElaboratedConfiguredPackage -> FilePath -> [BuildStatus] -> IO (Either BuildStatusRebuild BuildResult)
- updatePackageConfigFileMonitor :: PackageFileMonitor -> FilePath -> ElaboratedConfiguredPackage -> IO ()
- updatePackageBuildFileMonitor :: PackageFileMonitor -> FilePath -> MonitorTimestamp -> ElaboratedConfiguredPackage -> BuildStatusRebuild -> [MonitorFilePath] -> BuildResultMisc -> IO ()
- updatePackageRegFileMonitor :: PackageFileMonitor -> FilePath -> Maybe InstalledPackageInfo -> IO ()
- invalidatePackageRegFileMonitor :: PackageFileMonitor -> IO ()

# Documentation

data PackageFileMonitor #

As part of the dry run for local unpacked packages we have to check if the package config or files have changed. That is the purpose of `PackageFileMonitor` and `checkPackageFileMonitorChanged`.

When a package is (re)built, the monitor must be updated to reflect the new state of the package. Because we sometimes build without reconfiguring the state updates are split into two, one for package config changes and one for other changes. This is the purpose of `updatePackageConfigFileMonitor` and `updatePackageBuildFileMonitor`.

Constructors

PackageFileMonitor |
Fields pkgFileMonitorConfig :: FileMonitor ElaboratedConfiguredPackage () pkgFileMonitorBuild :: FileMonitor (Set ComponentName) BuildResultMisc pkgFileMonitorReg :: FileMonitor () (Maybe InstalledPackageInfo)

type BuildResultMisc = (DocsResult, TestsResult) #

This is all the components of the `BuildResult` other than the `[`InstalledPackageInfo`]`.

We have to split up the `BuildResult` components since they get produced at different times (or rather, when different things change).

newPackageFileMonitor :: ElaboratedSharedConfig -> DistDirLayout -> DistDirParams -> PackageFileMonitor #

packageFileMonitorKeyValues :: ElaboratedConfiguredPackage -> (ElaboratedConfiguredPackage, Set ComponentName) #

Helper function for `checkPackageFileMonitorChanged`, `updatePackageConfigFileMonitor` and `updatePackageBuildFileMonitor`.

It selects the info from a `ElaboratedConfiguredPackage` that are used by the `FileMonitor`s (in the `PackageFileMonitor`) to detect value changes.

checkPackageFileMonitorChanged :: PackageFileMonitor -> ElaboratedConfiguredPackage -> FilePath -> [BuildStatus] -> IO (Either BuildStatusRebuild BuildResult) #

Do all the checks on whether a package has changed and thus needs either rebuilding or reconfiguring and rebuilding.

updatePackageConfigFileMonitor :: PackageFileMonitor -> FilePath -> ElaboratedConfiguredPackage -> IO () #

updatePackageBuildFileMonitor :: PackageFileMonitor -> FilePath -> MonitorTimestamp -> ElaboratedConfiguredPackage -> BuildStatusRebuild -> [MonitorFilePath] -> BuildResultMisc -> IO () #

updatePackageRegFileMonitor :: PackageFileMonitor -> FilePath -> Maybe InstalledPackageInfo -> IO () #

invalidatePackageRegFileMonitor :: PackageFileMonitor -> IO () #