Rollup merge of #149554 - mati865:build-manifest-more-gen, r=Mark-Simulacrum

build-manifest: generate MSI and MINGW arrays from rustc

An alternative to rust-lang/rust#149503

The arrays after generating:
```
❯ bat -n build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/build-manifest-e0236666c7c4187b/out/targets.rs | rg MSI -A14
 136 static MSI_INSTALLERS: &[&str] = &[
 137     "aarch64-pc-windows-gnullvm",
 138     "aarch64-pc-windows-msvc",
 139     "i686-pc-windows-gnu",
 140     "i686-pc-windows-msvc",
 141     "x86_64-pc-windows-gnu",
 142     "x86_64-pc-windows-gnullvm",
 143     "x86_64-pc-windows-msvc",
 144 ];
 145 static MINGW: &[&str] = &[
 146     "aarch64-pc-windows-gnullvm",
 147     "i686-pc-windows-gnu",
 148     "x86_64-pc-windows-gnu",
 149     "x86_64-pc-windows-gnullvm",
 150 ];
```

r? ```@Mark-Simulacrum```
This commit is contained in:
Matthias Krüger 2025-12-04 08:46:24 +01:00 committed by GitHub
commit b63ef74e5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 11 deletions

View file

@ -60,7 +60,7 @@ fn main() {
let mut output = String::new();
writeln!(output, "static HOSTS: &[&str] = &[").unwrap();
for host in targets.hosts {
for host in &targets.hosts {
writeln!(output, " {:?},", host).unwrap();
}
writeln!(output, "];").unwrap();
@ -71,6 +71,22 @@ fn main() {
}
writeln!(output, "];").unwrap();
writeln!(output, "static MSI_INSTALLERS: &[&str] = &[").unwrap();
for host in &targets.hosts {
if host.contains("-windows-") {
writeln!(output, " {:?},", host).unwrap();
}
}
writeln!(output, "];").unwrap();
writeln!(output, "static MINGW: &[&str] = &[").unwrap();
for host in targets.hosts {
if host.contains("-windows-gnu") {
writeln!(output, " {:?},", host).unwrap();
}
}
writeln!(output, "];").unwrap();
std::fs::write(PathBuf::from(std::env::var_os("OUT_DIR").unwrap()).join("targets.rs"), output)
.unwrap();
}

View file

@ -29,18 +29,8 @@ static DOCS_FALLBACK: &[(&str, &str)] = &[
("", "x86_64-unknown-linux-gnu"),
];
static MSI_INSTALLERS: &[&str] = &[
"aarch64-pc-windows-msvc",
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc",
];
static PKG_INSTALLERS: &[&str] = &["x86_64-apple-darwin", "aarch64-apple-darwin"];
static MINGW: &[&str] = &["i686-pc-windows-gnu", "x86_64-pc-windows-gnu"];
static NIGHTLY_ONLY_COMPONENTS: &[PkgType] =
&[PkgType::Miri, PkgType::JsonDocs, PkgType::RustcCodegenCranelift];