blob: 496d1ccdc2d94ae7afffebd7f2dc4c39a0ff723f [file]
# Copyright 2024 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# A starlark input file for bazel cquery that prints one line of output
# that contains the path of each fuchsia package archive
#
# All paths are relative to the Bazel execroot.
#
# Example use:
# bazel cquery <config-options>
# --output=starlark --starlark:file=/path/to/this/file \
# //path/to/fuchsia:package
#
def format(target):
package_info = providers(target)["@@fuchsia_rules_common+//packages:providers.bzl%FuchsiaPackageInfo"]
result = {
"target": str(target.label),
"archive_path": package_info.far_file.path,
}
return json.encode(result)