diff --git a/app/buck2_build_api/src/query/bxl.rs b/app/buck2_build_api/src/query/bxl.rs index dabda4d754118..6844169997333 100644 --- a/app/buck2_build_api/src/query/bxl.rs +++ b/app/buck2_build_api/src/query/bxl.rs @@ -77,6 +77,17 @@ pub trait BxlCqueryFunctions: Send { dice: &mut DiceComputations<'_>, targets: &TargetSet, ) -> buck2_error::Result>>; + async fn allbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &TargetSet, + ) -> buck2_error::Result; + async fn rbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &FileSet, + argset: &FileSet, + ) -> buck2_error::Result; } #[async_trait] @@ -125,6 +136,17 @@ pub trait BxlUqueryFunctions: Send { dice: &mut DiceComputations<'_>, file_set: &FileSet, ) -> buck2_error::Result>; + async fn allbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &TargetSet, + ) -> buck2_error::Result; + async fn rbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &FileSet, + argset: &FileSet, + ) -> buck2_error::Result; } #[async_trait] diff --git a/app/buck2_bxl/src/bxl/starlark_defs/cquery.rs b/app/buck2_bxl/src/bxl/starlark_defs/cquery.rs index 3de734eadac44..ba36c42b89c4f 100644 --- a/app/buck2_bxl/src/bxl/starlark_defs/cquery.rs +++ b/app/buck2_bxl/src/bxl/starlark_defs/cquery.rs @@ -607,4 +607,68 @@ fn cquery_methods(builder: &mut MethodsBuilder) { }) .map(StarlarkFileSet::from)?) } + + /// The allbuildfiles query for finding the build files of the given targets and their transitive imports. + /// + /// Sample usage: + /// ```python + /// def _impl_allbuildfiles(ctx): + /// result = ctx.cquery().allbuildfiles("root//bin:the_binary") + /// ctx.output.print(result) + /// ``` + fn allbuildfiles<'v>( + this: &StarlarkCQueryCtx<'v>, + universe: ConfiguredTargetListExprArg<'v>, + eval: &mut Evaluator<'v, '_, '_>, + ) -> starlark::Result { + Ok(this + .ctx + .via_dice(eval, |dice| { + dice.via(|dice| { + async { + let universe = unpack_targets(this, dice, universe).await?; + get_cquery_env(&this.ctx, &this.global_cfg_options_override) + .await? + .allbuildfiles(dice, &universe) + .await + } + .boxed_local() + }) + }) + .map(StarlarkFileSet::from)?) + } + + /// The rbuildfiles query for finding all build files that transitively depend on the given files. + /// + /// Sample usage: + /// ```python + /// def _impl_rbuildfiles(ctx): + /// result = ctx.cquery().rbuildfiles("bin/TARGETS", "bin/defs.bzl") + /// ctx.output.print(result) + /// ``` + fn rbuildfiles<'v>( + this: &StarlarkCQueryCtx<'v>, + universe: FileSetExpr, + argset: FileSetExpr, + eval: &mut Evaluator<'v, '_, '_>, + ) -> starlark::Result { + Ok(this + .ctx + .via_dice(eval, |dice| { + dice.via(|dice| { + async { + get_cquery_env(&this.ctx, &this.global_cfg_options_override) + .await? + .rbuildfiles( + dice, + (universe.get(&this.ctx).await?).as_ref(), + (argset.get(&this.ctx).await?).as_ref(), + ) + .await + } + .boxed_local() + }) + }) + .map(StarlarkFileSet::from)?) + } } diff --git a/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/lazy_uquery_ctx.rs b/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/lazy_uquery_ctx.rs index 5e32bc8319177..03de49d6ad697 100644 --- a/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/lazy_uquery_ctx.rs +++ b/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/lazy_uquery_ctx.rs @@ -263,6 +263,38 @@ fn lazy_uquery_methods(builder: &mut MethodsBuilder) { Ok(StarlarkLazy::new_uquery(op)) } + /// Finds the build files of the given targets and their transitive imports. + /// + /// Example: + /// ```python + /// res = ctx.lazy.uquery().allbuildfiles("//:foo").catch().resolve() + /// ``` + fn allbuildfiles<'v>( + #[starlark(this)] _this: &'v StarlarkLazyUqueryCtx, + #[starlark(require = pos)] universe: TargetListExprArg<'v>, + ) -> starlark::Result { + let universe = OwnedTargetListExprArg::from_ref(&universe); + let op = LazyUqueryOperation::AllBuildfiles(universe); + Ok(StarlarkLazy::new_uquery(op)) + } + + /// Finds all build files that transitively depend on the given files. + /// + /// Example: + /// ```python + /// res = ctx.lazy.uquery().rbuildfiles("bin/TARGETS", "bin/defs.bzl").catch().resolve() + /// ``` + fn rbuildfiles<'v>( + #[starlark(this)] _this: &'v StarlarkLazyUqueryCtx, + #[starlark(require = pos)] universe: FileSetExpr<'v>, + #[starlark(require = pos)] argset: FileSetExpr<'v>, + ) -> starlark::Result { + let universe = OwnedFileSetExpr::from_ref(&universe); + let argset = OwnedFileSetExpr::from_ref(&argset); + let op = LazyUqueryOperation::Rbuildfiles { universe, argset }; + Ok(StarlarkLazy::new_uquery(op)) + } + /// Finds targets that own the specified files. /// /// Example: diff --git a/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/operation/uquery.rs b/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/operation/uquery.rs index c7da8aaad403b..23e08144e98d8 100644 --- a/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/operation/uquery.rs +++ b/app/buck2_bxl/src/bxl/starlark_defs/lazy_ctx/operation/uquery.rs @@ -71,6 +71,11 @@ pub(crate) enum LazyUqueryOperation { targets: OwnedTargetListExprArg, }, Buildfile(OwnedTargetListExprArg), + AllBuildfiles(OwnedTargetListExprArg), + Rbuildfiles { + universe: OwnedFileSetExpr, + argset: OwnedFileSetExpr, + }, Owner { files: OwnedFileSetExpr, }, @@ -95,6 +100,8 @@ pub(crate) enum LazyUqueryResult { Rdeps(StarlarkTargetSet), Filter(StarlarkTargetSet), Buildfile(StarlarkFileSet), + AllBuildfiles(StarlarkFileSet), + Rbuildfiles(StarlarkFileSet), Owner(StarlarkTargetSet), TargetsInBuildfile(StarlarkTargetSet), Eval(QueryEvaluationResult), @@ -114,6 +121,8 @@ impl LazyUqueryResult { LazyUqueryResult::Rdeps(target_set) => Ok(heap.alloc(target_set)), LazyUqueryResult::Filter(target_set) => Ok(heap.alloc(target_set)), LazyUqueryResult::Buildfile(file_set) => Ok(heap.alloc(file_set)), + LazyUqueryResult::AllBuildfiles(file_set) => Ok(heap.alloc(file_set)), + LazyUqueryResult::Rbuildfiles(file_set) => Ok(heap.alloc(file_set)), LazyUqueryResult::Owner(target_set) => Ok(heap.alloc(target_set)), LazyUqueryResult::TargetsInBuildfile(target_set) => Ok(heap.alloc(target_set)), LazyUqueryResult::Eval(result) => parse_query_evaluation_result(result, heap), @@ -258,6 +267,27 @@ impl LazyUqueryOperation { Ok(LazyUqueryResult::Buildfile(StarlarkFileSet::from(res))) } + LazyUqueryOperation::AllBuildfiles(expr) => { + let target_set = expr.to_unconfigured_target_set(core_data, dice).await?; + + let res = get_uquery_env(core_data) + .await? + .allbuildfiles(dice, &target_set) + .await?; + + Ok(LazyUqueryResult::AllBuildfiles(StarlarkFileSet::from(res))) + } + LazyUqueryOperation::Rbuildfiles { universe, argset } => { + let universe = universe.get(core_data)?; + let argset = argset.get(core_data)?; + + let res = get_uquery_env(core_data) + .await? + .rbuildfiles(dice, &universe, &argset) + .await?; + + Ok(LazyUqueryResult::Rbuildfiles(StarlarkFileSet::from(res))) + } LazyUqueryOperation::Owner { files } => { let file_set = files.get(core_data)?; diff --git a/app/buck2_bxl/src/bxl/starlark_defs/uquery.rs b/app/buck2_bxl/src/bxl/starlark_defs/uquery.rs index d186eb060ca90..4fb3140811ec0 100644 --- a/app/buck2_bxl/src/bxl/starlark_defs/uquery.rs +++ b/app/buck2_bxl/src/bxl/starlark_defs/uquery.rs @@ -490,6 +490,70 @@ fn uquery_methods(builder: &mut MethodsBuilder) { .map(StarlarkTargetSet::from)?) } + /// The allbuildfiles query for finding the build files of the given targets and their transitive imports. + /// + /// Sample usage: + /// ```python + /// def _impl_allbuildfiles(ctx): + /// result = ctx.uquery().allbuildfiles("root//bin:the_binary") + /// ctx.output.print(result) + /// ``` + fn allbuildfiles<'v>( + this: &StarlarkUQueryCtx<'v>, + universe: TargetListExprArg<'v>, + eval: &mut Evaluator<'v, '_, '_>, + ) -> starlark::Result { + Ok(this + .ctx + .via_dice(eval, |dice| { + dice.via(|dice| { + async { + let universe = unpack_targets(this, dice, universe).await?; + get_uquery_env(&this.ctx) + .await? + .allbuildfiles(dice, &universe) + .await + } + .boxed_local() + }) + }) + .map(StarlarkFileSet::from)?) + } + + /// The rbuildfiles query for finding all build files that transitively depend on the given files. + /// + /// Sample usage: + /// ```python + /// def _impl_rbuildfiles(ctx): + /// result = ctx.uquery().rbuildfiles("bin/TARGETS", "bin/defs.bzl") + /// ctx.output.print(result) + /// ``` + fn rbuildfiles<'v>( + this: &StarlarkUQueryCtx<'v>, + universe: FileSetExpr, + argset: FileSetExpr, + eval: &mut Evaluator<'v, '_, '_>, + ) -> starlark::Result { + Ok(this + .ctx + .via_dice(eval, |dice| { + dice.via(|dice| { + async { + get_uquery_env(&this.ctx) + .await? + .rbuildfiles( + dice, + (universe.get(&this.ctx).await?).as_ref(), + (argset.get(&this.ctx).await?).as_ref(), + ) + .await + } + .boxed_local() + }) + }) + .map(StarlarkFileSet::from)?) + } + /// The attrregexfilter query for rule attribute filtering with regex. /// /// Sample usage: diff --git a/app/buck2_query_impls/src/cquery/bxl.rs b/app/buck2_query_impls/src/cquery/bxl.rs index b2a9d88242dd4..1a72399881e41 100644 --- a/app/buck2_query_impls/src/cquery/bxl.rs +++ b/app/buck2_query_impls/src/cquery/bxl.rs @@ -244,6 +244,46 @@ impl BxlCqueryFunctions for BxlCqueryFunctionsImpl { }) .await?) } + + async fn allbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &TargetSet, + ) -> buck2_error::Result { + Ok(dice + .with_linear_recompute(|dice| async move { + cquery_functions() + .allbuildfiles( + &self + .cquery_env(&self.setup_dice_query_delegate(&dice).await?, None) + .await?, + universe, + ) + .await + }) + .await?) + } + + async fn rbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &FileSet, + argset: &FileSet, + ) -> buck2_error::Result { + Ok(dice + .with_linear_recompute(|dice| async move { + cquery_functions() + .rbuildfiles( + &self + .cquery_env(&self.setup_dice_query_delegate(&dice).await?, None) + .await?, + universe, + argset, + ) + .await + }) + .await?) + } } pub(crate) fn init_new_bxl_cquery_functions() { diff --git a/app/buck2_query_impls/src/uquery/bxl.rs b/app/buck2_query_impls/src/uquery/bxl.rs index 6d3395674764e..4eb1aa4f122f3 100644 --- a/app/buck2_query_impls/src/uquery/bxl.rs +++ b/app/buck2_query_impls/src/uquery/bxl.rs @@ -208,6 +208,40 @@ impl BxlUqueryFunctions for BxlUqueryFunctionsImpl { }) .await?) } + async fn allbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &TargetSet, + ) -> buck2_error::Result { + Ok(dice + .with_linear_recompute(|dice| async move { + uquery_functions() + .allbuildfiles( + &self.uquery_env(&self.uquery_delegate(&dice).await?).await?, + universe, + ) + .await + }) + .await?) + } + async fn rbuildfiles( + &self, + dice: &mut DiceComputations<'_>, + universe: &FileSet, + argset: &FileSet, + ) -> buck2_error::Result { + Ok(dice + .with_linear_recompute(|dice| async move { + uquery_functions() + .rbuildfiles( + &self.uquery_env(&self.uquery_delegate(&dice).await?).await?, + universe, + argset, + ) + .await + }) + .await?) + } } pub(crate) fn init_new_bxl_uquery_functions() { diff --git a/tests/core/bxl/test_query_buildfiles.py b/tests/core/bxl/test_query_buildfiles.py new file mode 100644 index 0000000000000..389a027cc6699 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles.py @@ -0,0 +1,54 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is dual-licensed under either the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree or the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. You may select, at your option, one of the +# above-listed licenses. + +# pyre-strict + +from buck2.tests.e2e_util.api.buck import Buck +from buck2.tests.e2e_util.buck_workspace import buck_test + + +@buck_test() +async def test_uquery_allbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:uquery_allbuildfiles", + ) + + +@buck_test() +async def test_uquery_rbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:uquery_rbuildfiles", + ) + + +@buck_test() +async def test_cquery_allbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:cquery_allbuildfiles", + ) + + +@buck_test() +async def test_cquery_rbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:cquery_rbuildfiles", + ) + + +@buck_test() +async def test_lazy_uquery_allbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:lazy_uquery_allbuildfiles", + ) + + +@buck_test() +async def test_lazy_uquery_rbuildfiles(buck: Buck) -> None: + await buck.bxl( + "//:query_buildfiles.bxl:lazy_uquery_rbuildfiles", + ) diff --git a/tests/core/bxl/test_query_buildfiles_data/.buckconfig b/tests/core/bxl/test_query_buildfiles_data/.buckconfig new file mode 100644 index 0000000000000..09556211287db --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/.buckconfig @@ -0,0 +1,12 @@ +[cells] + root = . + nano_prelude = nano_prelude + +[cell_aliases] + prelude = nano_prelude + +[external_cells] + nano_prelude = bundled + +[buildfile] + name = TARGETS.fixture diff --git a/tests/core/bxl/test_query_buildfiles_data/.buckroot b/tests/core/bxl/test_query_buildfiles_data/.buckroot new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/core/bxl/test_query_buildfiles_data/load/TARGETS.fixture b/tests/core/bxl/test_query_buildfiles_data/load/TARGETS.fixture new file mode 100644 index 0000000000000..a450543b9e97f --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/load/TARGETS.fixture @@ -0,0 +1,8 @@ +load(":a.bzl", "nothing_a") +load(":a.json", "value") + +nothing_a(value) + +stub( + name = "abc", +) diff --git a/tests/core/bxl/test_query_buildfiles_data/load/a.bzl b/tests/core/bxl/test_query_buildfiles_data/load/a.bzl new file mode 100644 index 0000000000000..98a55e6662cc6 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/load/a.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is dual-licensed under either the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree or the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. You may select, at your option, one of the +# above-listed licenses. + +def nothing_a(*args): + pass diff --git a/tests/core/bxl/test_query_buildfiles_data/load/a.json b/tests/core/bxl/test_query_buildfiles_data/load/a.json new file mode 100644 index 0000000000000..0967ef424bce6 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/load/a.json @@ -0,0 +1 @@ +{} diff --git a/tests/core/bxl/test_query_buildfiles_data/query_buildfiles.bxl b/tests/core/bxl/test_query_buildfiles_data/query_buildfiles.bxl new file mode 100644 index 0000000000000..fe728b6e5f725 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/query_buildfiles.bxl @@ -0,0 +1,103 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is dual-licensed under either the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree or the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. You may select, at your option, one of the +# above-listed licenses. + +_LOAD_FILES = [ + "load/TARGETS.fixture", + "load/a.bzl", + "load/a.json", +] + +_TRANSITIVE_LOAD_FILES = [ + "transitive_load/TARGETS.fixture", + "transitive_load/b.bzl", + "transitive_load/c.bzl", + "transitive_load/c.json", +] + +_RBUILDFILES_C_BZL = [ + "transitive_load/TARGETS.fixture", + "transitive_load/b.bzl", + "transitive_load/c.bzl", +] + +def _paths(file_set): + return sorted([f.path for f in file_set if f.cell == "root"]) + +def _uquery_allbuildfiles_impl(ctx: bxl.Context): + res = ctx.uquery().allbuildfiles("root//load:abc") + asserts.equals(_LOAD_FILES, _paths(res)) + + res = ctx.uquery().allbuildfiles(["root//load:abc", "root//transitive_load:def"]) + asserts.equals(sorted(_LOAD_FILES + _TRANSITIVE_LOAD_FILES), _paths(res)) + +uquery_allbuildfiles = bxl_main( + impl = _uquery_allbuildfiles_impl, + cli_args = {}, +) + +def _uquery_rbuildfiles_impl(ctx: bxl.Context): + res = ctx.uquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/c.bzl") + asserts.equals(_RBUILDFILES_C_BZL, _paths(res)) + + res = ctx.uquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/TARGETS.fixture") + asserts.equals(["transitive_load/TARGETS.fixture"], _paths(res)) + +uquery_rbuildfiles = bxl_main( + impl = _uquery_rbuildfiles_impl, + cli_args = {}, +) + +def _cquery_allbuildfiles_impl(ctx: bxl.Context): + universe = ctx.target_universe("root//load:abc").target_set() + res = ctx.cquery().allbuildfiles(universe) + asserts.equals(_LOAD_FILES, _paths(res)) + + universe = ctx.target_universe(["root//load:abc", "root//transitive_load:def"]).target_set() + res = ctx.cquery().allbuildfiles(universe) + asserts.equals(sorted(_LOAD_FILES + _TRANSITIVE_LOAD_FILES), _paths(res)) + +cquery_allbuildfiles = bxl_main( + impl = _cquery_allbuildfiles_impl, + cli_args = {}, +) + +def _cquery_rbuildfiles_impl(ctx: bxl.Context): + res = ctx.cquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/c.bzl") + asserts.equals(_RBUILDFILES_C_BZL, _paths(res)) + + res = ctx.cquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/TARGETS.fixture") + asserts.equals(["transitive_load/TARGETS.fixture"], _paths(res)) + +cquery_rbuildfiles = bxl_main( + impl = _cquery_rbuildfiles_impl, + cli_args = {}, +) + +def _lazy_uquery_allbuildfiles_impl(ctx: bxl.Context): + res = ctx.lazy.uquery().allbuildfiles("root//load:abc").resolve() + asserts.equals(_LOAD_FILES, _paths(res)) + + res = ctx.lazy.uquery().allbuildfiles(["root//load:abc", "root//transitive_load:def"]).resolve() + asserts.equals(sorted(_LOAD_FILES + _TRANSITIVE_LOAD_FILES), _paths(res)) + +lazy_uquery_allbuildfiles = bxl_main( + impl = _lazy_uquery_allbuildfiles_impl, + cli_args = {}, +) + +def _lazy_uquery_rbuildfiles_impl(ctx: bxl.Context): + res = ctx.lazy.uquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/c.bzl").resolve() + asserts.equals(_RBUILDFILES_C_BZL, _paths(res)) + + res = ctx.lazy.uquery().rbuildfiles("transitive_load/TARGETS.fixture", "transitive_load/TARGETS.fixture").resolve() + asserts.equals(["transitive_load/TARGETS.fixture"], _paths(res)) + +lazy_uquery_rbuildfiles = bxl_main( + impl = _lazy_uquery_rbuildfiles_impl, + cli_args = {}, +) diff --git a/tests/core/bxl/test_query_buildfiles_data/transitive_load/TARGETS.fixture b/tests/core/bxl/test_query_buildfiles_data/transitive_load/TARGETS.fixture new file mode 100644 index 0000000000000..4b0d2c4296ad7 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/transitive_load/TARGETS.fixture @@ -0,0 +1,11 @@ +load(":b.bzl", "nothing_b") + +nothing_b() + +stub( + name = "def", +) + +stub( + name = "ghi", +) diff --git a/tests/core/bxl/test_query_buildfiles_data/transitive_load/b.bzl b/tests/core/bxl/test_query_buildfiles_data/transitive_load/b.bzl new file mode 100644 index 0000000000000..ac9d4b282e14a --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/transitive_load/b.bzl @@ -0,0 +1,12 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is dual-licensed under either the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree or the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. You may select, at your option, one of the +# above-listed licenses. + +load(":c.bzl", "nothing_c") + +def nothing_b(): + nothing_c() diff --git a/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.bzl b/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.bzl new file mode 100644 index 0000000000000..efd683b197c9f --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.bzl @@ -0,0 +1,12 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is dual-licensed under either the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree or the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. You may select, at your option, one of the +# above-listed licenses. + +load(":c.json", "value") + +def nothing_c(): + return value diff --git a/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.json b/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.json new file mode 100644 index 0000000000000..0967ef424bce6 --- /dev/null +++ b/tests/core/bxl/test_query_buildfiles_data/transitive_load/c.json @@ -0,0 +1 @@ +{} diff --git a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/CqueryContext.md b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/CqueryContext.md index cabbee095efea..4fff4bb607c1d 100644 --- a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/CqueryContext.md +++ b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/CqueryContext.md @@ -1,6 +1,7 @@ # This file is @generated, regenerate by re-running test with `-- --env BUCK2_UPDATE_GOLDEN=1` appended to the test command # CqueryContext +## CqueryContext.allbuildfiles ## CqueryContext.allpaths ## CqueryContext.attrfilter ## CqueryContext.attrregexfilter @@ -12,6 +13,7 @@ ## CqueryContext.kind ## CqueryContext.nattrfilter ## CqueryContext.owner +## CqueryContext.rbuildfiles ## CqueryContext.rdeps ## CqueryContext.somepath ## CqueryContext.testsof diff --git a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/LazyUqueryContext.md b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/LazyUqueryContext.md index 67c3fe05533c8..f979f343493e6 100644 --- a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/LazyUqueryContext.md +++ b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/LazyUqueryContext.md @@ -1,6 +1,7 @@ # This file is @generated, regenerate by re-running test with `-- --env BUCK2_UPDATE_GOLDEN=1` appended to the test command # LazyUqueryContext +## LazyUqueryContext.allbuildfiles ## LazyUqueryContext.allpaths ## LazyUqueryContext.attrfilter ## LazyUqueryContext.attrregexfilter @@ -11,6 +12,7 @@ ## LazyUqueryContext.inputs ## LazyUqueryContext.kind ## LazyUqueryContext.owner +## LazyUqueryContext.rbuildfiles ## LazyUqueryContext.rdeps ## LazyUqueryContext.somepath ## LazyUqueryContext.targets\_in\_buildfile diff --git a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/UqueryContext.md b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/UqueryContext.md index 39aa415796813..f8391461b06e6 100644 --- a/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/UqueryContext.md +++ b/tests/core/docs/test_builtin_docs_data/buck2-golden-docs/bxl/UqueryContext.md @@ -1,6 +1,7 @@ # This file is @generated, regenerate by re-running test with `-- --env BUCK2_UPDATE_GOLDEN=1` appended to the test command # UqueryContext +## UqueryContext.allbuildfiles ## UqueryContext.allpaths ## UqueryContext.attrfilter ## UqueryContext.attrregexfilter @@ -11,6 +12,7 @@ ## UqueryContext.inputs ## UqueryContext.kind ## UqueryContext.owner +## UqueryContext.rbuildfiles ## UqueryContext.rdeps ## UqueryContext.somepath ## UqueryContext.targets\_in\_buildfile