@@ -461,6 +461,24 @@ impl Buck {
461461 cmd. args ( [
462462 "-c=client.id=rust-project" ,
463463 "-c=rust.rust_project_build=true" ,
464+ // Buck owner() queries stop at the innermost BUCK file unless
465+ // package_boundary_exceptions is set.
466+ //
467+ // This is arguably a bug in buck, because it's possible for a parent BUCK
468+ // file to own a file in a subdirectory that has its own BUCK file.
469+ //
470+ // Buck probably didn't intend to allow this pattern: it doesn't work when you
471+ // use `srcs = glob()`, but it does work for srcs with explicit paths.
472+ //
473+ // The intent of package_boundary_exceptions (added to buck2 in D34073360,
474+ // rolled out in D4339610) was to enforce boundaries with an explicit opt-out
475+ // list.
476+ //
477+ // However, due to the confusion with srcs, we can end up with owner() not
478+ // finding the target even when the package is not opted-out. Instead, opt-out
479+ // all packages for this query, so owner() always looks at parent BUCK files
480+ // and finds the relevant target.
481+ "-c=project.package_boundary_exceptions=." ,
464482 ] ) ;
465483
466484 cmd
@@ -738,25 +756,6 @@ impl Buck {
738756
739757 command. args ( [
740758 "prelude//rust/rust-analyzer/resolve_deps.bxl:resolve_owning_buildfile" ,
741- // Buck owner() queries stop at the innermost BUCK file unless
742- // package_boundary_exceptions is set.
743- //
744- // This is arguably a bug in buck, because it's possible for a parent BUCK
745- // file to own a file in a subdirectory that has its own BUCK file.
746- //
747- // Buck probably didn't intend to allow this pattern: it doesn't work when you
748- // use `srcs = glob()`, but it does work for srcs with explicit paths.
749- //
750- // The intent of package_boundary_exceptions (added to buck2 in D34073360,
751- // rolled out in D4339610) was to enforce boundaries with an explicit opt-out
752- // list.
753- //
754- // However, due to the confusion with srcs, we can end up with owner() not
755- // finding the target even when the package is not opted-out. Instead, opt-out
756- // all packages for this query, so owner() always looks at parent BUCK files
757- // and finds the relevant target.
758- "-c" ,
759- "project.package_boundary_exceptions=." ,
760759 "--" ,
761760 ] ) ;
762761
0 commit comments