Skip to content

Commit

Permalink
Filter cargo-credential-* dependencies by OS
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Nov 9, 2023
1 parent 1d89805 commit 1ee9632
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down Expand Up @@ -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 = [
Expand Down
6 changes: 6 additions & 0 deletions src/cargo/util/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 1ee9632

Please sign in to comment.