fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreMoved `cargo_dep_env` into it's own file. (#2823)64502533

cleanup
989 B38 linesraw
1load("@bazel_skylib//rules:write_file.bzl", "write_file")
2load("//cargo:defs.bzl", "cargo_build_script")
3load("//rust:defs.bzl", "rust_test")
4
5write_file(
6    name = "target_data",
7    out = "target_data.txt",
8    content = ["la-li-lu-le-lo"],
9)
10
11write_file(
12    name = "exec_data",
13    out = "exec_data.txt",
14    content = ["la-li-lu-le-lo"],
15)
16
17cargo_build_script(
18    name = "build_rs",
19    srcs = ["build.rs"],
20    build_script_env = {
21        "DATA_EXECPATH": "$(execpath target_data.txt)",
22        "DATA_RLOCATIONPATH": "$(rlocationpath target_data.txt)",
23        "DATA_ROOTPATH": "$(rootpath target_data.txt)",
24        "TOOL_EXECPATH": "$(execpath exec_data.txt)",
25        "TOOL_RLOCATIONPATH": "$(rlocationpath exec_data.txt)",
26        "TOOL_ROOTPATH": "$(rootpath exec_data.txt)",
27    },
28    data = ["target_data.txt"],
29    edition = "2018",
30    tools = ["exec_data.txt"],
31)
32
33rust_test(
34    name = "test",
35    srcs = ["test.rs"],
36    edition = "2018",
37    deps = [":build_rs"],
38)