-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparcelgen.bzl
More file actions
29 lines (27 loc) · 848 Bytes
/
Copy pathparcelgen.bzl
File metadata and controls
29 lines (27 loc) · 848 Bytes
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
def _impl(ctx):
args = ctx.actions.args()
args.add(["build", ctx.attr.entry_point])
args.add(["--out-dir", ctx.outputs.bundle.path])
ctx.actions.run(
inputs = ctx.files.srcs + ctx.files.node_modules,
executable = ctx.executable.parcel,
outputs = [ctx.outputs.bundle],
arguments = [args],
)
parcel = rule(
implementation = _impl,
attrs = {
# "config": attr.label(allow_files = True, single_file = True),
"node_modules": attr.label(default = Label("//:node_modules")),
"entry_point": attr.string(mandatory = True),
"srcs": attr.label_list(allow_files = True),
"parcel": attr.label(
default = Label("//:parcel"),
executable = True,
cfg = "host"
)
},
outputs = {
"bundle": "bundle"
},
)