|
| 1 | +diff --git node_modules/@angular/bazel/src/ng_module.bzl node_modules/@angular/bazel/src/ng_module.bzl |
| 2 | +index 9480c4b679dc..cf6f8ebaf437 100644 |
| 3 | +--- node_modules/@angular/bazel/src/ng_module.bzl |
| 4 | ++++ node_modules/@angular/bazel/src/ng_module.bzl |
| 5 | +@@ -334,8 +334,11 @@ def _ngc_tsconfig(ctx, files, srcs, **kwargs): |
| 6 | + "angularCompilerOptions": angular_compiler_options, |
| 7 | + }) |
| 8 | + |
| 9 | ++def _has_target_angular_summaries(target): |
| 10 | ++ return hasattr(target, "angular") and hasattr(target.angular, "summaries") |
| 11 | ++ |
| 12 | + def _collect_summaries_aspect_impl(target, ctx): |
| 13 | +- results = depset(target.angular.summaries if hasattr(target, "angular") else []) |
| 14 | ++ results = depset(target.angular.summaries if _has_target_angular_summaries(target) else []) |
| 15 | + |
| 16 | + # If we are visiting empty-srcs ts_library, this is a re-export |
| 17 | + srcs = ctx.rule.attr.srcs if hasattr(ctx.rule.attr, "srcs") else [] |
| 18 | +@@ -343,7 +346,7 @@ def _collect_summaries_aspect_impl(target, ctx): |
| 19 | + # "re-export" rules should expose all the files of their deps |
| 20 | + if not srcs and hasattr(ctx.rule.attr, "deps"): |
| 21 | + for dep in ctx.rule.attr.deps: |
| 22 | +- if (hasattr(dep, "angular")): |
| 23 | ++ if (_has_target_angular_summaries(dep)): |
| 24 | + results = depset(dep.angular.summaries, transitive = [results]) |
| 25 | + |
| 26 | + return struct(collect_summaries_aspect_result = results) |
| 27 | +@@ -588,20 +591,23 @@ def ng_module_impl(ctx, ts_compile_actions): |
| 28 | + |
| 29 | + outs = _expected_outs(ctx) |
| 30 | + |
| 31 | ++ providers["angular"] = {} |
| 32 | ++ |
| 33 | + if is_legacy_ngc: |
| 34 | +- providers["angular"] = { |
| 35 | +- "summaries": outs.summaries, |
| 36 | +- "metadata": outs.metadata, |
| 37 | +- } |
| 38 | ++ providers["angular"]["summaries"] = outs.summaries |
| 39 | ++ providers["angular"]["metadata"] = outs.metadata |
| 40 | + providers["ngc_messages"] = outs.i18n_messages |
| 41 | + |
| 42 | +- if is_legacy_ngc and _should_produce_flat_module_outs(ctx): |
| 43 | +- if len(outs.metadata) > 1: |
| 44 | ++ if _should_produce_flat_module_outs(ctx): |
| 45 | ++ # Sanity error if more than one metadata file has been created in the |
| 46 | ++ # legacy ngc compiler while a flat module should be produced. |
| 47 | ++ if is_legacy_ngc and len(outs.metadata) > 1: |
| 48 | + fail("expecting exactly one metadata output for " + str(ctx.label)) |
| 49 | + |
| 50 | + providers["angular"]["flat_module_metadata"] = struct( |
| 51 | + module_name = ctx.attr.module_name, |
| 52 | +- metadata_file = outs.metadata[0], |
| 53 | ++ # Metadata files are only generated in the legacy ngc compiler. |
| 54 | ++ metadata_file = outs.metadata[0] if is_legacy_ngc else None, |
| 55 | + typings_file = outs.bundle_index_typings, |
| 56 | + flat_module_out_file = _flat_module_out_file(ctx), |
| 57 | + ) |
0 commit comments