diff options
| author | bors <bors@rust-lang.org> | 2023-04-03 07:27:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-03 07:27:58 +0000 |
| commit | 932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa (patch) | |
| tree | 2c44d95b514a02c51806d2e3f38e3fe29c9b07e4 /src/bootstrap | |
| parent | d0eed58a1e78eb1a25bb54076e4b0f7ea5ff7401 (diff) | |
| parent | 22df7107bdd36cf47e327c8165e720c1eccb351d (diff) | |
| download | rust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.tar.gz rust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.zip | |
Auto merge of #109884 - matthiaskrgr:rollup-5wapig9, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #109526 (LIBPATH is used as dylib's path environment variable on AIX) - #109642 (check for missing codegen backeng config) - #109722 (Implement read_buf for RustHermit) - #109856 (fix(middle): emit error rather than delay bug when reaching limit) - #109868 (Improve PR job names in Github Actions preview) - #109871 (Include invocation start times) - #109873 (Move some UI tests into subdirectories) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 3 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 44 | ||||
| -rw-r--r-- | src/bootstrap/dylib_util.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/metrics.rs | 13 |
4 files changed, 60 insertions, 2 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 013d1ab525b..d12781cc33a 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -741,6 +741,9 @@ class RustBuild(object): env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \ (os.pathsep + env["LIBRARY_PATH"]) \ if "LIBRARY_PATH" in env else "" + env["LIBPATH"] = os.path.join(self.bin_root(), "lib") + \ + (os.pathsep + env["LIBPATH"]) \ + if "LIBPATH" in env else "" # Export Stage0 snapshot compiler related env variables build_section = "target.{}".format(self.build) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 15708bb183e..e3581943f2c 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -20,7 +20,7 @@ use serde_derive::Deserialize; use crate::builder::crate_description; use crate::builder::Cargo; -use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath}; use crate::cache::{Interned, INTERNER}; use crate::config::{LlvmLibunwind, RustcLto, TargetSelection}; use crate::dist; @@ -995,6 +995,44 @@ pub struct CodegenBackend { pub backend: Interned<String>, } +fn needs_codegen_config(run: &RunConfig<'_>) -> bool { + let mut needs_codegen_cfg = false; + for path_set in &run.paths { + needs_codegen_cfg = match path_set { + PathSet::Set(set) => set.iter().any(|p| is_codegen_cfg_needed(p, run)), + PathSet::Suite(suite) => is_codegen_cfg_needed(&suite, run), + } + } + needs_codegen_cfg +} + +const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; + +fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { + if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) { + let mut needs_codegen_backend_config = true; + for &backend in &run.builder.config.rust_codegen_backends { + if path + .path + .to_str() + .unwrap() + .ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + &backend)) + { + needs_codegen_backend_config = false; + } + } + if needs_codegen_backend_config { + run.builder.info( + "Warning: no codegen-backends config matched the requested path to build a codegen backend. \ + Help: add backend to codegen-backends in config.toml.", + ); + return true; + } + } + + return false; +} + impl Step for CodegenBackend { type Output = (); const ONLY_HOSTS: bool = true; @@ -1006,6 +1044,10 @@ impl Step for CodegenBackend { } fn make_run(run: RunConfig<'_>) { + if needs_codegen_config(&run) { + return; + } + for &backend in &run.builder.config.rust_codegen_backends { if backend == "llvm" { continue; // Already built as part of rustc diff --git a/src/bootstrap/dylib_util.rs b/src/bootstrap/dylib_util.rs index 6d75272c501..b14c0bed66c 100644 --- a/src/bootstrap/dylib_util.rs +++ b/src/bootstrap/dylib_util.rs @@ -12,6 +12,8 @@ pub fn dylib_path_var() -> &'static str { "DYLD_LIBRARY_PATH" } else if cfg!(target_os = "haiku") { "LIBRARY_PATH" + } else if cfg!(target_os = "aix") { + "LIBPATH" } else { "LD_LIBRARY_PATH" } diff --git a/src/bootstrap/metrics.rs b/src/bootstrap/metrics.rs index 5f254761aa1..82b123ec8a5 100644 --- a/src/bootstrap/metrics.rs +++ b/src/bootstrap/metrics.rs @@ -11,7 +11,7 @@ use serde_derive::{Deserialize, Serialize}; use std::cell::RefCell; use std::fs::File; use std::io::BufWriter; -use std::time::{Duration, Instant}; +use std::time::{Duration, Instant, SystemTime}; use sysinfo::{CpuExt, System, SystemExt}; pub(crate) struct BuildMetrics { @@ -27,6 +27,7 @@ impl BuildMetrics { system_info: System::new(), timer_start: None, invocation_timer_start: Instant::now(), + invocation_start: SystemTime::now(), }); BuildMetrics { state } @@ -124,6 +125,11 @@ impl BuildMetrics { } }; invocations.push(JsonInvocation { + start_time: state + .invocation_start + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(), duration_including_children_sec: state.invocation_timer_start.elapsed().as_secs_f64(), children: steps.into_iter().map(|step| self.prepare_json_step(step)).collect(), }); @@ -166,6 +172,7 @@ struct MetricsState { system_info: System, timer_start: Option<Instant>, invocation_timer_start: Instant, + invocation_start: SystemTime, } struct StepMetrics { @@ -194,6 +201,10 @@ struct JsonRoot { #[derive(Serialize, Deserialize)] #[serde(rename_all = "snake_case")] struct JsonInvocation { + // Unix timestamp in seconds + // + // This is necessary to easily correlate this invocation with logs or other data. + start_time: u64, duration_including_children_sec: f64, children: Vec<JsonNode>, } |
