This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +27
-10
lines changed Expand file tree Collapse file tree 4 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,21 @@ use crate::exec::cmd;
33use crate :: utils:: io:: copy_directory;
44use camino:: { Utf8Path , Utf8PathBuf } ;
55
6- pub ( super ) struct LinuxEnvironment ;
6+ pub ( super ) struct LinuxEnvironment {
7+ target_triple : String ,
8+ }
9+
10+ impl LinuxEnvironment {
11+ pub fn new ( target_triple : String ) -> Self {
12+ Self { target_triple }
13+ }
14+ }
715
816impl Environment for LinuxEnvironment {
17+ fn host_triple ( & self ) -> & str {
18+ & self . target_triple
19+ }
20+
921 fn python_binary ( & self ) -> & ' static str {
1022 "python3"
1123 }
Original file line number Diff line number Diff line change @@ -6,9 +6,7 @@ mod linux;
66mod windows;
77
88pub trait Environment {
9- fn host_triple ( & self ) -> String {
10- std:: env:: var ( "PGO_HOST" ) . expect ( "PGO_HOST environment variable missing" )
11- }
9+ fn host_triple ( & self ) -> & str ;
1210
1311 fn python_binary ( & self ) -> & ' static str ;
1412
@@ -69,9 +67,9 @@ pub trait Environment {
6967 fn skipped_tests ( & self ) -> & ' static [ & ' static str ] ;
7068}
7169
72- pub fn create_environment ( ) -> Box < dyn Environment > {
70+ pub fn create_environment ( target_triple : String ) -> Box < dyn Environment > {
7371 #[ cfg( target_family = "unix" ) ]
74- return Box :: new ( linux:: LinuxEnvironment ) ;
72+ return Box :: new ( linux:: LinuxEnvironment :: new ( target_triple ) ) ;
7573 #[ cfg( target_family = "windows" ) ]
76- return Box :: new ( windows:: WindowsEnvironment :: new ( ) ) ;
74+ return Box :: new ( windows:: WindowsEnvironment :: new ( target_triple ) ) ;
7775}
Original file line number Diff line number Diff line change @@ -9,15 +9,20 @@ use zip::ZipArchive;
99
1010pub ( super ) struct WindowsEnvironment {
1111 checkout_dir : Utf8PathBuf ,
12+ target_triple : String ,
1213}
1314
1415impl WindowsEnvironment {
15- pub fn new ( ) -> Self {
16- Self { checkout_dir : std:: env:: current_dir ( ) . unwrap ( ) . try_into ( ) . unwrap ( ) }
16+ pub fn new ( target_triple : String ) -> Self {
17+ Self { checkout_dir : std:: env:: current_dir ( ) . unwrap ( ) . try_into ( ) . unwrap ( ) , target_triple }
1718 }
1819}
1920
2021impl Environment for WindowsEnvironment {
22+ fn host_triple ( & self ) -> & str {
23+ & self . target_triple
24+ }
25+
2126 fn python_binary ( & self ) -> & ' static str {
2227 "python"
2328 }
Original file line number Diff line number Diff line change @@ -171,6 +171,8 @@ fn main() -> anyhow::Result<()> {
171171 . parse_default_env ( )
172172 . init ( ) ;
173173
174+ let target_triple = std:: env:: var ( "PGO_HOST" ) . expect ( "PGO_HOST environment variable missing" ) ;
175+
174176 let mut build_args: Vec < String > = std:: env:: args ( ) . skip ( 1 ) . collect ( ) ;
175177 println ! ( "Running optimized build pipeline with args `{}`" , build_args. join( " " ) ) ;
176178
@@ -202,7 +204,7 @@ fn main() -> anyhow::Result<()> {
202204 }
203205
204206 let mut timer = Timer :: new ( ) ;
205- let env = create_environment ( ) ;
207+ let env = create_environment ( target_triple ) ;
206208
207209 let result = execute_pipeline ( env. as_ref ( ) , & mut timer, build_args) ;
208210 log:: info!( "Timer results\n {}" , timer. format_stats( ) ) ;
You can’t perform that action at this time.
0 commit comments