-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10273 from 9999years/missing-or-private-details
Show why configuring dependencies failed
- Loading branch information
Showing
29 changed files
with
328 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Cabal-syntax/src/Distribution/Types/DependencySatisfaction.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Distribution.Types.DependencySatisfaction | ||
( DependencySatisfaction (..) | ||
) where | ||
|
||
import Distribution.Types.MissingDependencyReason (MissingDependencyReason) | ||
|
||
-- | Whether or not a dependency constraint is satisfied. | ||
data DependencySatisfaction | ||
= -- | The dependency constraint is satisfied. | ||
Satisfied | ||
| -- | The dependency constraint is not satisfied. | ||
-- | ||
-- Includes a reason for explanation. | ||
Unsatisfied MissingDependencyReason |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Distribution.Types.MissingDependency | ||
( MissingDependency (..) | ||
) where | ||
|
||
import Distribution.Compat.Prelude | ||
import Distribution.Pretty | ||
import Distribution.Types.Dependency | ||
( Dependency | ||
, simplifyDependency | ||
) | ||
import Distribution.Types.LibraryName | ||
( prettyLibraryNames | ||
) | ||
import Distribution.Types.MissingDependencyReason | ||
( MissingDependencyReason (..) | ||
) | ||
|
||
import qualified Text.PrettyPrint as PP | ||
|
||
-- | A missing dependency and information on why it's missing. | ||
data MissingDependency = MissingDependency Dependency MissingDependencyReason | ||
deriving (Show) | ||
|
||
instance Pretty MissingDependency where | ||
pretty (MissingDependency dependency reason) = | ||
let prettyReason = | ||
case reason of | ||
MissingLibrary libraries -> | ||
PP.text "missing" <+> prettyLibraryNames PP.empty libraries | ||
MissingPackage -> PP.text "missing" | ||
MissingComponent name -> PP.text "missing component" <+> pretty name | ||
WrongVersion versions -> | ||
PP.text "installed:" <+> commaSpaceSep versions | ||
in pretty (simplifyDependency dependency) <+> PP.parens prettyReason |
25 changes: 25 additions & 0 deletions
25
Cabal-syntax/src/Distribution/Types/MissingDependencyReason.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Distribution.Types.MissingDependencyReason | ||
( MissingDependencyReason (..) | ||
) where | ||
|
||
import Data.List.NonEmpty (NonEmpty) | ||
import Distribution.Types.LibraryName (LibraryName) | ||
import Distribution.Types.PackageName (PackageName) | ||
import Distribution.Types.Version (Version) | ||
|
||
-- | A reason for a depency failing to solve. | ||
-- | ||
-- This helps pinpoint dependencies that are installed with an incorrect | ||
-- version vs. dependencies that are not installed at all. | ||
data MissingDependencyReason | ||
= -- | One or more libraries is missing. | ||
MissingLibrary (NonEmpty LibraryName) | ||
| -- | A package is not installed. | ||
MissingPackage | ||
| -- | A package is installed, but the versions don't match. | ||
-- | ||
-- Contains the available versions. | ||
WrongVersion [Version] | ||
| -- | A component is not installed. | ||
MissingComponent PackageName | ||
deriving (Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.