Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 0ec10ed

Browse files
committed
Add include_dirs to all libraries
One can link directly to `rust_library` as well. The current logic is brittle: not all crates explicitly list crate-types, especially because not all crate types are available on all platforms: e.g. specifying a crate-type staticlib or cdylib makes it *impossible* to compile a crate to Wasm. On the other hand, crate consumers are free to specify whatever crate type they'd like via cargo, so not explicitly listing crate-types is a decent choice for crates. So the current logic leaves out crates like `icu_capi`, which have headers but don't have a `staticlib` crate-type. Test: m cargo_embargo + crate_tool regenerate icu_capi Change-Id: Iaf62f6abdcc5cd84090f37b1ddc200c9d64e8500
1 parent b04c59f commit 0ec10ed

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

tools/cargo_embargo/src/cargo.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ impl CrateType {
6464
pub fn is_test(self) -> bool {
6565
matches!(self, Self::Test | Self::TestNoHarness)
6666
}
67-
68-
/// Returns whether the crate type is a kind of C ABI library.
69-
pub fn is_c_library(self) -> bool {
70-
matches!(self, Self::CDyLib | Self::StaticLib)
71-
}
7267
}
7368

7469
/// Info extracted from `CargoOut` for a crate.

tools/cargo_embargo/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ fn crate_to_bp_modules(
11141114
if !crate_type.is_test() && package_cfg.host_supported && package_cfg.host_first_multilib {
11151115
m.props.set("compile_multilib", "first");
11161116
}
1117-
if crate_type.is_c_library() {
1117+
if crate_type.is_library() {
11181118
m.props.set_if_nonempty("include_dirs", package_cfg.exported_c_header_dir.clone());
11191119
}
11201120

0 commit comments

Comments
 (0)