Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal new-build treats haddock failures fatally #5232

Closed
hvr opened this issue Mar 25, 2018 · 14 comments · Fixed by #5459
Closed

cabal new-build treats haddock failures fatally #5232

hvr opened this issue Mar 25, 2018 · 14 comments · Fixed by #5459

Comments

@hvr
Copy link
Member

hvr commented Mar 25, 2018

originally reported at haskell-infra/hackage-trustees#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

@cartazio
Copy link
Contributor

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!

@alexbiehl
Copy link
Member

alexbiehl commented Mar 30, 2018

Carter, look here

whenHaddock $ do
when isParallelBuild $
notice verbosity $ "Generating " ++ dispname ++ " documentation..."
annotateFailureNoLog HaddocksFailed $
setup haddockCommand haddockFlags

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

@cartazio
Copy link
Contributor

@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?)

@alexbiehl
Copy link
Member

alexbiehl commented Mar 31, 2018

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.

@cartazio
Copy link
Contributor

@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?

@cartazio
Copy link
Contributor

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)

@cartazio
Copy link
Contributor

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

@cartazio
Copy link
Contributor

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?!

@alexbiehl
Copy link
Member

Yeah, the behaviour is yet to be specified.

For the other issue take a look here:

argTargets :: [FilePath]

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

@cartazio
Copy link
Contributor

cartazio commented Apr 18, 2018 via email

@cartazio
Copy link
Contributor

@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?

@cartazio
Copy link
Contributor

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


@cartazio
Copy link
Contributor

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

@cartazio
Copy link
Contributor

cartazio commented Jul 29, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants