feat(bazel): provide LinkablePackageInfo from ng_module (#37623)
Adds the `LinkablePackageInfo` to the `ng_module` rule. This allows
the linker to properly link `ng_module` targets in Node runtime
actions. Currently this does not work properly and packages like
`@angular/core` are not linked, so we cannot rely on the linker.
9a5de3728b/internal/linker/link_node_modules.bzl (L144-L146)
.
PR Close #37623
This commit is contained in:
parent
62a85f5e55
commit
6898eab946
|
@ -19,12 +19,14 @@ load(
|
|||
)
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//:providers.bzl",
|
||||
_LinkablePackageInfo = "LinkablePackageInfo",
|
||||
_NpmPackageInfo = "NpmPackageInfo",
|
||||
_js_ecma_script_module_info = "js_ecma_script_module_info",
|
||||
_js_named_module_info = "js_named_module_info",
|
||||
_node_modules_aspect = "node_modules_aspect",
|
||||
)
|
||||
|
||||
LinkablePackageInfo = _LinkablePackageInfo
|
||||
NpmPackageInfo = _NpmPackageInfo
|
||||
node_modules_aspect = _node_modules_aspect
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ load(
|
|||
"DEFAULT_NG_COMPILER",
|
||||
"DEFAULT_NG_XI18N",
|
||||
"DEPS_ASPECTS",
|
||||
"LinkablePackageInfo",
|
||||
"NpmPackageInfo",
|
||||
"TsConfigInfo",
|
||||
"compile_ts",
|
||||
|
@ -650,6 +651,15 @@ def _ng_module_impl(ctx):
|
|||
# once it is no longer needed.
|
||||
])
|
||||
|
||||
if ctx.attr.module_name:
|
||||
path = "/".join([p for p in [ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package] if p])
|
||||
ts_providers["providers"].append(LinkablePackageInfo(
|
||||
package_name = ctx.attr.module_name,
|
||||
path = path,
|
||||
files = ts_providers["typescript"]["es5_sources"],
|
||||
_tslibrary = True,
|
||||
))
|
||||
|
||||
return ts_providers_dict_to_struct(ts_providers)
|
||||
|
||||
local_deps_aspects = [node_modules_aspect, _collect_summaries_aspect]
|
||||
|
|
Loading…
Reference in New Issue