Skip to content

Commit 0bcd8a4

Browse files
committed
build: update to new infrastructure for depending on dev-infra browsers
1 parent 9d07625 commit 0bcd8a4

File tree

2 files changed

+66
-61
lines changed

2 files changed

+66
-61
lines changed

material.angular.io/WORKSPACE.bazel

Lines changed: 19 additions & 11 deletions
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",
@@ -44,17 +45,6 @@ http_archive(
4445
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
4546
)
4647

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

6050
web_test_repositories()
@@ -76,3 +66,21 @@ npm_translate_lock(
7666
load("@npm//:repositories.bzl", "npm_repositories")
7767

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

material.angular.io/defs.bzl

Lines changed: 47 additions & 50 deletions
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,27 @@ 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-
114111
def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs):
115112
"""
116113
Macro for Angular applications, creating various targets aligning with the Angular CLI.
@@ -137,44 +134,44 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
137134

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

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

142139
tags = kwargs.pop("tags", [])
143140

144141
# config files
145142
copy_to_bin(
146143
name = "ng-app-config",
147144
srcs = [
148-
"tsconfig.app.json",
145+
"tsconfig.app.json",
149146
],
150147
visibility = ["//visibility:private"],
151148
)
152149
copy_to_bin(
153150
name = "ng-test-config",
154151
srcs = [
155-
"karma.conf.js",
156-
"tsconfig.spec.json",
152+
"karma.conf.js",
153+
"tsconfig.spec.json",
157154
],
158155
visibility = ["//visibility:private"],
159156
)
160157
copy_to_bin(
161158
name = "ng-e2e-config",
162159
srcs = [
163-
"e2e/tsconfig.json",
164-
"e2e/protractor.conf.js",
160+
"e2e/tsconfig.json",
161+
"e2e/protractor.conf.js",
165162
],
166163
visibility = ["//visibility:private"],
167164
)
168165

169166
# 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-
)
167+
if native.package_name() != "":
168+
copy_to_bin(
169+
name = "lint-config",
170+
srcs = [
171+
".eslintrc.json",
172+
],
173+
visibility = ["//visibility:private"],
174+
)
178175

179176
project_name = project_name if project_name else name
180177

@@ -239,7 +236,7 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
239236
_architect_test(
240237
project_name,
241238
"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 []),
239+
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != "" else []),
243240
tags = tags + ["lint"],
244241
**kwargs
245242
)
@@ -248,8 +245,9 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
248245
output_dir = "%s%s" % (project_name, ".%s" % configuration if configuration else "")
249246

250247
args = [
251-
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
252-
"--output-path", output_dir
248+
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
249+
"--output-path",
250+
output_dir,
253251
] + args
254252

255253
architect_cli.architect(
@@ -258,13 +256,13 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
258256
args = args,
259257
out_dirs = [output_dir],
260258
srcs = srcs,
261-
**kwargs,
259+
**kwargs
262260
)
263261

264262
def _architect_test(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
265263
to_root = ""
266264
if native.package_name() != "":
267-
to_root = "".join(["../" for _ in native.package_name().split("/")])
265+
to_root = "".join(["../" for _ in native.package_name().split("/")])
268266

269267
env = {
270268
"CHROME_BIN": to_root + "$(CHROMIUM)",
@@ -275,25 +273,24 @@ def _architect_test(project_name, command, configuration = None, args = [], srcs
275273
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
276274
chdir = native.package_name(),
277275
args = [
278-
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
276+
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
279277
] + args,
280278
data = srcs,
281279
env = env,
282280
toolchains = [
283-
"@dev-infra//bazel/browsers/chromium:toolchain_alias",
284-
"@dev-infra//bazel/browsers/firefox:toolchain_alias",
281+
"@devinfra//bazel/browsers/chromium:toolchain_alias",
282+
"@devinfra//bazel/browsers/firefox:toolchain_alias",
285283
],
286-
**kwargs,
284+
**kwargs
287285
)
288286

289287
def _architect_binary(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
290288
architect_cli.architect_binary(
291289
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
292290
chdir = native.package_name(),
293291
args = [
294-
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
292+
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
295293
] + args,
296294
data = srcs,
297-
**kwargs,
295+
**kwargs
298296
)
299-

0 commit comments

Comments
 (0)