Summary. There are a few ways to do it:
I see code to do it (c.f. HaddockDefaultComponents), but I don't see anywhere which constructs this?
CC @dcoutts
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.)
This workaround seems to require having run cabal configure already, unfortunately.
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.)
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.
Oh yes, thank you for the correction @hamishmack !
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.
How do I run haddock on installed packages in my global store?
@jaccokrijnen We recently merged a draft new-haddock build but I don't know if it rebuilds things in the global store with Haddock.
Most helpful comment
Ah, yeah, I should have tried that based on the
copyworkaround. That does indeed work without needing acabal 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-haddockin a directory withcabal.projectand watchdist-newstylefill with the docs from all the packages.