Skip to content

Commit 7d96897

Browse files
authored
Merge pull request #252 from J-ZhengLi/dev-zhengli
fix optional components are not installed when installing toolchain
2 parents ec9a2a3 + 383faf9 commit 7d96897

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/core/rustup.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,27 @@ impl ToolchainInstaller {
7070
// if this is the first time installing the tool chain, we need to add the base components
7171
// from the manifest.
7272
let mut base = if first_install {
73-
config
74-
.manifest
75-
.rust
76-
.components
77-
.iter()
78-
.map(ToolchainComponent::new)
79-
.collect()
73+
config.manifest.rust.components.clone()
8074
} else {
8175
vec![]
8276
};
83-
base.extend(components.to_vec());
77+
base.extend(
78+
components
79+
.iter()
80+
.filter_map(|c| (!c.is_profile).then_some(c.name.clone())),
81+
);
82+
let components_arg = base.join(",");
8483

8584
let version = &config.manifest.rust.channel;
86-
let mut cmd = cmd!(rustup, "toolchain", "install", version, "--no-self-update");
85+
let mut cmd = cmd!(
86+
rustup,
87+
"toolchain",
88+
"install",
89+
version,
90+
"--no-self-update",
91+
"-c",
92+
&components_arg
93+
);
8794
if let Some(profile) = config.manifest.rust.profile() {
8895
cmd.args(["--profile", profile]);
8996
}

0 commit comments

Comments
 (0)