facebook / facebook/buck2

`attrs.query()` doesn't support non-literal target expressions

Open
#516 5 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

If I write this on the command line:

```
buck2 query set(root//foo/...)
```

it will list all targets defined in a BUCK file within the directory `foo` or in any directory beneath it.

However, when using an `attrs.query()` argument to a rule, it seems this is not possible. buck2 errors and tells me that it expected a target literal, not a pattern. This is easiest to see when using the `deps_query` argument a standard prelude rule, but it happens with any `attrs.query()` argument. It don't really understand Rust well, but it seems like it could be because of [this](https://github.com/facebook/buck2/blob/4b9193383109aa3c466d518585d2ad737164d798/app/buck2_interpreter_for_build/src/attrs/coerce/attr_type/query.rs#L53) (and also the comment suggests it's maybe intentional?).

Can anyone shed some light on this?

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.