Skip to content

Commit 9a41a61

Browse files
committed
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.
1 parent ead7904 commit 9a41a61

File tree

3 files changed

+7
-50
lines changed

3 files changed

+7
-50
lines changed

src/bin/cargo/commands/clean.rs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ pub fn cli() -> Command {
2929
.hide(true)
3030
.value_name("KINDS")
3131
.value_parser(
32-
PossibleValuesParser::new(["all", "download", "target", "shared-target"]).map(
33-
|x| match x.as_str() {
32+
PossibleValuesParser::new(["all", "download", "target"]).map(|x| {
33+
match x.as_str() {
3434
"all" => AutoGcKind::All,
3535
"download" => AutoGcKind::Download,
3636
"target" => panic!("target is not yet implemented"),
37-
"shared-target" => panic!("shared-target is not yet implemented"),
3837
x => panic!("possible value out of sync with `{x}`"),
39-
},
40-
),
38+
}
39+
}),
4140
)
4241
.require_equals(true),
4342
)
@@ -150,17 +149,6 @@ pub fn cli() -> Command {
150149
.value_parser(parse_time_span)
151150
.hide(true),
152151
)
153-
.arg(
154-
// TODO: come up with something less wordy?
155-
opt(
156-
"max-shared-target-age",
157-
"Deletes any shared build artifact files that have not been used \
158-
since the given age (unstable) (UNIMPLEMENTED)",
159-
)
160-
.value_name("DURATION")
161-
.value_parser(parse_time_span)
162-
.hide(true),
163-
)
164152
.arg(
165153
opt(
166154
"max-target-size",
@@ -171,17 +159,6 @@ pub fn cli() -> Command {
171159
.value_parser(parse_human_size)
172160
.hide(true),
173161
)
174-
.arg(
175-
// TODO: come up with something less wordy?
176-
opt(
177-
"max-shared-target-size",
178-
"Deletes shared build artifact files until the cache is under the given size \
179-
(unstable) (UNIMPLEMENTED)",
180-
)
181-
.value_name("SIZE")
182-
.value_parser(parse_human_size)
183-
.hide(true),
184-
)
185162
.after_help(color_print::cstr!(
186163
"Run `<cyan,bold>cargo help clean</>` for more detailed information.\n"
187164
))
@@ -255,9 +232,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
255232
max_git_size: unstable_size_opt("max-git-size")?,
256233
max_download_size: unstable_size_opt("max-download-size")?,
257234
max_target_age: unimplemented_duration_opt("max-target-age")?,
258-
max_shared_target_age: unimplemented_duration_opt("max-shared-target-age")?,
259235
max_target_size: unimplemented_size_opt("max-target-size")?,
260-
max_shared_target_size: unimplemented_size_opt("max-shared-target-size")?,
261236
};
262237
let max_download_age = unstable_duration_opt("max-download-age")?;
263238
gc_opts.update_for_auto_gc(config, &gc, max_download_age)?;

src/cargo/core/gc.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,8 @@ pub struct GcOpts {
137137

138138
/// The `--max-target-age` CLI option (UNIMPLEMENTED).
139139
pub max_target_age: Option<Duration>,
140-
/// The `--max-shared-target-age CLI option (UNIMPLEMENTED).
141-
pub max_shared_target_age: Option<Duration>,
142140
/// The `--max-target-size` CLI option (UNIMPLEMENTED).
143141
pub max_target_size: Option<u64>,
144-
/// The `--max-shared-target-size` CLI option (UNIMPLEMENTED).
145-
pub max_shared_target_size: Option<u64>,
146142
}
147143

148144
impl GcOpts {
@@ -169,10 +165,7 @@ impl GcOpts {
169165

170166
/// Returns whether any target directory cleaning options are set.
171167
pub fn is_target_opt_set(&self) -> bool {
172-
self.max_target_size.is_some()
173-
|| self.max_target_age.is_some()
174-
|| self.max_shared_target_age.is_some()
175-
|| self.max_shared_target_size.is_some()
168+
self.max_target_size.is_some() || self.max_target_age.is_some()
176169
}
177170

178171
/// Updates the configuration of this [`GcOpts`] to incorporate the
@@ -256,7 +249,7 @@ impl GcOpts {
256249
.unwrap_or(DEFAULT_MAX_AGE_DOWNLOADED),
257250
)?;
258251
}
259-
if matches!(kind, AutoGcKind::Target | AutoGcKind::SharedTarget) {
252+
if matches!(kind, AutoGcKind::Target) {
260253
bail!("target is unimplemented");
261254
}
262255
}
@@ -291,12 +284,6 @@ pub enum AutoGcKind {
291284
///
292285
/// This corresponds to `cargo clean --gc=target`.
293286
Target,
294-
/// Automatically clean only the shared target directory.
295-
///
296-
/// THIS IS NOT IMPLEMENTED.
297-
///
298-
/// This corresponds to `cargo clean --gc=shared-target`.
299-
SharedTarget,
300287
}
301288

302289
/// Garbage collector.

tests/testsuite/global_cache_tracker.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,7 @@ See [..] for more information about the `{trimmed_opt}` flag.
201201
.run();
202202
}
203203

204-
for opt in [
205-
"--max-target-age=0 day",
206-
"--max-shared-target-age=0 day",
207-
"--max-target-size=0",
208-
"--max-shared-target-size=0",
209-
] {
204+
for opt in ["--max-target-age=0 day", "--max-target-size=0"] {
210205
let trimmed_opt = opt.split('=').next().unwrap();
211206
p.cargo("clean")
212207
.arg(opt)

0 commit comments

Comments
 (0)