Cabal: `cabal new-build` treats haddock failures fatally

Created on 25 Mar 2018  Â·  14Comments  Â·  Source: haskell/cabal

originally reported at https://github.com/haskell-infra/hackage-trustees/issues/146

cabal new-build currently fails when haddock fails (e.g. due to documentation: True set globally; note that Haddock currently fails for packages w/o any local modules);
instead, cabal new-build ought to merely record/log/warn about them, but otherwise carry on

nix-local-build bug

Most helpful comment

We should do both I think:

1) Cabal shouldn't treat haddock errors as fatal errors and
2) Cabal should avoid invoking haddock if there are no inputs.

All 14 comments

this seems like a high priority bug :)

where in the cabal code base is this issue? i can poke around but if theres some know how, i'd like to help get this into a point fix post haste!

Carter, look here https://github.com/haskell/cabal/blob/457ebb8aff13e86e8928f301132f14ccaa23c28f/cabal-install/Distribution/Client/ProjectBuilding.hs#L941-L945

annotateFailureNoLog catches the error from Cabal and rethrows it. You probably don't want that behaviour in case of haddock.

@alexbiehl ok, that helps!
better question, should we fix just that, or also not generate haddocks when theres no modules? (later seems more complicated perhaps but more correct?)

We should do both I think:

1) Cabal shouldn't treat haddock errors as fatal errors and
2) Cabal should avoid invoking haddock if there are no inputs.

@alexbiehl is your haddock work on master a fix to for master, or unrealted clean up?

should i do this patch for 2.2 or master?

i'm trying to test build cabal and i'm getting this fun error

Resolving dependencies...
Configuring cabal-install-2.2.0.0...
Building cabal-install-2.2.0.0...
Installed cabal-install-2.2.0.0
Updating documentation index
/Users/carter/.cabal/share/doc/x86_64-osx-ghc-8.2.2/index.html
: cannot satisfy -package-id cabal-testsuite-2.2.0.0-inplace
(use -v for more information)

this hacky first cut of a patch seems to work now that i got the build working :)

the current patch just demotes haddock failures unconditionally to an adhoc warning, the right approach might be to add support for "warnings" along with full build failures.

additionally: it'd probably be good to have / retain the option to treat haddock failures as errors either per package build or globally?

additionally additionally: cabaly shouldn't even invoke haddock when theres no docs to build probably?!

Yeah, the behaviour is yet to be specified.

For the other issue take a look here:
https://github.com/haskell/cabal/blob/335fa8d82520bad1a6980fd55230e65889c99860/Cabal/Distribution/Simple/Haddock.hs#L111

You might want to not invoke haddock if argTargets is empty.

If you look I wrote a new function that soesnst rethrow

On Tue, Apr 17, 2018 at 7:45 PM Alexander Biehl notifications@github.com
wrote:

Yeah, the behaviour is yet to be specified.

For the other issue take a look here:

https://github.com/haskell/cabal/blob/335fa8d82520bad1a6980fd55230e65889c99860/Cabal/Distribution/Simple/Haddock.hs#L111

You might want to not invoke haddock if argTargets is empty.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/haskell/cabal/issues/5232#issuecomment-382193676, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAQwhiQuwlx6jj8P9SYTqgidumLJneTks5tpn6ZgaJpZM4S6Uyq
.

@alexbiehl thx! i'll have a look at that after i catchup with a few other things this week (my janky patch for now has me unstuck on a huge backlog at the moment :) )

Is there a mechanism in cabal at the moment for easy logging / posting of non-fatal warnings/errors to logs/user stdout/stderr? what are the current cabal-install standards for these?

ok, i pushed some partially done changes,
I added to the haddock exports a "compute input files " function,
though i'm not sure how i get the arguments i need for it in the ProjectBuilding.hs file

haddockInputFilesFromLibrary :: Verbosity
            -> LocalBuildInfo
            -> ComponentLocalBuildInfo
            -> Library
            -> IO [FilePath]
haddockInputFilesFromLibrary  verbosity lbi clbi lib =
  map snd `fmap` getLibSourceFiles verbosity lbi lib clbi


I'm a little lost about where i can get the right LocalBuildInfo / Library / ComponentLocalBuildInfo args from :(

Thanks!
Also your patch makes it look way cleaner than what I was trying to do.
Many thanks.

On Fri, Jul 27, 2018 at 7:36 AM Alexis Williams notifications@github.com
wrote:

Closed #5232 https://github.com/haskell/cabal/issues/5232 via #5459
https://github.com/haskell/cabal/pull/5459.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/haskell/cabal/issues/5232#event-1757081096, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAQwjHIlSGNq7nlk9VbuXsaF_fo8RIPks5uKvslgaJpZM4S6Uyq
.

Was this page helpful?
0 / 5 - 0 ratings