-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Expand file tree
/
Copy pathenvironment.rs
More file actions
108 lines (90 loc) · 2.89 KB
/
Copy pathenvironment.rs
File metadata and controls
108 lines (90 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
use camino::Utf8PathBuf;
use derive_builder::Builder;
#[derive(Builder)]
pub struct Environment {
host_triple: String,
python_binary: String,
/// The rustc checkout, where the compiler source is located.
checkout_dir: Utf8PathBuf,
/// The main directory where the build occurs. Stage0 rustc and cargo have to be available in
/// this directory before `opt-dist` is started.
build_dir: Utf8PathBuf,
/// Directory where the optimization artifacts (PGO/BOLT profiles, etc.)
/// will be stored.
artifact_dir: Utf8PathBuf,
/// Path to the host LLVM used to compile LLVM in `src/llvm-project`.
host_llvm_dir: Utf8PathBuf,
/// List of test paths that should be skipped when testing the optimized artifacts.
skipped_tests: Vec<String>,
/// Directory containing a pre-built rustc-perf checkout.
#[builder(default)]
prebuilt_rustc_perf: Option<Utf8PathBuf>,
use_bolt: bool,
shared_llvm: bool,
}
impl Environment {
pub fn host_triple(&self) -> &str {
&self.host_triple
}
pub fn python_binary(&self) -> &str {
&self.python_binary
}
pub fn checkout_path(&self) -> Utf8PathBuf {
self.checkout_dir.clone()
}
pub fn build_root(&self) -> Utf8PathBuf {
self.build_dir.clone()
}
pub fn build_artifacts(&self) -> Utf8PathBuf {
self.build_root().join("build").join(&self.host_triple)
}
pub fn artifact_dir(&self) -> Utf8PathBuf {
self.artifact_dir.clone()
}
pub fn cargo_stage_0(&self) -> Utf8PathBuf {
self.build_artifacts()
.join("stage0")
.join("bin")
.join(format!("cargo{}", executable_extension()))
}
pub fn rustc_stage_0(&self) -> Utf8PathBuf {
self.build_artifacts()
.join("stage0")
.join("bin")
.join(format!("rustc{}", executable_extension()))
}
pub fn rustc_stage_2(&self) -> Utf8PathBuf {
self.build_artifacts()
.join("stage2")
.join("bin")
.join(format!("rustc{}", executable_extension()))
}
pub fn prebuilt_rustc_perf(&self) -> Option<Utf8PathBuf> {
self.prebuilt_rustc_perf.clone()
}
/// Path to the built rustc-perf benchmark suite.
pub fn rustc_perf_dir(&self) -> Utf8PathBuf {
self.artifact_dir.join("rustc-perf")
}
pub fn host_llvm_dir(&self) -> Utf8PathBuf {
self.host_llvm_dir.clone()
}
pub fn use_bolt(&self) -> bool {
self.use_bolt
}
pub fn supports_shared_llvm(&self) -> bool {
self.shared_llvm
}
pub fn skipped_tests(&self) -> &[String] {
&self.skipped_tests
}
}
/// What is the extension of binary executables on this platform?
#[cfg(target_family = "unix")]
pub fn executable_extension() -> &'static str {
""
}
#[cfg(target_family = "windows")]
pub fn executable_extension() -> &'static str {
".exe"
}