bazelbuild / bazelbuild/bazel

Add `additional_outputs` parameter to `cc_common.compile`

Open
#22,036 2 comments 0 reactions 0 assignees View on GitHub
P3 stale team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Our compiler has extensions that can produce additional metadata files as an output of compilation.

Today, there is no way to retrieve these additional outputs from the sandbox via `cc_common.compile`. The only option I'm aware of (while continuing to use `cc_common`) would be `cc_common.get_memory_inefficient_command_line`, which we'd like to avoid for the sake of efficiency.

Ideal outcome would be that `cc_common.compile` gets an `additional_outputs` parameter, exactly as `cc_common.link` already has.

### Which category does this issue belong to?

C++ Rules

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

Retrieve additional (non-standard) output files from the sandbox when compiling via `cc_common.compile`.

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

release 7.0.1- (@non-git)

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

Built from source https://github.com/bazelbuild/bazel/releases/download/7.0.1/bazel-7.0.1-dist.zip

`env SOURCE_DATE_EPOCH=1 EXTRA_BAZEL_ARGS=--host_javabase=@local_jdk//:jdk bash ./compile.sh`

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

_No response_

### Have you found anything relevant by searching the web?

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing the requested cc_common.compile parameter with the existing additional_outputs support in cc_common.link. Trace how compile outputs are exposed from the sandbox, then verify that the new parameter retrieves compiler-produced metadata without using cc_common.get_memory_inefficient_command_line.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.