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("@rules_rust//rust:defs.bzl", "rust_binary", "rust_shared_library") 16load("@rules_rust//wasm_bindgen:defs.bzl", "rust_wasm_bindgen") 17 18package(default_visibility = ["//wasm_bindgen:__subpackages__"]) 19 20exports_files([ 21 "hello_world_wasm_test.js", 22 "main.rs", 23]) 24 25rust_binary( 26 name = "hello_world_bin_wasm", 27 srcs = ["main.rs"], 28 edition = "2018", 29 deps = [ 30 "@rules_rust//wasm_bindgen/3rdparty:wasm_bindgen", 31 ], 32) 33 34rust_shared_library( 35 name = "hello_world_lib_wasm", 36 srcs = ["main.rs"], 37 edition = "2018", 38 deps = [ 39 "@rules_rust//wasm_bindgen/3rdparty:wasm_bindgen", 40 ], 41) 42 43rust_wasm_bindgen( 44 name = "hello_world_bundler_wasm_bindgen", 45 wasm_file = ":hello_world_bin_wasm", 46) 47 48rust_wasm_bindgen( 49 name = "hello_world_web_wasm_bindgen", 50 target = "web", 51 wasm_file = ":hello_world_lib_wasm", 52) 53 54rust_wasm_bindgen( 55 name = "hello_world_deno_wasm_bindgen", 56 target = "deno", 57 wasm_file = ":hello_world_lib_wasm", 58) 59 60rust_wasm_bindgen( 61 name = "hello_world_nomodules_wasm_bindgen", 62 target = "no-modules", 63 wasm_file = ":hello_world_lib_wasm", 64) 65 66rust_wasm_bindgen( 67 name = "hello_world_nodejs_wasm_bindgen", 68 target = "nodejs", 69 wasm_file = ":hello_world_lib_wasm", 70) 71