blob: 3fd1b1c4f90e760a09d450e41f17f712025b115a [file] [log] [blame] [edit]
# Copyright 2024 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("//bazel/portage/build_defs:common.bzl", "BinaryPackageInfo", "get_all_deps")
visibility("public")
def _collect_ebuild_metadata_impl(target, ctx):
depsets = []
direct = []
if BinaryPackageInfo in target:
direct.append(target[BinaryPackageInfo].metadata)
for dep in get_all_deps(ctx):
if OutputGroupInfo in dep:
output_groups = dep[OutputGroupInfo]
d = getattr(output_groups, "ebuild_metadata", None)
if d:
depsets.append(d)
return [
OutputGroupInfo(ebuild_metadata = depset(direct, transitive = depsets)),
]
collect_ebuild_metadata_aspect = aspect(
implementation = _collect_ebuild_metadata_impl,
attr_aspects = ["*"],
attrs = dict(),
)