mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #13178 - epage:schemas, r=weihanglo
refactor(schemas): Pull out as `cargo-util-schemas` ### What does this PR try to resolve? Fixes #12801 ### How should we test and review this PR? See the individual commits for further justifications on the changes ### Additional information
This commit is contained in:
commit
881d79061a
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -257,6 +257,7 @@ dependencies = [
|
|||||||
"cargo-test-macro",
|
"cargo-test-macro",
|
||||||
"cargo-test-support",
|
"cargo-test-support",
|
||||||
"cargo-util",
|
"cargo-util",
|
||||||
|
"cargo-util-schemas",
|
||||||
"clap",
|
"clap",
|
||||||
"color-print",
|
"color-print",
|
||||||
"crates-io",
|
"crates-io",
|
||||||
@ -297,7 +298,6 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-untagged",
|
"serde-untagged",
|
||||||
"serde-value",
|
|
||||||
"serde_ignored",
|
"serde_ignored",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha1",
|
"sha1",
|
||||||
@ -314,7 +314,6 @@ dependencies = [
|
|||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"unicase",
|
"unicase",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"unicode-xid",
|
|
||||||
"url",
|
"url",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
@ -436,6 +435,20 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo-util-schemas"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"semver",
|
||||||
|
"serde",
|
||||||
|
"serde-untagged",
|
||||||
|
"serde-value",
|
||||||
|
"toml",
|
||||||
|
"unicode-xid",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo_metadata"
|
name = "cargo_metadata"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
@ -2821,6 +2834,7 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo",
|
"cargo",
|
||||||
"cargo-util",
|
"cargo-util",
|
||||||
|
"cargo-util-schemas",
|
||||||
"proptest",
|
"proptest",
|
||||||
"varisat",
|
"varisat",
|
||||||
]
|
]
|
||||||
|
@ -30,6 +30,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.4" }
|
|||||||
cargo-test-macro = { path = "crates/cargo-test-macro" }
|
cargo-test-macro = { path = "crates/cargo-test-macro" }
|
||||||
cargo-test-support = { path = "crates/cargo-test-support" }
|
cargo-test-support = { path = "crates/cargo-test-support" }
|
||||||
cargo-util = { version = "0.2.6", path = "crates/cargo-util" }
|
cargo-util = { version = "0.2.6", path = "crates/cargo-util" }
|
||||||
|
cargo-util-schemas = { version = "0.1.0", path = "crates/cargo-util-schemas" }
|
||||||
cargo_metadata = "0.18.1"
|
cargo_metadata = "0.18.1"
|
||||||
clap = "4.4.10"
|
clap = "4.4.10"
|
||||||
color-print = "0.3.5"
|
color-print = "0.3.5"
|
||||||
@ -144,6 +145,7 @@ base64.workspace = true
|
|||||||
bytesize.workspace = true
|
bytesize.workspace = true
|
||||||
cargo-credential.workspace = true
|
cargo-credential.workspace = true
|
||||||
cargo-platform.workspace = true
|
cargo-platform.workspace = true
|
||||||
|
cargo-util-schemas.workspace = true
|
||||||
cargo-util.workspace = true
|
cargo-util.workspace = true
|
||||||
clap = { workspace = true, features = ["wrap_help"] }
|
clap = { workspace = true, features = ["wrap_help"] }
|
||||||
color-print.workspace = true
|
color-print.workspace = true
|
||||||
@ -183,7 +185,6 @@ rustfix.workspace = true
|
|||||||
semver.workspace = true
|
semver.workspace = true
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde-untagged.workspace = true
|
serde-untagged.workspace = true
|
||||||
serde-value.workspace = true
|
|
||||||
serde_ignored.workspace = true
|
serde_ignored.workspace = true
|
||||||
serde_json = { workspace = true, features = ["raw_value"] }
|
serde_json = { workspace = true, features = ["raw_value"] }
|
||||||
sha1.workspace = true
|
sha1.workspace = true
|
||||||
@ -199,7 +200,6 @@ tracing.workspace = true
|
|||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
unicase.workspace = true
|
unicase.workspace = true
|
||||||
unicode-width.workspace = true
|
unicode-width.workspace = true
|
||||||
unicode-xid.workspace = true
|
|
||||||
url.workspace = true
|
url.workspace = true
|
||||||
walkdir.workspace = true
|
walkdir.workspace = true
|
||||||
|
|
||||||
|
22
crates/cargo-util-schemas/Cargo.toml
Normal file
22
crates/cargo-util-schemas/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[package]
|
||||||
|
name = "cargo-util-schemas"
|
||||||
|
version = "0.1.0"
|
||||||
|
rust-version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
homepage = "https://github.com/rust-lang/cargo"
|
||||||
|
repository = "https://github.com/rust-lang/cargo"
|
||||||
|
description = "Deserialization schemas for Cargo"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow.workspace = true
|
||||||
|
semver.workspace = true
|
||||||
|
serde = { workspace = true, features = ["derive"] }
|
||||||
|
serde-untagged.workspace = true
|
||||||
|
serde-value.workspace = true
|
||||||
|
toml.workspace = true
|
||||||
|
unicode-xid.workspace = true
|
||||||
|
url.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
1
crates/cargo-util-schemas/LICENSE-APACHE
Symbolic link
1
crates/cargo-util-schemas/LICENSE-APACHE
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../LICENSE-APACHE
|
1
crates/cargo-util-schemas/LICENSE-MIT
Symbolic link
1
crates/cargo-util-schemas/LICENSE-MIT
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../LICENSE-MIT
|
@ -1,6 +1,8 @@
|
|||||||
mod package_id_spec;
|
mod package_id_spec;
|
||||||
|
mod partial_version;
|
||||||
mod source_kind;
|
mod source_kind;
|
||||||
|
|
||||||
pub use package_id_spec::PackageIdSpec;
|
pub use package_id_spec::PackageIdSpec;
|
||||||
|
pub use partial_version::PartialVersion;
|
||||||
pub use source_kind::GitReference;
|
pub use source_kind::GitReference;
|
||||||
pub use source_kind::SourceKind;
|
pub use source_kind::SourceKind;
|
@ -6,10 +6,10 @@ use semver::Version;
|
|||||||
use serde::{de, ser};
|
use serde::{de, ser};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::util_schemas::core::GitReference;
|
use crate::core::GitReference;
|
||||||
use crate::util_schemas::core::SourceKind;
|
use crate::core::PartialVersion;
|
||||||
use crate::util_schemas::manifest::PackageName;
|
use crate::core::SourceKind;
|
||||||
use crate::util_semver::PartialVersion;
|
use crate::manifest::PackageName;
|
||||||
|
|
||||||
/// Some or all of the data required to identify a package:
|
/// Some or all of the data required to identify a package:
|
||||||
///
|
///
|
||||||
@ -59,7 +59,7 @@ impl PackageIdSpec {
|
|||||||
/// Some examples of valid strings
|
/// Some examples of valid strings
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use cargo::core::PackageIdSpec;
|
/// use cargo_util_schemas::core::PackageIdSpec;
|
||||||
///
|
///
|
||||||
/// let specs = vec![
|
/// let specs = vec![
|
||||||
/// "https://crates.io/foo",
|
/// "https://crates.io/foo",
|
||||||
@ -280,7 +280,7 @@ impl<'de> de::Deserialize<'de> for PackageIdSpec {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::PackageIdSpec;
|
use super::PackageIdSpec;
|
||||||
use crate::util_schemas::core::{GitReference, SourceKind};
|
use crate::core::{GitReference, SourceKind};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
@ -1,32 +1,8 @@
|
|||||||
use std::fmt::{self, Display};
|
use std::fmt::{self, Display};
|
||||||
|
|
||||||
use semver::{Comparator, Op, Version, VersionReq};
|
use semver::{Comparator, Version, VersionReq};
|
||||||
use serde_untagged::UntaggedEnumVisitor;
|
use serde_untagged::UntaggedEnumVisitor;
|
||||||
|
|
||||||
pub trait VersionExt {
|
|
||||||
fn is_prerelease(&self) -> bool;
|
|
||||||
|
|
||||||
fn to_exact_req(&self) -> VersionReq;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl VersionExt for Version {
|
|
||||||
fn is_prerelease(&self) -> bool {
|
|
||||||
!self.pre.is_empty()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_exact_req(&self) -> VersionReq {
|
|
||||||
VersionReq {
|
|
||||||
comparators: vec![Comparator {
|
|
||||||
op: Op::Exact,
|
|
||||||
major: self.major,
|
|
||||||
minor: Some(self.minor),
|
|
||||||
patch: Some(self.patch),
|
|
||||||
pre: self.pre.clone(),
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)]
|
||||||
pub struct PartialVersion {
|
pub struct PartialVersion {
|
||||||
pub major: u64,
|
pub major: u64,
|
@ -16,9 +16,9 @@ use serde::ser;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_untagged::UntaggedEnumVisitor;
|
use serde_untagged::UntaggedEnumVisitor;
|
||||||
|
|
||||||
use crate::util_schemas::core::PackageIdSpec;
|
use crate::core::PackageIdSpec;
|
||||||
use crate::util_schemas::restricted_names;
|
use crate::core::PartialVersion;
|
||||||
use crate::util_semver::PartialVersion;
|
use crate::restricted_names;
|
||||||
|
|
||||||
/// This type is used to deserialize `Cargo.toml` files.
|
/// This type is used to deserialize `Cargo.toml` files.
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
@ -7,6 +7,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cargo.workspace = true
|
cargo.workspace = true
|
||||||
|
cargo-util-schemas.workspace = true
|
||||||
cargo-util.workspace = true
|
cargo-util.workspace = true
|
||||||
proptest.workspace = true
|
proptest.workspace = true
|
||||||
varisat.workspace = true
|
varisat.workspace = true
|
||||||
|
@ -19,7 +19,7 @@ use cargo::core::{GitReference, SourceId};
|
|||||||
use cargo::sources::source::QueryKind;
|
use cargo::sources::source::QueryKind;
|
||||||
use cargo::sources::IndexSummary;
|
use cargo::sources::IndexSummary;
|
||||||
use cargo::util::{CargoResult, Config, IntoUrl};
|
use cargo::util::{CargoResult, Config, IntoUrl};
|
||||||
use cargo::util_schemas::manifest::RustVersion;
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
|
|
||||||
use proptest::collection::{btree_map, vec};
|
use proptest::collection::{btree_map, vec};
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
@ -168,6 +168,7 @@ fn bump_check(args: &clap::ArgMatches, config: &cargo::util::Config) -> CargoRes
|
|||||||
let mut cmd = ProcessBuilder::new("cargo");
|
let mut cmd = ProcessBuilder::new("cargo");
|
||||||
cmd.arg("semver-checks")
|
cmd.arg("semver-checks")
|
||||||
.arg("check-release")
|
.arg("check-release")
|
||||||
|
.args(&["--exclude", "cargo-util-schemas"]) // FIXME: Remove once 1.76 is stable
|
||||||
.arg("--workspace");
|
.arg("--workspace");
|
||||||
config.shell().status("Running", &cmd)?;
|
config.shell().status("Running", &cmd)?;
|
||||||
cmd.exec()?;
|
cmd.exec()?;
|
||||||
@ -177,6 +178,7 @@ fn bump_check(args: &clap::ArgMatches, config: &cargo::util::Config) -> CargoRes
|
|||||||
cmd.arg("semver-checks")
|
cmd.arg("semver-checks")
|
||||||
.arg("--workspace")
|
.arg("--workspace")
|
||||||
.args(&["--exclude", "rustfix"]) // FIXME: Remove once 1.76 is stable
|
.args(&["--exclude", "rustfix"]) // FIXME: Remove once 1.76 is stable
|
||||||
|
.args(&["--exclude", "cargo-util-schemas"]) // FIXME: Remove once 1.76 is stable
|
||||||
.arg("--baseline-rev")
|
.arg("--baseline-rev")
|
||||||
.arg(referenced_commit.id().to_string());
|
.arg(referenced_commit.id().to_string());
|
||||||
for krate in crates_not_check_against_channels {
|
for krate in crates_not_check_against_channels {
|
||||||
|
@ -25,6 +25,7 @@ TO_PUBLISH = [
|
|||||||
'crates/cargo-platform',
|
'crates/cargo-platform',
|
||||||
'crates/cargo-util',
|
'crates/cargo-util',
|
||||||
'crates/crates-io',
|
'crates/crates-io',
|
||||||
|
'crates/cargo-util-schemas',
|
||||||
'.',
|
'.',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use anyhow::format_err;
|
|||||||
use cargo::core::{GitReference, SourceId, Workspace};
|
use cargo::core::{GitReference, SourceId, Workspace};
|
||||||
use cargo::ops;
|
use cargo::ops;
|
||||||
use cargo::util::IntoUrl;
|
use cargo::util::IntoUrl;
|
||||||
use cargo::util_semver::VersionExt;
|
use cargo::util::VersionExt;
|
||||||
use cargo::CargoResult;
|
use cargo::CargoResult;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use semver::VersionReq;
|
use semver::VersionReq;
|
||||||
|
@ -4,8 +4,8 @@ use cargo::util::network::http::http_handle;
|
|||||||
use cargo::util::network::http::needs_custom_http_transport;
|
use cargo::util::network::http::needs_custom_http_transport;
|
||||||
use cargo::util::CliError;
|
use cargo::util::CliError;
|
||||||
use cargo::util::{self, closest_msg, command_prelude, CargoResult, CliResult, Config};
|
use cargo::util::{self, closest_msg, command_prelude, CargoResult, CliResult, Config};
|
||||||
use cargo::util_schemas::manifest::StringOrVec;
|
|
||||||
use cargo_util::{ProcessBuilder, ProcessError};
|
use cargo_util::{ProcessBuilder, ProcessError};
|
||||||
|
use cargo_util_schemas::manifest::StringOrVec;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
@ -94,9 +94,9 @@ use crate::util::errors::{CargoResult, VerboseError};
|
|||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::machine_message::{self, Message};
|
use crate::util::machine_message::{self, Message};
|
||||||
use crate::util::{add_path_args, internal, iter_join_onto, profile};
|
use crate::util::{add_path_args, internal, iter_join_onto, profile};
|
||||||
use crate::util_schemas::manifest::TomlDebugInfo;
|
|
||||||
use crate::util_schemas::manifest::TomlTrimPaths;
|
|
||||||
use cargo_util::{paths, ProcessBuilder, ProcessError};
|
use cargo_util::{paths, ProcessBuilder, ProcessError};
|
||||||
|
use cargo_util_schemas::manifest::TomlDebugInfo;
|
||||||
|
use cargo_util_schemas::manifest::TomlTrimPaths;
|
||||||
use rustfix::diagnostics::Applicability;
|
use rustfix::diagnostics::Applicability;
|
||||||
|
|
||||||
const RUSTDOC_CRATE_VERSION_FLAG: &str = "--crate-version";
|
const RUSTDOC_CRATE_VERSION_FLAG: &str = "--crate-version";
|
||||||
|
@ -6,6 +6,8 @@ use std::rc::Rc;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
|
use cargo_util_schemas::manifest::{TomlManifest, TomlProfiles};
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use serde::ser;
|
use serde::ser;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@ -19,8 +21,6 @@ use crate::core::{Edition, Feature, Features, WorkspaceConfig};
|
|||||||
use crate::util::errors::*;
|
use crate::util::errors::*;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::{short_hash, Config, Filesystem};
|
use crate::util::{short_hash, Config, Filesystem};
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use crate::util_schemas::manifest::{TomlManifest, TomlProfiles};
|
|
||||||
|
|
||||||
pub enum EitherManifest {
|
pub enum EitherManifest {
|
||||||
Real(Manifest),
|
Real(Manifest),
|
||||||
|
@ -14,7 +14,7 @@ pub use self::workspace::{
|
|||||||
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,
|
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,
|
||||||
WorkspaceRootConfig,
|
WorkspaceRootConfig,
|
||||||
};
|
};
|
||||||
pub use crate::util_schemas::core::{GitReference, PackageIdSpec, SourceKind};
|
pub use cargo_util_schemas::core::{GitReference, PackageIdSpec, SourceKind};
|
||||||
|
|
||||||
pub mod compiler;
|
pub mod compiler;
|
||||||
pub mod dependency;
|
pub mod dependency;
|
||||||
|
@ -10,6 +10,7 @@ use std::time::{Duration, Instant};
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use bytesize::ByteSize;
|
use bytesize::ByteSize;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use curl::easy::Easy;
|
use curl::easy::Easy;
|
||||||
use curl::multi::{EasyHandle, Multi};
|
use curl::multi::{EasyHandle, Multi};
|
||||||
use lazycell::LazyCell;
|
use lazycell::LazyCell;
|
||||||
@ -33,7 +34,6 @@ use crate::util::network::retry::{Retry, RetryResult};
|
|||||||
use crate::util::network::sleep::SleepTracker;
|
use crate::util::network::sleep::SleepTracker;
|
||||||
use crate::util::toml::prepare_for_publish;
|
use crate::util::toml::prepare_for_publish;
|
||||||
use crate::util::{self, internal, Config, Progress, ProgressStyle};
|
use crate::util::{self, internal, Config, Progress, ProgressStyle};
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
|
|
||||||
pub const MANIFEST_PREAMBLE: &str = "\
|
pub const MANIFEST_PREAMBLE: &str = "\
|
||||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||||
|
@ -31,12 +31,12 @@ use crate::core::{
|
|||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::toml::validate_profile;
|
use crate::util::toml::validate_profile;
|
||||||
use crate::util::{closest_msg, config, CargoResult, Config};
|
use crate::util::{closest_msg, config, CargoResult, Config};
|
||||||
use crate::util_schemas::manifest::TomlTrimPaths;
|
use anyhow::{bail, Context as _};
|
||||||
use crate::util_schemas::manifest::TomlTrimPathsValue;
|
use cargo_util_schemas::manifest::TomlTrimPaths;
|
||||||
use crate::util_schemas::manifest::{
|
use cargo_util_schemas::manifest::TomlTrimPathsValue;
|
||||||
|
use cargo_util_schemas::manifest::{
|
||||||
ProfilePackageSpec, StringOrBool, TomlDebugInfo, TomlProfile, TomlProfiles,
|
ProfilePackageSpec, StringOrBool, TomlDebugInfo, TomlProfile, TomlProfiles,
|
||||||
};
|
};
|
||||||
use anyhow::{bail, Context as _};
|
|
||||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::{cmp, fmt, hash};
|
use std::{cmp, fmt, hash};
|
||||||
|
@ -4,8 +4,7 @@ use std::task::Poll;
|
|||||||
use crate::core::{Dependency, PackageId, Registry, Summary};
|
use crate::core::{Dependency, PackageId, Registry, Summary};
|
||||||
use crate::sources::source::QueryKind;
|
use crate::sources::source::QueryKind;
|
||||||
use crate::util::edit_distance::edit_distance;
|
use crate::util::edit_distance::edit_distance;
|
||||||
use crate::util::{Config, OptVersionReq};
|
use crate::util::{Config, OptVersionReq, VersionExt};
|
||||||
use crate::util_semver::VersionExt;
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
|
|
||||||
use super::context::Context;
|
use super::context::Context;
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
|
|
||||||
use crate::core::{Dependency, PackageId, Summary};
|
use crate::core::{Dependency, PackageId, Summary};
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
|
|
||||||
/// A collection of preferences for particular package versions.
|
/// A collection of preferences for particular package versions.
|
||||||
///
|
///
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::core::{Dependency, PackageId, SourceId};
|
use crate::core::{Dependency, PackageId, SourceId};
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::CargoResult;
|
use crate::util::CargoResult;
|
||||||
use crate::util_schemas::manifest::FeatureName;
|
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
|
use cargo_util_schemas::manifest::FeatureName;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -26,10 +26,10 @@ use crate::util::errors::{CargoResult, ManifestError};
|
|||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::toml::{read_manifest, InheritableFields};
|
use crate::util::toml::{read_manifest, InheritableFields};
|
||||||
use crate::util::{config::ConfigRelativePath, Config, Filesystem, IntoUrl};
|
use crate::util::{config::ConfigRelativePath, Config, Filesystem, IntoUrl};
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use crate::util_schemas::manifest::{TomlDependency, TomlProfiles};
|
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
use cargo_util::paths::normalize_path;
|
use cargo_util::paths::normalize_path;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
|
use cargo_util_schemas::manifest::{TomlDependency, TomlProfiles};
|
||||||
use pathdiff::diff_paths;
|
use pathdiff::diff_paths;
|
||||||
|
|
||||||
/// The core abstraction in Cargo for working with a workspace of crates.
|
/// The core abstraction in Cargo for working with a workspace of crates.
|
||||||
|
@ -62,6 +62,9 @@
|
|||||||
//! - [`cargo-util`](https://crates.io/crates/cargo-util)
|
//! - [`cargo-util`](https://crates.io/crates/cargo-util)
|
||||||
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/cargo_util)):
|
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/cargo_util)):
|
||||||
//! This contains general utility code that is shared between cargo and the testsuite
|
//! This contains general utility code that is shared between cargo and the testsuite
|
||||||
|
//! - [`cargo-util-schemas`](https://crates.io/crates/cargo-util-schemas)
|
||||||
|
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/cargo_util-schemas)):
|
||||||
|
//! This contains the serde schemas for cargo
|
||||||
//! - [`crates-io`](https://crates.io/crates/crates-io)
|
//! - [`crates-io`](https://crates.io/crates/crates-io)
|
||||||
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/crates_io)):
|
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/crates_io)):
|
||||||
//! This contains code for accessing the crates.io API.
|
//! This contains code for accessing the crates.io API.
|
||||||
@ -98,7 +101,7 @@
|
|||||||
//! Files that interact with cargo include
|
//! Files that interact with cargo include
|
||||||
//!
|
//!
|
||||||
//! - Package
|
//! - Package
|
||||||
//! - `Cargo.toml`: User-written project manifest, loaded with [`util_schemas::manifest::TomlManifest`] and then
|
//! - `Cargo.toml`: User-written project manifest, loaded with [`util::toml::read_manifest`] and then
|
||||||
//! translated to [`core::manifest::Manifest`] which maybe stored in a [`core::Package`].
|
//! translated to [`core::manifest::Manifest`] which maybe stored in a [`core::Package`].
|
||||||
//! - This is editable with [`util::toml_mut::manifest::LocalManifest`]
|
//! - This is editable with [`util::toml_mut::manifest::LocalManifest`]
|
||||||
//! - `Cargo.lock`: Generally loaded with [`ops::resolve_ws`] or a variant of it into a [`core::resolver::Resolve`]
|
//! - `Cargo.lock`: Generally loaded with [`ops::resolve_ws`] or a variant of it into a [`core::resolver::Resolve`]
|
||||||
@ -152,8 +155,6 @@ pub mod core;
|
|||||||
pub mod ops;
|
pub mod ops;
|
||||||
pub mod sources;
|
pub mod sources;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod util_schemas;
|
|
||||||
pub mod util_semver;
|
|
||||||
mod version;
|
mod version;
|
||||||
|
|
||||||
pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! {
|
pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! {
|
||||||
|
@ -4,8 +4,8 @@ use anyhow::Context as _;
|
|||||||
|
|
||||||
use super::Dependency;
|
use super::Dependency;
|
||||||
use crate::util::toml_mut::dependency::RegistrySource;
|
use crate::util::toml_mut::dependency::RegistrySource;
|
||||||
use crate::util_schemas::manifest::PackageName;
|
|
||||||
use crate::CargoResult;
|
use crate::CargoResult;
|
||||||
|
use cargo_util_schemas::manifest::PackageName;
|
||||||
|
|
||||||
/// User-specified crate
|
/// User-specified crate
|
||||||
///
|
///
|
||||||
|
@ -11,6 +11,7 @@ use std::str::FromStr;
|
|||||||
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use indexmap::IndexSet;
|
use indexmap::IndexSet;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use toml_edit::Item as TomlItem;
|
use toml_edit::Item as TomlItem;
|
||||||
@ -35,7 +36,6 @@ use crate::util::toml_mut::dependency::WorkspaceSource;
|
|||||||
use crate::util::toml_mut::is_sorted;
|
use crate::util::toml_mut::is_sorted;
|
||||||
use crate::util::toml_mut::manifest::DepTable;
|
use crate::util::toml_mut::manifest::DepTable;
|
||||||
use crate::util::toml_mut::manifest::LocalManifest;
|
use crate::util::toml_mut::manifest::LocalManifest;
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use crate::CargoResult;
|
use crate::CargoResult;
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
use crate_spec::CrateSpec;
|
use crate_spec::CrateSpec;
|
||||||
|
@ -4,9 +4,9 @@ use crate::util::important_paths::find_root_manifest_for_wd;
|
|||||||
use crate::util::toml_mut::is_sorted;
|
use crate::util::toml_mut::is_sorted;
|
||||||
use crate::util::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
use crate::util::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
||||||
use crate::util::{restricted_names, Config};
|
use crate::util::{restricted_names, Config};
|
||||||
use crate::util_schemas::manifest::PackageName;
|
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use cargo_util::paths::{self, write_atomic};
|
use cargo_util::paths::{self, write_atomic};
|
||||||
|
use cargo_util_schemas::manifest::PackageName;
|
||||||
use serde::de;
|
use serde::de;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
@ -72,8 +72,8 @@ use crate::sources::PathSource;
|
|||||||
use crate::util::cache_lock::CacheLockMode;
|
use crate::util::cache_lock::CacheLockMode;
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::{profile, CanonicalUrl};
|
use crate::util::{profile, CanonicalUrl};
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//! [CVE-2022-46176]: https://blog.rust-lang.org/2023/01/10/cve-2022-46176.html
|
//! [CVE-2022-46176]: https://blog.rust-lang.org/2023/01/10/cve-2022-46176.html
|
||||||
|
|
||||||
pub use self::source::GitSource;
|
pub use self::source::GitSource;
|
||||||
pub use self::utils::{fetch, GitCheckout, GitDatabase, GitRemote};
|
pub use self::utils::{fetch, resolve_ref, GitCheckout, GitDatabase, GitRemote};
|
||||||
mod known_hosts;
|
mod known_hosts;
|
||||||
mod oxide;
|
mod oxide;
|
||||||
mod source;
|
mod source;
|
||||||
|
@ -123,7 +123,7 @@ impl GitRemote {
|
|||||||
|
|
||||||
let resolved_commit_hash = match locked_rev {
|
let resolved_commit_hash = match locked_rev {
|
||||||
Some(rev) => db.contains(rev).then_some(rev),
|
Some(rev) => db.contains(rev).then_some(rev),
|
||||||
None => reference.resolve(&db.repo).ok(),
|
None => resolve_ref(reference, &db.repo).ok(),
|
||||||
};
|
};
|
||||||
if let Some(rev) = resolved_commit_hash {
|
if let Some(rev) = resolved_commit_hash {
|
||||||
return Ok((db, rev));
|
return Ok((db, rev));
|
||||||
@ -148,7 +148,7 @@ impl GitRemote {
|
|||||||
.with_context(|| format!("failed to clone into: {}", into.display()))?;
|
.with_context(|| format!("failed to clone into: {}", into.display()))?;
|
||||||
let rev = match locked_rev {
|
let rev = match locked_rev {
|
||||||
Some(rev) => rev,
|
Some(rev) => rev,
|
||||||
None => reference.resolve(&repo)?,
|
None => resolve_ref(reference, &repo)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
@ -207,16 +207,15 @@ impl GitDatabase {
|
|||||||
self.repo.revparse_single(&oid.to_string()).is_ok()
|
self.repo.revparse_single(&oid.to_string()).is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [`GitReference::resolve`]s this reference with this database.
|
/// [`resolve_ref`]s this reference with this database.
|
||||||
pub fn resolve(&self, r: &GitReference) -> CargoResult<git2::Oid> {
|
pub fn resolve(&self, r: &GitReference) -> CargoResult<git2::Oid> {
|
||||||
r.resolve(&self.repo)
|
resolve_ref(r, &self.repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GitReference {
|
/// Resolves [`GitReference`] to an object ID with objects the `repo` currently has.
|
||||||
/// Resolves self to an object ID with objects the `repo` currently has.
|
pub fn resolve_ref(gitref: &GitReference, repo: &git2::Repository) -> CargoResult<git2::Oid> {
|
||||||
pub fn resolve(&self, repo: &git2::Repository) -> CargoResult<git2::Oid> {
|
let id = match gitref {
|
||||||
let id = match self {
|
|
||||||
// Note that we resolve the named tag here in sync with where it's
|
// Note that we resolve the named tag here in sync with where it's
|
||||||
// fetched into via `fetch` below.
|
// fetched into via `fetch` below.
|
||||||
GitReference::Tag(s) => (|| -> CargoResult<git2::Oid> {
|
GitReference::Tag(s) => (|| -> CargoResult<git2::Oid> {
|
||||||
@ -257,7 +256,6 @@ impl GitReference {
|
|||||||
};
|
};
|
||||||
Ok(id)
|
Ok(id)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> GitCheckout<'a> {
|
impl<'a> GitCheckout<'a> {
|
||||||
/// Creates an instance of [`GitCheckout`]. This doesn't imply the checkout
|
/// Creates an instance of [`GitCheckout`]. This doesn't imply the checkout
|
||||||
@ -1404,7 +1402,7 @@ fn github_fast_path(
|
|||||||
return Ok(FastPathRev::Indeterminate);
|
return Ok(FastPathRev::Indeterminate);
|
||||||
}
|
}
|
||||||
|
|
||||||
let local_object = reference.resolve(repo).ok();
|
let local_object = resolve_ref(reference, repo).ok();
|
||||||
|
|
||||||
let github_branch_name = match reference {
|
let github_branch_name = match reference {
|
||||||
GitReference::Branch(branch) => branch,
|
GitReference::Branch(branch) => branch,
|
||||||
|
@ -93,9 +93,9 @@ use crate::util::cache_lock::CacheLockMode;
|
|||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::IntoUrl;
|
use crate::util::IntoUrl;
|
||||||
use crate::util::{internal, CargoResult, Config, Filesystem, OptVersionReq};
|
use crate::util::{internal, CargoResult, Config, Filesystem, OptVersionReq};
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use cargo_util::{paths, registry::make_dep_path};
|
use cargo_util::{paths, registry::make_dep_path};
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -4,6 +4,7 @@ use crate::core::global_cache_tracker;
|
|||||||
use crate::core::{GitReference, PackageId, SourceId};
|
use crate::core::{GitReference, PackageId, SourceId};
|
||||||
use crate::sources::git;
|
use crate::sources::git;
|
||||||
use crate::sources::git::fetch::RemoteKind;
|
use crate::sources::git::fetch::RemoteKind;
|
||||||
|
use crate::sources::git::resolve_ref;
|
||||||
use crate::sources::registry::download;
|
use crate::sources::registry::download;
|
||||||
use crate::sources::registry::MaybeLock;
|
use crate::sources::registry::MaybeLock;
|
||||||
use crate::sources::registry::{LoadResponse, RegistryConfig, RegistryData};
|
use crate::sources::registry::{LoadResponse, RegistryConfig, RegistryData};
|
||||||
@ -149,7 +150,7 @@ impl<'cfg> RemoteRegistry<'cfg> {
|
|||||||
fn head(&self) -> CargoResult<git2::Oid> {
|
fn head(&self) -> CargoResult<git2::Oid> {
|
||||||
if self.head.get().is_none() {
|
if self.head.get().is_none() {
|
||||||
let repo = self.repo()?;
|
let repo = self.repo()?;
|
||||||
let oid = self.index_git_ref.resolve(repo)?;
|
let oid = resolve_ref(&self.index_git_ref, repo)?;
|
||||||
self.head.set(Some(oid));
|
self.head.set(Some(oid));
|
||||||
}
|
}
|
||||||
Ok(self.head.get().unwrap())
|
Ok(self.head.get().unwrap())
|
||||||
|
@ -11,12 +11,12 @@ use crate::util::{
|
|||||||
print_available_benches, print_available_binaries, print_available_examples,
|
print_available_benches, print_available_binaries, print_available_examples,
|
||||||
print_available_packages, print_available_tests,
|
print_available_packages, print_available_tests,
|
||||||
};
|
};
|
||||||
use crate::util_schemas::manifest::ProfileName;
|
|
||||||
use crate::util_schemas::manifest::RegistryName;
|
|
||||||
use crate::util_schemas::manifest::StringOrVec;
|
|
||||||
use crate::CargoResult;
|
use crate::CargoResult;
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
|
use cargo_util_schemas::manifest::ProfileName;
|
||||||
|
use cargo_util_schemas::manifest::RegistryName;
|
||||||
|
use cargo_util_schemas::manifest::StringOrVec;
|
||||||
use clap::builder::UnknownArgumentValueParser;
|
use clap::builder::UnknownArgumentValueParser;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -80,10 +80,10 @@ use crate::util::network::http::http_handle;
|
|||||||
use crate::util::try_canonicalize;
|
use crate::util::try_canonicalize;
|
||||||
use crate::util::{internal, CanonicalUrl};
|
use crate::util::{internal, CanonicalUrl};
|
||||||
use crate::util::{Filesystem, IntoUrl, IntoUrlWithBase, Rustc};
|
use crate::util::{Filesystem, IntoUrl, IntoUrlWithBase, Rustc};
|
||||||
use crate::util_schemas::manifest::RegistryName;
|
|
||||||
use anyhow::{anyhow, bail, format_err, Context as _};
|
use anyhow::{anyhow, bail, format_err, Context as _};
|
||||||
use cargo_credential::Secret;
|
use cargo_credential::Secret;
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
|
use cargo_util_schemas::manifest::RegistryName;
|
||||||
use curl::easy::Easy;
|
use curl::easy::Easy;
|
||||||
use lazycell::LazyCell;
|
use lazycell::LazyCell;
|
||||||
use serde::de::IntoDeserializer as _;
|
use serde::de::IntoDeserializer as _;
|
||||||
|
@ -22,7 +22,7 @@ pub use self::lockserver::{LockServer, LockServerClient, LockServerStarted};
|
|||||||
pub use self::progress::{Progress, ProgressStyle};
|
pub use self::progress::{Progress, ProgressStyle};
|
||||||
pub use self::queue::Queue;
|
pub use self::queue::Queue;
|
||||||
pub use self::rustc::Rustc;
|
pub use self::rustc::Rustc;
|
||||||
pub use self::semver_ext::OptVersionReq;
|
pub use self::semver_ext::{OptVersionReq, VersionExt};
|
||||||
pub use self::vcs::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
pub use self::vcs::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
||||||
pub use self::workspace::{
|
pub use self::workspace::{
|
||||||
add_path_args, path_args, print_available_benches, print_available_binaries,
|
add_path_args, path_args, print_available_benches, print_available_binaries,
|
||||||
|
@ -1,8 +1,30 @@
|
|||||||
use std::fmt::{self, Display};
|
use std::fmt::{self, Display};
|
||||||
|
|
||||||
use semver::{Op, Version, VersionReq};
|
use semver::{Comparator, Op, Version, VersionReq};
|
||||||
|
|
||||||
use crate::util_semver::VersionExt as _;
|
pub trait VersionExt {
|
||||||
|
fn is_prerelease(&self) -> bool;
|
||||||
|
|
||||||
|
fn to_exact_req(&self) -> VersionReq;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VersionExt for Version {
|
||||||
|
fn is_prerelease(&self) -> bool {
|
||||||
|
!self.pre.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_exact_req(&self) -> VersionReq {
|
||||||
|
VersionReq {
|
||||||
|
comparators: vec![Comparator {
|
||||||
|
op: Op::Exact,
|
||||||
|
major: self.major,
|
||||||
|
minor: Some(self.minor),
|
||||||
|
patch: Some(self.patch),
|
||||||
|
pre: self.pre.clone(),
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
|
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
|
||||||
pub enum OptVersionReq {
|
pub enum OptVersionReq {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
|
|
||||||
|
use cargo_util_schemas::manifest::PackageName;
|
||||||
|
|
||||||
use crate::util::restricted_names;
|
use crate::util::restricted_names;
|
||||||
use crate::util_schemas::manifest::PackageName;
|
|
||||||
use crate::CargoResult;
|
use crate::CargoResult;
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ use std::str::{self, FromStr};
|
|||||||
use anyhow::{anyhow, bail, Context as _};
|
use anyhow::{anyhow, bail, Context as _};
|
||||||
use cargo_platform::Platform;
|
use cargo_platform::Platform;
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
|
use cargo_util_schemas::manifest;
|
||||||
|
use cargo_util_schemas::manifest::RustVersion;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lazycell::LazyCell;
|
use lazycell::LazyCell;
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
@ -24,8 +26,6 @@ use crate::sources::{CRATES_IO_INDEX, CRATES_IO_REGISTRY};
|
|||||||
use crate::util::errors::{CargoResult, ManifestError};
|
use crate::util::errors::{CargoResult, ManifestError};
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::{self, config::ConfigRelativePath, Config, IntoUrl, OptVersionReq};
|
use crate::util::{self, config::ConfigRelativePath, Config, IntoUrl, OptVersionReq};
|
||||||
use crate::util_schemas::manifest;
|
|
||||||
use crate::util_schemas::manifest::RustVersion;
|
|
||||||
|
|
||||||
mod embedded;
|
mod embedded;
|
||||||
mod targets;
|
mod targets;
|
||||||
|
@ -14,18 +14,18 @@ use std::collections::HashSet;
|
|||||||
use std::fs::{self, DirEntry};
|
use std::fs::{self, DirEntry};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use anyhow::Context as _;
|
||||||
|
use cargo_util_schemas::manifest::{
|
||||||
|
PathValue, StringOrBool, StringOrVec, TomlBenchTarget, TomlBinTarget, TomlExampleTarget,
|
||||||
|
TomlLibTarget, TomlManifest, TomlTarget, TomlTestTarget,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::core::compiler::rustdoc::RustdocScrapeExamples;
|
use crate::core::compiler::rustdoc::RustdocScrapeExamples;
|
||||||
use crate::core::compiler::CrateType;
|
use crate::core::compiler::CrateType;
|
||||||
use crate::core::{Edition, Feature, Features, Target};
|
use crate::core::{Edition, Feature, Features, Target};
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::restricted_names;
|
use crate::util::restricted_names;
|
||||||
use crate::util::toml::warn_on_deprecated;
|
use crate::util::toml::warn_on_deprecated;
|
||||||
use crate::util_schemas::manifest::{
|
|
||||||
PathValue, StringOrBool, StringOrVec, TomlBenchTarget, TomlBinTarget, TomlExampleTarget,
|
|
||||||
TomlLibTarget, TomlManifest, TomlTarget, TomlTestTarget,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::Context as _;
|
|
||||||
|
|
||||||
const DEFAULT_TEST_DIR_NAME: &'static str = "tests";
|
const DEFAULT_TEST_DIR_NAME: &'static str = "tests";
|
||||||
const DEFAULT_BENCH_DIR_NAME: &'static str = "benches";
|
const DEFAULT_BENCH_DIR_NAME: &'static str = "benches";
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
use cargo::core::{PackageIdSpec, Shell};
|
use cargo::core::{PackageIdSpec, Shell};
|
||||||
use cargo::util::config::{self, Config, Definition, JobsConfig, SslVersionConfig, StringList};
|
use cargo::util::config::{self, Config, Definition, JobsConfig, SslVersionConfig, StringList};
|
||||||
use cargo::util_schemas::manifest::TomlTrimPaths;
|
|
||||||
use cargo::util_schemas::manifest::TomlTrimPathsValue;
|
|
||||||
use cargo::util_schemas::manifest::{self as cargo_toml, TomlDebugInfo, VecStringOrBool as VSOB};
|
|
||||||
use cargo::CargoResult;
|
use cargo::CargoResult;
|
||||||
use cargo_test_support::compare;
|
use cargo_test_support::compare;
|
||||||
use cargo_test_support::{panic_error, paths, project, symlink_supported, t};
|
use cargo_test_support::{panic_error, paths, project, symlink_supported, t};
|
||||||
|
use cargo_util_schemas::manifest::TomlTrimPaths;
|
||||||
|
use cargo_util_schemas::manifest::TomlTrimPathsValue;
|
||||||
|
use cargo_util_schemas::manifest::{self as cargo_toml, TomlDebugInfo, VecStringOrBool as VSOB};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//! Tests for profiles defined in config files.
|
//! Tests for profiles defined in config files.
|
||||||
|
|
||||||
use cargo::util_schemas::manifest::TomlDebugInfo;
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_lib_manifest, paths, project};
|
use cargo_test_support::{basic_lib_manifest, paths, project};
|
||||||
|
use cargo_util_schemas::manifest::TomlDebugInfo;
|
||||||
|
|
||||||
// TODO: this should be remove once -Zprofile-rustflags is stabilized
|
// TODO: this should be remove once -Zprofile-rustflags is stabilized
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user