mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Convert --explicit-version -> --versioned-dirs
This commit is contained in:
parent
78f45b95dc
commit
fd80795503
@ -28,9 +28,8 @@ pub fn cli() -> App {
|
|||||||
.multiple(true),
|
.multiple(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("explicit-version")
|
Arg::with_name("versioned-dirs")
|
||||||
.short("-x")
|
.long("versioned-dirs")
|
||||||
.long("explicit-version")
|
|
||||||
.help("Always include version in subdir name"),
|
.help("Always include version in subdir name"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@ -114,7 +113,7 @@ https://github.com/rust-lang/cargo/issues/new
|
|||||||
&ops::VendorOptions {
|
&ops::VendorOptions {
|
||||||
no_delete: args.is_present("no-delete"),
|
no_delete: args.is_present("no-delete"),
|
||||||
destination: &path,
|
destination: &path,
|
||||||
explicit_version: args.is_present("explicit-version"),
|
versioned_dirs: args.is_present("versioned-dirs"),
|
||||||
extra: args
|
extra: args
|
||||||
.values_of_os("tomls")
|
.values_of_os("tomls")
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
|
@ -14,7 +14,7 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
pub struct VendorOptions<'a> {
|
pub struct VendorOptions<'a> {
|
||||||
pub no_delete: bool,
|
pub no_delete: bool,
|
||||||
pub explicit_version: bool,
|
pub versioned_dirs: bool,
|
||||||
pub destination: &'a Path,
|
pub destination: &'a Path,
|
||||||
pub extra: Vec<PathBuf>,
|
pub extra: Vec<PathBuf>,
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ fn sync(
|
|||||||
.parent()
|
.parent()
|
||||||
.expect("manifest_path should point to a file");
|
.expect("manifest_path should point to a file");
|
||||||
let max_version = *versions[&id.name()].iter().rev().next().unwrap().0;
|
let max_version = *versions[&id.name()].iter().rev().next().unwrap().0;
|
||||||
let dir_has_version_suffix = opts.explicit_version || id.version() != max_version;
|
let dir_has_version_suffix = opts.versioned_dirs || id.version() != max_version;
|
||||||
let dst_name = if dir_has_version_suffix {
|
let dst_name = if dir_has_version_suffix {
|
||||||
// Eg vendor/futures-0.1.13
|
// Eg vendor/futures-0.1.13
|
||||||
format!("{}-{}", id.name(), id.version())
|
format!("{}-{}", id.name(), id.version())
|
||||||
|
@ -57,10 +57,10 @@ Don\(cqt delete the "vendor" directory when vendoring, but rather keep all
|
|||||||
existing contents of the vendor directory.
|
existing contents of the vendor directory.
|
||||||
.RE
|
.RE
|
||||||
.sp
|
.sp
|
||||||
\fB\-\-explicit\-version\fP
|
\fB\-\-versioned\-dirs\fP
|
||||||
.RS 4
|
.RS 4
|
||||||
Normally versions are only added to disambiguate multiple versions of the same package.
|
Normally versions are only added to disambiguate multiple versions of the same package.
|
||||||
This option causes all directories in the "vendor" directory to be explicitly versioned,
|
This option causes all directories in the "vendor" directory to be versioned,
|
||||||
which makes it easier to track the history of vendored packages over time, and can help
|
which makes it easier to track the history of vendored packages over time, and can help
|
||||||
with the performance of re-vendoring when only a subset of the packages have changed.
|
with the performance of re-vendoring when only a subset of the packages have changed.
|
||||||
.RE
|
.RE
|
||||||
|
@ -121,7 +121,7 @@ fn two_explicit_versions() {
|
|||||||
Package::new("bitflags", "0.7.0").publish();
|
Package::new("bitflags", "0.7.0").publish();
|
||||||
Package::new("bitflags", "0.8.0").publish();
|
Package::new("bitflags", "0.8.0").publish();
|
||||||
|
|
||||||
p.cargo("vendor --respect-source-config --explicit-version")
|
p.cargo("vendor --respect-source-config --versioned-dirs")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
let lock = p.read_file("vendor/bitflags-0.8.0/Cargo.toml");
|
let lock = p.read_file("vendor/bitflags-0.8.0/Cargo.toml");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user