Skip to content

Commit

Permalink
[Tools] Fix the issue of CI Pipeline (#14222)
Browse files Browse the repository at this point in the history
* Fix the issue that cannot fine valid module for Generated module in CI pipeline

* Fix the issue that Target module fails

Co-authored-by: wyunchi-ms <yunwang@microsoft.com>
  • Loading branch information
wyunchi-ms and wyunchi-ms authored Feb 19, 2021
1 parent 319b8e6 commit 24bd84a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
1 change: 0 additions & 1 deletion .ci-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
"tools/CheckIgnoredFile.ps1",
"tools/CleanupBuild.ps1",
"tools/CommonIncrementVersion.ps1",
"tools/CreateAliasMapping.ps1",
"tools/CreateMappings_rules.json",
"tools/CreateMappings.ps1",
"tools/CreateRegistryEntry.ps1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ public override bool Execute()
var csprojMap = ReadMapFile(CsprojMapFilePath, "CsprojMapFilePath");

Console.WriteLine(string.Format("FilesChanged: {0}", FilesChanged.Length));
if (FilesChanged != null)
if (!string.IsNullOrWhiteSpace(TargetModule))
{
return ProcessTargetModule(csprojMap);
}
else if (FilesChanged != null)
{
if (FilesChanged.Length > 0)
{
Expand All @@ -435,10 +439,6 @@ public override bool Execute()
return true;
}
}
else if (!string.IsNullOrWhiteSpace(TargetModule))
{
return ProcessTargetModule(csprojMap);
}
return true;
}
}
Expand Down
17 changes: 13 additions & 4 deletions tools/CreateFilterMappings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,17 @@ function Create-CsprojMappings
<#
Maps a normalized path to the projects to be built based on the service folder provided.
#>

function Get-ModuleFromPath
{
param
(
[Parameter(Mandatory = $true)]
[string]$FilePath
)

return $FilePath.Replace('/', '\').Split('\src\')[1].Split('\')[0]
}
function Add-CsprojMappings
{
param
Expand All @@ -267,14 +278,12 @@ function Add-CsprojMappings
$Values = New-Object System.Collections.Generic.HashSet[string]
foreach ($CsprojFile in $CsprojFiles)
{
$Fields = $CsprojFile.FullName.Replace('/', '\').Split('\')
$Project = $Fields[$Fields.Length - 3]
$Project = Get-ModuleFromPath $CsprojFile.FullName
foreach ($ProjectName in $Script:ProjectToSolutionMappings.Keys)
{
foreach ($Solution in $Script:ProjectToSolutionMappings[$ProjectName])
{
$Fields = $Solution.Replace('/', '\').Split('\')
$ProjectNameFromSolution = $Fields[$Fields.Length - 2]
$ProjectNameFromSolution = Get-ModuleFromPath $Solution
if ($ProjectNameFromSolution -eq $Project)
{
foreach ($ReferencedProject in $Script:SolutionToProjectMappings[$Solution])
Expand Down

0 comments on commit 24bd84a

Please sign in to comment.