-
-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathpkg.bzl
41 lines (35 loc) · 919 Bytes
/
pkg.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
"""
Test rule to create a pkg with DefaultInfo using copy_directory_bin_action
"""
load("@aspect_bazel_lib//lib/private:copy_directory.bzl", "copy_directory_bin_action")
_attrs = {
"src": attr.label(
mandatory = True,
allow_single_file = True,
),
"out": attr.string(mandatory = True),
"_tool": attr.label(
executable = True,
cfg = "exec",
default = "//tools/copy_directory",
),
}
def _pkg_impl(ctx):
dst = ctx.actions.declare_directory(ctx.attr.out)
copy_directory_bin_action(
ctx,
src = ctx.file.src,
dst = dst,
copy_directory_bin = ctx.executable._tool,
copy_directory_toolchain = None,
hardlink = "auto",
verbose = True,
)
return [
DefaultInfo(files = depset([dst])),
]
pkg = rule(
implementation = _pkg_impl,
attrs = _attrs,
provides = [DefaultInfo],
)