@@ -69,62 +69,60 @@ fn build_server(
69
69
let sb_spinner = spinners. insert ( num_steps - 1 , ProgressBar :: new_spinner ( ) ) ;
70
70
let sb_spinner = cfg_spinner ( sb_spinner, & sb_msg) ;
71
71
let sb_target = target;
72
- let sb_thread =
73
- spawn_thread ( move || {
74
- let ( stdout, _stderr) = handle_exit_code ! ( run_stage(
72
+ let sb_thread = spawn_thread ( move || {
73
+ let ( stdout, _stderr) = handle_exit_code ! ( run_stage(
75
74
vec![ & format!(
76
75
// This sets Cargo to tell us everything, including the executable path to the server
77
- "{} build --message-format json {} {}" ,
76
+ "{} build --message-format json --features integration-{} {} --no-default-features {}" ,
78
77
env:: var( "PERSEUS_CARGO_PATH" ) . unwrap_or_else( |_| "cargo" . to_string( ) ) ,
79
78
// Enable the appropriate integration
80
- format!(
81
- "--features integration-{} {} --no-default-features" ,
82
- integration. to_string( ) ,
83
- // We'll also handle whether or not it's standalone because that goes under the `--features` flag
84
- if is_standalone {
85
- "--features standalone"
86
- } else {
87
- ""
88
- }
89
- ) ,
79
+ integration. to_string( ) ,
80
+ // We'll also handle whether or not it's standalone because that goes under the `--features` flag
81
+ if is_standalone {
82
+ "--features standalone"
83
+ } else {
84
+ ""
85
+ } ,
90
86
if is_release { "--release" } else { "" } ,
91
87
) ] ,
92
88
& sb_target,
93
89
& sb_spinner,
94
90
& sb_msg
95
91
) ?) ;
96
92
97
- let msgs: Vec < & str > = stdout. trim ( ) . split ( '\n' ) . collect ( ) ;
98
- // If we got to here, the exit code was 0 and everything should've worked
99
- // The last message will just tell us that the build finished, the second-last one will tell us the executable path
100
- let msg = msgs. get ( msgs. len ( ) - 2 ) ;
101
- let msg = match msg {
102
- // We'll parse it as a Serde `Value`, we don't need to know everything that's in there
103
- Some ( msg) => serde_json:: from_str :: < serde_json:: Value > ( msg)
104
- . map_err ( |err| ExecutionError :: GetServerExecutableFailed { source : err } ) ?,
105
- None => return Err ( ExecutionError :: ServerExectutableMsgNotFound ) ,
106
- } ;
107
- let server_exec_path = msg. get ( "executable" ) ;
108
- let server_exec_path = match server_exec_path {
93
+ let msgs: Vec < & str > = stdout. trim ( ) . split ( '\n' ) . collect ( ) ;
94
+ // If we got to here, the exit code was 0 and everything should've worked
95
+ // The last message will just tell us that the build finished, the second-last one will tell us the executable path
96
+ let msg = msgs. get ( msgs. len ( ) - 2 ) ;
97
+ let msg = match msg {
98
+ // We'll parse it as a Serde `Value`, we don't need to know everything that's in there
99
+ Some ( msg) => serde_json:: from_str :: < serde_json:: Value > ( msg)
100
+ . map_err ( |err| ExecutionError :: GetServerExecutableFailed { source : err } ) ?,
101
+ None => return Err ( ExecutionError :: ServerExectutableMsgNotFound ) ,
102
+ } ;
103
+ let server_exec_path = msg. get ( "executable" ) ;
104
+ let server_exec_path = match server_exec_path {
109
105
// We'll parse it as a Serde `Value`, we don't need to know everything that's in there
110
106
Some ( server_exec_path) => match server_exec_path. as_str ( ) {
111
107
Some ( server_exec_path) => server_exec_path,
112
- None => return Err ( ExecutionError :: ParseServerExecutableFailed {
113
- err : "expected 'executable' field to be string" . to_string ( )
114
- } ) ,
108
+ None => {
109
+ return Err ( ExecutionError :: ParseServerExecutableFailed {
110
+ err : "expected 'executable' field to be string" . to_string ( ) ,
111
+ } )
112
+ }
115
113
} ,
116
114
None => return Err ( ExecutionError :: ParseServerExecutableFailed {
117
115
err : "expected 'executable' field in JSON map in second-last message, not present"
118
- . to_string ( )
116
+ . to_string ( ) ,
119
117
} ) ,
120
118
} ;
121
119
122
- // And now the main thread needs to know about this
123
- let mut exec_val = exec. lock ( ) . unwrap ( ) ;
124
- * exec_val = server_exec_path. to_string ( ) ;
120
+ // And now the main thread needs to know about this
121
+ let mut exec_val = exec. lock ( ) . unwrap ( ) ;
122
+ * exec_val = server_exec_path. to_string ( ) ;
125
123
126
- Ok ( 0 )
127
- } ) ;
124
+ Ok ( 0 )
125
+ } ) ;
128
126
129
127
Ok ( sb_thread)
130
128
}
0 commit comments