bazelbuild / bazelbuild/rules_rust
Make data dependencies not start at package root?
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
I feel like I'm just not understanding a bazel concept, so here goes.
I have this project structure:
```
ftzz
├── BUILD
├── testdata
│ └── generator
│ ├── simple_create_files_1000000.hash
│ ├── simple_create_files_100000.hash
│ ├── simple_create_files_10000.hash
│ └── simple_create_files_1000.hash
└── tests
└── generator.rs
```
And this rule:
```python
rust_test(
name = "ftzz_test",
srcs = [
"tests/generator.rs",
],
data = glob(["testdata/**/*.hash"]),
)
```
Inside the test, I'd like to be able to use the testdata like so:
```rust
PathBuf::from(format!(
"testdata/generator/simple_create_files_{}.hash",
num_files
));
```
However, the correct path seems to be `ftzz/testdata/generator/simple_create_files_{}.hash`. This is problematic because cargo doesn't execute the test binary above the project root, meaning you wouldn't be able to execute tests from both bazel and cargo. Is there a way to make bazel execute the binary inside the `ftzz` dir? That seems more correct anyway because renaming `ftzz` would break tests with the current bazel setup.
Contributor guide
Assessment
This issue has not been assessed yet.