bazelbuild / bazelbuild/bazel

FR: Expose `--per_file_copt` to Starlark

Open
#14,764 0 comments 1 reaction 0 assignees View on GitHub
P2 team-Rules-ObjC type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the problem / feature request:

I would like to get the effective value of `--per_file_copt` in a Starlark aspect.

### Feature requests: what underlying problem are you trying to solve with this feature?

In a Starlark aspect I'm collecting all of the copts that are used to compile Objective-C files. Currently I can get most of them through [cc_common.get_memory_inefficent_command_line](https://docs.bazel.build/versions/main/skylark/lib/cc_common.html#get_memory_inefficient_command_line) (is there a better way?), but that doesn't take into account `--per_file_copt`.

It seems a fully Starlark objc_library would need this as well, as it's currently relying on some native code to allow this flag to influence the compile action.

### What's the output of `bazel info release`?

release 5.0.0

Contributor guide

Open the contributing guide

Research direction

Start with the Starlark aspect use of cc_common.get_memory_inefficent_command_line and trace how native objc_library handling applies --per_file_copt. The work is done when a Starlark aspect can read the effective --per_file_copt value used for Objective-C compilation, including the behavior needed by a fully Starlark objc_library.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
build-system, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.