bazelbuild / bazelbuild/bazel

Add compilation mode specific config to allow `.bazelrc` controls conditional on it

Open
#23,477 7 comments 0 reactions 0 assignees View on GitHub
P3 team-Configurability 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:

Similar to `--enable_platform_specific_config` which allows `.bazelrc` to inject Linux, macOS, Windows, etc. flags as needed, it would be extremely helpful to have compilation mode specific configs so that a `.bazelrc` can inject `-c opt` or `-c dbg` specific flags.

### Which category does this issue belong to?

Configurability

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

The need to add customization specific to a compilation mode, such as local, hardware-specific flags that only applicable in an optimized build, or a local debugging feature that should only be enabled with `-c dbg`.

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

Linux and macOS

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

Not relevant...

### 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` ?

_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 reviewing Bazel's existing --enable_platform_specific_config behavior and how .bazelrc configuration is processed. Determine the expected behavior for -c opt and -c dbg, then verify the feature with focused configuration tests; done means compilation-mode-specific flags are injected only for the matching mode.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.