From 25825337cdd30a0ba1664ca389c56d99e41583d7 Mon Sep 17 00:00:00 2001 From: wyunchi-ms Date: Thu, 18 Feb 2021 15:37:06 +0800 Subject: [PATCH 1/2] Fix the issue that cannot fine valid module for Generated module in CI pipeline --- .ci-config.json | 1 - tools/CreateFilterMappings.ps1 | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.ci-config.json b/.ci-config.json index 023497961dd7..2e992e823072 100644 --- a/.ci-config.json +++ b/.ci-config.json @@ -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" diff --git a/tools/CreateFilterMappings.ps1 b/tools/CreateFilterMappings.ps1 index 925772d1b0ec..055ca25a7ca1 100644 --- a/tools/CreateFilterMappings.ps1 +++ b/tools/CreateFilterMappings.ps1 @@ -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 @@ -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]) From 0d5c800614e46a78ecc69c7fe66b2ea49aa71e9d Mon Sep 17 00:00:00 2001 From: wyunchi-ms Date: Thu, 18 Feb 2021 16:45:24 +0800 Subject: [PATCH 2/2] Fix the issue that Target module fails --- .../Microsoft.Azure.Build.Tasks/CIFilterTask.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs b/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs index 7295fd37f19a..60a5b0b5d98f 100644 --- a/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs +++ b/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs @@ -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) { @@ -435,10 +439,6 @@ public override bool Execute() return true; } } - else if (!string.IsNullOrWhiteSpace(TargetModule)) - { - return ProcessTargetModule(csprojMap); - } return true; } }