forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
171 lines (156 loc) · 4.59 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//:constants.bzl", "BASELINE_DATE")
load("//tools:defaults.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
load("//tools/baseline_browserslist:baseline_browserslist.bzl", "baseline_browserslist")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
npm_link_all_packages()
# Create a list of Tuple("path/file.json", "path_file") to be used as rules
ALL_SCHEMA_TARGETS = [
(
x,
x.replace("/", "_").replace("-", "_").replace(".json", ""),
)
for x in glob(
include = ["*/schema.json"],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
)
]
# Create all the targets.
[
ts_json_schema(
name = name,
src = src,
)
for (src, name) in ALL_SCHEMA_TARGETS
]
copy_to_bin(
name = "schemas",
srcs = glob(["**/schema.json"]),
)
baseline_browserslist(
name = "angular_browserslist",
out = "config/.browserslistrc",
baseline = BASELINE_DATE,
)
RUNTIME_ASSETS = [
"collection.json",
"migrations/migration-collection.json",
"package.json",
"utility/latest-versions/package.json",
":angular_browserslist",
] + glob(
include = [
"*/schema.json",
"*/files/**/*",
"*/other-files/**/*",
"*/implements-files/**/*",
"*/type-files/**/*",
"*/functional-files/**/*",
"*/class-files/**/*",
],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
)
ts_project(
name = "angular",
srcs = glob(
include = ["**/*.ts"],
exclude = [
"**/*_spec.ts",
# Also exclude templated files.
"*/files/**/*.ts",
"*/other-files/**/*.ts",
"*/implements-files/**/*",
"*/type-files/**/*",
"*/functional-files/**/*",
"*/class-files/**/*",
# Exclude test helpers.
"utility/test/**/*.ts",
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
) + [
"//packages/schematics/angular:" + src.replace(".json", ".ts")
for (src, _) in ALL_SCHEMA_TARGETS
],
data = RUNTIME_ASSETS,
module_name = "@schematics/angular",
deps = [
":node_modules/@angular-devkit/core",
":node_modules/@angular-devkit/schematics",
":node_modules/jsonc-parser",
"//:node_modules/@types/node",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
],
)
jasmine_test(
name = "no_typescript_runtime_dep_test",
data = [
"no_typescript_runtime_dep_spec.js",
":angular",
"//:node_modules/@types/jasmine",
],
)
ts_project(
name = "angular_test_lib",
testonly = True,
srcs = glob(
include = [
"**/*_spec.ts",
"utility/test/**/*.ts",
],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
),
deps = [
":angular",
":node_modules/@angular-devkit/core",
":node_modules/@angular-devkit/schematics",
":node_modules/jsonc-parser",
"//:node_modules/@types/jasmine",
"//:node_modules/@types/node",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
],
)
jasmine_test(
name = "angular_test",
data = [":angular_test_lib"],
)
genrule(
name = "license",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $(execpath //:LICENSE) $@",
)
npm_package(
name = "pkg",
pkg_deps = [
"//packages/angular_devkit/schematics:package.json",
"//packages/angular_devkit/core:package.json",
],
stamp_files = [
"utility/latest-versions.js",
],
tags = ["release-package"],
deps = RUNTIME_ASSETS + [
":README.md",
":angular",
":license",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript:LICENSE",
# Force typescript library to be included.
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript:lib/typescript.js",
],
)