Skip to content

Commit c4337d6

Browse files
build: update angular shared dev-infra code to b3b3466 (#30776)
* build: update angular shared dev-infra code to b3b3466 Closes #30478 as a pr takeover * build: update to new infrastructure for depending on dev-infra browsers --------- Co-authored-by: Angular Robot <[email protected]>
1 parent d9970db commit c4337d6

File tree

3 files changed

+68
-62
lines changed

3 files changed

+68
-62
lines changed

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
226226

227227
git_repository(
228228
name = "devinfra",
229-
commit = "cc73dde52b557f831cc3b6e48daf8c3b542a33df",
229+
commit = "b3b3466509babc50fd7f00b90e8bc607e7fe41aa",
230230
remote = "https://github.com/angular/dev-infra.git",
231231
)
232232

material.angular.io/WORKSPACE.bazel

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
23

34
http_archive(
45
name = "aspect_bazel_lib",
@@ -45,17 +46,6 @@ http_archive(
4546
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
4647
)
4748

48-
http_archive(
49-
name = "dev-infra",
50-
sha256 = "2e75c26ba9f678de8496f05a10470d62a398bad05f6b64864bbed5dc304a6f4e",
51-
strip_prefix = "dev-infra-8a438a3bdc519880d78b5ac92b62bfe688deb058",
52-
url = "https://github.com/angular/dev-infra/archive/8a438a3bdc519880d78b5ac92b62bfe688deb058/8a438a3bdc519880d78b5ac92b62bfe688deb058.tar.gz",
53-
)
54-
55-
load("@dev-infra//bazel/browsers:browser_repositories.bzl", "browser_repositories")
56-
57-
browser_repositories()
58-
5949
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
6050

6151
web_test_repositories()
@@ -78,3 +68,21 @@ npm_translate_lock(
7868
load("@npm//:repositories.bzl", "npm_repositories")
7969

8070
npm_repositories()
71+
72+
git_repository(
73+
name = "devinfra",
74+
commit = "b3b3466509babc50fd7f00b90e8bc607e7fe41aa",
75+
remote = "https://github.com/angular/dev-infra.git",
76+
)
77+
78+
load("@devinfra//bazel:setup_dependencies_1.bzl", "setup_dependencies_1")
79+
80+
setup_dependencies_1()
81+
82+
load("@devinfra//bazel:setup_dependencies_2.bzl", "setup_dependencies_2")
83+
84+
setup_dependencies_2()
85+
86+
load("@devinfra//bazel/browsers:browser_repositories.bzl", "browser_repositories")
87+
88+
browser_repositories()

material.angular.io/defs.bzl

+48-50
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ APPLICATION_CONFIG = COMMON_CONFIG + [
5353

5454
# Common dependencies of Angular CLI test suites
5555
TEST_CONFIG = COMMON_CONFIG + [
56-
"@dev-infra//bazel/browsers/chromium",
57-
"@dev-infra//bazel/browsers/firefox",
58-
56+
"@devinfra//bazel/browsers/chromium",
57+
"@devinfra//bazel/browsers/firefox",
5958
"//:ng-base-test-config",
6059
":ng-test-config",
6160
"//:node_modules/karma",
@@ -74,9 +73,8 @@ TEST_DEPS = [
7473

7574
# Common dependencies of Angular CLI e2e tests
7675
E2E_CONFIG = COMMON_CONFIG + [
77-
"@dev-infra//bazel/browsers/chromium",
78-
"@dev-infra//bazel/browsers/firefox",
79-
76+
"@devinfra//bazel/browsers/chromium",
77+
"@devinfra//bazel/browsers/firefox",
8078
"//:ng-base-test-config",
8179
":ng-e2e-config",
8280
"//:node_modules/jasmine-spec-reporter",
@@ -89,28 +87,28 @@ E2E_DEPS = [
8987
]
9088

9189
LINT_CONFIG = COMMON_CONFIG + [
92-
# Lint uses the e2e config
93-
"//:ng-base-test-config",
94-
":ng-e2e-config",
95-
"//:ng-base-lint-config",
96-
"//:node_modules/@angular-eslint/builder",
97-
"//:node_modules/@angular-eslint/eslint-plugin",
98-
"//:node_modules/@angular-eslint/eslint-plugin-template",
99-
"//:node_modules/@angular-eslint/template-parser",
100-
"//:node_modules/eslint-plugin-ban",
101-
"//:node_modules/eslint-plugin-import",
102-
"//:node_modules/eslint-plugin-jsdoc",
103-
"//:node_modules/eslint-plugin-prefer-arrow",
104-
"//:node_modules/@typescript-eslint/eslint-plugin",
105-
"//:node_modules/@typescript-eslint/parser",
106-
"//:node_modules/@stylistic/eslint-plugin",
90+
# Lint uses the e2e config
91+
"//:ng-base-test-config",
92+
":ng-e2e-config",
93+
"//:ng-base-lint-config",
94+
"//:node_modules/@angular-eslint/builder",
95+
"//:node_modules/@angular-eslint/eslint-plugin",
96+
"//:node_modules/@angular-eslint/eslint-plugin-template",
97+
"//:node_modules/@angular-eslint/template-parser",
98+
"//:node_modules/eslint-plugin-ban",
99+
"//:node_modules/eslint-plugin-import",
100+
"//:node_modules/eslint-plugin-jsdoc",
101+
"//:node_modules/eslint-plugin-prefer-arrow",
102+
"//:node_modules/@typescript-eslint/eslint-plugin",
103+
"//:node_modules/@typescript-eslint/parser",
104+
"//:node_modules/@stylistic/eslint-plugin",
107105
]
108106
LINT_DEPS = [
109-
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
110-
"//:node_modules/@angular-devkit/architect",
107+
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
108+
"//:node_modules/@angular-devkit/architect",
111109
]
112110

113-
111+
# buildifier: disable=unused-variable
114112
def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs):
115113
"""
116114
Macro for Angular applications, creating various targets aligning with the Angular CLI.
@@ -137,44 +135,44 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
137135

138136
test_srcs = native.glob(["src/test.ts", "src/**/*.spec.ts"])
139137

140-
e2e_srcs = native.glob(["e2e/src/**/*.ts"])
138+
e2e_srcs = native.glob(["e2e/src/**/*.ts"])
141139

142140
tags = kwargs.pop("tags", [])
143141

144142
# config files
145143
copy_to_bin(
146144
name = "ng-app-config",
147145
srcs = [
148-
"tsconfig.app.json",
146+
"tsconfig.app.json",
149147
],
150148
visibility = ["//visibility:private"],
151149
)
152150
copy_to_bin(
153151
name = "ng-test-config",
154152
srcs = [
155-
"karma.conf.js",
156-
"tsconfig.spec.json",
153+
"karma.conf.js",
154+
"tsconfig.spec.json",
157155
],
158156
visibility = ["//visibility:private"],
159157
)
160158
copy_to_bin(
161159
name = "ng-e2e-config",
162160
srcs = [
163-
"e2e/tsconfig.json",
164-
"e2e/protractor.conf.js",
161+
"e2e/tsconfig.json",
162+
"e2e/protractor.conf.js",
165163
],
166164
visibility = ["//visibility:private"],
167165
)
168166

169167
# Lint config files in addition to the root
170-
if native.package_name() != '':
171-
copy_to_bin(
172-
name = "lint-config",
173-
srcs = [
174-
".eslintrc.json",
175-
],
176-
visibility = ["//visibility:private"],
177-
)
168+
if native.package_name() != "":
169+
copy_to_bin(
170+
name = "lint-config",
171+
srcs = [
172+
".eslintrc.json",
173+
],
174+
visibility = ["//visibility:private"],
175+
)
178176

179177
project_name = project_name if project_name else name
180178

@@ -239,7 +237,7 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
239237
_architect_test(
240238
project_name,
241239
"lint",
242-
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != '' else []),
240+
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != "" else []),
243241
tags = tags + ["lint"],
244242
**kwargs
245243
)
@@ -248,8 +246,9 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
248246
output_dir = "%s%s" % (project_name, ".%s" % configuration if configuration else "")
249247

250248
args = [
251-
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
252-
"--output-path", output_dir
249+
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
250+
"--output-path",
251+
output_dir,
253252
] + args
254253

255254
architect_cli.architect(
@@ -258,13 +257,13 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
258257
args = args,
259258
out_dirs = [output_dir],
260259
srcs = srcs,
261-
**kwargs,
260+
**kwargs
262261
)
263262

264263
def _architect_test(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
265264
to_root = ""
266265
if native.package_name() != "":
267-
to_root = "".join(["../" for _ in native.package_name().split("/")])
266+
to_root = "".join(["../" for _ in native.package_name().split("/")])
268267

269268
env = {
270269
"CHROME_BIN": to_root + "$(CHROMIUM)",
@@ -275,25 +274,24 @@ def _architect_test(project_name, command, configuration = None, args = [], srcs
275274
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
276275
chdir = native.package_name(),
277276
args = [
278-
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
277+
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
279278
] + args,
280279
data = srcs,
281280
env = env,
282281
toolchains = [
283-
"@dev-infra//bazel/browsers/chromium:toolchain_alias",
284-
"@dev-infra//bazel/browsers/firefox:toolchain_alias",
282+
"@devinfra//bazel/browsers/chromium:toolchain_alias",
283+
"@devinfra//bazel/browsers/firefox:toolchain_alias",
285284
],
286-
**kwargs,
285+
**kwargs
287286
)
288287

289288
def _architect_binary(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
290289
architect_cli.architect_binary(
291290
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
292291
chdir = native.package_name(),
293292
args = [
294-
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
293+
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
295294
] + args,
296295
data = srcs,
297-
**kwargs,
296+
**kwargs
298297
)
299-

0 commit comments

Comments
 (0)