Possibility to add extra outputs for cc_common.compile and cc_common.link
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
This is a feature request to add the possibility to gather extra outputs for the compile and linking actions of the cc toolchain via `cc_common.compile` and `cc_common.link`. The interface could be as simple as adding an attribute `extra_outputs` to these 2 functions.
### Feature requests: what underlying problem are you trying to solve with this feature?
This would enable gathering artifacts like map file (-Wl,-Map=...) or stack usage files (-fstack-usage) for example.
As a workaround, one can use `cc_common.create_link_variables` + `cc_common.get_memory_inefficient_command_line` + `ctx.actions.run` but there seem to be a significant amount of code needed to achieve the same result (see [here](https://github.com/Bazel-snippets/custom_cc_rules) for example),
This would solve https://github.com/bazelbuild/bazel/issues/6718
Contributor guide
Research direction
Start with the cc_common.compile and cc_common.link interfaces described in the request, then review the workaround using cc_common.create_link_variables, cc_common.get_memory_inefficient_command_line, and ctx.actions.run. Done means compile and link actions can expose requested artifacts such as map files or stack-usage files without requiring the custom workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100