Distribution.Client.CmdInstall

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

Safe Haskell | None
Language | Haskell2010

Distribution.Client.CmdInstall

Contents

- The `build` CLI and action
- Internals exposed for testing
- Internals exposed for CmdRepl + CmdRun

Description

cabal-install CLI command: build

Synopsis

- installCommand :: CommandUI (NixStyleFlags ClientInstallFlags)
- installAction :: NixStyleFlags ClientInstallFlags -> [String] -> GlobalFlags -> IO ()
- selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either TargetProblem' [k]
- selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either TargetProblem' k
- establishDummyDistDirLayout :: Verbosity -> ProjectConfig -> FilePath -> IO DistDirLayout
- establishDummyProjectBaseContext :: Verbosity -> ProjectConfig -> DistDirLayout -> [PackageSpecifier UnresolvedSourcePackage] -> CurrentCommand -> IO ProjectBaseContext

# The `build` CLI and action

installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) #

installAction :: NixStyleFlags ClientInstallFlags -> [String] -> GlobalFlags -> IO () #

The `install` command actually serves four different needs. It installs: * exes: For example a program from hackage. The behavior is similar to the old install command, except that now conflicts between separate runs of the command are impossible thanks to the store. Exes are installed in the store like a normal dependency, then they are symlinked/copied in the directory specified by --installdir. To do this we need a dummy projectBaseContext containing the targets as extra packages and using a temporary dist directory. * libraries Libraries install through a similar process, but using GHC environment files instead of symlinks. This means that 'v2-install'ing libraries only works on GHC >= 8.0.

For more details on how this works, see the module Distribution.Client.ProjectOrchestration

# Internals exposed for testing

selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either TargetProblem' [k] #

This defines what a `TargetSelector` means for the `bench` command. It selects the `AvailableTarget`s that the `TargetSelector` refers to, or otherwise classifies the problem.

For the `build` command select all components except non-buildable and disabled tests/benchmarks, fail if there are no such components

selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either TargetProblem' k #

For a `TargetComponent` `TargetSelector`, check if the component can be selected.

For the `build` command we just need the basic checks on being buildable etc.

# Internals exposed for CmdRepl + CmdRun

establishDummyDistDirLayout :: Verbosity -> ProjectConfig -> FilePath -> IO DistDirLayout #

establishDummyProjectBaseContext #

Arguments

:: Verbosity |
-> ProjectConfig | Project configuration including the global config if needed
-> DistDirLayout | Where to put the dist directory
-> [PackageSpecifier UnresolvedSourcePackage] | The packages to be included in the project
-> CurrentCommand |
-> IO ProjectBaseContext |

Create a dummy project context, without a .cabal or a .cabal.project file (a place where to put a temporary dist directory is still needed)