1load("@rules_rust//bindgen:defs.bzl", "rust_bindgen_library") 2load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test") 3 4rust_bindgen_library( 5 name = "simple_bindgen", 6 bindgen_flags = [ 7 "--allowlist-function=simple_.*", 8 "--allowlist-var=SIMPLE_.*", 9 ], 10 cc_lib = "//bindgen/simple", 11 header = "//bindgen/simple:simple.h", 12 leak_symbols = False, 13) 14 15rust_binary( 16 name = "simple_example", 17 srcs = ["main.rs"], 18 deps = [":simple_bindgen"], 19) 20 21rust_test( 22 name = "simple_test", 23 crate = ":simple_example", 24) 25 26rust_bindgen_library( 27 name = "simple_leaked_bindgen", 28 bindgen_flags = [ 29 "--allowlist-function=simple_.*", 30 "--allowlist-var=SIMPLE_.*", 31 ], 32 cc_lib = "//bindgen/simple", 33 header = "//bindgen/simple:simple.h", 34 leak_symbols = True, 35) 36 37rust_binary( 38 name = "simple_leaked_example", 39 srcs = ["main_leaked.rs"], 40 deps = [":simple_leaked_bindgen"], 41) 42 43rust_test( 44 name = "simple_leaked_test", 45 crate = ":simple_leaked_example", 46) 47