-
Notifications
You must be signed in to change notification settings - Fork 237
/
Copy pathnative_common.bzl
67 lines (58 loc) · 2.36 KB
/
native_common.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under both the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree and the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.
# TODO(cjhopman): This was generated by scripts/hacks/rules_shim_with_docs.py,
# but should be manually edited going forward. There may be some errors in
# the generated docs, and so those should be verified to be accurate and
# well-formatted (and then delete this TODO)
load(":common.bzl", "LinkableDepType")
def _link_style():
return {
"link_style": attrs.option(attrs.enum(LinkableDepType), default = None, doc = """
Determines whether to build and link this rule's dependencies statically or dynamically. Can be
either `static`, `static_pic` or `shared`.
"""),
}
def _link_whole(link_whole_type):
return {
"link_whole": link_whole_type,
}
def _preferred_linkage(preferred_linkage_type):
return {
"preferred_linkage": preferred_linkage_type,
}
def _link_group_deps():
return {
"link_group_deps": attrs.list(attrs.dep(), default = [], doc = """
Additional targets to traverse when building link groups, but which should not
be direct dependencies of the main executable.
"""),
}
def _link_group_public_deps_label():
return {
"link_group_public_deps_label": attrs.option(attrs.string(), default = None, doc = """
Surface nodes with this label as "public" nodes in the main executable when
linking with with link groups.
"""),
}
def _soname():
return {
"soname": attrs.option(attrs.string(), default = None, doc = """
Sets the soname ("shared object name") of any shared library produced from this rule.
The default value is based on the full rule name.
The macro `$(ext)` will be replaced with a platform-appropriate extension.
An argument can be provided, which is a library version.
For example `soname = 'libfoo.$(ext 2.3)'` will be `libfoo.2.3.dylib` on Mac and `libfoo.so.2.3` on Linux.
"""),
}
native_common = struct(
link_group_deps = _link_group_deps,
link_group_public_deps_label = _link_group_public_deps_label,
link_style = _link_style,
link_whole = _link_whole,
preferred_linkage = _preferred_linkage,
soname = _soname,
)