blob: 1c34d05d5d36ccf8a7f171a2d3292af74ed9be9f [file] [log] [blame]
# Copyright 2018 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.
"""
Some utilities to declare and aggregate package contents.
"""
PackageLocalInfo = provider(
fields = {
"mappings": "list of (package dest, source) pairs",
},
)
# Identical to PackageLocalInfo, but a different type is needed when that
# information if generated from an aspect so that it does not collide with any
# existing PackageLocalInfo returned provider.
PackageGeneratedInfo = provider(
fields = {
"mappings": "list of (package dest, source) pairs",
},
)
PackageAggregateInfo = provider(
fields = {
"contents": "depset of (package dest, source) pairs",
},
)
def get_aggregate_info(mappings, deps):
transitive_info = []
for dep in deps:
if PackageAggregateInfo not in dep:
continue
transitive_info.append(dep[PackageAggregateInfo].contents)
return PackageAggregateInfo(contents = depset(mappings,
transitive = transitive_info))