Skip to content

haddock-project --local does not copy non-boot dependencies to output dir #8958

Closed

Description

@amesgen

Describe the bug
At least the blog post indicates that all dependencies (not just boot deps) should be supported:

This command will build ./haddocks directory which you can serve with a http server. It will contain documentation of all the local packages and its dependencies. You can even control which dependencies should be included via documentation option.

The code has a similar comment:

-- Build a self contained directory which contains haddocks of all
-- transitive dependencies; or depend on `--haddocks-html-location` to
-- provide location of the documentation of dependencies.

To Reproduce
https://github.com/amesgen/stuff/tree/cabal-haddock-project-deps

 $ git clone https://github.com/amesgen/stuff --single-branch --branch cabal-haddock-project-deps
 $ cd stuff
 $ cabal haddock-project --local
 $ ls haddocks/
array  containers  doc-index.html  exceptions  ghc-boot-th  haddock-bundle.min.js  linuwial.css  pretty          quick-jump.min.js  stuff         template-haskell
base   deepseq     doc-index.json  ghc-bignum  ghc-prim     index.html             mtl           quick-jump.css  stm                synopsis.png  transformers

Note that resourcet (a dependency of the test project) is not present.

Expected behavior
I would expect all dependencies to be copied to the output, or alternatively an indication in the documentation that it only works for boot deps.

System information

  • NixOS, x86_64-linux
  • cabal 3.10.1.0, ghc 9.4.5

Activity

  1. ulysses4ever commented on May 19, 2023

    @ulysses4ever
    Collaborator

    Thanks for the report! Any thoughts, @coot?

  2. self-assigned this
    on May 20, 2023
  3. coot commented on May 20, 2023

    @coot
    Collaborator

    The build plan which haddock-project is using requires resourcet-1.3.0-2a5777eca76f6caa1882bf381159a0bbfdefefbd08e4ce5550597937130edf11, but cabal-plan info reports resourcet-1.3.0-3327d742b734f4daace7f3299ff166ecb34971a1c063326e8ca093a3dddffa26. The former doesn't exist in cabal store, the latter does.

  4. added a commit that references this issue on May 20, 2023
    f915596
  5. coot commented on May 20, 2023

    @coot
    Collaborator

    @amesgen could you check if #8919 fixes the bug for you (in that branch you don't need to pass the --local flag).

  6. amesgen commented on May 20, 2023

    @amesgen
    ContributorAuthor

    Thanks for the quick reply ❤️

    @amesgen could you check if #8919 fixes the bug for you (in that branch you don't need to pass the --local flag).

    I think direct dependencies (like resourcet above) are now copied, but transitive non-direct dependencies (like primitive or unliftio-core above) are still not copied; I also get corresponding warnings:

    Warning: haddocks of
    "primitive-0.8.0.0-ad645076af9195e65e5c77d3a3850c7fb7f4153156656431f6be749f834f8371"
    not found in the store
    Warning: haddocks of
    "unliftio-core-0.2.1.0-ece7185c67bc94e7897e24d7cd1b3064100b73a194a2cca37863ee3222df8808"
    not found in the store
    
    Full logs
     $ cabal haddock-project
    Warning: this is a debug build of cabal-install with assertions enabled.
    Warning: haddock-project command is experimental, it might break in the future
    Resolving dependencies...
    Build profile: -w ghc-9.6.1 -O1
    In order, the following will be built (use -v for more details):
     - primitive-0.8.0.0 (lib) (requires build)
     - unliftio-core-0.2.1.0 (lib) (requires build)
     - resourcet-1.3.0 (lib) (requires build)
     - stuff-0.1.0.0 (lib) (first run)
    Build profile: -w ghc-9.6.1 -O1
    In order, the following will be built (use -v for more details):
     - primitive-0.8.0.0 (lib) (requires build)
     - unliftio-core-0.2.1.0 (lib) (requires build)
     - resourcet-1.3.0 (lib) (requires build)
     - stuff-0.1.0.0 (lib) (first run)
    Starting     unliftio-core-0.2.1.0 (lib)
    Starting     primitive-0.8.0.0 (lib)
    Building     unliftio-core-0.2.1.0 (lib)
    Building     primitive-0.8.0.0 (lib)
    Installing   unliftio-core-0.2.1.0 (lib)
    Completed    unliftio-core-0.2.1.0 (lib)
    Installing   primitive-0.8.0.0 (lib)
    Completed    primitive-0.8.0.0 (lib)
    Starting     resourcet-1.3.0 (lib)
    Building     resourcet-1.3.0 (lib)
    Haddock      resourcet-1.3.0 (lib)
    Installing   resourcet-1.3.0 (lib)
    Completed    resourcet-1.3.0 (lib)
    Warning: this is a debug build of cabal-install with assertions enabled.
    Configuring library for stuff-0.1.0.0..
    Warning: this is a debug build of cabal-install with assertions enabled.
    Preprocessing library for stuff-0.1.0.0..
    Building library for stuff-0.1.0.0..
    [1 of 1] Compiling MyLib            ( src/MyLib.hs, /tmp/tmp.7zfdHszbqs/stuff/dist-newstyle/build/x86_64-linux/ghc-9.6.1/stuff-0.1.0.0/build/MyLib.o, /tmp/tmp.7zfdHszbqs/stuff/dist-newstyle/build/x86_64-linux/ghc-9.6.1/stuff-0.1.0.0/build/MyLib.dyn_o )
    Warning: this is a debug build of cabal-install with assertions enabled.
    Warning: this is a debug build of cabal-install with assertions enabled.
    Preprocessing library for stuff-0.1.0.0..
    Running Haddock on library for stuff-0.1.0.0..
    Warning: The documentation for the following packages are not installed. No
    links will be generated to these packages: primitive-0.8.0.0,
    unliftio-core-0.2.1.0
       0% (  0 /  2) in 'MyLib'
      Missing documentation for:
        Module header
        someFunc (src/MyLib.hs:5)
    Documentation created:
    /tmp/tmp.7zfdHszbqs/stuff/dist-newstyle/build/x86_64-linux/ghc-9.6.1/stuff-0.1.0.0/doc/html/stuff/
    Build profile: -w ghc-9.6.1 -O1
    In order, the following will be built (use -v for more details):
     - primitive-0.8.0.0 (lib) (requires build)
     - unliftio-core-0.2.1.0 (lib) (requires build)
     - resourcet-1.3.0 (lib) (requires build)
     - stuff-0.1.0.0 (lib) (configuration changed)
    Starting     unliftio-core-0.2.1.0 (lib)
    Starting     primitive-0.8.0.0 (lib)
    Building     unliftio-core-0.2.1.0 (lib)
    Building     primitive-0.8.0.0 (lib)
    Haddock      unliftio-core-0.2.1.0 (lib)
    Installing   unliftio-core-0.2.1.0 (lib)
    Completed    unliftio-core-0.2.1.0 (lib)
    Haddock      primitive-0.8.0.0 (lib)
    Installing   primitive-0.8.0.0 (lib)
    Completed    primitive-0.8.0.0 (lib)
    Starting     resourcet-1.3.0 (lib)
    Building     resourcet-1.3.0 (lib)
    Haddock      resourcet-1.3.0 (lib)
    Installing   resourcet-1.3.0 (lib)
    Completed    resourcet-1.3.0 (lib)
    Warning: this is a debug build of cabal-install with assertions enabled.
    Configuring library for stuff-0.1.0.0..
    Warning: this is a debug build of cabal-install with assertions enabled.
    Preprocessing library for stuff-0.1.0.0..
    Running Haddock on library for stuff-0.1.0.0..
    Warning: --source-* options are ignored when --hyperlinked-source is enabled.
       0% (  0 /  2) in 'MyLib'
      Missing documentation for:
        Module header
        someFunc (src/MyLib.hs:5)
    Documentation created:
    /tmp/tmp.7zfdHszbqs/stuff/dist-newstyle/build/x86_64-linux/ghc-9.6.1/stuff-0.1.0.0/doc/html/stuff/
    Warning: haddocks of
    "primitive-0.8.0.0-ad645076af9195e65e5c77d3a3850c7fb7f4153156656431f6be749f834f8371"
    not found in the store
    Warning: haddocks of
    "unliftio-core-0.2.1.0-ece7185c67bc94e7897e24d7cd1b3064100b73a194a2cca37863ee3222df8808"
    not found in the store
    Documentation created: haddocks/index.html
     $ ls haddocks/
    array  containers  doc-index.html  exceptions  ghc-boot-th  haddock-bundle.min.js  linuwial.css  pretty          quick-jump.min.js  stm                    synopsis.png      transformers
    base   deepseq     doc-index.json  ghc-bignum  ghc-prim     index.html             mtl           quick-jump.css  resourcet          stuff-0.1.0.0-inplace  template-haskell
    
  7. added a commit that references this issue on May 21, 2023
    c55b90a
  8. coot commented on May 26, 2023

    @coot
    Collaborator

    I think it will if you add

    package unliftio-core
      documentation: True
    
  9. amesgen commented on May 29, 2023

    @amesgen
    ContributorAuthor

    Ah right, thanks, no wonder it did not work as I only enabled documentation for resourcet in the example above 🤦 Confirming that it works fine with your suggestion, or alternatively

    package *
      documentation: True
  10. added 3 commits that reference this issue on May 30, 2023
    d10ae0c
    59c5cf8
    4c44eda
  11. added 4 commits that reference this issue on Jun 17, 2023
    514ce8a
    42600bb
    621fb26
    d74a550
  12. added a commit that references this issue on Jul 5, 2023
    2c597e8
  13. added a commit that references this issue on Jul 5, 2023
    ec73ba9
  14. added 4 commits that reference this issue on Aug 27, 2023
    21b4ff4
    e0f6a5f
    e23e212
    43cf168
  15. added a commit that references this issue on Aug 27, 2023
    459c75e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions