mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Create tar balls of save-analysis-api metadata for the standard libraries as part of make dist
.
This commit is contained in:
parent
bd148d220e
commit
c49ba058a0
@ -125,6 +125,11 @@ fn main() {
|
|||||||
cmd.arg("-C").arg(format!("codegen-units={}", s));
|
cmd.arg("-C").arg(format!("codegen-units={}", s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emit save-analysis info.
|
||||||
|
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {
|
||||||
|
cmd.arg("-Zsave-analysis-api");
|
||||||
|
}
|
||||||
|
|
||||||
// Dealing with rpath here is a little special, so let's go into some
|
// Dealing with rpath here is a little special, so let's go into some
|
||||||
// detail. First off, `-rpath` is a linker option on Unix platforms
|
// detail. First off, `-rpath` is a linker option on Unix platforms
|
||||||
// which adds to the runtime dynamic loader path when looking for
|
// which adds to the runtime dynamic loader path when looking for
|
||||||
|
@ -23,7 +23,7 @@ use std::io::Write;
|
|||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use {Build, Compiler};
|
use {Build, Compiler, Mode};
|
||||||
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};
|
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};
|
||||||
|
|
||||||
pub fn package_vers(build: &Build) -> &str {
|
pub fn package_vers(build: &Build) -> &str {
|
||||||
@ -289,6 +289,50 @@ pub fn rust_src_location(build: &Build) -> PathBuf {
|
|||||||
distdir(build).join(&format!("{}.tar.gz", plain_name))
|
distdir(build).join(&format!("{}.tar.gz", plain_name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a tarball of save-analysis metadata, if available.
|
||||||
|
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
|
||||||
|
println!("Dist analysis");
|
||||||
|
|
||||||
|
if build.config.channel != "nightly" {
|
||||||
|
println!("Skipping dist-analysis - not on nightly channel");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if compiler.stage != 2 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let name = format!("rust-analysis-{}", package_vers(build));
|
||||||
|
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
|
||||||
|
|
||||||
|
let src = build.stage_out(compiler, Mode::Libstd).join(target).join("release").join("deps");
|
||||||
|
|
||||||
|
let image_src = src.join("save-analysis");
|
||||||
|
let dst = image.join("lib/rustlib").join(target).join("analysis");
|
||||||
|
t!(fs::create_dir_all(&dst));
|
||||||
|
cp_r(&image_src, &dst);
|
||||||
|
|
||||||
|
let mut cmd = Command::new("sh");
|
||||||
|
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||||
|
.arg("--product-name=Rust")
|
||||||
|
.arg("--rel-manifest-dir=rustlib")
|
||||||
|
.arg("--success-message=save-analysis-saved.")
|
||||||
|
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||||
|
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||||
|
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||||
|
.arg(format!("--package-name={}-{}", name, target))
|
||||||
|
.arg(format!("--component-name=rust-analysis-{}", target))
|
||||||
|
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||||
|
build.run(&mut cmd);
|
||||||
|
t!(fs::remove_dir_all(&image));
|
||||||
|
|
||||||
|
// Create plain source tarball
|
||||||
|
let mut cmd = Command::new("tar");
|
||||||
|
cmd.arg("-czf").arg(sanitize_sh(&distdir(build).join(&format!("{}.tar.gz", name))))
|
||||||
|
.arg("analysis")
|
||||||
|
.current_dir(&src);
|
||||||
|
build.run(&mut cmd);
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates the `rust-src` installer component and the plain source tarball
|
/// Creates the `rust-src` installer component and the plain source tarball
|
||||||
pub fn rust_src(build: &Build) {
|
pub fn rust_src(build: &Build) {
|
||||||
println!("Dist src");
|
println!("Dist src");
|
||||||
|
@ -507,6 +507,10 @@ impl Build {
|
|||||||
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
|
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.config.channel == "nightly" && compiler.stage == 2 {
|
||||||
|
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
// Environment variables *required* needed throughout the build
|
// Environment variables *required* needed throughout the build
|
||||||
//
|
//
|
||||||
// FIXME: should update code to not require this env var
|
// FIXME: should update code to not require this env var
|
||||||
|
@ -499,6 +499,10 @@ pub fn build_rules(build: &Build) -> Rules {
|
|||||||
.default(true)
|
.default(true)
|
||||||
.dep(|s| s.name("default:doc"))
|
.dep(|s| s.name("default:doc"))
|
||||||
.run(move |s| dist::docs(build, s.stage, s.target));
|
.run(move |s| dist::docs(build, s.stage, s.target));
|
||||||
|
rules.dist("dist-analysis", "src/libstd")
|
||||||
|
.dep(|s| s.name("dist-std"))
|
||||||
|
.default(true)
|
||||||
|
.run(move |s| dist::analysis(build, &s.compiler(), s.target));
|
||||||
rules.dist("install", "src")
|
rules.dist("install", "src")
|
||||||
.dep(|s| s.name("default:dist"))
|
.dep(|s| s.name("default:dist"))
|
||||||
.run(move |s| install::install(build, s.stage, s.target));
|
.run(move |s| install::install(build, s.stage, s.target));
|
||||||
|
Loading…
Reference in New Issue
Block a user