facebook / facebook/buck2

How to propagate or inherit certain buckconfig settings in child cells?

Open
#417 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

I have a `.buckconfig` in the root of the project (that is, next to `.buckroot`) that looks like this:

```ini
[repositories]
root = .
third-party = third-party/

[project]
ignore = \
.jj, \
.git, \
.direnv, \
.watchman-cookie** \
work
```

To make some things easier to refer to, I gave several of the top-level directories in this project their own cells like `third-party//`, so they have their own `.buckconfig` that looks like this (under `third-party/.buckconfig`):

```ini
[repositories]
third-party = .
```

However, when I build something out of the `third-party//` cell, it does *not* inherit the top-level `project.ignore`:

```
$ buck2 build third-party//sqlite:shell
File changed: root//.watchman-cookie-GANON-19124-6468
File changed: third-party//sqlite/BUILD
File changed: root//.watchman-cookie-GANON-19124-6469
9 additional file change events
Build ID: 8430ac14-7f80-4e1c-9af9-7e1ff47a08e9
Network: Up: 0B Down: 0B
Jobs completed: 20. Time elapsed: 0.0s.
```

Notably, even though I ran the build from the root directory of the project (i.e. what you would call `root//`), it still used the `.buckconfig` file from the `third-party//` cell, so it didn't ignore the `.watchman-cookie` files and instead saw them as changed.

The only current solution I see is duplicating the `project.ignore` setting across the `.buckconfig` of every single cell, but obviously this is kind of unfortunate and easy to mess up. This is my complaint, and what I would like to avoid. So I'd like a way to propagate or inherit this setting to child cells.

To be fair, I understand why this is the case overall and as the default; certain properties should definitely *not* be inherited by default. But would it be possible for certain "special" cases like `project.ignore` to propagate downwards? That would be an immediate fix but it's possibly not the best. Or maybe this should be handled through PACKAGE files or something, somehow? Should there be a new `project.global_ignore`? Or maybe there should be a new a `[root]` section that can only be specified in the top-level root `.buckconfig` file? I don't really know, but I'd like to just specify this setting once.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.