mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +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),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("explicit-version")
|
||||
.short("-x")
|
||||
.long("explicit-version")
|
||||
Arg::with_name("versioned-dirs")
|
||||
.long("versioned-dirs")
|
||||
.help("Always include version in subdir name"),
|
||||
)
|
||||
.arg(
|
||||
@ -114,7 +113,7 @@ https://github.com/rust-lang/cargo/issues/new
|
||||
&ops::VendorOptions {
|
||||
no_delete: args.is_present("no-delete"),
|
||||
destination: &path,
|
||||
explicit_version: args.is_present("explicit-version"),
|
||||
versioned_dirs: args.is_present("versioned-dirs"),
|
||||
extra: args
|
||||
.values_of_os("tomls")
|
||||
.unwrap_or_default()
|
||||
|
@ -14,7 +14,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
pub struct VendorOptions<'a> {
|
||||
pub no_delete: bool,
|
||||
pub explicit_version: bool,
|
||||
pub versioned_dirs: bool,
|
||||
pub destination: &'a Path,
|
||||
pub extra: Vec<PathBuf>,
|
||||
}
|
||||
@ -187,7 +187,7 @@ fn sync(
|
||||
.parent()
|
||||
.expect("manifest_path should point to a file");
|
||||
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 {
|
||||
// Eg vendor/futures-0.1.13
|
||||
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.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-explicit\-version\fP
|
||||
\fB\-\-versioned\-dirs\fP
|
||||
.RS 4
|
||||
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
|
||||
with the performance of re-vendoring when only a subset of the packages have changed.
|
||||
.RE
|
||||
|
@ -121,7 +121,7 @@ fn two_explicit_versions() {
|
||||
Package::new("bitflags", "0.7.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();
|
||||
|
||||
let lock = p.read_file("vendor/bitflags-0.8.0/Cargo.toml");
|
||||
|
Loading…
x
Reference in New Issue
Block a user