diff --git a/Cabal/src/Distribution/PackageDescription/Check/Target.hs b/Cabal/src/Distribution/PackageDescription/Check/Target.hs index 135bc5c6e20..4d24f190710 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Target.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Target.hs @@ -338,7 +338,9 @@ checkBuildInfo cet ams ads bi = do let ick = const (PackageDistInexcusable BaseNoUpperBounds) rck = PackageDistSuspiciousWarn . MissingUpperBounds cet checkPVP ick ids - checkPVPs rck rds + unless + (isInternalTarget cet) + (checkPVPs rck rds) -- Custom fields well-formedness (ASCII). mapM_ checkCustomField (customFieldsBI bi) @@ -728,6 +730,16 @@ mergeDependencies l@(d : _) = depName :: Dependency -> String depName wd = unPackageName . depPkgName $ wd +-- Is this an internal target? We do not perform PVP checks on those, +-- see https://github.com/haskell/cabal/pull/8361#issuecomment-1577547091 +isInternalTarget :: CEType -> Bool +isInternalTarget (CETLibrary{}) = False +isInternalTarget (CETForeignLibrary{}) = False +isInternalTarget (CETExecutable{}) = False +isInternalTarget (CETTest{}) = True +isInternalTarget (CETBenchmark{}) = True +isInternalTarget (CETSetup{}) = False + -- ------------------------------------------------------------ -- Options -- ------------------------------------------------------------ diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index c11461ef82c..1ae0d9934d6 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -1258,7 +1258,7 @@ A list of all warnings with their constructor: - UnknownArch: unknown architecture in condition. - UnknownCompiler: unknown compiler in condition. - BaseNoUpperBounds: missing upper bounds for important dependencies (``base``, and for ``custom-setup`` ``Cabal`` too). -- MissingUpperBounds: missing upper bound in dependency. +- MissingUpperBounds: missing upper bound in dependency (excluding test-suites and benchmarks). - SuspiciousFlagName: troublesome flag name (e.g. starting with a dash). - DeclaredUsedFlags: unused user flags. - NonASCIICustomField: non-ASCII characters in custom field.