Skip to content

Commit a33f731

Browse files
committed
Couple of minor build system changes
1 parent 1b96458 commit a33f731

4 files changed

Lines changed: 57 additions & 58 deletions

File tree

‎build_system/bench.rs‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::env;
22
use std::io::Write;
33
use std::path::Path;
4+
use std::process::Command;
45

56
usecrate::path::{Dirs,RelPath};
67
usecrate::prepare::GitRepo;
78
usecrate::rustc_info::get_file_name;
8-
usecrate::utils::{hyperfine_command,spawn_and_wait,Compiler};
9+
usecrate::utils::{spawn_and_wait,Compiler};
910

1011
staticSIMPLE_RAYTRACER_REPO:GitRepo = GitRepo::github(
1112
"ebobby",
@@ -128,3 +129,37 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
128129
gha_step_summary.write_all(b"\n").unwrap();
129130
}
130131
}
132+
133+
#[must_use]
134+
fnhyperfine_command(
135+
warmup:u64,
136+
runs:u64,
137+
prepare:Option<&str>,
138+
cmds:&[(&str,&str)],
139+
markdown_export:&Path,
140+
) -> Command{
141+
letmut bench = Command::new("hyperfine");
142+
143+
bench.arg("--export-markdown").arg(markdown_export);
144+
145+
if warmup != 0{
146+
bench.arg("--warmup").arg(warmup.to_string());
147+
}
148+
149+
if runs != 0{
150+
bench.arg("--runs").arg(runs.to_string());
151+
}
152+
153+
ifletSome(prepare) = prepare {
154+
bench.arg("--prepare").arg(prepare);
155+
}
156+
157+
for&(name, cmd)in cmds {
158+
if name != ""{
159+
bench.arg("-n").arg(name);
160+
}
161+
bench.arg(cmd);
162+
}
163+
164+
bench
165+
}

‎build_system/build_sysroot.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub(crate) fn build_sysroot(
136136
target_compiler
137137
}
138138

139+
#[must_use]
139140
structSysrootTarget{
140141
triple:String,
141142
libs:Vec<PathBuf>,
@@ -161,7 +162,6 @@ pub(crate) static STANDARD_LIBRARY: CargoProject =
161162
CargoProject::new(&STDLIB_SRC.join("library/sysroot"),"stdlib_target");
162163
pub(crate)staticRTSTARTUP_SYSROOT:RelPath = RelPath::BUILD.join("rtstartup");
163164

164-
#[must_use]
165165
fnbuild_sysroot_for_triple(
166166
dirs:&Dirs,
167167
compiler:Compiler,
@@ -176,7 +176,6 @@ fn build_sysroot_for_triple(
176176
}
177177
}
178178

179-
#[must_use]
180179
fnbuild_llvm_sysroot_for_triple(compiler:Compiler) -> SysrootTarget{
181180
let default_sysroot = crate::rustc_info::get_default_sysroot(&compiler.rustc);
182181

@@ -210,7 +209,6 @@ fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget {
210209
target_libs
211210
}
212211

213-
#[must_use]
214212
fnbuild_clif_sysroot_for_triple(
215213
dirs:&Dirs,
216214
mutcompiler:Compiler,

‎build_system/prepare.rs‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::build_sysroot::STDLIB_SRC;
88
usecrate::path::{Dirs,RelPath};
99
usecrate::rustc_info::get_default_sysroot;
1010
usecrate::utils::{
11-
copy_dir_recursively,git_command,remove_dir_if_exists, retry_spawn_and_wait, spawn_and_wait,
11+
copy_dir_recursively, remove_dir_if_exists, retry_spawn_and_wait, spawn_and_wait,
1212
};
1313

1414
pub(crate)fnprepare(dirs:&Dirs){
@@ -285,3 +285,22 @@ pub(crate) fn apply_patches(dirs: &Dirs, crate_name: &str, source_dir: &Path, ta
285285
spawn_and_wait(apply_patch_cmd);
286286
}
287287
}
288+
289+
#[must_use]
290+
fngit_command<'a>(repo_dir:implInto<Option<&'aPath>>,cmd:&str) -> Command{
291+
letmut git_cmd = Command::new("git");
292+
git_cmd
293+
.arg("-c")
294+
.arg("user.name=Dummy")
295+
.arg("-c")
296+
.arg("user.email=dummy@example.com")
297+
.arg("-c")
298+
.arg("core.autocrlf=false")
299+
.arg("-c")
300+
.arg("commit.gpgSign=false")
301+
.arg(cmd);
302+
ifletSome(repo_dir) = repo_dir.into(){
303+
git_cmd.current_dir(repo_dir);
304+
}
305+
git_cmd
306+
}

‎build_system/utils.rs‎

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -141,59 +141,6 @@ impl CargoProject {
141141
}
142142
}
143143

144-
#[must_use]
145-
pub(crate)fnhyperfine_command(
146-
warmup:u64,
147-
runs:u64,
148-
prepare:Option<&str>,
149-
cmds:&[(&str,&str)],
150-
markdown_export:&Path,
151-
) -> Command{
152-
letmut bench = Command::new("hyperfine");
153-
154-
bench.arg("--export-markdown").arg(markdown_export);
155-
156-
if warmup != 0{
157-
bench.arg("--warmup").arg(warmup.to_string());
158-
}
159-
160-
if runs != 0{
161-
bench.arg("--runs").arg(runs.to_string());
162-
}
163-
164-
ifletSome(prepare) = prepare {
165-
bench.arg("--prepare").arg(prepare);
166-
}
167-
168-
for&(name, cmd)in cmds {
169-
if name != ""{
170-
bench.arg("-n").arg(name);
171-
}
172-
bench.arg(cmd);
173-
}
174-
175-
bench
176-
}
177-
178-
#[must_use]
179-
pub(crate)fngit_command<'a>(repo_dir:implInto<Option<&'aPath>>,cmd:&str) -> Command{
180-
letmut git_cmd = Command::new("git");
181-
git_cmd
182-
.arg("-c")
183-
.arg("user.name=Dummy")
184-
.arg("-c")
185-
.arg("user.email=dummy@example.com")
186-
.arg("-c")
187-
.arg("core.autocrlf=false")
188-
.arg("-c")
189-
.arg("commit.gpgSign=false")
190-
.arg(cmd);
191-
ifletSome(repo_dir) = repo_dir.into(){
192-
git_cmd.current_dir(repo_dir);
193-
}
194-
git_cmd
195-
}
196-
197144
#[track_caller]
198145
pub(crate)fntry_hard_link(src:implAsRef<Path>,dst:implAsRef<Path>){
199146
let src = src.as_ref();

0 commit comments

Comments
 (0)