-
Notifications
You must be signed in to change notification settings - Fork 247
Patch HPC for better compatibility with large projects #1464
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
Conversation
I think this needs to be upstreamed. I would guess that it would be pretty safe to make |
We already have way too many GHC patches, if we can possibly avoid more that would be great... |
Thanks, I will try to upstream the change. I see now it applies to Because this change applies to the GHC source tree, not the HPC source tree, does that mean it will only take effect on future GHCs, unless explicitly back-ported? |
Here is the upstream change: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8194 I should probably provide a test to show it works without |
That looks super, thanks. Like I said, I think we might be able to get away with just:
|
This is an improvement to HPC authored by Richard Wallace (https://github.com/purefn) and myself. I have received permission from him to attempt to upstream it. This improvement was originally implemented as a patch to HPC via input-output-hk/haskell.nix: input-output-hk/haskell.nix#1464 Paraphrasing Richard, HPC currently requires all inputs as command line arguments. With large projects this can result in an argument list too long error. I have only seen this error in Nix, but I assume it can occur is a plain Unix environment. This MR adds the standard response file syntax support to HPC. For example you can now pass a file to the command line which contains the arguments. ``` hpc @response_file_1 @response_file_2 ... The contents of a Response File must have this format: COMMAND ... example: report my_library.tix --include=ModuleA --include=ModuleB ``` Updates hpc submodule Co-authored-by: Richard Wallace <[email protected]> Fixes #22050
@michaelpj Just to let you know that HPC has a new maintainership team now, and we are working on this. I just created a ticket for a reinstallable HPC here: https://gitlab.haskell.org/hpc/hpc-bin/-/issues/13 If you have any requirements on the HPC binary, feel free to chime in with feature requests :) |
Great! We may well have such in future, should I tag you in that case? |
Yes, feel free to tag me :) |
This is an improvement to HPC authored by Richard Wallace (https://github.com/purefn) and myself. I have received permission from him to attempt to upstream it. This improvement was originally implemented as a patch to HPC via input-output-hk/haskell.nix: input-output-hk/haskell.nix#1464 Paraphrasing Richard, HPC currently requires all inputs as command line arguments. With large projects this can result in an argument list too long error. I have only seen this error in Nix, but I assume it can occur is a plain Unix environment. This MR adds the standard response file syntax support to HPC. For example you can now pass a file to the command line which contains the arguments. ``` hpc @response_file_1 @response_file_2 ... The contents of a Response File must have this format: COMMAND ... example: report my_library.tix --include=ModuleA --include=ModuleB ``` Updates hpc submodule Co-authored-by: Richard Wallace <[email protected]> Fixes #22050
This is a patch to HPC authored by @purefn . I've received permission from him to attempt to upstream this patch.
Paraphrasing @purefn ,
HPC currently requires all inputs as command line arguments.
With large projects this can result in an
argument list too long
error: NixOS/nix#5593This patch to HPC adds the arguments
srcdirs-from=<FILE>
,hpcdirs-from=<FILE>
, andincludes-from=<FILE>
.Then,
haskell.nix
passes these inputs as files rather than as direct command line arguments.@purefn notes this improvement to HPC ought to be upstreamed to HPC directly: https://gitlab.haskell.org/ghc/packages/hpc
However, would this result in the change being available to old GHC versions such as 8.10.7?
Here are two tests of this patch on public projects:
Pandoc

peterbecich/pandoc@93bc858
This HTML report can be generated with:
nix build -f default.nix projectCoverageReport
No other arguments are needed because they are here: https://github.com/peterbecich/pandoc/blob/93bc85844c539a81b3a31eb8e76f7efb0d5aac63/default.nix#L13-L20
more tests TODO...
I do not have a test which exhibits the error without the patch. This is because projects sufficiently large to cause unpatched HPC to fail also hit other instances of the
argument list too long
error, unrelated to HPC: #1297So, the best I can do is to show that the patch is not a regression.