use builder::{Builder, Step};
use compile;
use tool::{self, Tool};
+use cache::{INTERNER, Interned};
pub fn pkgname(build: &Build, component: &str) -> String {
if component == "cargo" {
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::docs(build, s.stage, s.target));
-#[derive(Serialize)]
-pub struct Docs<'a> {
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Docs {
pub stage: u32,
- pub target: &'a str,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Docs<'a> {
- type Id = Docs<'static>;
+impl Step for Docs {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
path.ends_with("src/doc")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>,
+ ) {
builder.ensure(Docs {
stage: builder.top_stage,
target: target,
found
}
-fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build: &Build) {
+fn make_win_dist(
+ rust_root: &Path, plat_root: &Path, target_triple: Interned<String>, build: &Build
+) {
//Ask gcc where it keeps its stuff
let mut cmd = Command::new(build.cc(target_triple));
cmd.arg("-print-search-dirs");
// }
// });
-#[derive(Serialize)]
-pub struct Mingw<'a> {
- target: &'a str,
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Mingw {
+ target: Interned<String>,
}
-impl<'a> Step<'a> for Mingw<'a> {
- type Id = Mingw<'static>;
+impl Step for Mingw {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
false
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(Mingw { target });
}
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::rustc(build, s.stage, s.target));
-#[derive(Serialize)]
-pub struct Rustc<'a> {
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Rustc {
pub stage: u32,
- pub target: &'a str,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Rustc<'a> {
- type Id = Rustc<'static>;
+impl Step for Rustc {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
path.ends_with("src/librustc")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(Rustc {
stage: builder.top_stage,
target: target,
let target = self.target;
let compiler = builder.ensure(compile::Assemble {
- target_compiler: builder.compiler(stage, &build.build),
+ target_compiler: builder.compiler(stage, build.build),
});
println!("Dist rustc stage{} ({})", stage, target);
return distdir(build).join(format!("{}-{}.tar.gz", name, target));
- fn prepare_image(builder: &Builder, compiler: Compiler, target: &str, image: &Path) {
+ fn prepare_image(
+ builder: &Builder, compiler: Compiler, target: Interned<String>, image: &Path
+ ) {
let build = builder.build;
let src = builder.sysroot(compiler);
- let libdir = libdir(target);
+ let libdir = libdir(&target);
// Copy rustc/rustdoc binaries
t!(fs::create_dir_all(image.join("bin")));
// Debugger scripts
builder.ensure(DebuggerScripts {
- sysroot: &image,
+ sysroot: INTERNER.intern_path(image.to_owned()),
target: target,
});
// .run(move |s| dist::debugger_scripts(build, &builder.sysroot(&s.compiler()),
// s.target));
-#[derive(Serialize)]
-pub struct DebuggerScripts<'a> {
- pub sysroot: &'a Path,
- pub target: &'a str,
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct DebuggerScripts {
+ pub sysroot: Interned<PathBuf>,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for DebuggerScripts<'a> {
- type Id = DebuggerScripts<'static>;
+impl Step for DebuggerScripts {
type Output = ();
fn should_run(_builder: &Builder, path: &Path) -> bool {
path.ends_with("src/etc/lldb_batchmode.py")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(DebuggerScripts {
- sysroot: &builder.sysroot(builder.compiler(builder.top_stage, host)),
+ sysroot: builder.sysroot(builder.compiler(builder.top_stage, host)),
target: target,
});
}
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::std(build, &s.compiler(), s.target));
-#[derive(Serialize)]
-pub struct Std<'a> {
- pub compiler: Compiler<'a>,
- pub target: &'a str,
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Std {
+ pub compiler: Compiler,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Std<'a> {
- type Id = Std<'static>;
+impl Step for Std {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
path.ends_with("src/libstd")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(Std {
compiler: builder.compiler(builder.top_stage, host),
target: target,
let compiler = self.compiler;
let target = self.target;
- println!("Dist std stage{} ({} -> {})", compiler.stage, compiler.host,
+ println!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host,
target);
// The only true set of target libraries came from the build triple, so
let dst = image.join("lib/rustlib").join(target);
t!(fs::create_dir_all(&dst));
- let mut src = builder.sysroot_libdir(compiler, target);
+ let mut src = builder.sysroot_libdir(compiler, target).to_path_buf();
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
cp_r(&src, &dst);
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::analysis(build, &s.compiler(), s.target));
-#[derive(Serialize)]
-pub struct Analysis<'a> {
- pub compiler: Compiler<'a>,
- pub target: &'a str,
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Analysis {
+ pub compiler: Compiler,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Analysis<'a> {
- type Id = Analysis<'static>;
+impl Step for Analysis {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
path.ends_with("analysis")
}
- fn make_run(builder: &Builder, path: Option<&Path>, host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder,
+ path: Option<&Path>,
+ host: Interned<String>,
+ target: Interned<String>
+ ) {
if path.is_none() && !builder.build.config.extended {
return;
}
assert!(build.config.extended);
println!("Dist analysis");
- if compiler.host != build.build {
+ if &compiler.host != build.build {
println!("\tskipping, not a build host");
return None;
}
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |_| dist::rust_src(build));
-#[derive(Serialize)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Src;
-impl<'a> Step<'a> for Src {
- type Id = Src;
+impl Step for Src {
/// The output path of the src installer tarball
type Output = PathBuf;
const DEFAULT: bool = true;
path.ends_with("src")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, _target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
+ ) {
builder.ensure(Src);
}
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |_| dist::plain_source_tarball(build));
-#[derive(Serialize)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct PlainSourceTarball;
-impl<'a> Step<'a> for PlainSourceTarball {
- type Id = PlainSourceTarball;
+impl Step for PlainSourceTarball {
/// Produces the location of the tarball generated
type Output = PathBuf;
const DEFAULT: bool = true;
path.ends_with("src")
}
- fn make_run(builder: &Builder, path: Option<&Path>, _host: &str, _target: &str) {
+ fn make_run(
+ builder: &Builder, path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
+ ) {
if path.is_none() && !builder.build.config.rust_dist_src {
return;
}
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::cargo(build, s.stage, s.target));
-#[derive(Serialize)]
-pub struct Cargo<'a> {
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Cargo {
pub stage: u32,
- pub target: &'a str,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Cargo<'a> {
- type Id = Cargo<'static>;
+impl Step for Cargo {
type Output = PathBuf;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
path.ends_with("cargo")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(Cargo {
stage: builder.top_stage,
target: target,
builder.ensure(tool::Cargo { stage, target });
println!("Dist cargo stage{} ({})", stage, target);
- let compiler = builder.compiler(stage, &build.build);
+ let compiler = builder.compiler(stage, build.build);
let src = build.src.join("src/tools/cargo");
let etc = src.join("src/etc");
t!(fs::create_dir_all(image.join("share/zsh/site-functions")));
t!(fs::create_dir_all(image.join("etc/bash_completion.d")));
let cargo = build.cargo_out(compiler, Mode::Tool, target)
- .join(exe("cargo", target));
+ .join(exe("cargo", &target));
install(&cargo, &image.join("bin"), 0o755);
for man in t!(etc.join("man").read_dir()) {
let man = t!(man);
// .dep(|s| s.name("tool-rls"))
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::rls(build, s.stage, s.target));
-#[derive(Serialize)]
-pub struct Rls<'a> {
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Rls {
pub stage: u32,
- pub target: &'a str,
+ pub target: Interned<String>,
}
-impl<'a> Step<'a> for Rls<'a> {
- type Id = Rls<'static>;
+impl Step for Rls {
type Output = PathBuf;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
path.ends_with("rls")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
+ ) {
builder.ensure(Rls {
stage: builder.top_stage,
target: target,
builder.ensure(tool::Rls { stage, target });
println!("Dist RLS stage{} ({})", stage, target);
- let compiler = builder.compiler(stage, &build.build);
+ let compiler = builder.compiler(stage, build.build);
let src = build.src.join("src/tools/rls");
let release_num = build.release_num("rls");
// Prepare the image directory
let rls = build.cargo_out(compiler, Mode::Tool, target)
- .join(exe("rls", target));
+ .join(exe("rls", &target));
install(&rls, &image.join("bin"), 0o755);
let doc = image.join("share/doc/rls");
install(&src.join("README.md"), &doc, 0o644);
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::extended(build, s.stage, s.target));
-#[derive(Serialize)]
-pub struct Extended<'a> {
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Extended {
stage: u32,
- target: &'a str,
+ target: Interned<String>,
}
-impl<'a> Step<'a> for Extended<'a> {
- type Id = Extended<'static>;
+impl Step for Extended {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
path.ends_with("cargo")
}
- fn make_run(builder: &Builder, path: Option<&Path>, _host: &str, target: &str) {
+ fn make_run(
+ builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
+ ) {
if path.is_none() && !builder.build.config.extended {
return;
}
let build = builder.build;
let stage = self.stage;
let target = self.target;
- let compiler = builder.compiler(stage, &build.build);
+ let compiler = builder.compiler(stage, build.build);
println!("Dist extended stage{} ({})", stage, target);
}
}
-fn add_env(build: &Build, cmd: &mut Command, target: &str) {
+fn add_env(build: &Build, cmd: &mut Command, target: Interned<String>) {
let mut parts = channel::CFG_RELEASE_NUM.split('.');
cmd.env("CFG_RELEASE_INFO", build.rust_version())
.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM)
// .dep(move |s| s.name("tool-build-manifest").target(&build.build).stage(0))
// .run(move |_| dist::hash_and_sign(build));
-#[derive(Serialize)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct HashSign;
-impl<'a> Step<'a> for HashSign {
- type Id = HashSign;
+impl Step for HashSign {
type Output = ();
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
path.ends_with("hash-and-sign")
}
- fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, _target: &str) {
+ fn make_run(
+ builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
+ ) {
builder.ensure(HashSign);
}