@@ -193,7 +193,8 @@ private List<string> GetDependentModuleList(string moduleName, Dictionary<string
193
193
// Run a selected module list instead of run all the modules to speed up the CI process.
194
194
private List < string > GetSelectedModuleList ( )
195
195
{
196
- return new List < string > ( Environment . GetEnvironmentVariable ( "SELECTEDMODULELIST" ) . Split ( ';' ) ) ;
196
+ CIPhaseFilterConfig config = GetCIPhaseFilterConfig ( ) ;
197
+ return config . SelectModuleList ;
197
198
}
198
199
199
200
private List < string > GetTestCsprojList ( string moduleName , Dictionary < string , string [ ] > csprojMap )
@@ -251,7 +252,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
251
252
{
252
253
List < string > phaseList = new List < string > ( ) ;
253
254
bool isMatched = false ;
254
- string machedModuleName = "" ;
255
+ string matchedModuleName = "" ;
255
256
foreach ( ( Regex regex , List < string > phaseConfigList ) in ruleList )
256
257
{
257
258
var regexResult = regex . Match ( filePath ) ;
@@ -261,7 +262,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
261
262
isMatched = true ;
262
263
if ( regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Success )
263
264
{
264
- machedModuleName = regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Value ;
265
+ matchedModuleName = regexResult . Groups [ MODULE_NAME_PLACEHOLDER ] . Value ;
265
266
}
266
267
Console . WriteLine ( string . Format ( "File {0} match rule: {1} and phaseConfig is: [{2}]" , filePath , regex . ToString ( ) , string . Join ( ", " , phaseConfigList ) ) ) ;
267
268
break ;
@@ -294,7 +295,7 @@ private Dictionary<string, HashSet<string>> CalculateInfluencedModuleInfoForEach
294
295
}
295
296
else
296
297
{
297
- string moduleName = machedModuleName == "" ? filePath . Split ( '/' ) [ 1 ] : machedModuleName ;
298
+ string moduleName = matchedModuleName == "" ? filePath . Split ( '/' ) [ 1 ] : matchedModuleName ;
298
299
if ( scope . Equals ( SingleModule ) )
299
300
{
300
301
scopes . Add ( moduleName ) ;
@@ -411,7 +412,7 @@ private Dictionary<string, HashSet<string>> CalculateCsprojForBuildAndTest(Dicti
411
412
return influencedModuleInfo ;
412
413
}
413
414
414
- private bool ProcessFileChanged ( Dictionary < string , string [ ] > csprojMap )
415
+ private CIPhaseFilterConfig GetCIPhaseFilterConfig ( )
415
416
{
416
417
string configPath = Path . GetFullPath ( TaskMappingConfigName ) ;
417
418
if ( ! File . Exists ( configPath ) )
@@ -420,8 +421,14 @@ private bool ProcessFileChanged(Dictionary<string, string[]> csprojMap)
420
421
}
421
422
string content = File . ReadAllText ( configPath ) ;
422
423
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 ( ) ;
425
432
426
433
DateTime startTime = DateTime . Now ;
427
434
@@ -456,13 +463,28 @@ public override bool Execute()
456
463
}
457
464
else if ( FilesChanged != null )
458
465
{
459
- if ( FilesChanged . Length > 0 && FilesChanged . Length < OCTOKIT_CHANGED_FILE_LIMIT )
466
+ if ( FilesChanged . Length <= 0 )
460
467
{
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 ;
462
484
}
463
485
else
464
486
{
465
- return false ;
487
+ return ProcessFileChanged ( csprojMap ) ;
466
488
}
467
489
}
468
490
return true ;
0 commit comments