File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
bootstrap/src/core/build_steps Expand file tree Collapse file tree 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;
99
1010/// Suggests a list of possible `x.py` commands to run based on modified files in branch.
1111pub 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" ) ;
1419
1520 if !suggestions. status . success ( ) {
1621 println ! ( "failed to run `suggest-tests` tool ({})" , suggestions. status) ;
Original file line number Diff line number Diff line change 11use std:: process:: ExitCode ;
22
3- use build_helper:: git:: get_git_modified_files;
3+ use build_helper:: git:: { get_git_modified_files, GitConfig } ;
44use suggest_tests:: get_suggestions;
55
66fn 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+ ) ;
815 let modified_files = match modified_files {
916 Ok ( Some ( files) ) => files,
1017 Ok ( None ) => {
@@ -25,3 +32,13 @@ fn main() -> ExitCode {
2532
2633 ExitCode :: SUCCESS
2734}
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