Skip to content

Commit 84dce3a

Browse files
authored
Angular upgrade v17 to v18 (#7099)
## Motivation for features / changes This PR is the third step in a planned major Angular upgrade cycle, where each major version will be delivered in a separate PR, incrementally progressing until the project reaches Angular 21. This specific PR upgrades TensorBoard from Angular 17 to Angular 18 ## Technical description of changes - Updated Angular, NgRx, Material, and CDK to ^18.0.0. - Updated TypeScript from 5.2.2 to 5.4.5. - Updated @angular/build-tooling to its commit compatible with Angular 18. - Set selenium-webdriver to 4.27.0 to keep working with Node 18. - Updated the patch name in WORKSPACE; removed the old entry from whitespace_hygiene_test.py. - Added the m2- prefix to all Material M2 SCSS styles. Material 18 renamed these APIs (eg: define-light-theme became m2-define-light-theme). ## Detailed steps to verify changes work correctly (as executed by you) - All 2022 webapp tests pass - yarn lint passes with Node 18 - App builds and runs locally and you are able to interact with the page
1 parent 6feb9c9 commit 84dce3a

35 files changed

Lines changed: 2357 additions & 3331 deletions

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ yarn_install(
237237
# this Bazel/CI setup. Apply the generated patch artifacts directly during
238238
# yarn_install instead.
239239
post_install_patches = [
240-
"//patches:@angular+build-tooling+0.0.0-2113cd7f66a089ac0208ea84eee672b2529f4f6c.patch",
240+
"//patches:@angular+build-tooling+0.0.0-db91da4e742cd081bfba01db2edc4e816018419b.patch",
241241
"//patches:@bazel+concatjs+5.8.1.patch",
242242
],
243243
yarn_lock = "//:yarn.lock",

package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
},
2929
"homepage": "https://github.com/tensorflow/tensorboard#readme",
3030
"devDependencies": {
31-
"@angular-devkit/build-angular": "^17.0.0",
32-
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#3069be882e3e41cdb3dad58788d878e31d7d82e8",
33-
"@angular/cli": "^17.0.0",
34-
"@angular/compiler": "17.3.12",
35-
"@angular/compiler-cli": "^17.0.0",
31+
"@angular-devkit/build-angular": "^18.0.0",
32+
"@angular/build": "^18.0.0",
33+
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#c2de5cda47188d1ed960cd3c6fa9f4b699ba1001",
34+
"@angular/cli": "^18.0.0",
35+
"@angular/compiler": "18.2.14",
36+
"@angular/compiler-cli": "^18.0.0",
3637
"@babel/core": "^7.16.12",
3738
"@bazel/concatjs": "5.8.1",
3839
"@bazel/esbuild": "5.8.1",
@@ -61,22 +62,22 @@
6162
"prettier-plugin-organize-imports": "2.3.4",
6263
"requirejs": "^2.3.7",
6364
"tslib": "^2.3.0",
64-
"typescript": "5.2.2",
65+
"typescript": "5.4.5",
6566
"yarn-deduplicate": "^5.0.0"
6667
},
6768
"dependencies": {
68-
"@angular/animations": "^17.0.0",
69-
"@angular/cdk": "^17.0.0",
70-
"@angular/common": "17.3.12",
71-
"@angular/core": "^17.0.0",
72-
"@angular/forms": "^17.0.0",
73-
"@angular/localize": "^17.0.0",
74-
"@angular/material": "^17.0.0",
75-
"@angular/platform-browser": "^17.0.0",
76-
"@angular/platform-browser-dynamic": "^17.0.0",
77-
"@angular/router": "^17.0.0",
78-
"@ngrx/effects": "^17.0.0",
79-
"@ngrx/store": "^17.0.0",
69+
"@angular/animations": "^18.0.0",
70+
"@angular/cdk": "^18.0.0",
71+
"@angular/common": "18.2.14",
72+
"@angular/core": "^18.0.0",
73+
"@angular/forms": "^18.0.0",
74+
"@angular/localize": "^18.0.0",
75+
"@angular/material": "^18.0.0",
76+
"@angular/platform-browser": "^18.0.0",
77+
"@angular/platform-browser-dynamic": "^18.0.0",
78+
"@angular/router": "^18.0.0",
79+
"@ngrx/effects": "^18.0.0",
80+
"@ngrx/store": "^18.0.0",
8081
"@polymer/decorators": "^3.0.0",
8182
"@polymer/iron-behaviors": "^3.0.1",
8283
"@polymer/iron-collapse": "^3.0.1",
@@ -139,7 +140,8 @@
139140
"@types/d3-transition": "1.3.6",
140141
"@types/d3-zoom": "1.8.7",
141142
"@types/d3-drag": "1.2.8",
142-
"@types/d3-scale-chromatic": "1.5.4"
143+
"@types/d3-scale-chromatic": "1.5.4",
144+
"selenium-webdriver": "4.27.0"
143145
},
144146
"packageManager": "yarn@1.22.22"
145147
}

patches/@angular+build-tooling+0.0.0-2113cd7f66a089ac0208ea84eee672b2529f4f6c.patch renamed to patches/@angular+build-tooling+0.0.0-db91da4e742cd081bfba01db2edc4e816018419b.patch

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
diff --git a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel
2-
index 870da1b..3f1e5c5 100755
3-
--- a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel
4-
+++ b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel
5-
@@ -23,6 +23,7 @@ js_library(
6-
deps = [
7-
"@npm//@babel/core",
8-
"@npm//@babel/helper-annotate-as-pure",
9-
+ "@npm//@babel/helper-split-export-declaration",
10-
],
11-
)
12-
131
diff --git a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs
14-
index 6d5ec3f..ad4217f 100755
152
--- a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs
163
+++ b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs
17-
@@ -86,11 +86,11 @@ export async function createEsbuildAngularOptimizePlugin(opts, additionalBabelPl
18-
devkitOptimizePlugins.adjustTypeScriptEnumsPlugin,
19-
);
20-
4+
@@ -55,11 +55,11 @@
5+
if (opts.optimize) {
6+
plugins.push(adjustStaticMembers, adjustTypeScriptEnums, elideAngularMetadata);
7+
218
- // If the current file is denoted as explicit side effect free, add the pure
229
- // top-level functions optimization plugin for this file.
2310
- if (opts.optimize.isSideEffectFree && opts.optimize.isSideEffectFree(args.path)) {
24-
- plugins.push(devkitOptimizePlugins.pureToplevelFunctionsPlugin);
11+
- plugins.push(markTopLevelPure);
2512
- }
2613
+ // For TensorBoard: This plugin aggressively culls symbols in a way that
2714
+ // is incompatible with TensorBoard source. Disable it. As result the binary is bigger.
2815
+ //if (opts.optimize.isSideEffectFree && opts.optimize.isSideEffectFree(args.path)) {
29-
+ // plugins.push(devkitOptimizePlugins.pureToplevelFunctionsPlugin);
16+
+ // plugins.push(markTopLevelPure);
3017
+ //}
3118
}
32-
19+
3320
const shouldRunLinker =

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/common/_lib.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
1716
@use '@angular/material' as matm2var;
1817

1918
@mixin debugger-op-type {
20-
background-color: matm2.get-color-from-palette(
21-
matm2var.$blue-grey-palette,
19+
background-color: matm2.m2-get-color-from-palette(
20+
matm2var.$m2-blue-grey-palette,
2221
50
2322
);
2423
@include tb-theme-foreground-prop(border, border, 1px solid);
@@ -31,8 +30,8 @@ limitations under the License.
3130
width: max-content;
3231

3332
@include tb-dark-theme {
34-
background-color: matm2.get-color-from-palette(
35-
matm2var.$blue-grey-palette,
33+
background-color: matm2.m2-get-color-from-palette(
34+
matm2var.$m2-blue-grey-palette,
3635
700
3736
);
3837
}
@@ -42,8 +41,8 @@ limitations under the License.
4241
background-color: #fff099;
4342

4443
@include tb-dark-theme {
45-
background-color: matm2.get-color-from-palette(
46-
matm2var.$orange-palette,
44+
background-color: matm2.m2-get-color-from-palette(
45+
matm2var.$m2-orange-palette,
4746
900
4847
);
4948
}

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/execution_data/execution_data_component.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
1716
@use '@angular/material' as matm2var;
1817
@import 'tensorboard/webapp/theme/tb_theme';
@@ -47,16 +46,19 @@ limitations under the License.
4746
}
4847

4948
.focus-execution-container {
50-
background-color: matm2.get-color-from-palette(matm2var.$orange-palette, 200);
49+
background-color: matm2.m2-get-color-from-palette(
50+
matm2var.$m2-orange-palette,
51+
200
52+
);
5153
border-radius: 4px;
5254
font-size: 12px;
5355
height: 120px;
5456
padding: 5px;
5557
width: 360px;
5658

5759
@include tb-dark-theme {
58-
background-color: matm2.get-color-from-palette(
59-
matm2var.$orange-palette,
60+
background-color: matm2.m2-get-color-from-palette(
61+
matm2var.$m2-orange-palette,
6062
900
6163
);
6264
}

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/graph/graph_op_component.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
1716
@use '@angular/material' as matm2var;
1817
@import 'tensorboard/webapp/theme/tb_theme';
@@ -33,7 +32,7 @@ limitations under the License.
3332
padding: 2px 6px;
3433
text-align: right;
3534
width: 200px;
36-
$grey-600: matm2.get-color-from-palette(matm2var.$grey-palette, 600);
35+
$grey-600: matm2.m2-get-color-from-palette(matm2var.$m2-grey-palette, 600);
3736

3837
@include tb-dark-theme {
3938
box-shadow: 1px 3px $grey-600;

tensorboard/tools/whitespace_hygiene_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@
2525
import sys
2626

2727

28-
# @TODO(@cdavalos7): Remove this exception when the patch file is no longer needed.
2928
# Patch files use a trailing space on blank lines to mark them as context.
30-
# This is required by patch-package and cannot be removed.
29+
# This is required by patch format and cannot be removed.
3130
exceptions = frozenset(
3231
[
33-
"patches/@angular+build-tooling+0.0.0-2113cd7f66a089ac0208ea84eee672b2529f4f6c.patch",
3432
"patches/protobuf_6_31_1_java_export.patch",
3533
]
3634
)

tensorboard/webapp/feature_flag/views/feature_flag_dialog_component.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
17-
@use '@angular/material' as matm2var;
1816
@import 'tensorboard/webapp/theme/tb_theme';
1917

2018
.message {
2119
.warning {
22-
color: matm2.get-color-from-palette($tb-warn);
20+
color: matm2.m2-get-color-from-palette($tb-warn);
2321
}
2422

2523
margin-bottom: 16px;
2624
}
2725

2826
.note-1 {
29-
color: matm2.get-color-from-palette($tb-accent);
27+
color: matm2.m2-get-color-from-palette($tb-accent);
3028
}
3129

3230
.scrolling-page {

tensorboard/webapp/metrics/views/card_renderer/image_card_component.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
17-
@use '@angular/material' as matm2var;
1816
@import 'tensorboard/webapp/theme/tb_theme';
1917
@import '../common';
2018

@@ -155,7 +153,7 @@ $_title-to-heading-gap: 12px;
155153
}
156154

157155
:host ::ng-deep .mat-slider-min-value .mat-slider-thumb {
158-
background-color: matm2.get-color-from-palette($tb-primary);
156+
background-color: matm2.m2-get-color-from-palette($tb-primary);
159157
}
160158

161159
:host ::ng-deep .hide-slider.mat-slider-horizontal .mat-slider-track-wrapper {

tensorboard/webapp/metrics/views/card_renderer/scalar_card_component.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
@use '@angular/material' as mat;
1615
@use '@angular/material' as matm2;
17-
@use '@angular/material' as matm2var;
1816
@import 'tensorboard/webapp/theme/tb_theme';
1917
@import '../common';
2018

@@ -207,10 +205,13 @@ $_data_table_initial_height: 100px;
207205
align-items: center;
208206

209207
.expand-button {
210-
color: matm2.get-color-from-palette($tb-foreground, secondary-text);
208+
color: matm2.m2-get-color-from-palette($tb-foreground, secondary-text);
211209

212210
@include tb-dark-theme {
213-
color: matm2.get-color-from-palette($tb-dark-foreground, secondary-text);
211+
color: matm2.m2-get-color-from-palette(
212+
$tb-dark-foreground,
213+
secondary-text
214+
);
214215
background-color: map-get($tb-dark-background, background);
215216
}
216217
}

0 commit comments

Comments
 (0)