Skip to content

Comments

--haddock-for-hackage works with older Haddock#5496

Merged
hvr merged 2 commits intohaskell:masterfrom
harpocrates:fix/bug-5494
Aug 6, 2018
Merged

--haddock-for-hackage works with older Haddock#5496
hvr merged 2 commits intohaskell:masterfrom
harpocrates:fix/bug-5494

Conversation

@harpocrates
Copy link
Collaborator

We error-out when --quickjump is specified on a version of Haddock that
doesn't support it. However, if --quickjump was implied by
--haddock-for-hackage, we should just warn.

Fixes #5494.


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.

Please also shortly describe how you tested your change. Bonus points for added tests!

We error-out when `--quickjump` is specified on a version of Haddock that
doesn't support it. However, if `--quickjump` was implied by
`--haddock-for-hackage`, we should just warn.

Fixes haskell#5494.
@harpocrates harpocrates requested a review from hvr August 3, 2018 17:01
alt = "The generated documentation won't have the QuickJump feature."
case haddockTarget of
ForDevelopment -> die' verbosity msg
ForHackage -> warn verbosity (msg ++ "\n" ++ alt)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You probably want "\n\n" or " ", since there's no visual break this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want a visual break - just a new line. Should there be more of a visual break?

@hvr hvr added this to the 2.4 milestone Aug 3, 2018
Copy link
Member

@23Skidoo 23Skidoo left a comment

Choose a reason for hiding this comment

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

It may make sense to change the type of haddockQuickJump to something like Flag (Maybe Bool) so that we could distinguish the haddock --for-hackage case from haddock --for-hackage --quickjump.

@hvr
Copy link
Member

hvr commented Aug 6, 2018

@harpocrates do you have time to try to implement @23Skidoo suggestion?

i.e. so that

  • haddock --for-hackage merely warns and gracefully degrades to disabling quickjump, whereas
  • haddock --for-hackage --quickjump fails hard if haddock doesn't support quickjump

@harpocrates
Copy link
Collaborator Author

@hvr Done. Now, any mention of --quickjump, with or without --for-hackage, will cause Cabal run with an older Haddock to fail hard.

Also noticed that I'd forgotten to let through a --haddock-quickjump flag for new-haddock... 😄

case haddockTarget of
ForDevelopment -> die' verbosity msg
ForHackage -> warn verbosity (msg ++ "\n" ++ alt)
if Flag True == quickJmpFlag
Copy link
Member

Choose a reason for hiding this comment

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

This is not quite what @hvr suggested IIUC. Since --for-hackage implies --quickjump, all of --for-hackage, --for-hackage --quickjump, and --quickjump will now fail hard when using an older haddock.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is though (I've even tried it out). quickJmpFlag records what the quickjump flag was prior to the --for-hackage implication. That way, only --for-hackage --quickjump, and --quickjump will fail hard when using an older haddock - --for-hackage by itself is just a warning.

Copy link
Member

Choose a reason for hiding this comment

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

I can confirm that @harpocrates' PR works as advertised; I tried the combinations old/new haddock, and --haddock-for-hackage, --haddock-quickjump, --haddock-for-hackage --haddock-quickjump, and they matched my expectations.

Copy link
Member

Choose a reason for hiding this comment

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

Great! Don't we still get a warning when neither --for-hackage nor --quickjump were specified, but haddock is old?

Copy link
Member

Choose a reason for hiding this comment

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

@23Skidoo I don't see any warning w/ e.g. GHC 8.2.2 (i.e. old haddock) and a plain cabal new-haddock -w ghc-8.2.2 w/o any additional flags.

Copy link
Member

Choose a reason for hiding this comment

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

OK. Let's merge!

@hvr hvr merged commit 13a8991 into haskell:master Aug 6, 2018
hvr pushed a commit that referenced this pull request Aug 6, 2018
We only error-out when an explicit `--(haddock-)quickjump` is specified
on a version of Haddock that doesn't support it.

However, if `--(haddock-)quickjump` was implied by
`--(haddock-)for-hackage`, we should just warn.

Fixes #5494.

(cherry picked from commit 13a8991)
@hvr
Copy link
Member

hvr commented Aug 6, 2018

also cherry-picked into 2.4 via 76933f4

@hvr
Copy link
Member

hvr commented Aug 6, 2018

@harpocrates thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants