mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Remove shared-target gc kind.
This kind is unlikely to be implemented in the foreseeable future, and we don't really know what it is going to look like.
This commit is contained in:
parent
ead7904ad4
commit
9a41a6110c
@ -29,15 +29,14 @@ pub fn cli() -> Command {
|
||||
.hide(true)
|
||||
.value_name("KINDS")
|
||||
.value_parser(
|
||||
PossibleValuesParser::new(["all", "download", "target", "shared-target"]).map(
|
||||
|x| match x.as_str() {
|
||||
PossibleValuesParser::new(["all", "download", "target"]).map(|x| {
|
||||
match x.as_str() {
|
||||
"all" => AutoGcKind::All,
|
||||
"download" => AutoGcKind::Download,
|
||||
"target" => panic!("target is not yet implemented"),
|
||||
"shared-target" => panic!("shared-target is not yet implemented"),
|
||||
x => panic!("possible value out of sync with `{x}`"),
|
||||
},
|
||||
),
|
||||
}
|
||||
}),
|
||||
)
|
||||
.require_equals(true),
|
||||
)
|
||||
@ -150,17 +149,6 @@ pub fn cli() -> Command {
|
||||
.value_parser(parse_time_span)
|
||||
.hide(true),
|
||||
)
|
||||
.arg(
|
||||
// TODO: come up with something less wordy?
|
||||
opt(
|
||||
"max-shared-target-age",
|
||||
"Deletes any shared build artifact files that have not been used \
|
||||
since the given age (unstable) (UNIMPLEMENTED)",
|
||||
)
|
||||
.value_name("DURATION")
|
||||
.value_parser(parse_time_span)
|
||||
.hide(true),
|
||||
)
|
||||
.arg(
|
||||
opt(
|
||||
"max-target-size",
|
||||
@ -171,17 +159,6 @@ pub fn cli() -> Command {
|
||||
.value_parser(parse_human_size)
|
||||
.hide(true),
|
||||
)
|
||||
.arg(
|
||||
// TODO: come up with something less wordy?
|
||||
opt(
|
||||
"max-shared-target-size",
|
||||
"Deletes shared build artifact files until the cache is under the given size \
|
||||
(unstable) (UNIMPLEMENTED)",
|
||||
)
|
||||
.value_name("SIZE")
|
||||
.value_parser(parse_human_size)
|
||||
.hide(true),
|
||||
)
|
||||
.after_help(color_print::cstr!(
|
||||
"Run `<cyan,bold>cargo help clean</>` for more detailed information.\n"
|
||||
))
|
||||
@ -255,9 +232,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
max_git_size: unstable_size_opt("max-git-size")?,
|
||||
max_download_size: unstable_size_opt("max-download-size")?,
|
||||
max_target_age: unimplemented_duration_opt("max-target-age")?,
|
||||
max_shared_target_age: unimplemented_duration_opt("max-shared-target-age")?,
|
||||
max_target_size: unimplemented_size_opt("max-target-size")?,
|
||||
max_shared_target_size: unimplemented_size_opt("max-shared-target-size")?,
|
||||
};
|
||||
let max_download_age = unstable_duration_opt("max-download-age")?;
|
||||
gc_opts.update_for_auto_gc(config, &gc, max_download_age)?;
|
||||
|
@ -137,12 +137,8 @@ pub struct GcOpts {
|
||||
|
||||
/// The `--max-target-age` CLI option (UNIMPLEMENTED).
|
||||
pub max_target_age: Option<Duration>,
|
||||
/// The `--max-shared-target-age CLI option (UNIMPLEMENTED).
|
||||
pub max_shared_target_age: Option<Duration>,
|
||||
/// The `--max-target-size` CLI option (UNIMPLEMENTED).
|
||||
pub max_target_size: Option<u64>,
|
||||
/// The `--max-shared-target-size` CLI option (UNIMPLEMENTED).
|
||||
pub max_shared_target_size: Option<u64>,
|
||||
}
|
||||
|
||||
impl GcOpts {
|
||||
@ -169,10 +165,7 @@ impl GcOpts {
|
||||
|
||||
/// Returns whether any target directory cleaning options are set.
|
||||
pub fn is_target_opt_set(&self) -> bool {
|
||||
self.max_target_size.is_some()
|
||||
|| self.max_target_age.is_some()
|
||||
|| self.max_shared_target_age.is_some()
|
||||
|| self.max_shared_target_size.is_some()
|
||||
self.max_target_size.is_some() || self.max_target_age.is_some()
|
||||
}
|
||||
|
||||
/// Updates the configuration of this [`GcOpts`] to incorporate the
|
||||
@ -256,7 +249,7 @@ impl GcOpts {
|
||||
.unwrap_or(DEFAULT_MAX_AGE_DOWNLOADED),
|
||||
)?;
|
||||
}
|
||||
if matches!(kind, AutoGcKind::Target | AutoGcKind::SharedTarget) {
|
||||
if matches!(kind, AutoGcKind::Target) {
|
||||
bail!("target is unimplemented");
|
||||
}
|
||||
}
|
||||
@ -291,12 +284,6 @@ pub enum AutoGcKind {
|
||||
///
|
||||
/// This corresponds to `cargo clean --gc=target`.
|
||||
Target,
|
||||
/// Automatically clean only the shared target directory.
|
||||
///
|
||||
/// THIS IS NOT IMPLEMENTED.
|
||||
///
|
||||
/// This corresponds to `cargo clean --gc=shared-target`.
|
||||
SharedTarget,
|
||||
}
|
||||
|
||||
/// Garbage collector.
|
||||
|
@ -201,12 +201,7 @@ See [..] for more information about the `{trimmed_opt}` flag.
|
||||
.run();
|
||||
}
|
||||
|
||||
for opt in [
|
||||
"--max-target-age=0 day",
|
||||
"--max-shared-target-age=0 day",
|
||||
"--max-target-size=0",
|
||||
"--max-shared-target-size=0",
|
||||
] {
|
||||
for opt in ["--max-target-age=0 day", "--max-target-size=0"] {
|
||||
let trimmed_opt = opt.split('=').next().unwrap();
|
||||
p.cargo("clean")
|
||||
.arg(opt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user