fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
2bad96d9
cleanup
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 ( 7name = "hello_world_wasm_test.src" , 8src = "//test:hello_world_wasm_test.js" , 9out = "hello_world_wasm_test.js" , 10) 11 12rust_binary ( 13name = "hello_world_bin_wasm" , 14srcs = [ "//test:main.rs" ], 15edition = "2018" , 16deps = [ 17"@rules_rust_wasm_bindgen//3rdparty:wasm_bindgen" , 18], 19) 20 21rust_shared_library ( 22name = "hello_world_lib_wasm" , 23srcs = [ "//test:main.rs" ], 24edition = "2018" , 25deps = [ 26"@rules_rust_wasm_bindgen//3rdparty:wasm_bindgen" , 27], 28) 29 30js_rust_wasm_bindgen ( 31name = "hello_world_bundler_wasm_bindgen" , 32wasm_file = ":hello_world_bin_wasm" , 33) 34 35js_rust_wasm_bindgen ( 36name = "hello_world_web_wasm_bindgen" , 37target = "web" , 38wasm_file = ":hello_world_lib_wasm" , 39) 40 41js_rust_wasm_bindgen ( 42name = "hello_world_deno_wasm_bindgen" , 43target = "deno" , 44wasm_file = ":hello_world_lib_wasm" , 45) 46 47js_rust_wasm_bindgen ( 48name = "hello_world_nomodules_wasm_bindgen" , 49target = "no-modules" , 50wasm_file = ":hello_world_lib_wasm" , 51) 52 53js_rust_wasm_bindgen ( 54name = "hello_world_nodejs_wasm_bindgen" , 55target = "nodejs" , 56wasm_file = ":hello_world_lib_wasm" , 57) 58 59js_rust_wasm_bindgen ( 60name = "hello_world_nodejs_no_typescript_wasm_bindgen" , 61bindgen_flags = [ 62"--no-typescript" , 63], 64target = "nodejs" , 65wasm_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 ( 77name = "hello_world_wasm_direct_test" , 78data = _WASM_DATA , 79entry_point = ":hello_world_wasm_test.js" , 80) 81 82js_library ( 83name = "hello_world_wasm_lib" , 84srcs = [ 85":hello_world_wasm_test.js" , 86], 87data = _WASM_DATA , 88deps = [], 89) 90 91js_test ( 92name = "hello_world_wasm_lib_test" , 93data = [ 94":hello_world_wasm_lib" , 95], 96entry_point = ":hello_world_wasm_lib" , 97)