bazelbuild / bazelbuild/bazel

Bazel's documentation references nonexistent devtools_build::GetDataDependencyFilepath API

Open
#21,741 10 comments 7 reactions 0 assignees View on GitHub
P3 stale team-Documentation team-Rules-CPP type: documentation (cleanup)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Page link:

https://bazel.build/reference/be/c-cpp#cc_test.data

### Problem description (include actual vs expected text, if applicable):

Bazel's `cc_test.data` feature does not seem to be usable. The docs do not say anything useful about how the test is supposed to get access to the files. It claims the test can use an API like this:

```
const std::string path = devtools_build::GetDataDependencyFilepath(
"my/test/data/file");
```

However, this references a library that doesn't seem to exist. There are no instructions for where to get this library, how to import it, etc. Searching through the entire bazelbuild org, I found no reference to this library.

I did find reference to some "runfiles" mechanism, but I cannot get it to work or make heads or tails of what it's for because, since 2018 (https://github.com/bazelbuild/bazel/issues/6402), Bazel hasn't documented it.

### Where do you see this issue? (include link to specific section of the page, if applicable)

https://bazel.build/reference/be/c-cpp#cc_test.data

### Any other information you'd like to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the cc_test.data section at the linked Bazel documentation page and compare its devtools_build::GetDataDependencyFilepath example with the runfiles references and issue #6402. Done means the page no longer points to a nonexistent API and explains how a C++ test can access data files, including where the required mechanism comes from.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 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.