Skip to content

Commit 22381bf

Browse files
josephperrottthePunderWoman
authored andcommitted
build: update tools directory to use rules_js for building (angular#61656)
Use ts_project for building the tools directory targets PR Close angular#61656
1 parent 9832e72 commit 22381bf

14 files changed

+58
-50
lines changed

tools/defaults2.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def _determine_tsconfig(testonly):
3434
if native.package_name().startswith("packages"):
3535
return "//packages:tsconfig_test" if testonly else "//packages:tsconfig_build"
3636

37+
if native.package_name().startswith("tools"):
38+
return "//tools:tsconfig_test" if testonly else "//tools:tsconfig_build"
39+
3740
fail("Failing... a tsconfig value must be provided.")
3841

3942
def ts_project(

tools/saucelabs-daemon/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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 = "saucelabs-daemon",
77
srcs = [
88
"browser.ts",

tools/saucelabs-daemon/background-service/BUILD.bazel

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
load("//tools:defaults.bzl", "nodejs_binary", "ts_library")
1+
load("//tools:defaults.bzl", "nodejs_binary")
2+
load("//tools:defaults2.bzl", "ts_project")
23

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

5-
ts_library(
6+
ts_project(
67
name = "background-service_lib",
78
srcs = glob(["*.ts"]),
8-
deps = [
9+
interop_deps = [
910
"//:browser-providers",
1011
"//tools/saucelabs-daemon",
11-
"@npm//@types/node",
12-
"@npm//@types/selenium-webdriver4",
13-
"@npm//chalk",
14-
"@npm//selenium-webdriver4",
12+
],
13+
deps = [
14+
"//:node_modules/@types/node",
15+
"//:node_modules/@types/selenium-webdriver4",
16+
"//:node_modules/chalk",
17+
"//:node_modules/selenium-webdriver4",
1518
],
1619
)
1720

@@ -21,7 +24,7 @@ nodejs_binary(
2124
":background-service_lib",
2225
"//:sauce_connect",
2326
],
24-
entry_point = ":cli.ts",
27+
entry_point = ":cli.js",
2528
templated_args = [
2629
"$(rootpath //:sauce_connect)",
2730
],

tools/saucelabs-daemon/background-service/saucelabs-daemon.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {Builder, WebDriver} from 'selenium-webdriver4';
1111

1212
import {Browser, getUniqueId} from '../browser';
1313

14-
import {IpcServer} from './ipc';
1514
import {openSauceConnectTunnel} from './sauce-connect-tunnel';
1615

1716
const defaultCapabilities = {

tools/saucelabs-daemon/launcher/BUILD.bazel

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

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

5-
ts_library(
6+
ts_project(
67
name = "launcher",
78
srcs = [
89
"index.ts",
910
"launcher.ts",
1011
],
11-
deps = [
12+
interop_deps = [
1213
"//tools/saucelabs-daemon",
1314
"@npm//@types/node",
1415
],

tools/testing/BUILD.bazel

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

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

5-
ts_library(
6+
ts_project(
67
name = "zone_base_setup_lib",
78
testonly = 1,
8-
srcs = ["zone_base_setup.ts"],
9-
deps = [
9+
srcs = ["zone_base_setup.mts"],
10+
interop_deps = [
1011
"//packages/zone.js/lib",
1112
"@npm//reflect-metadata",
1213
],
1314
)
1415

15-
ts_library(
16+
ts_project(
1617
name = "browser",
1718
testonly = 1,
18-
srcs = ["browser_tests.init.ts"],
19-
deps = [
19+
srcs = ["browser_tests.init.mts"],
20+
interop_deps = [
2021
":zone_base_setup_lib",
2122
"//packages/compiler",
2223
"//packages/core/testing",
@@ -26,11 +27,11 @@ ts_library(
2627
],
2728
)
2829

29-
ts_library(
30+
ts_project(
3031
name = "browser_zoneless",
3132
testonly = 1,
32-
srcs = ["browser_zoneless_tests.init.ts"],
33-
deps = [
33+
srcs = ["browser_zoneless_tests.init.mts"],
34+
interop_deps = [
3435
"//packages/compiler",
3536
"//packages/core",
3637
"//packages/core/testing",
@@ -40,11 +41,11 @@ ts_library(
4041
],
4142
)
4243

43-
ts_library(
44+
ts_project(
4445
name = "node_zoneless",
4546
testonly = 1,
46-
srcs = ["node_zoneless_tests.init.ts"],
47-
deps = [
47+
srcs = ["node_zoneless_tests.init.mts"],
48+
interop_deps = [
4849
"//packages/compiler",
4950
"//packages/core",
5051
"//packages/core/testing",
@@ -55,11 +56,11 @@ ts_library(
5556
],
5657
)
5758

58-
ts_library(
59+
ts_project(
5960
name = "node",
6061
testonly = 1,
61-
srcs = ["node_tests.init.ts"],
62-
deps = [
62+
srcs = ["node_tests.init.mts"],
63+
interop_deps = [
6364
":zone_base_setup_lib",
6465
"//packages/compiler",
6566
"//packages/core/testing",
@@ -71,11 +72,11 @@ ts_library(
7172
],
7273
)
7374

74-
ts_library(
75+
ts_project(
7576
name = "node_no_angular",
7677
testonly = 1,
77-
srcs = ["node_no_angular_tests.init.ts"],
78-
deps = [
78+
srcs = ["node_no_angular_tests.init.mts"],
79+
interop_deps = [
7980
"//packages:types",
8081
],
8182
)
@@ -87,7 +88,7 @@ ts_library(
8788
# of a potential regression.
8889
jasmine_node_test(
8990
name = "fail_test",
90-
srcs = ["fail.spec.js"],
91+
srcs = ["fail.spec.mjs"],
9192
# While we force the termination of the process with an exitCode of 55 in fail.spec.js. Jasmine force it to 4.
9293
# see: https://github.com/jasmine/jasmine-npm/blob/eea8b26efe29176ecbb26ce3f1c4990f8bede685/lib/jasmine.js#L213
9394
expected_exit_code = 4,
@@ -101,7 +102,7 @@ jasmine_node_test(
101102
# of a potential regression.
102103
jasmine_node_test(
103104
name = "fail_bootstrap_test",
104-
srcs = ["fail.spec.js"],
105+
srcs = ["fail.spec.mjs"],
105106
bootstrap = ["//tools/testing:node"],
106107
data = ["//packages:package_json"],
107108
# While we force the termination of the process with an exitCode of 55 in fail.spec.js. Jasmine force it to 4.

tools/testing/browser_tests.init.ts renamed to tools/testing/browser_tests.init.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import 'zone.js/lib/browser/rollup-main';
10-
import './zone_base_setup';
10+
import './zone_base_setup.mjs';
1111
import '@angular/compiler'; // For JIT mode. Must be in front of any other @angular/* imports.
1212

1313
import {TestBed} from '@angular/core/testing';
File renamed without changes.

0 commit comments

Comments
 (0)