format!("{}-{}", component, builder.rls_package_vers())
} else if component == "clippy" {
format!("{}-{}", component, builder.clippy_package_vers())
+ } else if component == "miri" {
+ format!("{}-{}", component, builder.miri_package_vers())
} else if component == "rustfmt" {
format!("{}-{}", component, builder.rustfmt_package_vers())
} else if component == "llvm-tools" {
}
}
+#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Miri {
+ pub stage: u32,
+ pub target: Interned<String>,
+}
+
+impl Step for Miri {
+ type Output = Option<PathBuf>;
+ const ONLY_HOSTS: bool = true;
+
+ fn should_run(run: ShouldRun) -> ShouldRun {
+ run.path("miri")
+ }
+
+ fn make_run(run: RunConfig) {
+ run.builder.ensure(Miri {
+ stage: run.builder.top_stage,
+ target: run.target,
+ });
+ }
+
+ fn run(self, builder: &Builder) -> Option<PathBuf> {
+ let stage = self.stage;
+ let target = self.target;
+ assert!(builder.config.extended);
+
+ builder.info(&format!("Dist miri stage{} ({})", stage, target));
+ let src = builder.src.join("src/tools/miri");
+ let release_num = builder.release_num("miri");
+ let name = pkgname(builder, "miri");
+ let version = builder.miri_info.version(builder, &release_num);
+
+ let tmp = tmpdir(builder);
+ let image = tmp.join("miri-image");
+ drop(fs::remove_dir_all(&image));
+ builder.create_dir(&image);
+
+ // Prepare the image directory
+ // We expect miri to build, because we've exited this step above if tool
+ // state for miri isn't testing.
+ let miri = builder.ensure(tool::Miri {
+ compiler: builder.compiler(stage, builder.config.build),
+ target, extra_features: Vec::new()
+ }).or_else(|| { missing_tool("miri", builder.build.config.missing_tools); None })?;
+ let cargomiri = builder.ensure(tool::CargoMiri {
+ compiler: builder.compiler(stage, builder.config.build),
+ target, extra_features: Vec::new()
+ }).or_else(|| { missing_tool("cargo miri", builder.build.config.missing_tools); None })?;
+
+ builder.install(&miri, &image.join("bin"), 0o755);
+ builder.install(&cargomiri, &image.join("bin"), 0o755);
+ let doc = image.join("share/doc/miri");
+ builder.install(&src.join("README.md"), &doc, 0o644);
+ builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
+ builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
+
+ // Prepare the overlay
+ let overlay = tmp.join("miri-overlay");
+ drop(fs::remove_dir_all(&overlay));
+ t!(fs::create_dir_all(&overlay));
+ builder.install(&src.join("README.md"), &overlay, 0o644);
+ builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
+ builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
+ builder.create(&overlay.join("version"), &version);
+
+ // Generate the installer tarball
+ let mut cmd = rust_installer(builder);
+ cmd.arg("generate")
+ .arg("--product-name=Rust")
+ .arg("--rel-manifest-dir=rustlib")
+ .arg("--success-message=miri-ready-to-serve.")
+ .arg("--image-dir").arg(&image)
+ .arg("--work-dir").arg(&tmpdir(builder))
+ .arg("--output-dir").arg(&distdir(builder))
+ .arg("--non-installed-overlay").arg(&overlay)
+ .arg(format!("--package-name={}-{}", name, target))
+ .arg("--legacy-manifest-dirs=rustlib,cargo")
+ .arg("--component-name=miri-preview");
+
+ builder.run(&mut cmd);
+ Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
+ }
+}
+
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rustfmt {
pub stage: u32,
let rls_installer = builder.ensure(Rls { stage, target });
let llvm_tools_installer = builder.ensure(LlvmTools { stage, target });
let clippy_installer = builder.ensure(Clippy { stage, target });
+ let miri_installer = builder.ensure(Miri { stage, target });
let lldb_installer = builder.ensure(Lldb { target });
let mingw_installer = builder.ensure(Mingw { host: target });
let analysis_installer = builder.ensure(Analysis {
tarballs.push(cargo_installer);
tarballs.extend(rls_installer.clone());
tarballs.extend(clippy_installer.clone());
+ tarballs.extend(miri_installer.clone());
tarballs.extend(rustfmt_installer.clone());
tarballs.extend(llvm_tools_installer);
tarballs.extend(lldb_installer);
if clippy_installer.is_none() {
contents = filter(&contents, "clippy");
}
+ if miri_installer.is_none() {
+ contents = filter(&contents, "miri");
+ }
if rustfmt_installer.is_none() {
contents = filter(&contents, "rustfmt");
}
if clippy_installer.is_some() {
prepare("clippy");
}
+ if miri_installer.is_some() {
+ prepare("miri");
+ }
// create an 'uninstall' package
builder.install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
"rls-preview".to_string()
} else if name == "clippy" {
"clippy-preview".to_string()
+ } else if name == "miri" {
+ "miri-preview".to_string()
} else {
name.to_string()
};
if clippy_installer.is_some() {
prepare("clippy");
}
+ if miri_installer.is_some() {
+ prepare("miri");
+ }
if target.contains("windows-gnu") {
prepare("rust-mingw");
}
.arg("-out").arg(exe.join("ClippyGroup.wxs"))
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
}
+ if miri_installer.is_some() {
+ builder.run(Command::new(&heat)
+ .current_dir(&exe)
+ .arg("dir")
+ .arg("miri")
+ .args(&heat_flags)
+ .arg("-cg").arg("MiriGroup")
+ .arg("-dr").arg("Miri")
+ .arg("-var").arg("var.MiriDir")
+ .arg("-out").arg(exe.join("MiriGroup.wxs"))
+ .arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
+ }
builder.run(Command::new(&heat)
.current_dir(&exe)
.arg("dir")
if clippy_installer.is_some() {
cmd.arg("-dClippyDir=clippy");
}
+ if miri_installer.is_some() {
+ cmd.arg("-dMiriDir=miri");
+ }
if target.contains("windows-gnu") {
cmd.arg("-dGccDir=rust-mingw");
}
if clippy_installer.is_some() {
candle("ClippyGroup.wxs".as_ref());
}
+ if miri_installer.is_some() {
+ candle("MiriGroup.wxs".as_ref());
+ }
candle("AnalysisGroup.wxs".as_ref());
if target.contains("windows-gnu") {
if clippy_installer.is_some() {
cmd.arg("ClippyGroup.wixobj");
}
+ if miri_installer.is_some() {
+ cmd.arg("MiriGroup.wixobj");
+ }
if target.contains("windows-gnu") {
cmd.arg("GccGroup.wixobj");
cmd.arg(builder.package_vers(&builder.release_num("cargo")));
cmd.arg(builder.package_vers(&builder.release_num("rls")));
cmd.arg(builder.package_vers(&builder.release_num("clippy")));
+ cmd.arg(builder.package_vers(&builder.release_num("miri")));
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
cmd.arg(builder.llvm_tools_package_vers());
cmd.arg(builder.lldb_package_vers());