Skip to content

Commit 9d7768c

Browse files
devversionkirjs
authored andcommitted
build: rework benchmarks and examples in modules/ to new optimization rule (#61566)
We are dropping the custom ESBuild and Terser pipeline from dev-infra and instead leverage the Angular CLI directly. This commit adjusts the benchmarks to use this new rule. PR Close #61566
1 parent b80957d commit 9d7768c

File tree

159 files changed

+2944
-6305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+2944
-6305
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-151232324
55
adev/shared-docs/pipeline/api-gen/package.json=939673974
6+
modules/package.json=1088918580
67
package.json=1801177040
78
packages/animations/package.json=-678724831
89
packages/common/package.json=1729763064
@@ -11,9 +12,13 @@ packages/compiler/package.json=1190056499
1112
packages/core/package.json=1154833122
1213
packages/core/test/bundling/package.json=1175613456
1314
packages/forms/package.json=-877154917
15+
packages/localize/package.json=-1012769529
16+
packages/platform-browser-dynamic/package.json=1901947880
1417
packages/platform-browser/package.json=-1163479450
1518
packages/router/package.json=860819913
16-
pnpm-lock.yaml=427404612
17-
pnpm-workspace.yaml=-1870270384
19+
packages/upgrade/package.json=16347051
20+
packages/zone.js/package.json=-1545343303
21+
pnpm-lock.yaml=-1557989717
22+
pnpm-workspace.yaml=-1264776080
1823
tools/bazel/rules_angular_store/package.json=-239561259
1924
yarn.lock=-1393712141

.bazelignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ modules/ssr-benchmarks/node_modules
4141

4242
# For rules_js
4343
adev/shared-docs/pipeline/api-gen/node_modules
44+
modules/node_modules
4445
packages/animations/node_modules
4546
packages/common/node_modules
47+
packages/localize/node_modules
4648
packages/compiler-cli/node_modules
4749
packages/compiler/node_modules
4850
packages/core/node_modules
4951
packages/core/test/bundling/node_modules
5052
packages/forms/node_modules
5153
packages/platform-browser/node_modules
54+
packages/platform-browser-dynamic/node_modules
5255
packages/router/node_modules
56+
packages/zone.js/node_modules
57+
packages/upgrade/node_modules
5358
tools/bazel/rules_angular_store/node_modules

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,20 @@ npm_translate_lock(
110110
"//:package.json",
111111
"//:pnpm-workspace.yaml",
112112
"//adev/shared-docs/pipeline/api-gen:package.json",
113+
"//modules:package.json",
113114
"//packages/animations:package.json",
114115
"//packages/common:package.json",
115116
"//packages/compiler:package.json",
116117
"//packages/compiler-cli:package.json",
117118
"//packages/core:package.json",
118119
"//packages/core/test/bundling:package.json",
119120
"//packages/forms:package.json",
121+
"//packages/localize:package.json",
120122
"//packages/platform-browser:package.json",
123+
"//packages/platform-browser-dynamic:package.json",
121124
"//packages/router:package.json",
125+
"//packages/upgrade:package.json",
126+
"//packages/zone.js:package.json",
122127
"//tools/bazel/rules_angular_store:package.json",
123128
],
124129
npmrc = "//:.npmrc",

modules/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
load("@npm2//:defs.bzl", "npm_link_all_packages")
2+
3+
npm_link_all_packages()

modules/benchmarks/BUILD.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1+
load("//tools:defaults2.bzl", "ts_config")
2+
13
package(default_visibility = ["//visibility:public"])
24

35
exports_files([
46
"tsconfig-build.json",
57
"tsconfig-e2e.json",
68
])
9+
10+
ts_config(
11+
name = "tsconfig_build",
12+
src = "tsconfig-build.json",
13+
)
14+
15+
ts_config(
16+
name = "tsconfig_e2e",
17+
src = "tsconfig-e2e.json",
18+
deps = [
19+
"//:node_modules/@types/jasmine",
20+
"//:node_modules/@types/node",
21+
],
22+
)

modules/benchmarks/src/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
load("//tools:defaults.bzl", "ts_library")
1+
load("//tools:defaults2.bzl", "ts_project")
22

33
package(default_visibility = ["//visibility:public"])
44

5-
ts_library(
5+
ts_project(
66
name = "util_lib",
77
srcs = ["util.ts"],
8+
tsconfig = "//modules/benchmarks:tsconfig_build",
89
)

modules/benchmarks/src/change_detection/BUILD.bazel

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
load("//tools:defaults.bzl", "ts_library")
2+
load("//tools:defaults2.bzl", "ts_project")
23

34
package(default_visibility = ["//visibility:public"])
45

5-
ts_library(
6+
ts_project(
67
name = "util_lib",
78
srcs = ["util.ts"],
8-
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
9-
deps = ["//modules/benchmarks/src:util_lib"],
9+
tsconfig = "//modules/benchmarks:tsconfig_build",
10+
deps = ["//modules/benchmarks/src:util_lib_rjs"],
1011
)
1112

1213
ts_library(

modules/benchmarks/src/change_detection/transplanted_views/BUILD.bazel

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
2+
load("@rules_angular//src/optimization:index.bzl", "optimize_angular_app")
23
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
3-
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module")
4+
load("//tools:defaults.bzl", "http_server")
45

56
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
67

7-
ng_module(
8-
name = "transplanted_views_lib",
9-
srcs = glob(["*.ts"]),
10-
tsconfig = "//modules/benchmarks:tsconfig-build.json",
11-
deps = [
12-
"//modules/benchmarks/src:util_lib",
13-
"//modules/benchmarks/src/change_detection:util_lib",
14-
"//packages/core",
15-
"//packages/platform-browser",
8+
optimize_angular_app(
9+
name = "bundles",
10+
srcs = [
11+
"index.html",
12+
"init.ts",
13+
"main.ts",
14+
"transplanted_views.ts",
15+
"//modules/benchmarks/src:util_lib_rjs",
16+
"//modules/benchmarks/src/change_detection:util_lib_rjs",
1617
],
17-
)
18-
19-
app_bundle(
20-
name = "bundle",
21-
entry_point = ":index_aot.ts",
18+
include_zonejs = True,
2219
deps = [
23-
":transplanted_views_lib",
24-
"@npm//rxjs",
20+
"//:node_modules/rxjs",
21+
"//:node_modules/tslib",
22+
"//modules:node_modules/@angular/build",
23+
"//modules:node_modules/@angular/common",
24+
"//modules:node_modules/@angular/core",
25+
"//modules:node_modules/@angular/platform-browser",
26+
"//modules:node_modules/zone.js",
2527
],
2628
)
2729

2830
# The script needs to be called `app_bundle` for easier syncing into g3.
2931
genrule(
3032
name = "app_bundle",
31-
srcs = [":bundle.debug.min.js"],
33+
srcs = [":bundles"],
3234
outs = ["app_bundle.js"],
33-
cmd = "cp $< $@",
35+
cmd = "cp $</main.js $@",
3436
)
3537

3638
http_server(
Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark")
2-
31
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
42

5-
component_benchmark(
6-
name = "benchmark",
7-
driver = ":class_bindings.perf-spec.ts",
8-
driver_deps = [
9-
"@npm//@angular/build-tooling/bazel/benchmark/driver-utilities",
10-
"@npm//@types/jasmine",
11-
"@npm//protractor",
12-
],
13-
ng_deps = [
14-
"//packages:types",
15-
"//packages/common",
16-
"//packages/core",
17-
"//packages/platform-browser",
18-
"@npm//rxjs",
19-
],
20-
ng_srcs = glob(
21-
["**/*.ts"],
22-
exclude = ["**/*.perf-spec.ts"],
23-
),
24-
prefix = "",
25-
styles = ["styles.css"],
26-
)
3+
#component_benchmark(
4+
# name = "benchmark",
5+
# tags =
6+
# driver = ":class_bindings.perf-spec.ts",
7+
# driver_deps = [
8+
# "@npm//@angular/build-tooling/bazel/benchmark/driver-utilities",
9+
# "@npm//@types/jasmine",
10+
# "@npm//protractor",
11+
# ],
12+
# ng_deps = [
13+
# "//packages:types",
14+
# "//packages/common",
15+
# "//packages/core",
16+
# "//packages/platform-browser",
17+
# "@npm//rxjs",
18+
# ],
19+
# ng_srcs = glob(
20+
# ["**/*.ts"],
21+
# exclude = ["**/*.perf-spec.ts"],
22+
# ),
23+
# prefix = "",
24+
# styles = ["styles.css"],
25+
#)

0 commit comments

Comments
 (0)