Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bazel_dep(name = "readerwriterqueue", version = "1.0.6")
bazel_dep(name = "rules_cc", version = "0.2.9")
bazel_dep(name = "rules_foreign_cc", version = "0.15.0")
bazel_dep(name = "rules_python", version = "1.6.3")
bazel_dep(name = "rules_rust", version = "0.63.0")
bazel_dep(name = "rules_rust", version = "0.67.0")
bazel_dep(name = "rules_rust_bindgen", version = "0.63.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "spdlog", version = "1.15.3")
Expand Down
4 changes: 2 additions & 2 deletions repositories/rust_setup_stage_1.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def rust_setup_stage_1():
maybe(
http_archive,
name = "rules_rust",
sha256 = "c38b622f26f35c34738100e26d1793ff252897381546467b22d89c9d4d8bfd50",
url = "https://github.com/bazelbuild/rules_rust/releases/download/0.63.0/rules_rust-0.63.0.tar.gz",
sha256 = "dc287e3eca80b29d5cc95e261cae273eedf1af4a00a96ae937e234534dadb24c",
url = "https://github.com/bazelbuild/rules_rust/releases/download/0.67.0/rules_rust-0.67.0.tar.gz",
)

maybe(
Expand Down
21 changes: 14 additions & 7 deletions ros2/rust_interfaces.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def _compile_rust_code(ctx, label, crate_name, srcs, deps):
name = crate_name,
type = crate_type,
root = crate_root,
srcs = depset(srcs),
srcs = srcs,
deps = deps,
proc_macro_deps = depset([]),
proc_macro_deps = [],
aliases = {},
output = rust_lib,
rustc_output = generate_output_diagnostics(ctx, rust_lib),
Expand All @@ -126,6 +126,7 @@ def _compile_rust_code(ctx, label, crate_name, srcs, deps):
crate_info = _get_crate_info(providers),
dep_info = _get_dep_info(providers),
cc_info = _get_cc_info(providers),
build_info = None,
)

def _rust_generator_aspect_impl(target, ctx):
Expand Down Expand Up @@ -170,21 +171,23 @@ def _rust_generator_aspect_impl(target, ctx):
[dep_aspect_info.dep_variant_info],
transitive = [dep_aspect_info.transitive_dep_infos],
))
transitive_dep_infos = depset(transitive = transitive_deps)

dep_variant_info = _compile_rust_code(
ctx,
label = target.label,
crate_name = package_name,
srcs = interface_outputs,
deps = depset(
direct = runtime_deps,
transitive = transitive_deps,
),
# NOTE: rules_rust 0.63 -> 0.67: deps must be a list of DepVariantInfo providers.
# Performance-wise doesn't make much sense to call to_list() since deps is going
# to converted to a depset within rustc_compile_action:
# https://github.com/bazelbuild/rules_rust/blob/0.67.0/rust/private/rustc.bzl#L1211
deps = runtime_deps + transitive_dep_infos.to_list(),
)

return RustGeneratorAspectInfo(
dep_variant_info = dep_variant_info,
transitive_dep_infos = depset(transitive = transitive_deps),
transitive_dep_infos = transitive_dep_infos,
)

rust_generator_aspect = aspect(
Expand Down Expand Up @@ -218,6 +221,9 @@ rust_generator_aspect = aspect(
"_rustc_output_diagnostics": attr.label(
default = Label("@rules_rust//:rustc_output_diagnostics"),
),
"_always_enable_metadata_output_groups": attr.label(
default = Label("@rules_rust//rust/settings:always_enable_metadata_output_groups"),
),
},
required_providers = [Ros2InterfaceInfo],
required_aspect_providers = [
Expand All @@ -239,6 +245,7 @@ def _rust_ros2_interface_library_impl(ctx):
),
crate_info = None,
dep_info = None,
build_info = None,
)
return [
DefaultInfo(
Expand Down