blob: c1cccbb0a6a4e13bcee0e8b2e650383726e033ff [file] [log] [blame]
compile_data = {% if crate.common_attrs | get(key="compile_data_glob") %}glob(include = {{ crate.common_attrs.compile_data_glob | json_encode | safe }}, exclude = ["BUILD", "BUILD.bazel", "WORKSPACE", "WORKSPACE.bazel"]) + {% endif %}{% set selectable = crate.common_attrs | get(key="compile_data", default=default_select_list) %}{% include "partials/starlark/selectable_list.j2" -%},
crate_root = "{{ target.crate_root }}",
crate_features = [
{%- for feature in crate.common_attrs | get(key="crate_features", default=[]) %}
"{{ feature }}",
{%- endfor %}
],
data = {% if crate.common_attrs | get(key="data_glob") %}glob(include = {{ crate.common_attrs.data_glob | json_encode | safe }}, exclude = ["BUILD", "BUILD.bazel", "WORKSPACE", "WORKSPACE.bazel"]) + {% endif %}{% set selectable = crate.common_attrs | get(key="data", default=default_select_list) %}{% include "partials/starlark/selectable_list.j2" -%},
edition = "{{ crate.common_attrs.edition }}",
{%- if crate.common_attrs | get(key="linker_script", default=Null) %}
linker_script = "{{ crate.common_attrs.linker_script }}",
{%- endif %}
rustc_env = {% set selectable = crate.common_attrs | get(key="rustc_env", default=Null) %}{% include "partials/starlark/selectable_dict.j2" -%},
rustc_env_files = {% set selectable = crate.common_attrs | get(key="rustc_env_files", default=Null) %}{% include "partials/starlark/selectable_list.j2" -%},
rustc_flags = [
# In most cases, warnings in 3rd party crates are not interesting as
# they're out of the control of consumers. The flag here silences
# warnings. For more details see:
# https://doc.rust-lang.org/rustc/lints/levels.html
"--cap-lints=allow",
{%- if crate.common_attrs | get(key="rustc_flags", default=Null) %}
# User provided rustc_flags
{%- for rustc_flag in crate.common_attrs.rustc_flags %}
"{{ rustc_flag }}",
{%- endfor %}
{%- endif %}
],
srcs = {% set glob = target.srcs %}{% include "partials/starlark/glob.j2" -%},
version = "{{ crate.common_attrs.version }}",
tags = [
{%- if crate.common_attrs | get(key="tags", default=Null) %}
{%- for tag in crate.common_attrs.tags %}
"{{ tag }}",
{%- endfor %}
{%- endif %}
"cargo-bazel",
"manual",
"noclippy",
"norustfmt",
],