Skip to content

Commit 04ddb65

Browse files
committed
build: patch ng_package to produce partial output with ng_project
Temporarily patches the legacy `ng_package` rule to properly request partial compilation output from the new `ng_project` rule targets.
1 parent c28287c commit 04ddb65

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

tools/postinstall/patches/@angular+bazel+20.0.0-next.1.patch

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/node_modules/@angular/bazel/src/ng_module/ng_module.bzl b/node_modules/@angular/bazel/src/ng_module/ng_module.bzl
2-
index 5e82bcb..3c239f8 100755
2+
index 4c61ba9..f495e99 100755
33
--- a/node_modules/@angular/bazel/src/ng_module/ng_module.bzl
44
+++ b/node_modules/@angular/bazel/src/ng_module/ng_module.bzl
5-
@@ -18,6 +18,7 @@ load(
5+
@@ -17,6 +17,7 @@ load(
66
"TsConfigInfo",
77
"compile_ts",
88
"js_ecma_script_module_info",
@@ -19,24 +19,24 @@ index 5e82bcb..3c239f8 100755
1919
else:
2020
- expected_outs = outs.closure_js + outs.declarations
2121
+ expected_outs = outs.closure_js
22-
22+
2323
if not ctx.attr.type_check and ctx.attr.strict_templates:
2424
fail("Cannot set type_check = False and strict_templates = True for ng_module()")
25-
@@ -355,11 +356,11 @@ def _compile_action(
26-
25+
@@ -356,11 +357,11 @@ def _compile_action(
26+
2727
def _prodmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts):
2828
outs = _expected_outs(ctx)
2929
- return _compile_action(ctx, inputs, outputs + outs.closure_js + outs.prod_perf_files + outs.declarations, tsconfig_file, node_opts, "prodmode")
3030
+ return _compile_action(ctx, inputs, outputs + outs.closure_js + outs.prod_perf_files, tsconfig_file, node_opts, "prodmode")
31-
31+
3232
def _devmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts):
3333
outs = _expected_outs(ctx)
3434
- compile_action_outputs = outputs + outs.devmode_js + outs.dev_perf_files
3535
+ compile_action_outputs = outputs + outs.devmode_js + outs.dev_perf_files + outs.declarations
3636
_compile_action(ctx, inputs, compile_action_outputs, tsconfig_file, node_opts, "devmode")
37-
37+
3838
# Note: We need to define `label` and `srcs_files` as `tsc_wrapped` passes
39-
@@ -413,9 +414,13 @@ def _ng_module_impl(ctx):
39+
@@ -414,9 +415,13 @@ def _ng_module_impl(ctx):
4040
# and issue https://github.com/bazelbuild/rules_nodejs/issues/57 for more details.
4141
ts_providers["providers"].extend([
4242
js_module_info(
@@ -51,17 +51,34 @@ index 5e82bcb..3c239f8 100755
5151
js_ecma_script_module_info(
5252
sources = ts_providers["typescript"]["es6_sources"],
5353
deps = ctx.attr.deps,
54-
@@ -431,7 +436,7 @@ def _ng_module_impl(ctx):
54+
@@ -432,7 +437,7 @@ def _ng_module_impl(ctx):
5555
package_name = ctx.attr.package_name,
5656
package_path = ctx.attr.package_path,
5757
path = path,
5858
- files = ts_providers["typescript"]["es6_sources"],
5959
+ files = ts_providers["typescript"]["es5_sources"],
6060
))
61-
61+
6262
return ts_providers_dict_to_struct(ts_providers)
63+
diff --git a/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl b/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
64+
index 5fd9a73..c155cea 100755
65+
--- a/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
66+
+++ b/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
67+
@@ -16,10 +16,10 @@ ng_partial_compilation_flag = rule(
68+
)
69+
70+
def _partial_compilation_transition_impl(_settings, _attr):
71+
- return {"@npm//@angular/bazel/src:partial_compilation": True}
72+
+ return {"@rules_angular//src/ng_project/config:partial_compilation": True}
73+
74+
partial_compilation_transition = transition(
75+
implementation = _partial_compilation_transition_impl,
76+
inputs = [],
77+
- outputs = ["@npm//@angular/bazel/src:partial_compilation"],
78+
+ outputs = ["@rules_angular//src/ng_project/config:partial_compilation"],
79+
)
6380
diff --git a/node_modules/@angular/bazel/src/ng_package/packager.mjs b/node_modules/@angular/bazel/src/ng_package/packager.mjs
64-
index dd6ec61..c2a0acf 100755
81+
index 20604c5..6066214 100755
6582
--- a/node_modules/@angular/bazel/src/ng_package/packager.mjs
6683
+++ b/node_modules/@angular/bazel/src/ng_package/packager.mjs
6784
@@ -8,7 +8,7 @@
@@ -74,7 +91,7 @@ index dd6ec61..c2a0acf 100755
7491
* List of known `package.json` fields which provide information about
7592
* supported package formats and their associated entry paths.
7693
diff --git a/node_modules/@angular/bazel/src/ngc-wrapped/index.mjs b/node_modules/@angular/bazel/src/ngc-wrapped/index.mjs
77-
index 47aab66..3305d94 100755
94+
index a315d24..021dea9 100755
7895
--- a/node_modules/@angular/bazel/src/ngc-wrapped/index.mjs
7996
+++ b/node_modules/@angular/bazel/src/ngc-wrapped/index.mjs
8097
@@ -12,7 +12,7 @@ import tscw from '@bazel/concatjs/internal/tsc_wrapped/index.js';
@@ -86,7 +103,7 @@ index 47aab66..3305d94 100755
86103
// FIXME: we should be able to add the assets to the tsconfig so FileLoader
87104
// knows about them
88105
const NGC_ASSETS = /\.(css|html)$/;
89-
@@ -350,6 +350,12 @@ function gatherDiagnosticsForInputsOnly(options, bazelOpts, ngProgram) {
106+
@@ -351,6 +351,12 @@ function gatherDiagnosticsForInputsOnly(options, bazelOpts, ngProgram) {
90107
}
91108
return diagnostics;
92109
}
@@ -100,7 +117,7 @@ index 47aab66..3305d94 100755
100117
* @deprecated
101118
* Kept here just for compatibility with 1P tools. To be removed soon after 1P update.
102119
diff --git a/node_modules/@angular/bazel/src/ngc-wrapped/ngc-wrapped-main.mjs b/node_modules/@angular/bazel/src/ngc-wrapped/ngc-wrapped-main.mjs
103-
index 8efba56..d420348 100755
120+
index 8efba56..be29334 100755
104121
--- a/node_modules/@angular/bazel/src/ngc-wrapped/ngc-wrapped-main.mjs
105122
+++ b/node_modules/@angular/bazel/src/ngc-wrapped/ngc-wrapped-main.mjs
106123
@@ -5,7 +5,7 @@

0 commit comments

Comments
 (0)