-
Notifications
You must be signed in to change notification settings - Fork 440
/
BUILD.crate.bazel.template
41 lines (37 loc) · 1.3 KB
/
BUILD.crate.bazel.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
38
39
40
41
# buildifier: disable=load
load(
"@rules_rust//rust:defs.bzl",
"rust_binary",
"rust_library",
"rust_proc_macro",
"rust_test",
)
# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")
package(default_visibility = [
"//visibility:public",
])
licenses([
"{{crate.license.rating}}", # {{crate.license.name}}
])
# Generated targets
{%- set crate_name_sanitized = crate.pkg_name | replace(from="-", to="_") %}
{%- if crate.build_script_target %}
{% include "templates/partials/build_script.template" %}
{%- endif %}
{%- for target in crate.targets %}
{%- set target_name_sanitized = target.name | replace(from="-", to="_") %}
{%- if target.kind == "lib" %}
{% include "templates/partials/rust_library.template" %}
{%- elif target.kind == "bin" %}
{% include "templates/partials/rust_binary.template" %}
{%- elif target.kind == "proc-macro" %}
{% include "templates/partials/rust_library.template" %}
{%- elif target.kind == "dylib" %}
{% include "templates/partials/rust_library.template" %}
{%- elif target.kind == "rlib" %}
{% include "templates/partials/rust_library.template" %}
{%- else %}
# Unsupported target "{{ target.name }}" with type "{{ target.kind }}" omitted
{%- endif %}
{%- endfor %}