Skip to content

Commit 2204aaf

Browse files
committed
build: update to [email protected]
Update to use [email protected] and update correseponding build rule usages and references
1 parent 53e98b1 commit 2204aaf

File tree

18 files changed

+752
-104
lines changed

18 files changed

+752
-104
lines changed

WORKSPACE

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,17 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
88
# Add NodeJS rules
99
http_archive(
1010
name = "build_bazel_rules_nodejs",
11-
sha256 = "b3521b29c7cb0c47a1a735cce7e7e811a4f80d8e3720cf3a1b624533e4bb7cb6",
12-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.3.2/rules_nodejs-2.3.2.tar.gz"],
11+
sha256 = "dd4dc46066e2ce034cba0c81aa3e862b27e8e8d95871f567359f7a534cccb666",
12+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.1.0/rules_nodejs-3.1.0.tar.gz"],
1313
)
14-
1514
# Add sass rules
1615
http_archive(
1716
name = "io_bazel_rules_sass",
18-
# Patch `rules_sass` to work around a bug that causes error messages to be not
19-
# printed in worker mode: https://github.com/bazelbuild/rules_sass/issues/96.
20-
# TODO(devversion): remove this patch once the Sass Node entry-point returns a `Promise`.
21-
patches = ["//tools/postinstall:sass_worker_async.patch"],
22-
sha256 = "cf28ff1bcfafb3c97f138bbc8ca9fe386e968ed3faaa9f8e6214abb5e88a2ecd",
23-
strip_prefix = "rules_sass-1.29.0",
17+
sha256 = "596ab3616d370135e0ecc710e103422e0aa3719f1c970303a0886b70c81ee819",
18+
strip_prefix = "rules_sass-1.32.2",
2419
urls = [
25-
"https://github.com/bazelbuild/rules_sass/archive/1.29.0.zip",
20+
"https://github.com/bazelbuild/rules_sass/archive/1.32.2.zip",
21+
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.32.2.zip",
2622
],
2723
)
2824

@@ -49,10 +45,6 @@ node_repositories(
4945

5046
yarn_install(
5147
name = "npm",
52-
# Redirects Yarn `stdout` output to `stderr`. This ensures that stdout is not accidentally
53-
# polluted when Bazel runs Yarn. Workaround until the upstream fix is available:
54-
# https://github.com/bazelbuild/bazel/pull/10611.
55-
args = ["1>&2"],
5648
# We add the postinstall patches file, and ngcc main fields update script here so
5749
# that Yarn will rerun whenever one of these files has been modified.
5850
data = [
@@ -61,22 +53,15 @@ yarn_install(
6153
],
6254
package_json = "//:package.json",
6355
quiet = False,
56+
strict_visibility = False,
6457
yarn_lock = "//:yarn.lock",
6558
)
6659

67-
# Install all bazel dependencies of the @ngdeps npm packages
68-
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
6960

70-
install_bazel_dependencies(
71-
# TODO(crisbeto): supress warnings for now so everything works like it has until now.
72-
# Eventually we should remove it and re-test everything.
73-
suppress_warning = True,
74-
)
61+
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
7562

76-
# Fetch transitive dependencies which are needed to use the karma rules.
77-
load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")
63+
npm_bazel_protractor_dependencies()
7864

79-
npm_bazel_karma_dependencies()
8065

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

integration/size-test/index.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def size_test(name, file, deps):
7777
nodejs_binary(
7878
name = "%s.approve" % name,
7979
testonly = True,
80+
templated_args = ["--bazel_patch_module_resolver"],
8081
data = [
8182
"//goldens:size-test.yaml",
8283
"//integration/size-test:check-size",

package.json

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,55 @@
7171
"zone.js": "~0.11.3"
7272
},
7373
"devDependencies": {
74+
"diff": "^3.5.0",
75+
"reflect-metadata": "^0.1.3",
76+
"@material/animation": "10.0.0-canary.d29ec2862.0",
77+
"@material/auto-init": "10.0.0-canary.d29ec2862.0",
78+
"@material/banner": "10.0.0-canary.d29ec2862.0",
79+
"@material/base": "10.0.0-canary.d29ec2862.0",
80+
"@material/button": "10.0.0-canary.d29ec2862.0",
81+
"@material/card": "10.0.0-canary.d29ec2862.0",
82+
"@material/checkbox": "10.0.0-canary.d29ec2862.0",
83+
"@material/chips": "10.0.0-canary.d29ec2862.0",
84+
"@material/circular-progress": "10.0.0-canary.d29ec2862.0",
85+
"@material/data-table": "10.0.0-canary.d29ec2862.0",
86+
"@material/density": "10.0.0-canary.d29ec2862.0",
87+
"@material/dialog": "10.0.0-canary.d29ec2862.0",
88+
"@material/dom": "10.0.0-canary.d29ec2862.0",
89+
"@material/drawer": "10.0.0-canary.d29ec2862.0",
90+
"@material/elevation": "10.0.0-canary.d29ec2862.0",
91+
"@material/fab": "10.0.0-canary.d29ec2862.0",
92+
"@material/feature-targeting": "10.0.0-canary.d29ec2862.0",
93+
"@material/floating-label": "10.0.0-canary.d29ec2862.0",
94+
"@material/form-field": "10.0.0-canary.d29ec2862.0",
95+
"@material/icon-button": "10.0.0-canary.d29ec2862.0",
96+
"@material/image-list": "10.0.0-canary.d29ec2862.0",
97+
"@material/layout-grid": "10.0.0-canary.d29ec2862.0",
98+
"@material/line-ripple": "10.0.0-canary.d29ec2862.0",
99+
"@material/linear-progress": "10.0.0-canary.d29ec2862.0",
100+
"@material/list": "10.0.0-canary.d29ec2862.0",
101+
"@material/menu": "10.0.0-canary.d29ec2862.0",
102+
"@material/menu-surface": "10.0.0-canary.d29ec2862.0",
103+
"@material/notched-outline": "10.0.0-canary.d29ec2862.0",
104+
"@material/radio": "10.0.0-canary.d29ec2862.0",
105+
"@material/ripple": "10.0.0-canary.d29ec2862.0",
106+
"@material/rtl": "10.0.0-canary.d29ec2862.0",
107+
"@material/segmented-button": "10.0.0-canary.d29ec2862.0",
108+
"@material/select": "10.0.0-canary.d29ec2862.0",
109+
"@material/shape": "10.0.0-canary.d29ec2862.0",
110+
"@material/slider": "10.0.0-canary.d29ec2862.0",
111+
"@material/snackbar": "10.0.0-canary.d29ec2862.0",
112+
"@material/switch": "10.0.0-canary.d29ec2862.0",
113+
"@material/tab": "10.0.0-canary.d29ec2862.0",
114+
"@material/tab-bar": "10.0.0-canary.d29ec2862.0",
115+
"@material/tab-indicator": "10.0.0-canary.d29ec2862.0",
116+
"@material/tab-scroller": "10.0.0-canary.d29ec2862.0",
117+
"@material/textfield": "10.0.0-canary.d29ec2862.0",
118+
"@material/theme": "10.0.0-canary.d29ec2862.0",
119+
"@material/tooltip": "10.0.0-canary.d29ec2862.0",
120+
"@material/top-app-bar": "10.0.0-canary.d29ec2862.0",
121+
"@material/touch-target": "10.0.0-canary.d29ec2862.0",
122+
"@material/typography": "10.0.0-canary.d29ec2862.0",
74123
"@angular-devkit/build-optimizer": "^0.1200.0-next.0",
75124
"@angular-devkit/core": "^12.0.0-next.0",
76125
"@angular-devkit/schematics": "^12.0.0-next.0",
@@ -85,12 +134,12 @@
85134
"@bazel/bazelisk": "^1.4.0",
86135
"@bazel/buildifier": "^4.0.0",
87136
"@bazel/ibazel": "^0.14.0",
88-
"@bazel/jasmine": "^2.3.2",
89-
"@bazel/karma": "^2.3.2",
90-
"@bazel/protractor": "^2.3.2",
91-
"@bazel/rollup": "^2.3.2",
92-
"@bazel/terser": "^2.3.2",
93-
"@bazel/typescript": "^2.3.2",
137+
"@bazel/jasmine": "3.1.0",
138+
"@bazel/concatjs": "3.1.0",
139+
"@bazel/protractor": "3.1.0",
140+
"@bazel/rollup": "3.1.0",
141+
"@bazel/terser": "3.1.0",
142+
"@bazel/typescript": "3.1.0",
94143
"@firebase/app-types": "^0.6.1",
95144
"@octokit/rest": "18.1.0",
96145
"@schematics/angular": "^12.0.0-next.0",

packages.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ ANGULAR_PACKAGE_VERSION = "^11.0.0 || ^12.0.0-0"
55
MDC_PACKAGE_VERSION = "^9.0.0-canary.419e03572.0"
66
TSLIB_PACKAGE_VERSION = "^2.0.0"
77

8+
# Each placer holder is used to stamp versions during the build process, replacing the key with it's
9+
# value pair. These replacements occur during building of `npm_package` and `ng_package` stamping in
10+
# the peer dependencies and versions, primarily in `package.json`s.
811
VERSION_PLACEHOLDER_REPLACEMENTS = {
12+
# Version of `material-components-web`
913
"0.0.0-MDC": MDC_PACKAGE_VERSION,
14+
# Version of `@angular/core`
1015
"0.0.0-NG": ANGULAR_PACKAGE_VERSION,
16+
# Version of `tslib`
1117
"0.0.0-TSLIB": TSLIB_PACKAGE_VERSION,
18+
# Version of the local package being built, generated via the `--workspace_status_command` flag.
19+
"0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}",
1220
}
1321

1422
# List of default Angular library UMD bundles which are not processed by ngcc.

src/e2e-app/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@npm//@bazel/typescript:index.bzl", "ts_devserver")
1+
load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")
22
load("//:packages.bzl", "getAngularUmdTargets")
33
load("//tools:defaults.bzl", "ng_module", "sass_binary")
44

@@ -85,7 +85,7 @@ sass_binary(
8585
],
8686
)
8787

88-
ts_devserver(
88+
concatjs_devserver(
8989
name = "devserver",
9090
testonly = True,
9191
additional_root_paths = [

src/universal-app/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,11 @@ nodejs_test(
5959
":server",
6060
":theme_scss",
6161
],
62+
63+
templated_args = [
64+
# TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver
65+
# See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324
66+
"--bazel_patch_module_resolver",
67+
],
6268
entry_point = ":prerender.ts",
6369
)

test/bazel-karma-local-config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* want to launch any browser and just enable manual browser debugging.
44
*/
55

6-
const bazelKarma = require('@bazel/karma');
6+
const bazelKarma = require('@bazel/concatjs');
77

88
module.exports = config => {
99
const overwrites = {};
1010

11-
// By default "@bazel/karma" configures Chrome as browser. Since we don't want
11+
// By default "@bazel/concatjs" configures Chrome as browser. Since we don't want
1212
// to launch any browser at all, we overwrite the "browsers" option. Since the
1313
// default config tries to extend the browsers array with "Chrome", we need to
1414
// always return a new empty array.
@@ -19,16 +19,16 @@ module.exports = config => {
1919
});
2020

2121
// Ensures that tests start executing once browsers have been manually connected. We need
22-
// to use "defineProperty" because the default "@bazel/karma" config overwrites the option.
22+
// to use "defineProperty" because the default "@bazel/concatjs" config overwrites the option.
2323
Object.defineProperty(overwrites, 'autoWatch', {
2424
get: () => true,
2525
set: () => {},
2626
enumerable: true,
2727
});
2828

29-
// When not running with ibazel, do not set up the `@bazel/karma` watcher. This one
29+
// When not running with ibazel, do not set up the `@bazel/concatjs` watcher. This one
3030
// relies on ibazel to write to the `stdin` interface. When running without ibazel, the
31-
// watcher will kill Karma since there is no data written to the `stdin` interface.
31+
// watcher will kill concatjs since there is no data written to the `stdin` interface.
3232
if (process.env['IBAZEL_NOTIFY_CHANGES'] !== 'y') {
3333
delete bazelKarma['watcher'];
3434
}

tools/defaults.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
load("@io_bazel_rules_sass//:defs.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library")
44
load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
55
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
6-
load("@npm//@bazel/karma:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
6+
load("@npm//@bazel/concatjs:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
77
load("@npm//@bazel/protractor:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
88
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library")
99
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS", "getAngularUmdTargets")

tools/dev-server/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ts_library(
2525

2626
nodejs_binary(
2727
name = "dev-server_bin",
28+
templated_args = ["--bazel_patch_module_resolver"],
2829
data = [
2930
":dev-server_lib",
3031
],

tools/dgeni/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package(default_visibility = ["//visibility:public"])
55

66
nodejs_binary(
77
name = "dgeni",
8+
templated_args = ["--bazel_patch_module_resolver"],
89
data = [
910
":sources",
1011
"@npm//dgeni",

tools/example-module/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ts_library(
1515

1616
nodejs_binary(
1717
name = "bazel-bin",
18+
templated_args = ["--bazel_patch_module_resolver"],
1819
data = [
1920
":example-module.template",
2021
":example-module-lib",

tools/highlight-files/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ts_library(
1010
deps = [
1111
"//tools/region-parser",
1212
"@npm//@types/fs-extra",
13+
"@npm//fs-extra",
1314
"@npm//@types/node",
1415
],
1516
)
@@ -21,5 +22,10 @@ nodejs_binary(
2122
"@npm//fs-extra",
2223
"@npm//highlight.js",
2324
],
25+
templated_args = [
26+
# TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver
27+
# See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324
28+
"--bazel_patch_module_resolver",
29+
],
2430
entry_point = ":highlight-files.ts",
2531
)

tools/markdown-to-html/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ts_library(
1515
deps = [
1616
"//tools/highlight-files:sources",
1717
"@npm//@types/marked",
18+
"@npm//marked",
1819
"@npm//@types/node",
1920
],
2021
)
@@ -26,6 +27,7 @@ nodejs_binary(
2627
"@npm//highlight.js",
2728
"@npm//marked",
2829
],
30+
templated_args = ["--bazel_patch_module_resolver"],
2931
entry_point = ":transform-markdown.ts",
3032
)
3133

tools/markdown-to-html/docs-marked-renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export class DocsMarkdownRenderer extends Renderer {
8181
html = html.replace(exampleCommentRegex, (_match: string, content: string) => {
8282
// using [\s\S]* because .* does not match line breaks
8383
if (content.match(/\{[\s\S]*\}/g)) {
84-
const {example, file, region} = JSON.parse(content);
84+
const {example, file, region} = JSON.parse(content) as {
85+
example: string, file: string, region: string};
8586
return `<div material-docs-example="${example}"
8687
${file ? `file="${file}"` : ''}
8788
${region ? `region="${region}"` : ''}></div>`;

tools/package-docs-content/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ nodejs_binary(
99
":sources",
1010
"@npm//fs-extra",
1111
],
12+
templated_args = ["--bazel_patch_module_resolver"],
1213
entry_point = ":package-docs-content.ts",
1314
)
1415

tools/postinstall/@bazel_typescript_tsc_wrapped_worker_cache_fix.patch

Lines changed: 0 additions & 34 deletions
This file was deleted.

tools/postinstall/apply-patches.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function applyPatches() {
8787
const hasFlatModuleBundle = fs.existsSync(filePath.replace('.d.ts', '.metadata.json'));
8888
if ((filePath.includes('node_modules/') || !hasFlatModuleBundle) && $1`,
8989
'node_modules/@angular/compiler-cli/src/transformers/compiler_host.js');
90-
applyPatch(path.join(__dirname, './flat_module_factory_resolution.patch'));
90+
// applyPatch(path.join(__dirname, './flat_module_factory_resolution.patch'));
9191
// The three replacements below ensure that metadata files can be read by NGC and
9292
// that metadata files are collected as Bazel action inputs.
9393
searchAndReplace(
@@ -108,10 +108,7 @@ function applyPatches() {
108108
'node_modules/@angular/bazel/src/ng_module.bzl');
109109

110110
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1208.
111-
applyPatch(path.join(__dirname, './manifest_externs_hermeticity.patch'));
112-
113-
// Patches the changes from: https://github.com/bazelbuild/rules_typescript/pull/504.
114-
applyPatch(path.join(__dirname, './@bazel_typescript_tsc_wrapped_worker_cache_fix.patch'));
111+
// applyPatch(path.join(__dirname, './manifest_externs_hermeticity.patch'));
115112

116113
// Workaround for https://github.com/angular/angular/issues/33452:
117114
searchAndReplace(

0 commit comments

Comments
 (0)