about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/build-manifest/src/main.rs83
-rw-r--r--src/tools/build-manifest/src/versions.rs3
2 files changed, 49 insertions, 37 deletions
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index f09e1e5718e..efe4412726a 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -401,42 +401,55 @@ impl Builder {
         let mut components = Vec::new();
         let mut extensions = Vec::new();
 
-        let host_component = |pkg| Component::from_str(pkg, host);
-
-        // rustc/rust-std/cargo/docs are all required,
-        // and so is rust-mingw if it's available for the target.
-        components.extend(vec![
-            host_component("rustc"),
-            host_component("rust-std"),
-            host_component("cargo"),
-            host_component("rust-docs"),
-        ]);
-        if host.contains("pc-windows-gnu") {
-            components.push(host_component("rust-mingw"));
-        }
+        let host_component = |pkg: &_| Component::from_str(pkg, host);
 
-        // Tools are always present in the manifest,
-        // but might be marked as unavailable if they weren't built.
-        extensions.extend(vec![
-            host_component("clippy-preview"),
-            host_component("miri-preview"),
-            host_component("rls-preview"),
-            host_component("rust-analyzer-preview"),
-            host_component("rustfmt-preview"),
-            host_component("llvm-tools-preview"),
-            host_component("rust-analysis"),
-            host_component("rust-docs-json-preview"),
-        ]);
-
-        extensions.extend(
-            TARGETS
-                .iter()
-                .filter(|&&target| target != host)
-                .map(|target| Component::from_str("rust-std", target)),
-        );
-        extensions.extend(HOSTS.iter().map(|target| Component::from_str("rustc-dev", target)));
-        extensions.extend(HOSTS.iter().map(|target| Component::from_str("rustc-docs", target)));
-        extensions.push(Component::from_str("rust-src", "*"));
+        for pkg in PkgType::all() {
+            match pkg {
+                // rustc/rust-std/cargo/docs are all required
+                PkgType::Rustc | PkgType::Cargo | PkgType::HtmlDocs => {
+                    components.push(host_component(&pkg.manifest_component_name()));
+                }
+                PkgType::RustStd => {
+                    components.push(host_component(&pkg.manifest_component_name()));
+                    extensions.extend(
+                        TARGETS.iter().filter(|&&target| target != host).map(|target| {
+                            Component::from_str(&pkg.manifest_component_name(), target)
+                        }),
+                    );
+                }
+                // so is rust-mingw if it's available for the target
+                PkgType::RustMingw => {
+                    if host.contains("pc-windows-gnu") {
+                        components.push(host_component("rust-mingw"));
+                    }
+                }
+                // Tools are always present in the manifest,
+                // but might be marked as unavailable if they weren't built.
+                PkgType::Clippy
+                | PkgType::Miri
+                | PkgType::Rls
+                | PkgType::RustAnalyzer
+                | PkgType::Rustfmt
+                | PkgType::LlvmTools
+                | PkgType::RustAnalysis
+                | PkgType::JsonDocs => {
+                    extensions.push(host_component(&pkg.manifest_component_name()));
+                }
+                PkgType::RustcDev | PkgType::RustcDocs => {
+                    extensions.extend(
+                        HOSTS.iter().map(|target| {
+                            Component::from_str(&pkg.manifest_component_name(), target)
+                        }),
+                    );
+                }
+                PkgType::RustSrc => {
+                    extensions.push(Component::from_str(&pkg.manifest_component_name(), "*"));
+                }
+                PkgType::Rust | PkgType::Other(_) => {}
+                // FIXME: is this correct? maybe we should add it so rustup knows about it ...
+                PkgType::ReproducibleArtifacts => {}
+            }
+        }
 
         // If the components/extensions don't actually exist for this
         // particular host/target combination then nix it entirely from our
diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs
index 967433a86ad..cea34905db6 100644
--- a/src/tools/build-manifest/src/versions.rs
+++ b/src/tools/build-manifest/src/versions.rs
@@ -39,7 +39,6 @@ macro_rules! pkg_type {
                 }
             }
 
-            /// Component name in the manifest. In particular, this includes the `-preview` suffix where appropriate.
             pub(crate) fn all() -> &'static [PkgType] {
                 &[ $(PkgType::$variant),+ ]
             }
@@ -69,7 +68,7 @@ pkg_type! {
 }
 
 impl PkgType {
-    // / Component name in the manifest. In particular, this includes the `-preview` suffix where appropriate.
+    /// Component name in the manifest. In particular, this includes the `-preview` suffix where appropriate.
     pub(crate) fn manifest_component_name(&self) -> String {
         if self.is_preview() {
             format!("{}-preview", self.tarball_component_name())