From a3a202923363fc0dfc686d4eb67d963fbe4d2870 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Tue, 5 Dec 2023 07:12:13 +0000 Subject: [PATCH 1/2] Use `program-options` in preference to `package *` stanza. This commit adjusts `cabal.project` so that the unused packages warning is only triggered for local packages. Explanation: - The `package *` stanza applies to *all* packages, including local packages from the project *and* external dependencies. - The `program-options` stanza applies *only* to local packages. - In the case of detecting unused packages, we only care about the dependencies of local packages. See: https://cabal.readthedocs.io/en/stable/cabal-project.html --- cabal.project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal.project b/cabal.project index fe39a51ab59..6377312ccf9 100644 --- a/cabal.project +++ b/cabal.project @@ -195,7 +195,7 @@ package cardano-node flags: -systemd -- Fail to build if there are any unused package dependencies: -package * +program-options ghc-options: -Wunused-packages -- ------------------------------------------------------------------------- From 15c18824d8c55ef5a42624e7e62167d6ce50188d Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Tue, 5 Dec 2023 07:54:28 +0000 Subject: [PATCH 2/2] Exclude `cardano-wallet-primitive` from unused package dependency check. --- cabal.project | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index 6377312ccf9..6a9d2c9929e 100644 --- a/cabal.project +++ b/cabal.project @@ -194,11 +194,23 @@ package cardano-config package cardano-node flags: -systemd --- Fail to build if there are any unused package dependencies: +-------------------------------------------------------------------------------- +-- Detection of unused package dependencies +-------------------------------------------------------------------------------- + +-- By default, we fail to build if there are any unused package dependencies. program-options ghc-options: -Wunused-packages --- ------------------------------------------------------------------------- +-- NOTE: We make an exception for `cardano-wallet-primitive`, as for some +-- reason GHC panics when building this package if the above flag is enabled. +-- +-- TODO: Investigate this problem further and/or file a GHC bug report. +-- +package cardano-wallet-primitive + ghc-options: -Wno-unused-packages + +-------------------------------------------------------------------------------- -- Enable specific tests in this repo test-show-details: direct