Skip to content

Commit fde05ea

Browse files
committed
Use PkgType for profiles, too
This makes it easier to remove `is_preview` from components in the future if we choose to do so.
1 parent 1e9d218 commit fde05ea

File tree

1 file changed

+24
-37
lines changed
  • src/tools/build-manifest/src

1 file changed

+24
-37
lines changed

src/tools/build-manifest/src/main.rs

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -311,44 +311,28 @@ impl Builder {
311311
}
312312

313313
fn add_profiles_to(&mut self, manifest: &mut Manifest) {
314-
let mut profile = |name, pkgs| self.profile(name, &mut manifest.profiles, pkgs);
315-
profile("minimal", &["rustc", "cargo", "rust-std", "rust-mingw"]);
316-
profile(
317-
"default",
318-
&[
319-
"rustc",
320-
"cargo",
321-
"rust-std",
322-
"rust-mingw",
323-
"rust-docs",
324-
"rustfmt-preview",
325-
"clippy-preview",
326-
],
327-
);
328-
profile(
329-
"complete",
330-
&[
331-
"rustc",
332-
"cargo",
333-
"rust-std",
334-
"rust-mingw",
335-
"rust-docs",
336-
"rustfmt-preview",
337-
"clippy-preview",
338-
"rls-preview",
339-
"rust-analyzer-preview",
340-
"rust-src",
341-
"llvm-tools-preview",
342-
"rust-analysis",
343-
"miri-preview",
344-
],
345-
);
314+
use PkgType::*;
315+
316+
let mut profile = |name, pkgs: &_| self.profile(name, &mut manifest.profiles, pkgs);
317+
318+
// Use a Vec here to make sure we don't exclude any components in an earlier profile.
319+
let minimal = vec![Rustc, Cargo, RustStd, RustMingw];
320+
profile("minimal", &minimal);
321+
322+
let mut default = minimal;
323+
default.extend([HtmlDocs, Rustfmt, Clippy]);
324+
profile("default", &default);
325+
326+
// NOTE: this profile is effectively deprecated; do not add new components to it.
327+
let mut complete = default;
328+
complete.extend([Rls, RustAnalyzer, RustSrc, LlvmTools, RustAnalysis, Miri]);
329+
profile("complete", &complete);
346330

347331
// The compiler libraries are not stable for end users, and they're also huge, so we only
348332
// `rustc-dev` for nightly users, and only in the "complete" profile. It's still possible
349333
// for users to install the additional component manually, if needed.
350334
if self.versions.channel() == "nightly" {
351-
self.extend_profile("complete", &mut manifest.profiles, &["rustc-dev"]);
335+
self.extend_profile("complete", &mut manifest.profiles, &[RustcDev]);
352336
// Do not include the rustc-docs component for now, as it causes
353337
// conflicts with the rust-docs component when installed. See
354338
// #75833.
@@ -468,20 +452,23 @@ impl Builder {
468452
&mut self,
469453
profile_name: &str,
470454
dst: &mut BTreeMap<String, Vec<String>>,
471-
pkgs: &[&str],
455+
pkgs: &[PkgType],
472456
) {
473-
dst.insert(profile_name.to_owned(), pkgs.iter().map(|s| (*s).to_owned()).collect());
457+
dst.insert(
458+
profile_name.to_owned(),
459+
pkgs.iter().map(|s| s.manifest_component_name()).collect(),
460+
);
474461
}
475462

476463
fn extend_profile(
477464
&mut self,
478465
profile_name: &str,
479466
dst: &mut BTreeMap<String, Vec<String>>,
480-
pkgs: &[&str],
467+
pkgs: &[PkgType],
481468
) {
482469
dst.get_mut(profile_name)
483470
.expect("existing profile")
484-
.extend(pkgs.iter().map(|s| (*s).to_owned()));
471+
.extend(pkgs.iter().map(|s| s.manifest_component_name()));
485472
}
486473

487474
fn package(

0 commit comments

Comments
 (0)