Skip to content

Commit 207bc6c

Browse files
committed
build: clean-up to use fine-grained targets for faster rebuilds
We've decided to not leverage pnpm workspace first-party dependency linking, except for integration tests. This commit cleans up leftovers from the previous revert commit, and also fixes other tests to work with the fine-grained targets. In addition, we also improve visibility rules to safe-guard against accidentally relying on the pnpm first party linkings.
1 parent 29a9ee6 commit 207bc6c

File tree

33 files changed

+211
-68
lines changed

33 files changed

+211
-68
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-1406867100
55
integration/package.json=-620011313
6-
package.json=-635422980
6+
package.json=20540807
77
patches/@angular__compiler-cli.patch=-65319555
8-
pnpm-lock.yaml=-1494189058
8+
pnpm-lock.yaml=-1601778403
99
pnpm-workspace.yaml=334858811
10-
src/cdk-experimental/package.json=2063150503
10+
src/cdk-experimental/package.json=237487315
1111
src/cdk/package.json=-908433069
1212
src/components-examples/package.json=560048349
1313
src/dev-app/package.json=624475908
1414
src/e2e-app/package.json=-1971485006
1515
src/google-maps/package.json=-886415500
1616
src/material-date-fns-adapter/package.json=-332076964
17-
src/material-experimental/package.json=592784609
17+
src/material-experimental/package.json=1822916455
1818
src/material-luxon-adapter/package.json=-199007660
1919
src/material-moment-adapter/package.json=-1407689629
2020
src/material/package.json=-1237533685

WORKSPACE

+15-3
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ npm_translate_lock(
167167
"@angular/animations": "node ../../@nginfra/angular-linking/index.mjs",
168168
"@angular/common": "node ../../@nginfra/angular-linking/index.mjs",
169169
"@angular/forms": "node ../../@nginfra/angular-linking/index.mjs",
170+
"@angular/localize": "node ../../@nginfra/angular-linking/index.mjs",
170171
"@angular/platform-browser": "node ../../@nginfra/angular-linking/index.mjs",
172+
"@angular/platform-server": "node ../../@nginfra/angular-linking/index.mjs",
171173
"@angular/router": "node ../../@nginfra/angular-linking/index.mjs",
172-
"@angular/localize": "node ../../@nginfra/angular-linking/index.mjs",
173174
},
174175
data = [
175176
"//:package.json",
@@ -191,6 +192,17 @@ npm_translate_lock(
191192
"//src/youtube-player:package.json",
192193
],
193194
npmrc = "//:.npmrc",
195+
package_visibility = {
196+
"@angular/cdk": ["//integration:__subpackages__"],
197+
"@angular/cdk-experimental": ["//integration:__subpackages__"],
198+
"@angular/material": ["//integration:__subpackages__"],
199+
"@angular/material-experimental": ["//integration:__subpackages__"],
200+
"@angular/google-maps": ["//integration:__subpackages__"],
201+
"@angular/youtube-player": ["//integration:__subpackages__"],
202+
"@angular/material-moment-adapter": ["//integration:__subpackages__"],
203+
"@angular/material-date-fns-adapter": ["//integration:__subpackages__"],
204+
"@angular/material-luxon-adapter": ["//integration:__subpackages__"],
205+
},
194206
pnpm_lock = "//:pnpm-lock.yaml",
195207
update_pnpm_lock = True,
196208
verify_node_modules_ignored = "//:.bazelignore",
@@ -238,7 +250,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
238250

239251
git_repository(
240252
name = "devinfra",
241-
commit = "b9bcdb3f9dff85fbfe8d1ca1d95531ddfe475f80",
253+
commit = "492cc1f5295d3ededcd6b226354a1e2924c64246",
242254
remote = "https://github.com/angular/dev-infra.git",
243255
)
244256

@@ -252,7 +264,7 @@ setup_dependencies_2()
252264

253265
git_repository(
254266
name = "rules_angular",
255-
commit = "92127883c3a3714e63782a51bac1a7c03ec8b0f5",
267+
commit = "60d0dbdf18224f5167da1a43f4de9c4cb717b593",
256268
remote = "https://github.com/devversion/rules_angular.git",
257269
)
258270

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"date-fns": "^4.1.0",
6666
"luxon": "^3.0.0",
6767
"moment": "^2.29.1",
68-
"rxjs-tslint-rules": "^4.34.8",
6968
"rxjs": "^6.6.7",
69+
"rxjs-tslint-rules": "^4.34.8",
7070
"tslib": "^2.3.1",
7171
"zone.js": "~0.15.0"
7272
},
@@ -226,6 +226,11 @@
226226
"dependencies": {
227227
"@nginfra/angular-linking": "1.0.6"
228228
}
229+
},
230+
"@angular/platform-server": {
231+
"dependencies": {
232+
"@nginfra/angular-linking": "1.0.6"
233+
}
229234
}
230235
}
231236
}

pnpm-lock.yaml

+24-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
55
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
66
load("//tools/dgeni:index.bzl", "dgeni_api_docs")
77
load("//tools:defaults2.bzl", "ts_project")
8+
load("@aspect_rules_js//js:defs.bzl", "js_library")
89

910
package(default_visibility = ["//visibility:public"])
1011

@@ -37,6 +38,11 @@ copy_to_bin(
3738
srcs = ["package.json"],
3839
)
3940

41+
js_library(
42+
name = "esbuild-linked-config",
43+
srcs = ["esbuild-linked.config.mjs"],
44+
)
45+
4046
dgeni_api_docs(
4147
name = "api-docs",
4248
srcs = apiSourceFiles + [

src/cdk-experimental/BUILD.bazel

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("//src/cdk-experimental:config.bzl", "CDK_EXPERIMENTAL_TARGETS")
22
load("//tools:defaults.bzl", "ng_package")
33
load("//tools:defaults2.bzl", "ts_project")
44
load("//tools/bazel:legacy_target.bzl", "get_legacy_label")
5-
load("@npm2//defs:bzl", "npm_link_all_packages")
5+
load("@npm2//:defs.bzl", "npm_link_all_packages")
66

77
package(default_visibility = ["//visibility:public"])
88

@@ -21,6 +21,13 @@ ng_package(
2121
name = "npm_package",
2222
package_name = "@angular/cdk-experimental",
2323
srcs = ["package.json"],
24+
package_deps = [":node_modules/@angular/cdk"],
2425
tags = ["release-package"],
26+
visibility = [
27+
"//:__pkg__",
28+
"//goldens:__pkg__",
29+
"//integration:__subpackages__",
30+
"//src/material-experimental:__subpackages__",
31+
],
2532
deps = [get_legacy_label(t) for t in CDK_EXPERIMENTAL_TARGETS],
2633
)

src/cdk-experimental/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"@angular/cdk": "0.0.0-PLACEHOLDER",
1616
"@angular/core": "0.0.0-NG"
1717
},
18+
"devDependencies": {
19+
"@angular/cdk": "workspace:*"
20+
},
1821
"dependencies": {
1922
"tslib": "^2.3.0"
2023
},

src/cdk/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ ng_package(
6363
"//src/cdk/schematics:npm_package",
6464
],
6565
tags = ["release-package"],
66+
visibility = [
67+
"//:__pkg__",
68+
"//goldens:__pkg__",
69+
"//integration:__subpackages__",
70+
],
6671
deps = [get_legacy_label(t) for t in CDK_TARGETS],
6772
)
6873

src/cdk/schematics/BUILD.bazel

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
2-
load("//tools:defaults.bzl", "jasmine_node_test")
3-
load("//tools:defaults2.bzl", "npm_package", "ts_project")
2+
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
43
load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")
54

6-
package(default_visibility = ["//visibility:public"])
5+
package(default_visibility = [":__subpackages__"])
76

87
copy_to_bin(
98
name = "schematics_assets",
@@ -63,6 +62,10 @@ npm_package(
6362
":schematics_assets",
6463
],
6564
package = "@angular/cdk/schematics",
65+
visibility = [
66+
"//src/cdk:__pkg__",
67+
"//src/material/schematics:__pkg__",
68+
],
6669
)
6770

6871
ts_project(
@@ -91,10 +94,10 @@ ts_project(
9194
],
9295
)
9396

94-
jasmine_node_test(
97+
jasmine_test(
9598
name = "unit_tests",
96-
srcs = [":unit_test_sources_legacy"],
9799
data = [
98100
":schematics_assets",
101+
":unit_test_sources",
99102
],
100103
)

src/cdk/testing/tests/webdriver.e2e.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ setDefaultService(
2727
new ServiceBuilder(chromeDriver).enableVerboseLogging().loggingTo('/tmp/test.txt').build(),
2828
);
2929

30-
process.env['CHROMEDRIVER_EXE'] = chromeDriver;
31-
3230
// Kagekiri is available globally in the browser. We declare it here so we can use it in the
3331
// browser-side script passed to `By.js`.
3432
declare const kagekiri: {

src/components-examples/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ load("//tools/package-docs-content:index.bzl", "package_docs_content")
44
load(":config.bzl", "ALL_EXAMPLES")
55
load("//tools:defaults2.bzl", "ng_project")
66
load("//tools/bazel:legacy_target.bzl", "get_legacy_label")
7+
load("@npm2//:defs.bzl", "npm_link_all_packages")
78

89
package(default_visibility = ["//visibility:public"])
910

11+
npm_link_all_packages()
12+
1013
ng_project(
1114
name = "components-examples",
1215
srcs = glob(
@@ -59,11 +62,13 @@ package_docs_content(
5962

6063
ng_package(
6164
name = "npm_package",
65+
package_name = "@angular/components-examples",
6266
srcs = ["package.json"],
6367
# this is a workaround to store a tree artifact in the ng_package.
6468
# ng_package does not properly handle tree artifacts currently so we escalate to nested_packages
6569
nested_packages = [":docs-content"],
6670
tags = ["docs-package"],
71+
visibility = ["//visibility:private"],
6772
deps = [":components-examples_legacy"] + [get_legacy_label(t) for t in ALL_EXAMPLES],
6873
)
6974

src/dev-app/BUILD.bazel

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
2-
load("//tools:defaults.bzl", "devmode_esbuild", "esbuild_config", "http_server", "sass_binary")
3-
load("//src/components-examples:config.bzl", "ALL_EXAMPLES")
4-
load("//tools/angular:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")
2+
load("//tools:defaults.bzl", "http_server", "sass_binary")
53
load("//tools:defaults2.bzl", "ng_project")
4+
load("@npm2//:defs.bzl", "npm_link_all_packages")
5+
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
6+
load("//src/components-examples:config.bzl", "ALL_EXAMPLES")
67

78
package(default_visibility = ["//visibility:public"])
89

10+
npm_link_all_packages()
11+
912
ng_project(
1013
name = "dev-app",
1114
srcs = [
1215
"dev-app.ts",
1316
"main.ts",
17+
"polyfills.ts",
1418
"routes.ts",
1519
],
1620
deps = [
@@ -91,24 +95,25 @@ ng_project(
9195
],
9296
)
9397

94-
esbuild_config(
95-
name = "esbuild_config",
96-
config_file = "esbuild.config.mjs",
97-
)
98-
99-
devmode_esbuild(
98+
esbuild(
10099
name = "bundles",
101-
config = ":esbuild_config",
102-
entry_points = [":main.ts"] + ["%s:index.ts" % e for e in ALL_EXAMPLES],
100+
srcs = [
101+
"//src:build-tsconfig",
102+
],
103+
bundle = True,
104+
config = "//src:esbuild-linked-config",
105+
entry_points = [
106+
":main.js",
107+
":polyfills.js",
108+
] + ["%s:index.js" % e for e in ALL_EXAMPLES],
109+
minify = True,
103110
platform = "browser",
104111
splitting = True,
105112
# We cannot use `ES2017` or higher as that would result in `async/await` not being downleveled.
106113
# ZoneJS needs to be able to intercept these as otherwise change detection would not work properly.
107114
target = "es2016",
108-
# Note: We add all linker-processed FW packages as dependencies here so that ESBuild will
109-
# map all framework packages to their linker-processed bundles from `tools/angular`.
110-
deps = LINKER_PROCESSED_FW_PACKAGES + [
111-
":dev-app_legacy",
115+
deps = ALL_EXAMPLES + [
116+
":dev-app",
112117
],
113118
)
114119

src/dev-app/esbuild.config.mjs renamed to src/dev-app/polyfills.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
export default {
10-
resolveExtensions: ['.js'],
11-
format: 'esm',
12-
};
9+
// Load `$localize` for examples using it.
10+
import '@angular/localize/init';

0 commit comments

Comments
 (0)