fork/rules_rust

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

UebelAndreUpdate wasm_bindgen to use crate universe. (#1398)97264b79

0.8.0
2.1 KiB78 linesraw
1# Copyright 2020 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
16load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_shared_library")
17load("@rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")
18
19package(default_visibility = ["//visibility:public"])
20
21rust_binary(
22    name = "hello_world_bin_wasm",
23    srcs = ["main.rs"],
24    edition = "2018",
25    deps = [
26        "@rules_rust//wasm_bindgen/3rdparty:wasm_bindgen",
27    ],
28)
29
30rust_shared_library(
31    name = "hello_world_lib_wasm",
32    srcs = ["main.rs"],
33    edition = "2018",
34    deps = [
35        "@rules_rust//wasm_bindgen/3rdparty:wasm_bindgen",
36    ],
37)
38
39rust_wasm_bindgen(
40    name = "hello_world_bundler_wasm_bindgen",
41    wasm_file = ":hello_world_bin_wasm",
42)
43
44rust_wasm_bindgen(
45    name = "hello_world_web_wasm_bindgen",
46    target = "web",
47    wasm_file = ":hello_world_lib_wasm",
48)
49
50rust_wasm_bindgen(
51    name = "hello_world_deno_wasm_bindgen",
52    target = "deno",
53    wasm_file = ":hello_world_lib_wasm",
54)
55
56rust_wasm_bindgen(
57    name = "hello_world_nomodules_wasm_bindgen",
58    target = "no-modules",
59    wasm_file = ":hello_world_lib_wasm",
60)
61
62rust_wasm_bindgen(
63    name = "hello_world_nodejs_wasm_bindgen",
64    target = "nodejs",
65    wasm_file = ":hello_world_lib_wasm",
66)
67
68nodejs_test(
69    name = "hello_world_wasm_test",
70    data = [
71        ":hello_world_bundler_wasm_bindgen",
72        ":hello_world_deno_wasm_bindgen",
73        ":hello_world_nodejs_wasm_bindgen",
74        ":hello_world_nomodules_wasm_bindgen",
75        ":hello_world_web_wasm_bindgen",
76    ],
77    entry_point = "hello_world_wasm_test.js",
78)