| # Copyright 2026 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| FilegroupInfo = provider(fields = ["files", "manifest"]) |
| |
| def _filegroup_impl(ctx): |
| files = depset(ctx.files.srcs) |
| manifest = ctx.actions.declare_file(ctx.label.name + ".manifest") |
| ctx.actions.write( |
| manifest, |
| "manifest for " + str(ctx.label) + "\n" + |
| "\n".join(sorted([f.path for f in ctx.files.srcs])) |
| ) |
| return [ |
| DefaultInfo(files = files), |
| FilegroupInfo(files = files, manifest = manifest), |
| ] |
| |
| filegroup = rule( |
| implementation = _filegroup_impl, |
| attrs = { |
| "srcs": attr.label_list(allow_files = True), |
| } |
| ) |
| |
| def _filegroups_impl(ctx): |
| filegroups = [fg[FilegroupInfo].files for fg in ctx.attr.filegroups] |
| return [DefaultInfo(files = depset(transitive = filegroups))] |
| |
| filegroups = rule( |
| implementation = _filegroups_impl, |
| attrs = { |
| "filegroups": attr.label_list(allow_files = True), |
| } |
| ) |