Skip to content

Commit 7bda312

Browse files
9999yearslf-
authored andcommitted
//A/B/C is a valid name for //A/B/C:C
> Prefer using the short name when referring to an eponymous target (`//x` instead of `//x:x`). If > you are in the same package, prefer the local reference (`:x` instead of `//x`). See: https://bazel.build/build/style-guide#target-naming This syntax is supported on the command-line, but not in BUCK files. Unfortunately, the only(?) Starlark formatter (buildifier: https://github.com/bazelbuild/buildtools) automatically abbreviates targets on the assumption that this syntax is valid, which causes errors when using Buck2: ... 4: Error coercing "//src/Foo" 5: Invalid absolute target pattern `//src/Foo` is not allowed 6: Expected a `:`, a trailing `/...` or the literal `...`. We can adjust the parsing rules to allow this syntax in more places.
1 parent d4ca6e3 commit 7bda312

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/buck2_core/src/pattern/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl<T: PatternType> ParsedPattern<T> {
302302
cell_alias_resolver,
303303
TargetParsingOptions {
304304
relative,
305-
infer_target: false,
305+
infer_target: true,
306306
strip_package_trailing_slash: false,
307307
},
308308
pattern,

0 commit comments

Comments
 (0)