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

--haddock-lib is not used for dependencies #9053

Closed
FinleyMcIlwaine opened this issue Jun 20, 2023 · 1 comment
Closed

--haddock-lib is not used for dependencies #9053

FinleyMcIlwaine opened this issue Jun 20, 2023 · 1 comment

Comments

@FinleyMcIlwaine
Copy link
Contributor

Describe the bug
I have a Haddock built outside of the GHC tree at /my/haddock and a Haddock resource directory at /my/haddock/resources. In a cabal project with a dependency, running

cabal v2-haddock -v2 --with-haddock=/my/haddock --haddock-lib=/my/haddock/resources

Causes building documentation to fail with Haddock's resource directory does not exist! in the build logs for the dependency.

I think --haddock-lib=/my/haddock/resources should cause a --lib=/my/haddock/resources argument to be provided to all invocations of Haddock, including those for dependencies.

To Reproduce
lib.cabal contents:

cabal-version:   3.8
name:            scratch
version:         0.1.0
build-type:      Simple

library
    build-depends:
        base
      , acme-missiles
    default-language: Haskell2010

In same directory as lib.cabal, run (substituting paths appropriately):

cabal v2-haddock -v2 --with-haddock=/my/haddock --haddock-lib=/my/haddock/resources

It will fail to build documentation for the acme-missiles dependency. cat the resulting build log and see output ending with something like:

Running: /my/haddock '@dist/doc/html/acme-missiles/haddock-response97139-1.txt'
[1 of 2] Compiling Acme.Missiles    ( Acme/Missiles.hs, nothing )
[2 of 2] Compiling Acme.Missiles.STM ( Acme/Missiles/STM.hs, nothing )
Haddock's resource directory does not exist!

Haddock coverage:
 100% (  2 /  2) in 'Acme.Missiles'
  75% (  3 /  4) in 'Acme.Missiles.STM'
  Missing documentation for:
    Module header

Expected behavior
Building documentation with a haddock built outside the GHC tree and a specific --haddock-lib should succeed.

System information

I suspect this occurs with any version of Haddock built outside of the GHC tree with any version of GHC, but I have not verified that.

@FinleyMcIlwaine
Copy link
Contributor Author

FinleyMcIlwaine commented Aug 16, 2023

I now realize the correct way to do this is with:

package *
  haddock-lib: ...

But that was not clear since the haddock-lib option is not included in the users guide. I will be adding an entry for it in #9177

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

No branches or pull requests

1 participant