Skip to content

Commit

Permalink
Downgrade NoLibraryFound from an error to a warning
Browse files Browse the repository at this point in the history
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
  • Loading branch information
TeofilC committed Apr 24, 2024
1 parent 3395fa1 commit 92ab485
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cabal/src/Distribution/Simple/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ data CabalException
| EnableBenchMark
| BenchMarkNameDisabled String
| NoBenchMark String
| NoLibraryFound
| -- | @NoLibraryFound@ has been downgraded to a warning, and is therefore no longer emitted.
NoLibraryFound
| CompilerNotInstalled CompilerFlavor
| CantFindIncludeFile String
| UnsupportedTestSuite String
Expand Down
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/Simple/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions changelog.d/issue-6750
Original file line number Diff line number Diff line change
@@ -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 that this error has been downgraded to a warning, Cabal will succeed if
there's nothing to do.
}

0 comments on commit 92ab485

Please sign in to comment.