forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathng_cli_schema_generator.bzl
46 lines (42 loc) · 1.1 KB
/
ng_cli_schema_generator.bzl
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
# 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.io/license
# @external_begin
def _cli_json_schema_interface_impl(ctx):
args = [
ctx.files.src[0].path,
ctx.outputs.json.path,
]
ctx.actions.run(
inputs = ctx.files.src + ctx.files.data,
executable = ctx.executable._binary,
outputs = [ctx.outputs.json],
arguments = args,
)
return [DefaultInfo()]
cli_json_schema = rule(
_cli_json_schema_interface_impl,
attrs = {
"src": attr.label(
allow_files = [".json"],
mandatory = True,
),
"out": attr.string(
mandatory = True,
),
"data": attr.label_list(
allow_files = [".json"],
mandatory = True,
),
"_binary": attr.label(
default = Label("//tools:ng_cli_schema"),
executable = True,
cfg = "host",
),
},
outputs = {
"json": "%{out}",
},
)
# @external_end