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-project --local does not copy non-boot dependencies to output dir #8958

Closed
amesgen opened this issue May 19, 2023 · 6 comments · Fixed by #8919
Closed

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

amesgen opened this issue May 19, 2023 · 6 comments · Fixed by #8919

Comments

@amesgen
Copy link

amesgen commented May 19, 2023

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
@ulysses4ever
Copy link
Collaborator

Thanks for the report! Any thoughts, @coot?

@coot coot self-assigned this May 20, 2023
@coot
Copy link
Collaborator

coot commented May 20, 2023

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.

coot added a commit that referenced this issue May 20, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store
@coot
Copy link
Collaborator

coot commented May 20, 2023

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

@coot coot mentioned this issue May 20, 2023
4 tasks
@amesgen
Copy link
Author

amesgen commented May 20, 2023

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

coot added a commit that referenced this issue May 21, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store
@coot
Copy link
Collaborator

coot commented May 26, 2023

I think it will if you add

package unliftio-core
  documentation: True

@amesgen
Copy link
Author

amesgen commented May 29, 2023

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

coot added a commit that referenced this issue May 30, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store
coot added a commit that referenced this issue Jun 3, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store
coot added a commit that referenced this issue Jun 3, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store
coot added a commit that referenced this issue Jun 17, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Jun 17, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Jun 17, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Jun 19, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
ulysses4ever pushed a commit that referenced this issue Jul 5, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
@mergify mergify bot closed this as completed in #8919 Jul 5, 2023
mergify bot pushed a commit that referenced this issue Jul 5, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.

(cherry picked from commit 2c597e8)

# Conflicts:
#	cabal-install/src/Distribution/Client/CmdHaddockProject.hs
coot added a commit that referenced this issue Aug 27, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Aug 27, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Aug 27, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
coot added a commit that referenced this issue Aug 27, 2023
`haddock-project` command need to build the project so that haddocks of
the dependencies are available in the store.

Fixes #8958.
Kleidukos pushed a commit that referenced this issue Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants