blob: e499c313b90b83c67fb2af0ea163e33c399e42f0 [file] [log] [blame]
Brian Silvermancc09f182022-03-09 15:40:20 -08001# 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
15# buildifier: disable=module-docstring
16load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
17load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_shared_library")
18load("@rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")
19
20package(default_visibility = ["//visibility:public"])
21
22rust_binary(
23 name = "hello_world_bin_wasm",
24 srcs = ["main.rs"],
25 edition = "2018",
26 deps = [
27 "@rules_rust//wasm_bindgen/raze:wasm_bindgen",
28 ],
29)
30
31rust_shared_library(
32 name = "hello_world_lib_wasm",
33 srcs = ["main.rs"],
34 edition = "2018",
35 deps = [
36 "@rules_rust//wasm_bindgen/raze:wasm_bindgen",
37 ],
38)
39
40rust_wasm_bindgen(
41 name = "hello_world_bundler_wasm_bindgen",
42 wasm_file = ":hello_world_bin_wasm",
43)
44
45rust_wasm_bindgen(
46 name = "hello_world_web_wasm_bindgen",
47 target = "web",
48 wasm_file = ":hello_world_lib_wasm",
49)
50
51rust_wasm_bindgen(
52 name = "hello_world_deno_wasm_bindgen",
53 target = "deno",
54 wasm_file = ":hello_world_lib_wasm",
55)
56
57rust_wasm_bindgen(
58 name = "hello_world_nomodules_wasm_bindgen",
59 target = "no-modules",
60 wasm_file = ":hello_world_lib_wasm",
61)
62
63rust_wasm_bindgen(
64 name = "hello_world_nodejs_wasm_bindgen",
65 target = "nodejs",
66 wasm_file = ":hello_world_lib_wasm",
67)
68
69nodejs_test(
70 name = "hello_world_wasm_test",
71 data = [
72 ":hello_world_bundler_wasm_bindgen",
73 ":hello_world_deno_wasm_bindgen",
74 ":hello_world_nodejs_wasm_bindgen",
75 ":hello_world_nomodules_wasm_bindgen",
76 ":hello_world_web_wasm_bindgen",
77 ],
78 entry_point = "hello_world_wasm_test.js",
79)