Skip to content

Commit 1001b70

Browse files
committed
Revert "build: remove unused angular bazel postinstall patch (#18373)"
This reverts commit e7e1ec3.
1 parent a35639a commit 1001b70

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
diff --git node_modules/@angular/bazel/_BUILD.bazel node_modules/@angular/bazel/_BUILD.bazel
2+
index 1e4880f..5654615 100755
3+
--- node_modules/@angular/bazel/_BUILD.bazel
4+
+++ node_modules/@angular/bazel/_BUILD.bazel
5+
@@ -1,6 +1,6 @@
6+
-load("//tools:defaults.bzl", "npm_package")
7+
+load("//tools:defaults.bzl", "pkg_npm")
8+
9+
-npm_package(
10+
+pkg_npm(
11+
name = "npm_package",
12+
srcs = glob(
13+
["*"],
14+
@@ -14,10 +14,10 @@ npm_package(
15+
"//src/schematics:package_assets",
16+
"//third_party/github.com/bazelbuild/bazel/src/main/protobuf:package_assets",
17+
],
18+
- packages = [
19+
+ nested_packages = [
20+
"//docs",
21+
],
22+
- replacements = {
23+
+ substitutions = {
24+
"(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "",
25+
"//": "//",
26+
"npm_angular_bazel/": "npm_angular_bazel/",
27+
diff --git node_modules/@angular/bazel/src/ng_package/ng_package.bzl node_modules/@angular/bazel/src/ng_package/ng_package.bzl
28+
index 55bd685..8aaefdc 100755
29+
--- node_modules/@angular/bazel/src/ng_package/ng_package.bzl
30+
+++ node_modules/@angular/bazel/src/ng_package/ng_package.bzl
31+
@@ -15,9 +15,9 @@ specification of this format at https://goo.gl/jB3GVv
32+
33+
load("@build_bazel_rules_nodejs//:providers.bzl", "JSEcmaScriptModuleInfo", "JSNamedModuleInfo", "NpmPackageInfo", "node_modules_aspect")
34+
load(
35+
- "@build_bazel_rules_nodejs//internal/npm_package:npm_package.bzl",
36+
- "NPM_PACKAGE_ATTRS",
37+
- "NPM_PACKAGE_OUTPUTS",
38+
+ "@build_bazel_rules_nodejs//internal/pkg_npm:pkg_npm.bzl",
39+
+ "PKG_NPM_ATTRS",
40+
+ "PKG_NPM_OUTPUTS",
41+
"create_package",
42+
)
43+
load("//src:external.bzl", "FLAT_DTS_FILE_SUFFIX")
44+
@@ -623,7 +623,7 @@ def _ng_package_impl(ctx):
45+
package_dir = create_package(
46+
ctx,
47+
devfiles.to_list(),
48+
- [npm_package_directory] + ctx.files.packages,
49+
+ [npm_package_directory] + ctx.files.nested_packages,
50+
)
51+
return [DefaultInfo(
52+
files = depset([package_dir]),
53+
@@ -631,7 +631,7 @@ def _ng_package_impl(ctx):
54+
55+
_NG_PACKAGE_DEPS_ASPECTS = [esm5_outputs_aspect, ng_package_module_mappings_aspect, node_modules_aspect]
56+
57+
-_NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **{
58+
+_NG_PACKAGE_ATTRS = dict(PKG_NPM_ATTRS, **{
59+
"srcs": attr.label_list(
60+
doc = """JavaScript source files from the workspace.
61+
These can use ES2015 syntax and ES Modules (import/export)""",
62+
@@ -807,12 +807,12 @@ def _ng_package_outputs(name, entry_point, entry_point_name):
63+
"umd": "%s.umd.js" % basename,
64+
"umd_min": "%s.umd.min.js" % basename,
65+
}
66+
- for key in NPM_PACKAGE_OUTPUTS:
67+
- # NPM_PACKAGE_OUTPUTS is a "normal" dict-valued outputs so it looks like
68+
+ for key in PKG_NPM_OUTPUTS:
69+
+ # PKG_NPM_OUTPUTS is a "normal" dict-valued outputs so it looks like
70+
# "pack": "%{name}.pack",
71+
# But this is a function-valued outputs.
72+
# Bazel won't replace the %{name} token so we have to do it.
73+
- outputs[key] = NPM_PACKAGE_OUTPUTS[key].replace("%{name}", name)
74+
+ outputs[key] = PKG_NPM_OUTPUTS[key].replace("%{name}", name)
75+
return outputs
76+
77+
ng_package = rule(

tools/bazel/postinstall-patches.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ shelljs.cd(projectDir);
2929
// Workaround for https://github.com/angular/angular/issues/18810.
3030
shelljs.exec('ngc -p angular-tsconfig.json');
3131

32+
try {
33+
// Temporary patch to make @angular/bazel compatible with rules_nodejs 1.0.0.
34+
// This is needed to resolve the dependency sandwich between angular components and
35+
// repo framework. It can be removed with a future @angular/bazel update.
36+
// try/catch needed for this the material CI tests to work in angular/repo
37+
applyPatch(path.join(__dirname, './angular_bazel_rules_nodejs_1.0.0.patch'));
38+
} catch (_) {}
39+
40+
// Temporary patch for ts-api-guardian to be compatible with rules_nodejs 1.0.0.
41+
// TODO: a new ts-api-guardian release is needed.
42+
applyPatch(path.join(__dirname, './ts_api_guardian_rules_nodejs_1.0.0.patch'));
43+
3244
// Workaround for https://github.com/angular/angular/issues/30586. It's not possible to
3345
// enable tsickle decorator processing without enabling import rewriting to closure.
3446
// This replacement allows us to enable decorator processing without rewriting imports.

0 commit comments

Comments
 (0)