Skip to content

Commit aaa7979

Browse files
authored
Fix the issue that will not run autorest test cases (#23662)
1 parent d675eef commit aaa7979

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Copyright (c) Microsoft. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -362,25 +362,28 @@ private bool ProcessFileChanged(Dictionary<string, string[]> csprojMap)
362362

363363
Dictionary<string, HashSet<string>> influencedModuleInfo = CalculateInfluencedModuleInfoForEachPhase(ruleList, csprojMap);
364364
DateTime endOfRegularExpressionTime = DateTime.Now;
365-
366-
influencedModuleInfo = CalculateCsprojForBuildAndTest(influencedModuleInfo, csprojMap);
367-
DateTime endTime = DateTime.Now;
368-
Console.WriteLine(string.Format("Takes {0} seconds for RE match, {1} seconds for phase config.", (endOfRegularExpressionTime - startTime).TotalSeconds, (endTime - endOfRegularExpressionTime).TotalSeconds));
369-
370-
if (!Directory.Exists(config.ArtifactPipelineInfoFolder))
371-
{
372-
Directory.CreateDirectory(config.ArtifactPipelineInfoFolder);
373-
}
365+
366+
#region Record the CI plan info to CIPlan.json under the artifacts folder
374367
Dictionary<string, HashSet<string>> CIPlan = new Dictionary<string, HashSet<string>>
375368
{
376-
[BUILD_PHASE] = new HashSet<string>(influencedModuleInfo[BUILD_PHASE].Select(GetModuleNameFromPath).Where(x => x != null)),
377-
[TEST_PHASE] = new HashSet<string>(influencedModuleInfo[TEST_PHASE].Select(GetModuleNameFromPath).Where(x => x != null))
369+
[BUILD_PHASE] = new HashSet<string>(influencedModuleInfo[BUILD_PHASE]),
370+
[TEST_PHASE] = new HashSet<string>(influencedModuleInfo[TEST_PHASE])
378371
};
379372
foreach (var analysisPhase in ANALYSIS_PHASE_LIST)
380373
{
381374
CIPlan.Add(analysisPhase, influencedModuleInfo[analysisPhase]);
382375
}
376+
if (!Directory.Exists(config.ArtifactPipelineInfoFolder))
377+
{
378+
Directory.CreateDirectory(config.ArtifactPipelineInfoFolder);
379+
}
383380
File.WriteAllText(Path.Combine(config.ArtifactPipelineInfoFolder, "CIPlan.json"), JsonConvert.SerializeObject(CIPlan, Formatting.Indented));
381+
#endregion
382+
383+
influencedModuleInfo = CalculateCsprojForBuildAndTest(influencedModuleInfo, csprojMap);
384+
DateTime endTime = DateTime.Now;
385+
Console.WriteLine(string.Format("Takes {0} seconds for RE match, {1} seconds for phase config.", (endOfRegularExpressionTime - startTime).TotalSeconds, (endTime - endOfRegularExpressionTime).TotalSeconds));
386+
384387
influencedModuleInfo[TEST_PHASE] = new HashSet<string>(influencedModuleInfo[TEST_PHASE].Where(x => x.EndsWith(".csproj")));
385388

386389
BuildCsprojList = influencedModuleInfo[BUILD_PHASE].ToArray();

0 commit comments

Comments
 (0)