cabal-buck2-0.6.0.0: buck2/prelude/ide_integrations/visual_studio/get_deps.bxl
# 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("utils.bxl", "flatten_lists", "log_debug")
def get_deps(bxl_ctx, targets: bxl.ConfiguredTargetSet) -> typing.Iterable:
log_debug("# Getting dependencies for {}", targets, bxl_ctx = bxl_ctx)
# -1 or large value for unbounded traversal https://fburl.com/code/7vtwh6bu
# Return dependencies in DFS post-order.
deps = bxl_ctx.cquery().deps(targets, -1, "target_deps()")
# Skip special targets that are going to cause trouble in generation and not useful in final solution.
block_list = {
"toolchains//:android-hack": True,
}
return [dep for dep in deps if dep.label.raw_target() not in block_list]
def _main(bxl_ctx):
targets = flatten_lists(bxl_ctx.cli_args.target)
deps = get_deps(bxl_ctx, targets)
for t in deps:
bxl_ctx.output.print(t.label)
main = bxl_main(
impl = _main,
cli_args = {
"log_level": cli_args.int(default = 30),
"target": cli_args.list(cli_args.target_expr()),
},
)