From a71e0fcca89b16f9dc0dbc8add4ef9a1684617c5 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 10:10:51 -0400 Subject: [PATCH 1/8] Set -Wunused-packages --- project-cabal/ghc-options.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project-cabal/ghc-options.config b/project-cabal/ghc-options.config index e3ece385c5c..acea85803f1 100644 --- a/project-cabal/ghc-options.config +++ b/project-cabal/ghc-options.config @@ -1,2 +1,2 @@ program-options - ghc-options: -fno-ignore-asserts -Werror + ghc-options: -fno-ignore-asserts -Werror -Wunused-packages From b7325d7d9cde2ae73c9bb691383a2ba100652b37 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 10:11:04 -0400 Subject: [PATCH 2/8] Remove transformers from Cabal-described --- Cabal-described/Cabal-described.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/Cabal-described/Cabal-described.cabal b/Cabal-described/Cabal-described.cabal index f5a5f49f6a5..99b9b6c722d 100644 --- a/Cabal-described/Cabal-described.cabal +++ b/Cabal-described/Cabal-described.cabal @@ -19,7 +19,6 @@ library , rere >=0.1 && <0.3 , tasty , tasty-quickcheck - , transformers exposed-modules: Distribution.Described From fd93edfa71856ffc88aa5adb9650eb9f4c429fc8 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 10:11:57 -0400 Subject: [PATCH 3/8] Remove Cabal from cabal-install-solver:unit-tests --- cabal-install-solver/cabal-install-solver.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index df3fbcc7f26..472adf09e21 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -135,7 +135,6 @@ Test-Suite unit-tests build-depends: , base >= 4.10 && <4.20 - , Cabal , Cabal-syntax , cabal-install-solver , tasty >= 1.2.3 && <1.6 From 5ae2d6123e54ae93c4356e685b87665bfaed26fb Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 10:14:08 -0400 Subject: [PATCH 4/8] Remove unused packages from Cabal-tests - Remove stm and containers from hackage-tests - Remove tasty-expected-failure from check-tests - Remove tasty-quickcheck from parser-tests - Remove async, binary, Cabal-tests, deep-seq, integer-logarithms, rere, tagged and transformers from unit-tests --- Cabal-tests/Cabal-tests.cabal | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Cabal-tests/Cabal-tests.cabal b/Cabal-tests/Cabal-tests.cabal index 858ce659c45..ca3ce6816bd 100644 --- a/Cabal-tests/Cabal-tests.cabal +++ b/Cabal-tests/Cabal-tests.cabal @@ -57,31 +57,23 @@ test-suite unit-tests main-is: UnitTests.hs build-depends: array - , async >=2.2.2 && <2.3 , base >=4.9 && <5 - , binary , bytestring , Cabal , Cabal-described , Cabal-syntax , Cabal-QuickCheck - , Cabal-tests , containers - , deepseq , Diff >=0.4 && <0.6 , directory , filepath - , integer-logarithms >=1.0.2 && <1.1 , pretty , QuickCheck >=2.14 && <2.15 - , rere >=0.1 && <0.3 - , tagged , tasty >=1.2.3 && <1.6 , tasty-hunit , tasty-quickcheck , temporary , text - , transformers ghc-options: -Wall default-language: Haskell2010 @@ -102,7 +94,6 @@ test-suite parser-tests , tasty >=1.2.3 && <1.6 , tasty-golden >=2.3.1.1 && <2.4 , tasty-hunit - , tasty-quickcheck , tree-diff >=0.1 && <0.4 ghc-options: -Wall @@ -121,7 +112,6 @@ test-suite check-tests , directory , filepath , tasty >=1.2.3 && <1.6 - , tasty-expected-failure , tasty-golden >=2.3.1.1 && <2.4 ghc-options: -Wall @@ -157,7 +147,6 @@ test-suite hackage-tests , Cabal , Cabal-syntax , Cabal-tree-diff - , containers , deepseq , directory , filepath @@ -167,7 +156,6 @@ test-suite hackage-tests , base-orphans >=0.6 && <0.10 , clock >=0.8 && <0.9 , optparse-applicative >=0.13.2.0 && <0.19 - , stm >=2.4.5.0 && <2.6 , tar >=0.5.0.3 && <0.7 , tree-diff >=0.1 && <0.4 From 157ab75c1bf3383a4c625c6133d54bb14a99c1c2 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 11:16:11 -0400 Subject: [PATCH 5/8] Remove unused packages from cabal-testsuite Use -Wwarn=unused-packages for cabal-testsuite --- cabal-testsuite/cabal-testsuite.cabal | 34 ++++++++++++--------------- project-cabal/ghc-options.config | 3 +++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/cabal-testsuite/cabal-testsuite.cabal b/cabal-testsuite/cabal-testsuite.cabal index d09abed023e..4fdd0e51e7c 100644 --- a/cabal-testsuite/cabal-testsuite.cabal +++ b/cabal-testsuite/cabal-testsuite.cabal @@ -29,8 +29,6 @@ common shared , base >= 4.9 && <4.20 -- this needs to match the in-tree lib:Cabal version , Cabal ^>= 3.11.0.0 - , Cabal-syntax ^>= 3.11.0.0 - , Cabal-tests ghc-options: -Wall @@ -62,9 +60,9 @@ library Test.Cabal.ScriptEnv0 build-depends: + , Cabal-tests , aeson ^>= 1.4.2.0 || ^>=1.5.0.0 || ^>= 2.0.0.0 || ^>= 2.1.0.0 || ^>= 2.2.1.0 , async ^>= 2.2.1 - , attoparsec ^>= 0.13.2.2 || ^>=0.14.1 , base16-bytestring ^>= 0.1.1.5 || ^>= 1.0 , bytestring ^>= 0.10.0.2 || ^>= 0.11.0.0 || ^>= 0.12.0.0 , containers ^>= 0.5.0.0 || ^>= 0.6.0.1 || ^>= 0.7 @@ -79,7 +77,6 @@ library , regex-tdfa ^>= 1.2.3.1 || ^>=1.3.1.0 , retry ^>= 0.9.1.0 , array ^>= 0.4.0.1 || ^>= 0.5.0.0 - , temporary ^>= 1.3 , text ^>= 1.2.3.1 || ^>= 2.0.1 || ^>= 2.1 , transformers ^>= 0.3.0.0 || ^>= 0.4.2.0 || ^>= 0.5.2.0 || ^>= 0.6.0.2 @@ -101,11 +98,9 @@ executable cabal-tests , cabal-testsuite -- constraints inherited via lib:cabal-testsuite component , async - , exceptions , filepath , optparse-applicative , process - , transformers -- dependencies specific to exe:cabal-tests , clock ^>= 0.7.2 || ^>=0.8 , directory @@ -127,23 +122,24 @@ executable setup -- If you require an external dependency for a test it must be listed here. executable test-runtime-deps default-language: Haskell2010 - build-depends: cabal-testsuite, - base, - directory, - Cabal, - Cabal-syntax, - filepath, - transformers, - bytestring, - time, - process, - exceptions + -- Apart from base that is a compile-time dependency, the rest are runtime dependencies + build-depends: + , Cabal + , Cabal-syntax + , base + , bytestring + , cabal-testsuite + , directory + , exceptions + , filepath + , process + , time + , transformers main-is: static/Main.hs if !os(windows) build-depends: unix else - build-depends: - , Win32 + build-depends: Win32 custom-setup -- we only depend on even stable releases of lib:Cabal diff --git a/project-cabal/ghc-options.config b/project-cabal/ghc-options.config index acea85803f1..3f1b3e13e5a 100644 --- a/project-cabal/ghc-options.config +++ b/project-cabal/ghc-options.config @@ -1,2 +1,5 @@ program-options ghc-options: -fno-ignore-asserts -Werror -Wunused-packages + +package cabal-testsuite + ghc-options: -Wwarn=unused-packages From ca2a6add42fc85c1ed5919a21a04b99cbd4f4c5d Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 12:24:03 -0400 Subject: [PATCH 6/8] Guard -Wunused-packages with impl(ghc) --- project-cabal/ghc-options.config | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/project-cabal/ghc-options.config b/project-cabal/ghc-options.config index 3f1b3e13e5a..f050591d591 100644 --- a/project-cabal/ghc-options.config +++ b/project-cabal/ghc-options.config @@ -1,5 +1,10 @@ program-options - ghc-options: -fno-ignore-asserts -Werror -Wunused-packages + ghc-options: + -fno-ignore-asserts + -Werror -package cabal-testsuite - ghc-options: -Wwarn=unused-packages +if impl(ghc >= 8.10) + program-options + ghc-options: -Wunused-packages + package cabal-testsuite + ghc-options: -Wwarn=unused-packages From 4282bfeb4ff321ea908aecc22fdd0addf7c5c7ff Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 14:56:23 -0400 Subject: [PATCH 7/8] Only enable -Wunused-packages when ghc >=9 --- Cabal-syntax/Cabal-syntax.cabal | 4 +++- Cabal/Cabal.cabal | 4 +++- cabal-install-solver/cabal-install-solver.cabal | 6 ++++-- cabal-install/cabal-install.cabal | 6 +++--- project-cabal/ghc-options.config | 4 +++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Cabal-syntax/Cabal-syntax.cabal b/Cabal-syntax/Cabal-syntax.cabal index 9dfc891468b..db2a52c114e 100644 --- a/Cabal-syntax/Cabal-syntax.cabal +++ b/Cabal-syntax/Cabal-syntax.cabal @@ -59,7 +59,9 @@ library if impl(ghc >= 8.0) && impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - if impl(ghc >= 8.10) + -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives + -- false positives with GHC 8.10. + if impl(ghc >= 9) ghc-options: -Wunused-packages build-tool-depends: alex:alex diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index 07fbd7f2593..cbb468c69c3 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -65,7 +65,9 @@ library if impl(ghc >= 8.0) && impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - if impl(ghc >= 8.10) + -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives + -- false positives with GHC 8.10. + if impl(ghc >= 9) ghc-options: -Wunused-packages exposed-modules: diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index 472adf09e21..05f19b23cac 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -40,10 +40,12 @@ library -Wall -Wcompat -Wnoncanonical-monad-instances -fwarn-tabs -fwarn-incomplete-uni-patterns - if impl(ghc <8.8) + if impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - if impl(ghc >=8.10) + -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives + -- false positives with GHC 8.10. + if impl(ghc >= 9) ghc-options: -Wunused-packages exposed-modules: diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 2e06aa991b5..ba89665e673 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -51,9 +51,9 @@ common warnings if impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - if impl(ghc >=9.0) - -- Warning: even though introduced with GHC 8.10, -Wunused-packages - -- gives false positives with GHC 8.10. + -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives + -- false positives with GHC 8.10. + if impl(ghc >= 9) ghc-options: -Wunused-packages common base-dep diff --git a/project-cabal/ghc-options.config b/project-cabal/ghc-options.config index f050591d591..67fe1a2487e 100644 --- a/project-cabal/ghc-options.config +++ b/project-cabal/ghc-options.config @@ -3,7 +3,9 @@ program-options -fno-ignore-asserts -Werror -if impl(ghc >= 8.10) +-- Warning: even though introduced with GHC 8.10, -Wunused-packages gives false +-- positives with GHC 8.10. +if impl(ghc >= 9) program-options ghc-options: -Wunused-packages package cabal-testsuite From fa915e93db6820fc3204a8f920d077b734b814d3 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 29 Mar 2024 15:57:42 -0400 Subject: [PATCH 8/8] Only check -Wunused-package by project --- Cabal-syntax/Cabal-syntax.cabal | 5 ----- Cabal/Cabal.cabal | 5 ----- cabal-install-solver/cabal-install-solver.cabal | 5 ----- cabal-install/cabal-install.cabal | 5 ----- 4 files changed, 20 deletions(-) diff --git a/Cabal-syntax/Cabal-syntax.cabal b/Cabal-syntax/Cabal-syntax.cabal index db2a52c114e..a6bdd769d5f 100644 --- a/Cabal-syntax/Cabal-syntax.cabal +++ b/Cabal-syntax/Cabal-syntax.cabal @@ -59,11 +59,6 @@ library if impl(ghc >= 8.0) && impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives - -- false positives with GHC 8.10. - if impl(ghc >= 9) - ghc-options: -Wunused-packages - build-tool-depends: alex:alex exposed-modules: diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index cbb468c69c3..c264a39ad14 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -65,11 +65,6 @@ library if impl(ghc >= 8.0) && impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives - -- false positives with GHC 8.10. - if impl(ghc >= 9) - ghc-options: -Wunused-packages - exposed-modules: Distribution.Backpack.Configure Distribution.Backpack.ComponentsGraph diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index 05f19b23cac..86b448ebb89 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -43,11 +43,6 @@ library if impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives - -- false positives with GHC 8.10. - if impl(ghc >= 9) - ghc-options: -Wunused-packages - exposed-modules: Distribution.Client.Utils.Assertion diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index ba89665e673..1752d8a2455 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -51,11 +51,6 @@ common warnings if impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances - -- Warning: even though introduced with GHC 8.10, -Wunused-packages gives - -- false positives with GHC 8.10. - if impl(ghc >= 9) - ghc-options: -Wunused-packages - common base-dep build-depends: base >=4.10 && <4.20