Skip to content

Commit 9b883fe

Browse files
devversionjosephperrott
authored andcommitted
build: migrate @angular/build to ts_project
This commit migrates `@angular/build` to `ts_project`.
1 parent 7348e8c commit 9b883fe

File tree

6 files changed

+119
-95
lines changed

6 files changed

+119
-95
lines changed

packages/angular/build/BUILD.bazel

+82-89
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
22
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
3-
load("//tools:defaults.bzl", "pkg_npm", "ts_library")
3+
load("//tools:defaults.bzl", "pkg_npm")
4+
load("//tools:interop.bzl", "ts_project")
45
load("//tools:ts_json_schema.bzl", "ts_json_schema")
56

67
licenses(["notice"])
@@ -22,9 +23,8 @@ ts_json_schema(
2223
src = "src/builders/extract-i18n/schema.json",
2324
)
2425

25-
ts_library(
26+
ts_project(
2627
name = "build",
27-
package_name = "@angular/build",
2828
srcs = glob(
2929
include = [
3030
"src/**/*.ts",
@@ -34,9 +34,9 @@ ts_library(
3434
"src/**/*_spec.ts",
3535
"src/**/tests/**/*.ts",
3636
"src/testing/**/*.ts",
37-
"src/private.ts",
3837
],
3938
) + [
39+
"index.ts",
4040
"//packages/angular/build:src/builders/application/schema.ts",
4141
"//packages/angular/build:src/builders/dev-server/schema.ts",
4242
"//packages/angular/build:src/builders/extract-i18n/schema.ts",
@@ -52,82 +52,75 @@ ts_library(
5252
"builders.json",
5353
"package.json",
5454
],
55-
module_name = "@angular/build",
56-
module_root = "src/index.d.ts",
57-
deps = [
55+
interop_deps = [
5856
"//packages/angular/ssr",
5957
"//packages/angular/ssr/node",
6058
"//packages/angular_devkit/architect",
61-
"@npm//@ampproject/remapping",
62-
"@npm//@angular/common",
63-
"@npm//@angular/compiler",
64-
"@npm//@angular/compiler-cli",
65-
"@npm//@angular/core",
66-
"@npm//@angular/localize",
67-
"@npm//@angular/platform-server",
68-
"@npm//@angular/service-worker",
69-
"@npm//@babel/core",
70-
"@npm//@babel/helper-annotate-as-pure",
71-
"@npm//@babel/helper-split-export-declaration",
72-
"@npm//@babel/plugin-syntax-import-attributes",
73-
"@npm//@inquirer/confirm",
74-
"@npm//@types/babel__core",
75-
"@npm//@types/less",
76-
"@npm//@types/node",
77-
"@npm//@types/picomatch",
78-
"@npm//@types/semver",
79-
"@npm//@types/watchpack",
80-
"@npm//@vitejs/plugin-basic-ssl",
81-
"@npm//beasties",
82-
"@npm//browserslist",
83-
"@npm//esbuild",
84-
"@npm//esbuild-wasm",
85-
"@npm//fast-glob",
86-
"@npm//https-proxy-agent",
87-
"@npm//listr2",
88-
"@npm//lmdb",
89-
"@npm//magic-string",
90-
"@npm//mrmime",
91-
"@npm//parse5-html-rewriting-stream",
92-
"@npm//picomatch",
93-
"@npm//piscina",
94-
"@npm//postcss",
95-
"@npm//rollup",
96-
"@npm//sass",
97-
"@npm//semver",
98-
"@npm//tslib",
99-
"@npm//typescript",
100-
"@npm//vite",
101-
"@npm//watchpack",
10259
],
103-
)
104-
105-
ts_library(
106-
name = "private",
107-
srcs = ["src/private.ts"],
108-
module_name = "@angular/build/private",
109-
module_root = "src/private.d.ts",
60+
module_name = "@angular/build",
11061
deps = [
111-
"//packages/angular/build",
62+
"//:root_modules/@ampproject/remapping",
63+
"//:root_modules/@angular/common",
64+
"//:root_modules/@angular/compiler",
65+
"//:root_modules/@angular/compiler-cli",
66+
"//:root_modules/@angular/core",
67+
"//:root_modules/@angular/localize",
68+
"//:root_modules/@angular/platform-server",
69+
"//:root_modules/@angular/service-worker",
70+
"//:root_modules/@babel/core",
71+
"//:root_modules/@babel/helper-annotate-as-pure",
72+
"//:root_modules/@babel/helper-split-export-declaration",
73+
"//:root_modules/@babel/plugin-syntax-import-attributes",
74+
"//:root_modules/@inquirer/confirm",
75+
"//:root_modules/@types/babel__core",
76+
"//:root_modules/@types/less",
77+
"//:root_modules/@types/node",
78+
"//:root_modules/@types/picomatch",
79+
"//:root_modules/@types/semver",
80+
"//:root_modules/@types/watchpack",
81+
"//:root_modules/@vitejs/plugin-basic-ssl",
82+
"//:root_modules/beasties",
83+
"//:root_modules/browserslist",
84+
"//:root_modules/esbuild",
85+
"//:root_modules/esbuild-wasm",
86+
"//:root_modules/fast-glob",
87+
"//:root_modules/https-proxy-agent",
88+
"//:root_modules/jsonc-parser",
89+
"//:root_modules/listr2",
90+
"//:root_modules/lmdb",
91+
"//:root_modules/magic-string",
92+
"//:root_modules/mrmime",
93+
"//:root_modules/parse5-html-rewriting-stream",
94+
"//:root_modules/picomatch",
95+
"//:root_modules/piscina",
96+
"//:root_modules/postcss",
97+
"//:root_modules/rollup",
98+
"//:root_modules/sass",
99+
"//:root_modules/semver",
100+
"//:root_modules/tslib",
101+
"//:root_modules/typescript",
102+
"//:root_modules/vite",
103+
"//:root_modules/watchpack",
112104
],
113105
)
114106

115-
ts_library(
107+
ts_project(
116108
name = "unit_test_lib",
117109
testonly = True,
118110
srcs = glob(
119111
include = ["src/**/*_spec.ts"],
120112
exclude = ["src/builders/**/tests/**"],
121113
),
122114
deps = [
123-
":build",
124-
":private",
125-
"//packages/angular_devkit/core",
126-
"//packages/angular_devkit/core/node",
127-
"@npm//@angular/compiler-cli",
128-
"@npm//@babel/core",
129-
"@npm//prettier",
130-
"@npm//typescript",
115+
":build_rjs",
116+
"//:root_modules/@angular/compiler-cli",
117+
"//:root_modules/@babel/core",
118+
"//:root_modules/@types/jasmine",
119+
"//:root_modules/prettier",
120+
"//:root_modules/typescript",
121+
"//packages/angular/build/private:private_rjs",
122+
"//packages/angular_devkit/core:core_rjs",
123+
"//packages/angular_devkit/core/node:node_rjs",
131124
],
132125
)
133126

@@ -136,38 +129,38 @@ jasmine_node_test(
136129
deps = [":unit_test_lib"],
137130
)
138131

139-
ts_library(
132+
ts_project(
140133
name = "integration_test_lib",
141134
testonly = True,
142135
srcs = glob(include = ["src/builders/**/tests/**/*.ts"]),
143136
deps = [
144-
":build",
145-
":private",
146-
"//modules/testing/builder",
147-
"//packages/angular_devkit/architect",
148-
"//packages/angular_devkit/architect/node",
149-
"//packages/angular_devkit/architect/testing",
150-
"//packages/angular_devkit/core",
151-
"//packages/angular_devkit/core/node",
137+
":build_rjs",
138+
"//packages/angular/build/private:private_rjs",
139+
"//modules/testing/builder:builder_rjs",
140+
"//packages/angular_devkit/architect:architect_rjs",
141+
"//packages/angular_devkit/architect/node:node_rjs",
142+
"//packages/angular_devkit/architect/testing:testing_rjs",
143+
"//packages/angular_devkit/core:core_rjs",
144+
"//packages/angular_devkit/core/node:node_rjs",
152145

153146
# dev server only test deps
154-
"@npm//@types/http-proxy",
155-
"@npm//http-proxy",
156-
"@npm//puppeteer",
147+
"//:root_modules/@types/http-proxy",
148+
"//:root_modules/http-proxy",
149+
"//:root_modules/puppeteer",
157150

158151
# Base dependencies for the application in hello-world-app.
159-
"@npm//@angular/common",
160-
"@npm//@angular/compiler",
161-
"@npm//@angular/compiler-cli",
162-
"@npm//@angular/core",
163-
"@npm//@angular/platform-browser",
164-
"@npm//@angular/platform-browser-dynamic",
165-
"@npm//@angular/router",
166-
"@npm//rxjs",
167-
"@npm//tslib",
168-
"@npm//typescript",
169-
"@npm//zone.js",
170-
"@npm//buffer",
152+
"//:root_modules/@angular/common",
153+
"//:root_modules/@angular/compiler",
154+
"//:root_modules/@angular/compiler-cli",
155+
"//:root_modules/@angular/core",
156+
"//:root_modules/@angular/platform-browser",
157+
"//:root_modules/@angular/platform-browser-dynamic",
158+
"//:root_modules/@angular/router",
159+
"//:root_modules/rxjs",
160+
"//:root_modules/tslib",
161+
"//:root_modules/typescript",
162+
"//:root_modules/zone.js",
163+
"//:root_modules/buffer",
171164
],
172165
)
173166

packages/angular/build/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
export * from './src/index';
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("//tools:interop.bzl", "ts_project")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ts_project(
6+
name = "private",
7+
srcs = ["index.ts"],
8+
module_name = "@angular/build/private",
9+
deps = [
10+
"//packages/angular/build:build_rjs",
11+
],
12+
)
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
export * from '../src/private';

packages/angular_devkit/build_angular/BUILD.bazel

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ ts_project(
120120
"package.json",
121121
],
122122
interop_deps = [
123-
"//packages/angular/build",
124-
"//packages/angular/build:private",
125123
"//packages/angular/ssr",
126124
"//packages/angular_devkit/build_webpack",
127125
"//packages/angular_devkit/core",
@@ -201,6 +199,8 @@ ts_project(
201199
"//:root_modules/webpack-dev-server",
202200
"//:root_modules/webpack-merge",
203201
"//:root_modules/webpack-subresource-integrity",
202+
"//packages/angular/build:build_rjs",
203+
"//packages/angular/build/private:private_rjs",
204204
"//packages/angular_devkit/architect",
205205
],
206206
)
@@ -287,14 +287,14 @@ ts_project(
287287
data = glob(["test/**/*"]),
288288
interop_deps = [
289289
"//modules/testing/builder",
290-
"//packages/angular/build",
291-
"//packages/angular/build:private",
292290
"//packages/angular_devkit/core",
293291
"//packages/angular_devkit/core/node",
294292
],
295293
deps = [
296294
":build_angular_rjs",
297295
"//:root_modules/@types/jasmine",
296+
"//packages/angular/build:build_rjs",
297+
"//packages/angular/build/private:private_rjs",
298298
"//packages/angular_devkit/architect:architect_rjs",
299299
"//packages/angular_devkit/architect/node:node_rjs",
300300
"//packages/angular_devkit/architect/testing:testing_rjs",
@@ -386,13 +386,13 @@ LARGE_SPECS = {
386386
"//packages/angular_devkit/core",
387387
"//packages/angular_devkit/core/node",
388388
"//modules/testing/builder",
389-
"//packages/angular/build",
390-
"//packages/angular/build:private",
391389
] + LARGE_SPECS[spec].get("extra_interop_deps", []),
392390
deps = [
393391
# Dependencies needed to compile and run the specs themselves.
394392
":build_angular_rjs",
395393
":build_angular_test_utils_rjs",
394+
"//packages/angular/build:build_rjs",
395+
"//packages/angular/build/private:private_rjs",
396396
"//packages/angular_devkit/architect:architect_rjs",
397397
"//packages/angular_devkit/architect/node:node_rjs",
398398
"//packages/angular_devkit/architect/testing:testing_rjs",

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@angular-devkit/build-angular": ["./packages/angular_devkit/build_angular"],
3030
"@angular-devkit/*": ["./packages/angular_devkit/*/src"],
3131
"@angular/ssr": ["./packages/angular/ssr"],
32+
"@angular/ssr/node": ["./packages/angular/ssr/node"],
3233
"@angular/*": ["./packages/angular/*/src"],
3334
"@angular/build/private": ["./packages/angular/build/src/private"],
3435
"@ngtools/webpack": ["./packages/ngtools/webpack/index"],

0 commit comments

Comments
 (0)