Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Jul 1, 2021
1 parent 51679b8 commit 6d4f0a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 14 additions & 4 deletions examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch
Expand Up @@ -811,7 +811,7 @@ index 32b640a..a787bbb 100755
node_modules_aspect = _node_modules_aspect

diff --git a/node_modules/@angular/bazel/src/ng_module.bzl b/node_modules/@angular/bazel/src/ng_module.bzl
index a38f6a8..436d83b 100755
index a38f6a8..0bd569d 100755
--- a/node_modules/@angular/bazel/src/ng_module.bzl
+++ b/node_modules/@angular/bazel/src/ng_module.bzl
@@ -13,6 +13,7 @@ load(
Expand All @@ -822,21 +822,31 @@ index a38f6a8..436d83b 100755
"NpmPackageInfo",
"TsConfigInfo",
"compile_ts",
@@ -629,6 +630,14 @@ def _ng_module_impl(ctx):
@@ -629,6 +630,15 @@ def _ng_module_impl(ctx):
# once it is no longer needed.
])

+ if ctx.attr.module_name:
+ if ctx.attr.package_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,
+ package_name = ctx.attr.package_name,
+ package_path = ctx.attr.package_path,
+ path = path,
+ files = ts_providers["typescript"]["es5_sources"],
+ ))
+
return ts_providers_dict_to_struct(ts_providers)

local_deps_aspects = [node_modules_aspect, _collect_summaries_aspect]
@@ -750,6 +760,8 @@ NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{
default = Label("@npm//typescript:typescript__typings"),
),
"entry_point": attr.label(allow_single_file = True),
+ "package_name": attr.string(),
+ "package_path": attr.string(),

# Default is %{name}_public_index
# The suffix points to the generated "bundle index" files that users import from
diff --git a/node_modules/@angular/bazel/src/ng_package/ng_package.bzl b/node_modules/@angular/bazel/src/ng_package/ng_package.bzl
index db33ad3..0079446 100755
--- a/node_modules/@angular/bazel/src/ng_package/ng_package.bzl
Expand Down
Expand Up @@ -6,6 +6,7 @@ ng_module(
name = "typography",
srcs = glob(["*.ts"]),
module_name = "@examples/angular/typography",
package_name = "@examples/angular/typography",
tsconfig = "//src:tsconfig.json",
deps = [
"@npm//@angular/core",
Expand Down
3 changes: 2 additions & 1 deletion internal/linker/link_node_modules.bzl
Expand Up @@ -157,7 +157,8 @@ def _get_module_mappings(target, ctx):
_debug(ctx.var, "No package_name in LinkablePackageInfo for", target.label)
return mappings

map_key = "%s:%s" % (linkable_package_info.package_name, linkable_package_info.package_path)
package_path = linkable_package_info.package_path if hasattr(linkable_package_info, "package_path") else ""
map_key = "%s:%s" % (linkable_package_info.package_name, package_path)
map_value = linkable_package_info.path

if _link_mapping(target.label, mappings, map_key, map_value):
Expand Down

0 comments on commit 6d4f0a9

Please sign in to comment.