rust: Add export_include_dirs property to rust_ffi

The cc property include_dirs is neverallowed in certain paths since it
has been deprecated. The property in rust_ffi modules with the same name  functionally works the same way as the CC property export_include_dirs.

To reduce confusion, and avoid triggering the neverallow rule, deprecate
include_dirs and create an export_include_dirs property which does the
same thing. This brings rust module properties into better alignment
with cc module property as well, reducing confusion.

Bug: 330736943
Test: New Soong test
Change-Id: Ib2020a22e6747ac690c46dbff84e38744f93ed15
This commit is contained in:
Ivan Lozano
2024-03-21 13:43:14 -04:00
parent 181a27986c
commit f033ca61a2
3 changed files with 27 additions and 3 deletions

View File

@@ -403,3 +403,22 @@ func TestLibstdLinkage(t *testing.T) {
}
}
func TestRustFFIExportedIncludes(t *testing.T) {
ctx := testRust(t, `
rust_ffi {
name: "libbar",
srcs: ["foo.rs"],
crate_name: "bar",
export_include_dirs: ["rust_includes"],
host_supported: true,
}
cc_library_static {
name: "libfoo",
srcs: ["foo.cpp"],
shared_libs: ["libbar"],
host_supported: true,
}`)
libfooStatic := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_static").Rule("cc")
android.AssertStringDoesContain(t, "cFlags for lib module", libfooStatic.Args["cFlags"], " -Irust_includes ")
}