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

Expose compilation_outputs.gcno_files() and compilation_outputs.pic_gcno_files() as public starlark API #24724

Open
malt3 opened this issue Dec 17, 2024 · 1 comment

Comments

@malt3
Copy link
Contributor

malt3 commented Dec 17, 2024

Description of the feature request:

When trying to access the second output (compilation_outputs) of cc_common.compile, some methods are private API and calling them from user-defined rules leads to the following error:

ERROR: /home/user/project/BUILD.bazel:119:37: in foo_library rule //REDACTED: 
Traceback (most recent call last):
        File "/home/user/...output-base.../external/rules_foo+/rule/cc/helper.bzl", line 222, column 56, in create_cc_providers_from_files
                metadata_files = compilation_outputs.gcno_files() + compilation_outputs.pic_gcno_files(),
Error in gcno_files: file '@@rules_foo+//rule/cc:helper.bzl' cannot use private API

Which category does this issue belong to?

No response

What underlying problem are you trying to solve with this feature?

Use cc_common.compile and friends to build C++ code, then get valid coverage (including gcno files) forwarded to coverage_common.instrumented_files_info, just like what Bazel does internally.

I think this could be as simple as changing this.

Alternatively, rules_cc could maybe export create_cc_instrumented_files_info, but change the API so it takes compilation_outputs and extracts gcno files in that helper (which should be allowed to use private APIs). I implemented that here.

Which operating system are you running Bazel on?

Ubuntu 22.04

What is the output of bazel info release?

release 8.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@fmeum
Copy link
Collaborator

fmeum commented Dec 17, 2024

@c-mita

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

No branches or pull requests

6 participants