Filter cargo-credential-* dependencies by OS

This commit is contained in:
Josh Stone 2023-11-09 10:09:00 -08:00
parent 1d8980511e
commit 1ee96328c3
2 changed files with 15 additions and 3 deletions

View File

@ -128,9 +128,6 @@ anyhow.workspace = true
base64.workspace = true
bytesize.workspace = true
cargo-credential.workspace = true
cargo-credential-libsecret.workspace = true
cargo-credential-macos-keychain.workspace = true
cargo-credential-wincred.workspace = true
cargo-platform.workspace = true
cargo-util.workspace = true
clap = { workspace = true, features = ["wrap_help"] }
@ -189,9 +186,18 @@ unicode-xid.workspace = true
url.workspace = true
walkdir.workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
cargo-credential-libsecret.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
cargo-credential-macos-keychain.workspace = true
[target.'cfg(not(windows))'.dependencies]
openssl = { workspace = true, optional = true }
[target.'cfg(windows)'.dependencies]
cargo-credential-wincred.workspace = true
[target.'cfg(windows)'.dependencies.windows-sys]
workspace = true
features = [

View File

@ -529,9 +529,15 @@ fn credential_action(
}
"cargo:paseto" => bail!("cargo:paseto requires -Zasymmetric-token"),
"cargo:token-from-stdout" => Box::new(BasicProcessCredential {}),
#[cfg(windows)]
"cargo:wincred" => Box::new(cargo_credential_wincred::WindowsCredential {}),
#[cfg(target_os = "macos")]
"cargo:macos-keychain" => Box::new(cargo_credential_macos_keychain::MacKeychain {}),
#[cfg(target_os = "linux")]
"cargo:libsecret" => Box::new(cargo_credential_libsecret::LibSecretCredential {}),
name if BUILT_IN_PROVIDERS.contains(&name) => {
Box::new(cargo_credential::UnsupportedCredential {})
}
process => Box::new(CredentialProcessCredential::new(process)),
};
config.shell().verbose(|c| {