-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
BUILD.bazel
91 lines (81 loc) · 2.13 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("//tools:defaults.bzl", "esbuild", "jasmine_node_test", "pkg_npm", "spec_bundle", "ts_library")
package(default_visibility = ["//visibility:public"])
STATIC_ASSETS = [
"schema.json",
]
ts_library(
name = "mdc_migration_lib",
srcs = glob(
["**/*.ts"],
exclude = ["**/*.spec.ts"],
),
deps = [
"//src/cdk/schematics",
"@npm//@angular-devkit/schematics",
"@npm//@types/node",
"@npm//postcss",
"@npm//postcss-scss",
],
)
esbuild(
name = "mdc_migration_bundle",
entry_point = ":index.ts",
external = [
"@angular/cdk/schematics",
"@angular-devkit/schematics",
"@angular-devkit/core",
],
format = "cjs",
output = "index_bundled.js",
platform = "node",
target = "es2015",
deps = [":mdc_migration_lib"],
)
pkg_npm(
name = "npm_package",
srcs = STATIC_ASSETS,
deps = [":mdc_migration_bundle"],
)
########################################
# Testing configuration #
########################################
ts_library(
name = "unit_tests_lib",
testonly = True,
srcs = glob(["**/*.spec.ts"]),
deps = [
":mdc_migration_lib",
"//src/cdk/schematics/testing",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@bazel/runfiles",
"@npm//@types/jasmine",
"@npm//@types/node",
],
)
spec_bundle(
name = "unit_tests_bundle",
platform = "node",
deps = [":unit_tests_lib"],
)
copy_to_bin(
name = "unit_tests_assets",
testonly = True,
srcs = STATIC_ASSETS,
)
jasmine_node_test(
name = "unit_tests",
data = [
":mdc_migration_bundle",
":unit_tests_assets",
"//src/material/schematics:schematics_assets",
],
deps = [
":unit_tests_bundle",
# Runtime dependencies needed by the test and actual migration sources. These need
# to be specified explicitly here because they are not captured by the bundling.
"//src/cdk/schematics",
"@npm//@schematics/angular",
],
)