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

How do I haddock with new-build? #3535

Closed
ezyang opened this issue Jul 11, 2016 · 10 comments
Closed

How do I haddock with new-build? #3535

ezyang opened this issue Jul 11, 2016 · 10 comments

Comments

@ezyang
Copy link
Contributor

ezyang commented Jul 11, 2016

Summary. There are a few ways to do it:

  1. The most straightforward approach is to introduce Haddock as an extra "target" that can be applied to a component. There is a major downside to this approach, which is that you have to rebuild the libraries when you want to rebuild the Haddocks (because they count as separate "packages" from the perspective of the store). As an addendum to this, you could have some configuration option to stop transitively building Haddock at some point, to avoid thrashing the store (in case you only care about Haddocks for inplace.)
  2. A better solution is to somehow treat the Haddock documentation as a separate component that can be installed separately.

I see code to do it (c.f. HaddockDefaultComponents), but I don't see anywhere which constructs this?

@ezyang
Copy link
Contributor Author

ezyang commented Jul 12, 2016

CC @dcoutts

@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Edit. See @hamishmack's comment below.

We can work around the problem by running cabal act-as-setup -- haddock --builddir=dist-newstyle/packagename-0.1 (or if you have a Custom build, invoke your setup script directly.) (It doesn't seem you can call cabal haddock directly; the reconfiguring code is too smart for its own good.)

@acfoltzer
Copy link
Collaborator

This workaround seems to require having run cabal configure already, unfortunately.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Err, just to double check, did you run cabal act-as-setup -- haddock, and not cabal haddock? (The emailed copy of this ticket has the wrong instructions; I edited it to fix it.)

@hamishmack
Copy link
Collaborator

The --builddir needs to point to the subdirectory for the package:

cabal new-build
cabal act-as-setup -- haddock --builddir=dist-newstyle/build/package-name-0.1

Also keep in mind that if your cabal.project file is in a parent directory dist-newstyle will also be in that directory.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Oh yes, thank you for the correction @hamishmack !

@acfoltzer
Copy link
Collaborator

Ah, yeah, I should have tried that based on the copy workaround. That does indeed work without needing a cabal configure.

And as soon as I get this workaround going, I realize that what is more important to us for this feature is to lift this command to the metaproject level. It would be great to run cabal new-haddock in a directory with cabal.project and watch dist-newstyle fill with the docs from all the packages.

hamishmack added a commit to leksah/leksah that referenced this issue Jul 21, 2016
@jaccokrijnen
Copy link
Contributor

jaccokrijnen commented Oct 29, 2016

How do I run haddock on installed packages in my global store?

@ezyang
Copy link
Contributor Author

ezyang commented Oct 31, 2016

@jaccokrijnen We recently merged a draft new-haddock build but I don't know if it rebuilds things in the global store with Haddock.

@gbaz
Copy link
Collaborator

gbaz commented Aug 14, 2021

I think this can be closed as we do have a v2-haddock working now.

@gbaz gbaz closed this as completed Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants