@@ -193,7 +193,8 @@ private List<string> GetDependentModuleList(string moduleName, Dictionary<string
193193 // Run a selected module list instead of run all the modules to speed up the CI process.
194194 private List < string > GetSelectedModuleList ( )
195195 {
196- return new List < string > ( Environment . GetEnvironmentVariable ( "SELECTEDMODULELIST" ) . Split ( ';' ) ) ;
196+ CIPhaseFilterConfig config = GetCIPhaseFilterConfig ( ) ;
197+ return config . SelectModuleList ;
197198 }
198199
199200 private List < string > GetTestCsprojList ( string moduleName , Dictionary < string , string [ ] > csprojMap )
@@ -251,7 +252,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
251252 {
252253 List < string > phaseList = new List < string > ( ) ;
253254 bool isMatched = false ;
254- string machedModuleName = "" ;
255+ string matchedModuleName = "" ;
255256 foreach ( ( Regex regex , List < string > phaseConfigList ) in ruleList )
256257 {
257258 var regexResult = regex . Match ( filePath ) ;
@@ -261,7 +262,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
261262 isMatched = true ;
262263 if ( regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Success )
263264 {
264- machedModuleName = regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Value ;
265+ matchedModuleName = regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Value ;
265266 }
266267 Console . WriteLine ( string . Format ( "File {0} match rule: {1} and phaseConfig is: [{2}]" , filePath , regex . ToString ( ) , string . Join ( ", " , phaseConfigList ) ) ) ;
267268 break ;
@@ -294,7 +295,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
294295 }
295296 else
296297 {
297- string moduleName = machedModuleName == "" ? filePath . Split ( '/' ) [ 1 ] : machedModuleName ;
298+ string moduleName = matchedModuleName == "" ? filePath . Split ( '/' ) [ 1 ] : matchedModuleName ;
298299 if ( scope . Equals ( SingleModule ) )
299300 {
300301 scopes . Add ( moduleName ) ;
@@ -411,7 +412,7 @@ private Dictionary<string, HashSet<string>> CalculateCsprojForBuildAndTest(Dicti
411412 return influencedModuleInfo ;
412413 }
413414
414- private bool ProcessFileChanged ( Dictionary < string , string [ ] > csprojMap )
415+ private CIPhaseFilterConfig GetCIPhaseFilterConfig ( )
415416 {
416417 string configPath = Path . GetFullPath ( TaskMappingConfigName ) ;
417418 if ( ! File . Exists ( configPath ) )
@@ -420,8 +421,14 @@ private bool ProcessFileChanged(Dictionary<string, string[]> csprojMap)
420421 }
421422 string content = File . ReadAllText ( configPath ) ;
422423
423- CIPhaseFilterConfig config = JsonConvert . DeserializeObject < CIPhaseFilterConfig > ( content ) ;
424- List < ( Regex , List < string > ) > ruleList = config . Rules . Select ( rule => ( new Regex ( string . Join ( "|" , rule . Patterns . Select ( ProcessSinglePattern ) ) ) , rule . Phases ) ) . ToList ( ) ;
424+ return JsonConvert . DeserializeObject < CIPhaseFilterConfig > ( content ) ;
425+ }
426+
427+ private bool ProcessFileChanged ( Dictionary < string , string [ ] > csprojMap )
428+ {
429+
430+ CIPhaseFilterConfig config = GetCIPhaseFilterConfig ( ) ;
431+ List < ( Regex , List < string > ) > ruleList = config . Rules . Select ( rule => ( new Regex ( string . Join ( "|" , rule . Patterns . Select ( ProcessSinglePattern ) . ToList ( ) ) ) , rule . Phases ) ) . ToList ( ) ;
425432
426433 DateTime startTime = DateTime . Now ;
427434
@@ -456,13 +463,28 @@ public override bool Execute()
456463 }
457464 else if ( FilesChanged != null )
458465 {
459- if ( FilesChanged . Length > 0 && FilesChanged . Length < OCTOKIT_CHANGED_FILE_LIMIT )
466+ if ( FilesChanged . Length <= 0 )
460467 {
461- return ProcessFileChanged ( csprojMap ) ;
468+ return false ;
469+ }
470+ else if ( FilesChanged . Length >= OCTOKIT_CHANGED_FILE_LIMIT )
471+ {
472+ var selectedModuleList = GetSelectedModuleList ( ) ;
473+ Dictionary < string , HashSet < string > > influencedModuleInfo = new Dictionary < string , HashSet < string > >
474+ {
475+ [ BUILD_PHASE ] = new HashSet < string > ( selectedModuleList ) ,
476+ [ ANALYSIS_BREAKING_CHANGE_PHASE ] = new HashSet < string > ( selectedModuleList ) ,
477+ [ ANALYSIS_DEPENDENCY_PHASE ] = new HashSet < string > ( selectedModuleList ) ,
478+ [ ANALYSIS_HELP_PHASE ] = new HashSet < string > ( selectedModuleList ) ,
479+ [ ANALYSIS_SIGNATURE_PHASE ] = new HashSet < string > ( selectedModuleList ) ,
480+ [ TEST_PHASE ] = new HashSet < string > ( selectedModuleList )
481+ } ;
482+ FilterTaskResult . PhaseInfo = CalculateCsprojForBuildAndTest ( influencedModuleInfo , csprojMap ) ;
483+ return true ;
462484 }
463485 else
464486 {
465- return false ;
487+ return ProcessFileChanged ( csprojMap ) ;
466488 }
467489 }
468490 return true ;
0 commit comments