From dd17326bccd802c075c26426292f1b593344fe73 Mon Sep 17 00:00:00 2001 From: Teo Camarasu Date: Wed, 24 Apr 2024 11:47:53 +0100 Subject: [PATCH] Downgrade NoLibraryFound from an error to a warning This makes Setup copy/install succeed if there's nothing to do because the package doesn't contain a library or executable. This allows downstream users of Cabal to avoid having to add workarounds for this edge case. Resolves #6750 --- Cabal/src/Distribution/Simple/Errors.hs | 2 +- Cabal/src/Distribution/Simple/Install.hs | 2 +- changelog.d/issue-6750 | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 changelog.d/issue-6750 diff --git a/Cabal/src/Distribution/Simple/Errors.hs b/Cabal/src/Distribution/Simple/Errors.hs index 45029565e99..a4ee3ea2da2 100644 --- a/Cabal/src/Distribution/Simple/Errors.hs +++ b/Cabal/src/Distribution/Simple/Errors.hs @@ -47,7 +47,7 @@ data CabalException | EnableBenchMark | BenchMarkNameDisabled String | NoBenchMark String - | NoLibraryFound + | NoLibraryFound -- ^ @NoLibraryFound@ has been downgraded to a warning, and is therefore no longer emitted. | CompilerNotInstalled CompilerFlavor | CantFindIncludeFile String | UnsupportedTestSuite String diff --git a/Cabal/src/Distribution/Simple/Install.hs b/Cabal/src/Distribution/Simple/Install.hs index c1134e2b355..c46f28b3529 100644 --- a/Cabal/src/Distribution/Simple/Install.hs +++ b/Cabal/src/Distribution/Simple/Install.hs @@ -147,7 +147,7 @@ install_setupHooks checkHasLibsOrExes = unless (hasLibs pkg_descr || hasForeignLibs pkg_descr || hasExes pkg_descr) $ - dieWithException verbosity NoLibraryFound + warn verbosity "No executables and no library found. Nothing to do." -- | Copy package global files. copyPackage diff --git a/changelog.d/issue-6750 b/changelog.d/issue-6750 new file mode 100644 index 00000000000..f6fcb860f8f --- /dev/null +++ b/changelog.d/issue-6750 @@ -0,0 +1,13 @@ +synopsis: Make Setup copy/install succeed when there's no executable or library +packages: Cabal +prs: TODO +issues: #750 + +description: { + Historically the Setup copy and install steps would fail if the package didn't + contain an executable or library component. In this case there's nothing to do. + + This required workarounds for downstream users of Cabal to handle this edge case. + Now we downgrade this error to a warning. Cabal will now succeed if there's + nothing to do. +}