File tree 2 files changed +26
-4
lines changed
bootstrap/src/core/build_steps
2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,13 @@ use crate::core::builder::Builder;
9
9
10
10
/// Suggests a list of possible `x.py` commands to run based on modified files in branch.
11
11
pub fn suggest ( builder : & Builder < ' _ > , run : bool ) {
12
- let suggestions =
13
- builder. tool_cmd ( Tool :: SuggestTests ) . output ( ) . expect ( "failed to run `suggest-tests` tool" ) ;
12
+ let git_config = builder. config . git_config ( ) ;
13
+ let suggestions = builder
14
+ . tool_cmd ( Tool :: SuggestTests )
15
+ . env ( "SUGGEST_TESTS_GITHUB_REPOSITORY" , git_config. github_repository )
16
+ . env ( "SUGGEST_TESTS_NIGHTLY_BRANCH" , git_config. nightly_branch )
17
+ . output ( )
18
+ . expect ( "failed to run `suggest-tests` tool" ) ;
14
19
15
20
if !suggestions. status . success ( ) {
16
21
println ! ( "failed to run `suggest-tests` tool ({})" , suggestions. status) ;
Original file line number Diff line number Diff line change 1
1
use std:: process:: ExitCode ;
2
2
3
- use build_helper:: git:: get_git_modified_files;
3
+ use build_helper:: git:: { get_git_modified_files, GitConfig } ;
4
4
use suggest_tests:: get_suggestions;
5
5
6
6
fn main ( ) -> ExitCode {
7
- let modified_files = get_git_modified_files ( None , & Vec :: new ( ) ) ;
7
+ let modified_files = get_git_modified_files (
8
+ & GitConfig {
9
+ github_repository : & env ( "SUGGEST_TESTS_GITHUB_REPOSITORY" ) ,
10
+ nightly_branch : & env ( "SUGGEST_TESTS_NIGHTLY_BRANCH" ) ,
11
+ } ,
12
+ None ,
13
+ & Vec :: new ( ) ,
14
+ ) ;
8
15
let modified_files = match modified_files {
9
16
Ok ( Some ( files) ) => files,
10
17
Ok ( None ) => {
@@ -25,3 +32,13 @@ fn main() -> ExitCode {
25
32
26
33
ExitCode :: SUCCESS
27
34
}
35
+
36
+ fn env ( key : & str ) -> String {
37
+ match std:: env:: var ( key) {
38
+ Ok ( var) => var,
39
+ Err ( err) => {
40
+ eprintln ! ( "suggest-tests: failed to read environment variable {key}: {err}" ) ;
41
+ std:: process:: exit ( 1 ) ;
42
+ }
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments