fork/rules_rust

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

UebelAndreAdded bzlmod support to all extension rules. (#3037)a7aba2d0

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