-
Notifications
You must be signed in to change notification settings - Fork 104
/
rust_binary.template
37 lines (37 loc) · 1.3 KB
/
rust_binary.template
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
{%- set target_name_sanitized = target.name | replace(from="-", to="_") %}
rust_binary(
# Prefix bin name to disambiguate from (probable) collision with lib name
# N.B.: The exact form of this is subject to change.
name = "cargo_bin_{{ target_name_sanitized }}",
crate_root = "{{ target.path }}",
edition = "{{ target.edition }}",
srcs = glob(["**/*.rs"]),
deps = [
# Binaries get an implicit dependency on their lib
":{{crate.pkg_name | replace(from="-", to="_") }}",
{%- for dependency in crate.dependencies %}
"{{dependency.buildable_target}}",
{%- endfor %}
{%- for dependency in crate.raze_settings.additional_deps %}
"{{dependency}}",
{%- endfor %}
],
rustc_flags = [
"--cap-lints=allow",
{%- for flag in crate.raze_settings.additional_flags %}
"{{flag}}",
{%- endfor %}
],
{%- if crate.build_script_target %}
out_dir_tar = ":{{ crate.pkg_name | replace(from="-", to="_")}}_build_script_executor",
{%- endif %}
{%- if crate.raze_settings.data_attr %}
data = {{crate.raze_settings.data_attr}},
{%- endif %}
version = "{{ crate.pkg_version }}",
crate_features = [
{%- for feature in crate.features %}
"{{feature}}",
{%- endfor %}
],
)