Revision 6769df72952b41f6552effca3e7cf2abe83ba455 authored by Dylan Hunn on 01 December 2021, 21:21:03 UTC, committed by Dylan Hunn on 01 December 2021, 21:25:00 UTC
PR Close #44334
1 parent f1f6e71
extract_typings_rule.bzl
"""Starlark file that exposes a rule for extracting type definitions of dependencies."""
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo")
def _extract_typings_rule_impl(ctx):
"""Implementation of the `extract_typings` rule."""
transitive_depsets = []
for dep in ctx.attr.deps:
# Based on whether declarations should be collected, extract direct
# and transitive declaration files using the `DeclarationInfo` provider.
if DeclarationInfo in dep:
transitive_depsets.append(dep[DeclarationInfo].transitive_declarations)
return [DefaultInfo(files = depset(transitive = transitive_depsets))]
# TODO: Move into shared dev-infra package.
extract_typings = rule(
implementation = _extract_typings_rule_impl,
doc = """Rule that extracts all transitive typings of dependencies""",
attrs = {
"deps": attr.label_list(
allow_files = True,
),
},
)
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...