Skip to content

Commit b98fa51

Browse files
author
Rules WASM Component
committed
fix: resolve rules_rust compatibility issues
Update rules_rust integration to work with current API and resolve bzl_library dependency issues. Changes: - Revert to rust_library with --crate-type=cdylib rustc flag - Update rules_rust to version 0.50.1 for better compatibility - Remove failing bzl_library dependency on @rules_rust//rust:defs - Use rustc flags instead of deprecated attributes This approach uses the standard rust_library rule with explicit crate type specification via rustc flags, which should be more compatible across different rules_rust versions.
1 parent b816b8d commit b98fa51

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module(
77
)
88

99
# Dependencies for WebAssembly tooling
10-
bazel_dep(name = "rules_rust", version = "0.46.0")
10+
bazel_dep(name = "rules_rust", version = "0.50.1")
1111
bazel_dep(name = "bazel_skylib", version = "1.7.1")
1212
bazel_dep(name = "platforms", version = "0.0.11")
1313

rust/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ bzl_library(
1919
deps = [
2020
"//providers:providers",
2121
"//common:common",
22-
"@rules_rust//rust:defs",
2322
],
2423
)
2524

rust/rust_wasm_component.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Rust WASM component rule implementation"""
22

3-
load("@rules_rust//rust:defs.bzl", "rust_shared_library")
3+
load("@rules_rust//rust:defs.bzl", "rust_library")
44
load("//providers:providers.bzl", "WasmComponentInfo", "WitInfo")
55
load("//common:common.bzl", "WASM_TARGET_TRIPLE")
66

@@ -109,7 +109,7 @@ def rust_wasm_component(
109109
"""
110110
Builds a Rust WebAssembly component.
111111
112-
This macro combines rust_shared_library with WASM component conversion.
112+
This macro combines rust_library with WASM component conversion.
113113
114114
Args:
115115
name: Target name
@@ -121,7 +121,7 @@ def rust_wasm_component(
121121
rustc_flags: Additional rustc flags
122122
profiles: List of build profiles to create ["debug", "release", "custom"]
123123
visibility: Target visibility
124-
**kwargs: Additional arguments passed to rust_shared_library
124+
**kwargs: Additional arguments passed to rust_library
125125
126126
Example:
127127
rust_wasm_component(
@@ -169,13 +169,13 @@ def rust_wasm_component(
169169
"--target=" + WASM_TARGET_TRIPLE,
170170
]
171171

172-
rust_shared_library(
172+
rust_library(
173173
name = rust_library_name,
174174
srcs = srcs,
175175
deps = deps,
176176
edition = "2021",
177177
crate_features = crate_features,
178-
rustc_flags = profile_rustc_flags,
178+
rustc_flags = profile_rustc_flags + ["--crate-type=cdylib"],
179179
visibility = ["//visibility:private"],
180180
**kwargs
181181
)

0 commit comments

Comments
 (0)