5
5
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
6
6
# of this source tree.
7
7
8
+ prelude = native
9
+
8
10
# @lint-ignore FBCODEBZLADDLOADS
9
11
_SELECT_TYPE = type (select ({"DEFAULT" : []}))
10
12
@@ -19,8 +21,7 @@ def cpp_library(
19
21
** kwargs ):
20
22
_unused = (undefined_symbols ) # @unused
21
23
22
- # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
23
- native .cxx_library (
24
+ prelude .cxx_library (
24
25
deps = _maybe_select_map (deps + external_deps_to_targets (external_deps ), _fix_deps ),
25
26
visibility = visibility ,
26
27
preferred_linkage = "static" ,
@@ -49,9 +50,8 @@ def rust_library(
49
50
# Reset visibility because internal and external paths are different.
50
51
visibility = ["PUBLIC" ]
51
52
52
- # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
53
- native .rust_library (
54
- rustc_flags = rustc_flags + [_CFG_BUCK_OSS_BUILD ],
53
+ prelude .rust_library (
54
+ rustc_flags = rustc_flags + [_CFG_BUCK_BUILD ],
55
55
deps = deps ,
56
56
visibility = visibility ,
57
57
mapped_srcs = mapped_srcs ,
@@ -71,8 +71,8 @@ def rust_binary(
71
71
deps = _maybe_select_map (deps , _fix_deps )
72
72
73
73
# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
74
- native .rust_binary (
75
- rustc_flags = rustc_flags + [_CFG_BUCK_OSS_BUILD ],
74
+ prelude .rust_binary (
75
+ rustc_flags = rustc_flags + [_CFG_BUCK_BUILD ],
76
76
deps = deps ,
77
77
visibility = visibility ,
78
78
** kwargs
@@ -85,9 +85,8 @@ def rust_unittest(
85
85
** kwargs ):
86
86
deps = _maybe_select_map (deps , _fix_deps )
87
87
88
- # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
89
- native .rust_test (
90
- rustc_flags = rustc_flags + [_CFG_BUCK_OSS_BUILD ],
88
+ prelude .rust_test (
89
+ rustc_flags = rustc_flags + [_CFG_BUCK_BUILD ],
91
90
deps = deps ,
92
91
visibility = visibility ,
93
92
** kwargs
@@ -111,7 +110,7 @@ def rust_protobuf_library(
111
110
build_name = name + "-build"
112
111
proto_name = name + "-proto"
113
112
114
- rust_binary (
113
+ prelude . rust_binary (
115
114
name = build_name ,
116
115
srcs = [build_script ],
117
116
crate_root = build_script ,
@@ -129,8 +128,7 @@ def rust_protobuf_library(
129
128
},
130
129
)
131
130
132
- # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
133
- native .genrule (
131
+ prelude .genrule (
134
132
name = proto_name ,
135
133
srcs = protos + [
136
134
"buck//third-party/proto:google_protobuf" ,
@@ -140,7 +138,7 @@ def rust_protobuf_library(
140
138
env = build_env ,
141
139
)
142
140
143
- rust_library (
141
+ prelude . rust_library (
144
142
name = name ,
145
143
srcs = srcs ,
146
144
doctests = doctests ,
@@ -157,8 +155,7 @@ def rust_protobuf_library(
157
155
158
156
# For python tests only
159
157
for proto in protos :
160
- # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
161
- native .export_file (
158
+ prelude .export_file (
162
159
name = proto ,
163
160
visibility = ["PUBLIC" ],
164
161
)
@@ -169,17 +166,13 @@ def ocaml_binary(
169
166
** kwargs ):
170
167
deps = _maybe_select_map (deps , _fix_deps )
171
168
172
- # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
173
- native .ocaml_binary (
169
+ prelude .ocaml_binary (
174
170
deps = deps ,
175
171
visibility = visibility ,
176
172
** kwargs
177
173
)
178
174
179
- # Configuration that is used when building open source using Buck2 as the build system.
180
- # E.g. not applied either internally, or when using Cargo to build the open source code.
181
- # At the moment of writing, mostly used to disable jemalloc.
182
- _CFG_BUCK_OSS_BUILD = "--cfg=buck_oss_build"
175
+ _CFG_BUCK_BUILD = "--cfg=buck_build"
183
176
184
177
def _maybe_select_map (v , mapper ):
185
178
if is_select (v ):
0 commit comments