bazelbuild / bazelbuild/bazel

Providing a compile-time dependency (e.g. plugin) to cc_binary

Open
#16,241 2 comments 0 reactions 0 assignees View on GitHub
not stale P3 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:

There doesn't seem to be a way to provide a clang compiler plugin when building with cc_library or cc_binary. Using `deps` attempts to include the shared object as a link time dependency, and using `data` seems to include it as runtime dependency.

I noticed that for building java there is a `java_plugin` attribute, perhaps there should be something similar for c++?

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

We'd like to be able to build and use clang plugins as part of our existing bazel build.

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

macos

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

release 5.2.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 master; git rev-parse HEAD` ?

_No response_

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

I wasn't able to find anything relevant

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by examining how cc_library and cc_binary currently handle deps and data, then compare that behavior with the java_plugin attribute mentioned in the issue. Done means a Bazel build can provide and use a clang compiler plugin at compile time without treating it as a link-time or runtime dependency.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.