From 4ffb628a55cd94eb39d2853064dc55c85dae574e Mon Sep 17 00:00:00 2001 From: michaelm Date: Fri, 11 Oct 2024 14:52:21 -0400 Subject: [PATCH] Add transitive typecheck output group --- ts/private/ts_project.bzl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ts/private/ts_project.bzl b/ts/private/ts_project.bzl index 1393019f..a53992a7 100644 --- a/ts/private/ts_project.bzl +++ b/ts/private/ts_project.bzl @@ -29,6 +29,15 @@ def _gather_types_from_js_infos(targets): ]) return depset([], transitive = files_depsets) +def _gather_transitive_typecheck_from_output_group_infos(typecheck_outs, targets): + files_depsets = [] + files_depsets.extend([ + target[OutputGroupInfo].transitive_typecheck + for target in targets + if OutputGroupInfo in target and "transitive_typecheck" in target[OutputGroupInfo] + ]) + return depset(typecheck_outs, transitive = files_depsets) + def _ts_project_impl(ctx): """Creates the action which spawns `tsc`. @@ -308,6 +317,8 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details. transitive_types = js_lib_helpers.gather_transitive_types(output_types, srcs_tsconfig_deps) + transitive_typecheck = _gather_transitive_typecheck_from_output_group_infos(typecheck_outs, ctx.attr.deps) + npm_sources = js_lib_helpers.gather_npm_sources( srcs = ctx.attr.srcs + [ctx.attr.tsconfig], deps = ctx.attr.deps, @@ -345,6 +356,7 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details. OutputGroupInfo( types = output_types_depset, typecheck = depset(typecheck_outs), + transitive_typecheck = transitive_typecheck, # make the inputs to the tsc action available for analysis testing _action_inputs = transitive_inputs_depset, # https://bazel.build/extending/rules#validations_output_group