0

Adopt new rust_bindgen behaviour in Rust mojo impl

The rust_bindgen template now makes a library that exports the bindgen
generated symbols.

R=lukasza@chromium.org

Bug: b/373864033
Cq-Include-Trybots: luci.chromium.try:android-rust-arm64-rel,android-rust-arm32-rel,android-rust-arm64-dbg,linux-rust-x64-dbg,linux-rust-x64-rel,mac-rust-x64-dbg,win-rust-x64-dbg,win-rust-x64-rel
Change-Id: I4584b004907612a3c122f4cf39dddc397288332a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973313
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1374768}
This commit is contained in:
danakj
2024-10-28 18:55:07 +00:00
committed by Chromium LUCI CQ
parent 293f2c839f
commit 09afac1d1a
3 changed files with 8 additions and 17 deletions
build/rust
mojo/public/rust

@ -78,14 +78,14 @@ template("rust_bindgen") {
"output_name",
] + TESTONLY_AND_VISIBILITY)
# This will allow the rust_static_library to depend on the `rust_bindgen_generator`
# through visibility.
# This will allow the rust_static_library to depend on the
# `rust_bindgen_generator` through visibility.
library_name = target_name
# We know the library that is going to consume this rust_bindgen and we're sure
# that only a single bindgen is there. So rename the bindings to avoid passing
# envflags.
# envflags are usually problematic for Cronet as Soong does not support it (b/181221467).
# We know the library that is going to consume this rust_bindgen and we're
# sure that only a single bindgen is there. So rename the bindings to avoid
# passing envflags. envflags are usually problematic for Cronet as Soong
# does not support it (b/181221467).
output_name = "bindings"
}

@ -73,11 +73,6 @@ rust_static_library("mojo_system") {
"//third_party/rust/bitflags/v2:lib",
]
bindgen_output = get_target_outputs(":mojo_c_system_binding")
inputs = bindgen_output
rustenv = [ "BINDGEN_RS_FILE=" +
rebase_path(bindgen_output[0], get_path_info(crate_root, "dir")) ]
# TODO(crbug.com/369430130): reenable this warning.
rustflags = [ "-Aimproper-ctypes" ]
}

@ -17,12 +17,8 @@
//! TODO(crbug.com/40206847):
//! * Remove references to the now-nonexistent mojo Github
pub mod raw_ffi {
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(env!("BINDGEN_RS_FILE"));
chromium::import! {
pub "//mojo/public/rust:mojo_c_system_binding" as raw_ffi;
}
pub mod types {