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

Fix building haddocks for packages with internal libraries #4596

Merged
merged 1 commit into from
Feb 19, 2019

Conversation

qrilka
Copy link
Contributor

@qrilka qrilka commented Feb 19, 2019

Please include the following checklist in your PR:

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

I've tested it using https://github.com/qrilka/test-internal-haddock. Without this patch I get

Updating Haddock index for local packages and dependencies in
/home/qrilka/ws/h/stack-tests/test-internal/.stack-work/install/x86_64-linux-tinfo6/d542db1939a9b706609e6e30f7207fbc656b1f8b91ec7d78f8c9c350b2157d09/8.6.3/doc/all/index.html
Received ExitFailure 1 when running
Raw command: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.3/bin/haddock --optghc=-package-db=/home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/d542db1939a9b706609e6e30f7207fbc656b1f8b91ec7d78f8c9c350b2157d09/8.6.3/pkgdb --optghc=-package-db=/home/qrilka/ws/h/stack-tests/test-internal/.stack-work/install/x86_64-linux-tinfo6/d542db1939a9b706609e6e30f7207fbc656b1f8b91ec7d78f8c9c350b2157d09/8.6.3/pkgdb --gen-contents --gen-index -i ../ghc-prim-0.5.3,../ghc-prim-0.5.3/ghc-prim.haddock -i ../z-test-internal-haddock-z-internal-lib-0.1.0.0,../z-test-internal-haddock-z-internal-lib-0.1.0.0/z-test-internal-haddock-z-internal-lib.haddock -i ../test-internal-haddock-0.1.0.0,../test-internal-haddock-0.1.0.0/test-internal-haddock.haddock -i ../base-4.12.0.0,../base-4.12.0.0/base.haddock -i ../integer-gmp-1.0.2.0,../integer-gmp-1.0.2.0/integer-gmp.haddock
Run from: /home/qrilka/ws/h/stack-tests/test-internal/.stack-work/install/x86_64-linux-tinfo6/d542db1939a9b706609e6e30f7207fbc656b1f8b91ec7d78f8c9c350b2157d09/8.6.3/doc/all/
Standard output:

haddock: internal error: ../z-test-internal-haddock-z-internal-lib-0.1.0.0/z-test-internal-haddock-z-internal-lib.haddock: openBinaryFile: does not exist (No such file or directory)

While with this fix I get correct results.

Fixes #3989

@qrilka
Copy link
Contributor Author

qrilka commented Feb 19, 2019

Originally I planned to add an integration test for this but it looks to require fresh haddock existing in LTS-13 otherwise haddock fails with an error like in #4428

@snoyberg snoyberg merged commit 55c13af into master Feb 19, 2019
@snoyberg snoyberg deleted the haddock-internal branch February 19, 2019 13:56
@mihaimaruseac
Copy link
Contributor

Thank you

@dcastro
Copy link

dcastro commented Jun 11, 2019

Unless I'm misunderstanding something or doing something wrong, I'm still not able to run stack haddock on my project even after stack upgrade --git.

Here's what my package.yaml looks like: https://github.com/dcastro/haskell-flatbuffers/blob/51d5035f6f6c28f8b9e984aa1cfc8c55e89af709/package.yaml

I've essentially got:

  • the main lib flatbuffers
  • an internal lib examples that depends on flatbuffers
  • a test suite that depends on examples+flatbuffers
  • (will add a benchmark that also depends on examples+flatbuffers)
$ stack --version
Version 2.2.0, Git revision aa3a5f2573ffe8791f63e621447c9084d5aa0ba1 PRE-RELEASE x86_64 hpack-0.31.1

$ stack haddock
...
Documentation created:
.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/doc/html/flatbuffers/index.html,
Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3: internal error when calculating
.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/doc/html/flatbuffers/flatbuffers.txt
transitive package dependencies.
Preprocessing library 'examples' for flatbuffers-0.1.0.0..
Debug info: []
Running Haddock on library 'examples' for flatbuffers-0.1.0.0..


--  While building package flatbuffers-0.1.0.0 using:
      /Users/dcastro/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --haddock-option=--quickjump
    Process exited with code: ExitFailure 1

@dbaynard
Copy link
Contributor

This looks to me like a circular dependencies issue, as (unless this has been changed recently) stack's build plans do not yet work at a component level. This means examples depends on flatbuffers as specified in your package.yaml, but flatbuffers depends on examples because the build plan builds the library first. I'm not familiar with recent changes, but @qrilka will know the current state of affairs.

@qrilka
Copy link
Contributor Author

qrilka commented Jun 12, 2019

it was decided to look into component-based builds after the upcoming release

@madgen
Copy link

madgen commented Oct 17, 2019

@qrilka do you know if there has been more work on this (that doesn't reference the issue)? I still get the same "internal error when calculating transitive dependencies" with Stack 2.1.3.

My dependencies are even simpler than those of @dcastro.

I have the following:

library -----------------------------------> test suite
   |                                             ^
   |------------> internal library --------------|

@qrilka
Copy link
Contributor Author

qrilka commented Oct 19, 2019

@madgen I think we need component-based builds for that and there were no movements yet in that direction unfortunately.

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

Successfully merging this pull request may close these issues.

Internal libraries break stack haddock
6 participants