Don't build winapi crate on non-windows environment

Hide winapi crate behind 'cfg(windows)' in Cargo.toml.
This CL is for ChromeOS build.

This commit is unneeded on non-ChromeOS environment because winapi has
'#![cfg(windows)]' in its body so it can be built as empty crate even
on non-windows environments.
However, in ChromeOS build system, winapi crate is replaced with an
empty crate that cannot be built on Linux [1].

[1]: http://cs/h/chromium/chromiumos/codesearch/+/main:src/third_party/rust_crates/vendor/winapi-0.3.9/src/lib.rs?l=1

BUG=none
TEST=cros_run_unit_tests --board octopus --packages crosvm on cros_skd

Change-Id: I6174b4f777b9ad5d94544e4ea9cbfd2e65f48089
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5321370
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Keiichi Watanabe 2024-02-26 20:53:02 +09:00 committed by crosvm LUCI
parent 88174c360b
commit 8039f7149b
2 changed files with 5 additions and 1 deletions

View file

@ -12,5 +12,7 @@ rand = "0.8"
thiserror = "1.0.20"
serde = { version = "1", features = [ "derive" ] }
serde_json = "*"
[target.'cfg(windows)'.dependencies]
win_util = { path = "../win_util"}
winapi = "*"

View file

@ -7,11 +7,13 @@ edition = "2021"
[dependencies]
anyhow = "*"
enumn = "0.1.0"
winapi = { version = "*", features = ["everything", "std", "impl-default"] }
libc = "*"
once_cell = "1.7"
serde = { version = "1", features = [ "derive" ] }
[target.'cfg(windows)'.dependencies]
winapi = { version = "*", features = ["everything", "std", "impl-default"] }
[dependencies.windows]
version = "0.39.0"
features = [