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 #5210 Don't refer to index.html when Haddock will not create it #9332

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

mpilgrem
Copy link
Collaborator

Haddock documents that it will not create index.html if option --use-contents or option --use-index is passed to it. See: https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-use-contents

However, that is not reflected in the existing logic for result in Distribution.Simple.Haddock.renderArgs, resulting in the behaviour complained about in issue #5210. This pull request fixes that.

  • Patches conform to the coding conventions. I have followed the style of the surrounding source code.
  • Any changes that could be relevant to users have been recorded in the changelog. I don't think this fix merits a Change Log entry.
  • The documentation has been updated, if necessary. The feature is undocumented, so there is no documentation to update.
  • Manual QA notes have been included. I don't think QA notes are needed, but I have included a code comment.

Cabal/src/Distribution/Simple/Haddock.hs Outdated Show resolved Hide resolved
@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Oct 14, 2023

Any chance for a test?

Changelog would be nice too.

@mpilgrem
Copy link
Collaborator Author

As requested, I've add something to Cabal's ChangeLog (I hope it was the correct file) and also to cabal-install's (as it flows through to the tool, too).

I can't think of how to test for the original mistake.

@geekosaur
Copy link
Collaborator

There's a changelog.d directory into which changelog fragments go, rather than edit the ChangeLog directly; this lets changelogs be built for a particular version from the commits that go into that version.

@ulysses4ever
Copy link
Collaborator

Thanks! The explanation about changelogs is referenced in the PR template.

@mpilgrem
Copy link
Collaborator Author

@geekosaur, @ulysses4ever apologies on ChangeLog. I've now read the instructions, and tried again.

@ulysses4ever
Copy link
Collaborator

For testing: could you create a copy of cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd, rename it, change the call to cabal in cabal.test.hs from

  r <- cabal' "haddock" ["--haddock-output-dir=docs", "A"] 

to

  r <- cabal' "haddock" ["--haddock-output-dir=docs", " --haddock-for-hackage" "A"] 

and replace the last line in the same file (assertFindInFile...) with assertOutputDoesNotContain "index.html" r?

I may be missing some details but high-level this is the way to go, I think.

To test is locally you may need to dive into https://github.com/haskell/cabal/blob/master/cabal-testsuite/README.md Most importantly, --with-cabal should be set correctly (e.g. to $(cabal list-bin cabal) after you have built cabal).

@mpilgrem
Copy link
Collaborator Author

mpilgrem commented Oct 14, 2023

@ulysses4ever, I have added a test but my attempts to test the test locally came to naught, because Test.Cabal.Prelude.withRepo contains a skipIfWindows. So, I am relying on CI to test the test. EDIT: Well that did not work ... I am retrying with a simpler test. EDIT2: Well that did not work either. Perhaps it is something to do with the cabal.out file ... I am retrying with one.

@mpilgrem mpilgrem force-pushed the fix5210 branch 2 times, most recently from d4d1f03 to defd6c7 Compare October 14, 2023 22:56
@ulysses4ever
Copy link
Collaborator

Thank you for willing to give it a go, and I'm sorry it doesn't go through yet.

withRepo may actually be not necessary. You could try any other existing test that calls cabal against a local package instead of a dependency (withRepo is only necessary when a test package uses a dependency).

@ulysses4ever
Copy link
Collaborator

Sorry, didn't see the edits until now (better send new comments — for visibility). Yes, .out will need to be adjusted. Usually it's done by calling the test binary with --accept but if you can't run it locally, this may be a problem...

@mpilgrem
Copy link
Collaborator Author

@ulysses4ever, I finally arrived at a test that has passed the CI.

Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrific, thank you! Apologies for all the pain due to the test suite, but tests is the only way to assure sanity in the future..

@ulysses4ever ulysses4ever added the merge me Tell Mergify Bot to merge label Oct 15, 2023
@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Oct 17, 2023
@mergify mergify bot merged commit eece442 into master Oct 17, 2023
45 checks passed
@mergify mergify bot deleted the fix5210 branch October 17, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants