Skip to content

Commit

Permalink
Add logic of collect the error and warning in build step
Browse files Browse the repository at this point in the history
  • Loading branch information
wyunchi-ms committed Oct 20, 2022
1 parent c5b9e26 commit 0c39c41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@
<BuildAction Condition="'$(Configuration)' != 'Release'">build</BuildAction>
<BuildAction Condition="'$(Configuration)' == 'Release'">publish</BuildAction>
</PropertyGroup>
<Exec Command="dotnet $(BuildAction) $(RepoArtifacts)Azure.PowerShell.sln -c $(Configuration)" Condition="$(GenerateDocumentationFile) != 'false'"/>
<Exec Command="dotnet $(BuildAction) $(RepoArtifacts)Azure.PowerShell.sln -c $(Configuration) -p:GenerateDocumentationFile=false" Condition="$(GenerateDocumentationFile) == 'false'"/>


<Exec Command="$(PowerShellCoreCommandPrefix) &quot;.\tools\ExecuteCIStep.ps1 -Build -RepoArtifacts $(RepoArtifacts) -Configuration $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) -BuildAction $(BuildAction)&quot;" />
<!-- Build version controller -->
<Exec Command="dotnet build $(RepoTools)VersionController/VersionController.Netcore.csproj -c $(Configuration)" />

Expand Down
13 changes: 10 additions & 3 deletions tools/ExecuteCIStep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,26 @@ If ($Build)
$LogFile = "$RepoArtifacts/Build.Log"
If ($GenerateDocumentationFile)
{
dotnet $BuildAction $RepoArtifacts/Azure.PowerShell.sln -c $Configuration -fl "/flp1:logFile=$LogFile;verbosity=quiet" --no-restore
dotnet $BuildAction $RepoArtifacts/Azure.PowerShell.sln -c $Configuration -fl "/flp1:logFile=$LogFile;verbosity=quiet"
}
Else
{
dotnet $BuildAction $RepoArtifacts/Azure.PowerShell.sln -c $Configuration -p:GenerateDocumentationFile=false -fl "/flp1:logFile=$LogFile;verbosity=quiet" --no-restore
dotnet $BuildAction $RepoArtifacts/Azure.PowerShell.sln -c $Configuration -p:GenerateDocumentationFile=false -fl "/flp1:logFile=$LogFile;verbosity=quiet"
}
$LogContent = Get-Content $LogFile
$BuildResultArray = @()
ForEach ($Line In $LogContent)
{
$Position, $ErrorOrWarningType, $Detail = $Line.Split(": ")
$Detail = Join-String -Separator ": " -InputObject $Detail
$ModuleName = $Position.Replace("\", "/").Split("src/")[1].Split('/')[0]
If ($Position.Contains("src"))
{
$ModuleName = $Position.Replace("\", "/").Split("src/")[1].Split('/')[0]
}
Else
{
$ModuleName = "dotnet"
}
$Type, $Code = $ErrorOrWarningType.Split(" ")
$BuildResultArray += @{
"Position" = $Position;
Expand Down

0 comments on commit 0c39c41

Please sign in to comment.