fork/rules_rust

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

UebelAndreMoved rust extension rules into a separate `rules_rust_ext` workspace. (#3007)2bad96d9

cleanup
2.2 KiB97 linesraw
1load("@aspect_rules_js//js:defs.bzl", "js_library", "js_test")
2load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
3load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_shared_library")
4load("@rules_rust_wasm_bindgen//rules_js:defs.bzl", "js_rust_wasm_bindgen")
5
6copy_file(
7    name = "hello_world_wasm_test.src",
8    src = "//test:hello_world_wasm_test.js",
9    out = "hello_world_wasm_test.js",
10)
11
12rust_binary(
13    name = "hello_world_bin_wasm",
14    srcs = ["//test:main.rs"],
15    edition = "2018",
16    deps = [
17        "@rules_rust_wasm_bindgen//3rdparty:wasm_bindgen",
18    ],
19)
20
21rust_shared_library(
22    name = "hello_world_lib_wasm",
23    srcs = ["//test:main.rs"],
24    edition = "2018",
25    deps = [
26        "@rules_rust_wasm_bindgen//3rdparty:wasm_bindgen",
27    ],
28)
29
30js_rust_wasm_bindgen(
31    name = "hello_world_bundler_wasm_bindgen",
32    wasm_file = ":hello_world_bin_wasm",
33)
34
35js_rust_wasm_bindgen(
36    name = "hello_world_web_wasm_bindgen",
37    target = "web",
38    wasm_file = ":hello_world_lib_wasm",
39)
40
41js_rust_wasm_bindgen(
42    name = "hello_world_deno_wasm_bindgen",
43    target = "deno",
44    wasm_file = ":hello_world_lib_wasm",
45)
46
47js_rust_wasm_bindgen(
48    name = "hello_world_nomodules_wasm_bindgen",
49    target = "no-modules",
50    wasm_file = ":hello_world_lib_wasm",
51)
52
53js_rust_wasm_bindgen(
54    name = "hello_world_nodejs_wasm_bindgen",
55    target = "nodejs",
56    wasm_file = ":hello_world_lib_wasm",
57)
58
59js_rust_wasm_bindgen(
60    name = "hello_world_nodejs_no_typescript_wasm_bindgen",
61    bindgen_flags = [
62        "--no-typescript",
63    ],
64    target = "nodejs",
65    wasm_file = ":hello_world_lib_wasm",
66)
67
68_WASM_DATA = [
69    ":hello_world_bundler_wasm_bindgen",
70    ":hello_world_deno_wasm_bindgen",
71    ":hello_world_nodejs_wasm_bindgen",
72    ":hello_world_nomodules_wasm_bindgen",
73    ":hello_world_web_wasm_bindgen",
74]
75
76js_test(
77    name = "hello_world_wasm_direct_test",
78    data = _WASM_DATA,
79    entry_point = ":hello_world_wasm_test.js",
80)
81
82js_library(
83    name = "hello_world_wasm_lib",
84    srcs = [
85        ":hello_world_wasm_test.js",
86    ],
87    data = _WASM_DATA,
88    deps = [],
89)
90
91js_test(
92    name = "hello_world_wasm_lib_test",
93    data = [
94        ":hello_world_wasm_lib",
95    ],
96    entry_point = ":hello_world_wasm_lib",
97)