Skip to content

Commit 6fb6bda

Browse files
devversionmmalerba
authored andcommitted
build: update bazel setup to rules_nodejs v0.38.0 (#17249)
Updates the `rules_nodejs` version to the latest version. This is necessary to stay up-to-date and to unblock framework which also wants to update to `rules_nodejs#0.38.0`. This unblocks: angular/angular#32889. (cherry picked from commit 65a8c96)
1 parent 24660fb commit 6fb6bda

File tree

7 files changed

+106
-54
lines changed

7 files changed

+106
-54
lines changed

WORKSPACE

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
55
# Add NodeJS rules (explicitly used for sass bundle rules)
66
http_archive(
77
name = "build_bazel_rules_nodejs",
8-
sha256 = "3356c6b767403392bab018ce91625f6d15ff8f11c6d772dc84bc9cada01c669a",
9-
# Note that we cannot update to rules_nodejs#0.36.2 as it contains a bug where
10-
# node output binaries cannot be launched on windows. We can update once the
11-
# fix is released: https://github.com/bazelbuild/rules_nodejs/pull/1104.
12-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.1/rules_nodejs-0.36.1.tar.gz"],
8+
sha256 = "1249a60f88e4c0a46d78de06be04d3d41e7421dcfa0c956de65309a7b7ecf6f4",
9+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.0/rules_nodejs-0.38.0.tar.gz"],
1310
)
1411

1512
# Add sass rules
@@ -42,6 +39,7 @@ yarn_install(
4239
# are executed in the Bazel sandbox.
4340
data = [
4441
"//:angular-tsconfig.json",
42+
"//:tools/bazel/angular_bazel_0.38.0.patch",
4543
"//:tools/bazel/flat_module_factory_resolution.patch",
4644
"//:tools/bazel/postinstall-patches.js",
4745
"//:tools/bazel/rollup_windows_arguments.patch",
@@ -61,14 +59,14 @@ load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
6159
install_bazel_dependencies()
6260

6361
# Setup TypeScript Bazel workspace
64-
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
62+
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
6563

6664
ts_setup_workspace()
6765

6866
# Fetch transitive dependencies which are needed to use the karma rules.
69-
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
67+
load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies")
7068

71-
rules_karma_dependencies()
69+
npm_bazel_karma_dependencies()
7270

7371
# Setup web testing. We need to setup a browser because the web testing rules for TypeScript need
7472
# a reference to a registered browser (ideally that's a hermetic version of a browser)

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@
6868
"@angular/router": "^8.2.2",
6969
"@angular/upgrade": "^8.2.2",
7070
"@bazel/bazel": "^0.29.0",
71-
"@bazel/buildifier": "^0.28.0",
71+
"@bazel/buildifier": "^0.29.0",
7272
"@bazel/ibazel": "^0.10.3",
73-
"@bazel/jasmine": "0.36.1",
74-
"@bazel/karma": "0.36.1",
75-
"@bazel/typescript": "0.36.1",
76-
"@bazel/protractor": "0.36.1",
73+
"@bazel/jasmine": "^0.38.0",
74+
"@bazel/karma": "^0.38.0",
75+
"@bazel/typescript": "^0.38.0",
76+
"@bazel/protractor": "^0.38.0",
7777
"@firebase/app-types": "^0.3.2",
7878
"@octokit/rest": "^16.28.7",
7979
"@schematics/angular": "^8.2.1",

src/e2e-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package(default_visibility = ["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
4-
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
4+
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
55
load("//:packages.bzl", "ANGULAR_LIBRARY_UMDS")
66
load("//tools:defaults.bzl", "ng_module")
77

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git node_modules/@angular/bazel/src/esm5.bzl node_modules/@angular/bazel/src/esm5.bzl
2+
index 98315468fb44..22903a9d772d 100644
3+
--- node_modules/@angular/bazel/src/esm5.bzl
4+
+++ node_modules/@angular/bazel/src/esm5.bzl
5+
@@ -30,7 +30,7 @@ ESM5Info = provider(
6+
)
7+
8+
def _map_closure_path(file):
9+
- result = file.short_path[:-len(".closure.js")]
10+
+ result = file.short_path[:-len(".mjs")]
11+
12+
# short_path is meant to be used when accessing runfiles in a binary, where
13+
# the CWD is inside the current repo. Therefore files in external repo have a
14+
diff --git node_modules/@angular/bazel/src/modify_tsconfig.js node_modules/@angular/bazel/src/modify_tsconfig.js
15+
index 9d3c491598c3..3c997462b247 100644
16+
--- node_modules/@angular/bazel/src/modify_tsconfig.js
17+
+++ node_modules/@angular/bazel/src/modify_tsconfig.js
18+
@@ -44,7 +44,7 @@ function main(args) {
19+
// ngc-wrapped is expecting POSIX paths and the TypeScript Bazel rules by default only pass
20+
// POSIX paths as well.
21+
angularCompilerOptions['expectedOut'] = angularCompilerOptions['expectedOut'].map(
22+
- f => f.replace(/\.closure\.js$/, '.js').replace(binDir, newOutputBase));
23+
+ f => f.replace(/\.mjs$/, '.js').replace(binDir, newOutputBase));
24+
}
25+
fs.writeFileSync(output, JSON.stringify(data));
26+
}
27+
diff --git node_modules/@angular/bazel/src/ng_module.bzl node_modules/@angular/bazel/src/ng_module.bzl
28+
index 9b88fbb51c2e..d2eb8aa135f4 100644
29+
--- node_modules/@angular/bazel/src/ng_module.bzl
30+
+++ node_modules/@angular/bazel/src/ng_module.bzl
31+
@@ -237,7 +237,7 @@ def _expected_outs(ctx):
32+
continue
33+
34+
filter_summaries = ctx.attr.filter_summaries
35+
- closure_js = [f.replace(".js", ".closure.js") for f in devmode_js if not filter_summaries or not f.endswith(".ngsummary.js")]
36+
+ closure_js = [f.replace(".js", ".mjs") for f in devmode_js if not filter_summaries or not f.endswith(".ngsummary.js")]
37+
declarations = [f.replace(".js", ".d.ts") for f in devmode_js]
38+
39+
devmode_js_files += [ctx.actions.declare_file(basename + ext) for ext in devmode_js]
40+
@@ -262,7 +262,7 @@ def _expected_outs(ctx):
41+
if _should_produce_flat_module_outs(ctx):
42+
flat_module_out = _flat_module_out_file(ctx)
43+
devmode_js_files.append(ctx.actions.declare_file("%s.js" % flat_module_out))
44+
- closure_js_files.append(ctx.actions.declare_file("%s.closure.js" % flat_module_out))
45+
+ closure_js_files.append(ctx.actions.declare_file("%s.mjs" % flat_module_out))
46+
bundle_index_typings = ctx.actions.declare_file("%s.d.ts" % flat_module_out)
47+
declaration_files.append(bundle_index_typings)
48+
if is_legacy_ngc:

tools/bazel/postinstall-patches.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ shelljs.sed('-i', /("metadata": outs.metadata),/,
8787
if (!shelljs.test('-f', 'node_modules/@angular/bazel/src/ng_package/rollup_bin.js')) {
8888
shelljs.cat(path.join(__dirname, './rollup_windows_arguments.patch')).exec('patch -p0');
8989
}
90+
91+
// Patches https://github.com/angular/angular/pull/32889 into our "@angular/bazel"
92+
// installation. We need to patch it because otherwise the @angular/bazel PR cannot land
93+
// as the "component-unit-tests" job will fail due to not being updated to 0.38.0. Either
94+
// the framework or component repo needs to be patched to unblock the cyclic dependency.
95+
shelljs.cat(path.join(__dirname, './angular_bazel_0.38.0.patch')).exec('patch -p0');

tools/defaults.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
load("@npm_angular_bazel//:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
44
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
5-
load("@npm_bazel_karma//:defs.bzl", _karma_web_test_suite = "karma_web_test_suite")
5+
load("@npm_bazel_karma//:index.bzl", _karma_web_test_suite = "karma_web_test_suite")
66
load("@npm_bazel_protractor//:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
7-
load("@npm_bazel_typescript//:defs.bzl", _ts_library = "ts_library")
7+
load("@npm_bazel_typescript//:index.bzl", _ts_library = "ts_library")
88
load("//:packages.bzl", "ANGULAR_LIBRARY_UMDS", "VERSION_PLACEHOLDER_REPLACEMENTS")
99
load("//tools/markdown-to-html:index.bzl", _markdown_to_html = "markdown_to_html")
1010

yarn.lock

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -306,29 +306,29 @@
306306
"@bazel/bazel-linux_x64" "0.29.0"
307307
"@bazel/bazel-win32_x64" "0.29.0"
308308

309-
"@bazel/buildifier-darwin_x64@0.28.0":
310-
version "0.28.0"
311-
resolved "https://registry.yarnpkg.com/@bazel/buildifier-darwin_x64/-/buildifier-darwin_x64-0.28.0.tgz#bc8c4312596d4cf321062ae4e3f2115be453fef2"
312-
integrity sha512-bvWz4W3FzWFqUr65Z/IrrhUuzHzvFnYB3QpPXUlUOI1sx43Ge3pMlndEwhMBOPM2SoRi5Z5rxG0X9NuvuXWw8w==
313-
314-
"@bazel/buildifier-linux_x64@0.28.0":
315-
version "0.28.0"
316-
resolved "https://registry.yarnpkg.com/@bazel/buildifier-linux_x64/-/buildifier-linux_x64-0.28.0.tgz#d09dedcfcd1677ddec8fe17fa7e39612dab86b41"
317-
integrity sha512-KVXUcT2yZnKcRf4L9qzlYtEHw9SdO4/O6/cyyyybYPzpS3CJ2yIFm6VabXBTXsUp3LXfWc3EE62f8ieHoRJJnw==
318-
319-
"@bazel/buildifier-win32_x64@0.28.0":
320-
version "0.28.0"
321-
resolved "https://registry.yarnpkg.com/@bazel/buildifier-win32_x64/-/buildifier-win32_x64-0.28.0.tgz#1d2c239753a389f48669a194bf16477c1f15befd"
322-
integrity sha512-6E9QZPVzMolcQQKDi5tRJjAFylgzBWbV01/3RiFZb1x4ITZJ74h/FuTRhdYAUPA3n59ge2F3sPtf9Q97RxJU7g==
323-
324-
"@bazel/buildifier@^0.28.0":
325-
version "0.28.0"
326-
resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-0.28.0.tgz#cce8a5b67520f27b611c149bf334b5f86e5e5aa7"
327-
integrity sha512-g9F7rEQayXU4SHgbOYhDLk8AzDMhqFNnZVb/xVDeCkbg20MbCGIZDj9pN8NBnowB7OJF4VsvnSV0FB4BVGfpxQ==
309+
"@bazel/buildifier-darwin_x64@0.29.0":
310+
version "0.29.0"
311+
resolved "https://registry.yarnpkg.com/@bazel/buildifier-darwin_x64/-/buildifier-darwin_x64-0.29.0.tgz#13dfaf3ea4d89f9d4da00085e894e90b7d302342"
312+
integrity sha512-jiQIZo5z1c8oFokD2jObrkB04Bs+7RaUJ6WlHV9BBeJiRMGfRVUBUrOF5eJPk6VB8qknIOfHvJD/Ym5XUc1Zlw==
313+
314+
"@bazel/buildifier-linux_x64@0.29.0":
315+
version "0.29.0"
316+
resolved "https://registry.yarnpkg.com/@bazel/buildifier-linux_x64/-/buildifier-linux_x64-0.29.0.tgz#0191fc46735a1c281878642673844f2b717cd8dc"
317+
integrity sha512-sXXY0gP4oC1nC1G8Baqd7kyBL/y9/qOqftKSkDe2Y7gBoc9GslwyexwDxTSxK0Gun/4Vcvc2eRu7b83hMOxuag==
318+
319+
"@bazel/buildifier-win32_x64@0.29.0":
320+
version "0.29.0"
321+
resolved "https://registry.yarnpkg.com/@bazel/buildifier-win32_x64/-/buildifier-win32_x64-0.29.0.tgz#a63438c7a7d2dc593e626ed6e163e9d8ea93917a"
322+
integrity sha512-hnOQfPhQNAIqbrhsHT3MWAyAZSUhKwxzEuZJZoOsGrW8fPonhKysdvfZJqfqJ6vDVYaMJKvLnSO1c9QZRhU7kQ==
323+
324+
"@bazel/buildifier@^0.29.0":
325+
version "0.29.0"
326+
resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-0.29.0.tgz#7984739270c8d1dd23650f87a810e1e6367188d9"
327+
integrity sha512-skJ7vVff7x3tB8crBCtJji2wU09uH0uD2N30xfOpVUgsMJSXktAQMj8+RPdMBqJQ9XS5+O5lmRthR35Ua7xQXA==
328328
optionalDependencies:
329-
"@bazel/buildifier-darwin_x64" "0.28.0"
330-
"@bazel/buildifier-linux_x64" "0.28.0"
331-
"@bazel/buildifier-win32_x64" "0.28.0"
329+
"@bazel/buildifier-darwin_x64" "0.29.0"
330+
"@bazel/buildifier-linux_x64" "0.29.0"
331+
"@bazel/buildifier-win32_x64" "0.29.0"
332332

333333
"@bazel/hide-bazel-files@latest":
334334
version "0.35.0"
@@ -340,19 +340,19 @@
340340
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.10.3.tgz#2e2b8a1d3e885946eac41db2b1aa6801fb319887"
341341
integrity sha512-v1nXbMTHVlMM4z4uWp6XiRoHAyUlYggF1SOboLLWRp0+D22kWixqArWqnozLw2mOtnxr97BdLjluWiho6A8Hjg==
342342

343-
"@bazel/jasmine@0.36.1":
344-
version "0.36.1"
345-
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-0.36.1.tgz#2069f8deb52a6ee206926936dbfd6829228962c2"
346-
integrity sha512-gXCOeiHWNZzClMmYbKvdhS1ZC62inM2e+/w/Z0kOKDFSoSE9GnC6NuIK4vFlDOPjx0vGy2+ZCb/tezrgpqhp2A==
343+
"@bazel/jasmine@^0.38.0":
344+
version "0.38.0"
345+
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-0.38.0.tgz#d40bc3fa5b9cdaf9125ff422a1ed5fc25c41203e"
346+
integrity sha512-p4faogKschhMiZ4+g5z0On0VkhQzjsa4gCg8WMbHbxwSrjMYVQmiwqwEtNN2jBV0mqRRKOvRrH7O1snD2MyihA==
347347
dependencies:
348348
jasmine "~3.4.0"
349349
jasmine-core "~3.4.0"
350350
v8-coverage "1.0.9"
351351

352-
"@bazel/karma@0.36.1":
353-
version "0.36.1"
354-
resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-0.36.1.tgz#3d6e5e8772d2d2799d0b301020c1483ed3fe5de1"
355-
integrity sha512-2zSW12BBJEqV1QYhPiwfTmObKCeyq3Gdox1b+2eYbyNw2HBlCHhWJs0FquGo63LLBn9XZhhk2H2IQmwhUOhx+w==
352+
"@bazel/karma@^0.38.0":
353+
version "0.38.0"
354+
resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-0.38.0.tgz#c738f769691196884f985c18a903b326c152854f"
355+
integrity sha512-toDlcQy6z69D/aZfzzkWjWd4eAn0gxwJmfCnomsC/P56mWEsFNj1BBjuINEd8xcQhXyBi8q1zHa9MyAoDqrYWQ==
356356
dependencies:
357357
jasmine-core "2.8.0"
358358
karma "^4.0.0"
@@ -366,17 +366,17 @@
366366
semver "5.6.0"
367367
tmp "0.0.33"
368368

369-
"@bazel/protractor@0.36.1":
370-
version "0.36.1"
371-
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-0.36.1.tgz#7d6dc95deeeb1e79daff3450815cce86067dc067"
372-
integrity sha512-mlsKTTChaUKdqkeNTZ5Ny3PDFI7aul7j6IGYozQUaAopY7qoCMEiOUnwYNYYaf/iKJlcIhQLf7HQwGAq36NTsQ==
369+
"@bazel/protractor@^0.38.0":
370+
version "0.38.0"
371+
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-0.38.0.tgz#08be006d29543fc3c417c4d9f59e1eb927bb2fa6"
372+
integrity sha512-omvQwYjvMTd6/xI9WNDfscl9GVhuaXs+lahhv2b7D3DGUuVStihQp4Ux4/xT6jlmOkru2uk38nfes/jfOoalkQ==
373373
dependencies:
374374
protractor "^5.4.2"
375375

376-
"@bazel/typescript@0.36.1":
377-
version "0.36.1"
378-
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.36.1.tgz#de7994ed8eec90e0593525f62060a302fcf49ef1"
379-
integrity sha512-TvItSk/aGakCmbrxTnbydKxq7bfYzMKqk9tNwHCzC8KqtTTyNuGTHisjqixw8G6jeSrms6vIkfH9YpYw9OHzRQ==
376+
"@bazel/typescript@^0.38.0":
377+
version "0.38.0"
378+
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.38.0.tgz#0fce6ac5618a11bf7a9803455c24dbdcdf4a85cd"
379+
integrity sha512-3xZNQ1aHBRMPvxyDUR7yHxT5o/2IUkZh0s/eMMBB9GvU/uit0HpxOOdEADHqoID/8afU0SPYX0LKw+jDn6tfFA==
380380
dependencies:
381381
protobufjs "6.8.8"
382382
semver "5.6.0"

0 commit comments

Comments
 (0)