Skip to content

Commit 8b9c274

Browse files
mpickeringMikolaj
authored andcommitted
Implement v2-outdated command for cabal-install
This commit updates the outdated command to the new v2 architecture: - Transform the old `outdated` command into a new v2-style command `v2-outdated` - Support three modes of operation: - Check for outdated dependencies in v1-style freeze file - Check for outdated dependencies in project context (cabal.project & cabal.project.freeze) - Check for outdated dependencies in local packages Since the `cabal outdated` command now supports the v2-architecture, you can request to run the `v2-outdated` command on any target. I also introduced the `resolveTargetsFromLocalPackages` which resolves which local packages targets refer to without having to run the solver. This will be useful for `cabal check` as well. A change in behaviour from before is that the package description is flattened, so all bounds will be warned about rather than those in conditional branches being ignored. Fixes #8283
1 parent 0f1f67c commit 8b9c274

File tree

30 files changed

+1216
-257
lines changed

30 files changed

+1216
-257
lines changed

Cabal-syntax/src/Distribution/Utils/Generic.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module Distribution.Utils.Generic
5656
, listUnion
5757
, listUnionRight
5858
, ordNub
59+
, sortNub
5960
, ordNubBy
6061
, ordNubRight
6162
, safeHead
@@ -385,6 +386,10 @@ ordNubRight = fst . foldr go ([], Set.empty)
385386
then p
386387
else (x : l, Set.insert x s)
387388

389+
-- | Sort and nub a list
390+
sortNub :: Ord a => [a] -> [a]
391+
sortNub = Set.toList . Set.fromList
392+
388393
-- | A right-biased version of 'listUnion'.
389394
--
390395
-- Example:

Cabal/src/Distribution/Simple/Utils.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ module Distribution.Simple.Utils
185185
, listUnion
186186
, listUnionRight
187187
, ordNub
188+
, sortNub
188189
, ordNubBy
189190
, ordNubRight
190191
, safeHead

cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import qualified System.FilePath.Posix as Posix
3838
import qualified System.FilePath.Windows as Windows
3939
import qualified Data.List.NonEmpty as NE
4040
import Distribution.Solver.Modular.Version (VR)
41-
import Distribution.Pretty (prettyShow)
41+
import Distribution.Pretty (prettyShow, Pretty(..))
4242
import Distribution.Utils.String (trim)
4343
import Text.PrettyPrint
4444
import Distribution.Simple.Utils (ordNub)
@@ -58,6 +58,9 @@ import Distribution.System (OS(Windows), buildOS)
5858
newtype ProjectConfigPath = ProjectConfigPath (NonEmpty FilePath)
5959
deriving (Eq, Show, Generic)
6060

61+
instance Pretty ProjectConfigPath where
62+
pretty = docProjectConfigPath
63+
6164
-- | Sorts URIs after local file paths and longer file paths after shorter ones
6265
-- as measured by the number of path segments. If still equal, then sorting is
6366
-- lexical.

0 commit comments

Comments
 (0)