bazelbuild / bazelbuild/bazel

ActionConflict when cc_test is put in filegroup

Open
#21,410 8 comments 2 reactions 0 assignees View on GitHub
P3 team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 16h
Merged PRs (30d)
72

Description

### Description of the bug:

When a cc_test is added to a filegroup, and both are built together with //..., an ActionConflictException is generated. The command fails when both filegroup and cc_test are invoked together. This issue means that aquery on the root of the repo and other full analysis actions fail.

pkg_zip and cc_test have the same issue.

Minimal example: https://github.com/peakschris/filegroup-of-cc-test

### Which category does this issue belong to?

C++ Rules

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

git clone https://github.com/peakschris/filegroup-of-cc-test
cd filegroup-of-cc-test
bazel build //test_fg/...

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

Windows

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

release 7.0.1

### 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_

### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

_No response_

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

_No response_

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

The two conflicting configurations differ only in that one has:
FragmentOptions com.google.devtools.build.lib.analysis.test.TestConfiguration$TestOptions
and the other does not have this fragment.

Contributor guide

Open the contributing guide

Research direction

Clone the linked minimal example and run `bazel build //test_fg/...` on Windows with Bazel 7.0.1 to reproduce the ActionConflict. Start by tracing the C++ rules' analysis configurations, especially the differing `TestConfiguration$TestOptions` fragment; done means the filegroup and cc_test can be built together without the conflict, including the reported pkg_zip case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.