-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUILD.bazel
More file actions
40 lines (33 loc) · 1.23 KB
/
BUILD.bazel
File metadata and controls
40 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Basic example of building a WASM component"""
load("@rules_wasm_component//rust:defs.bzl", "rust_wasm_component_bindgen", "rust_wasm_component_test")
load("@rules_wasm_component//wit:defs.bzl", "wit_library")
package(default_visibility = ["//visibility:public"])
# Define WIT interfaces
wit_library(
name = "hello_interfaces",
package_name = "hello:interfaces",
srcs = ["wit/hello.wit"],
world = "hello",
)
# Build Rust WASM component with automatic WIT binding generation
rust_wasm_component_bindgen(
name = "hello_component",
srcs = ["src/lib.rs"],
profiles = ["release"], # Build release profile
validate_wit = False, # Disable validation to avoid multi-output issues with OCI
wit = ":hello_interfaces",
)
# Test the component
rust_wasm_component_test(
name = "hello_component_test",
component = ":hello_component",
)
# Run clippy on the component
# TODO: Fix clippy to work with transitioned targets
# rust_wasm_component_clippy(
# name = "hello_component_clippy",
# target = ":hello_component",
# )
# NOTE: binaryen_optimize does NOT work with WASM components (only core modules)
# For component optimization, use jco_opt instead.
# See: https://github.com/WebAssembly/binaryen/issues/6728