From 394ef0ab93f8f53591b74154db4445b6f179277b Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 15 Feb 2019 17:00:06 -0800 Subject: [PATCH] Add missing entry to Version.Details.xml (#7643) Changes: * add entry for Mono.WebAssembly.Interop to Version.Details.xml * Update code check to ensure all veriables in the 'automated' section are accounted for in Version.Details.xml --- eng/Version.Details.xml | 4 ++++ eng/scripts/CodeCheck.ps1 | 50 +++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d23e550a66..ee4abc41eb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -277,6 +277,10 @@ https://github.com/aspnet/Extensions 61070026dca7117d439de0443cfbbb0fb7172c65 + + https://github.com/aspnet/Extensions + 0000 + https://github.com/dotnet/corefx c38c10d28e223aeea2f363a6ef0bf4a63d00a776 diff --git a/eng/scripts/CodeCheck.ps1 b/eng/scripts/CodeCheck.ps1 index 7ccf9a3bac..45fc9bd1e6 100644 --- a/eng/scripts/CodeCheck.ps1 +++ b/eng/scripts/CodeCheck.ps1 @@ -15,7 +15,19 @@ $repoRoot = Resolve-Path "$PSScriptRoot/../.." [string[]] $errors = @() -function LogError([string]$message) { +function LogError { + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$message, + [string]$FilePath + ) + if ($env:TF_BUILD) { + $prefix = "##vso[task.logissue type=error" + if ($FilePath) { + $prefix = "${prefix};sourcepath=$FilePath" + } + Write-Host "${prefix}]${message}" + } Write-Host -f Red "error: $message" $script:errors += $message } @@ -26,13 +38,19 @@ try { # if ($ci) { - & $repoRoot/build.ps1 -ci /t:InstallDotNet + & $repoRoot/build.ps1 -ci -norestore /t:InstallDotNet } Write-Host "Checking that Versions.props and Version.Details.xml match" [xml] $versionProps = Get-Content "$repoRoot/eng/Versions.props" [xml] $versionDetails = Get-Content "$repoRoot/eng/Version.Details.xml" - foreach ($dep in $versionDetails.SelectNodes('//ProductDependencies/Dependency')) { + + $versionVars = New-Object 'System.Collections.Generic.HashSet[string]' + foreach ($vars in $versionProps.SelectNodes("//PropertyGroup[`@Label=`"Automated`"]/*")) { + $versionVars.Add($vars.Name) | Out-Null + } + + foreach ($dep in $versionDetails.SelectNodes('//Dependency')) { Write-Verbose "Found $dep" $varName = $dep.Name -replace '\.','' $varName = $varName -replace '\-','' @@ -43,14 +61,24 @@ try { continue } + $versionVars.Remove($varName) | Out-Null + $expectedVersion = $dep.Version $actualVersion = $versionVar.InnerText if ($expectedVersion -ne $actualVersion) { - LogError "Version variable '$varName' does not match the value in Version.Details.xml. Expected '$expectedVersion', actual '$actualVersion'" + LogError ` + "Version variable '$varName' does not match the value in Version.Details.xml. Expected '$expectedVersion', actual '$actualVersion'" ` + -filepath "$repoRoot\eng\Versions.props" } } + foreach ($unexpectedVar in $versionVars) { + LogError ` + "Version variable '$unexpectedVar' does not have a matching entry in Version.Details.xml. See https://github.com/aspnet/AspNetCore/blob/master/docs/ReferenceResolution.md for instructions on how to add a new dependency." ` + -filepath "$repoRoot\eng\Versions.props" + } + Write-Host "Checking that solutions are up to date" Get-ChildItem "$repoRoot/*.sln" -Recurse ` @@ -92,12 +120,14 @@ try { & $dotnet run -p "$repoRoot/eng/tools/BaselineGenerator/" } - Write-Host "git diff" - & git diff --ignore-space-at-eol --exit-code - if ($LastExitCode -ne 0) { - $status = git status -s | Out-String - $status = $status -replace "`n","`n " - LogError "Generated code is not up to date." + Write-Host "Run git diff to check for pending changes" + $changedFiles = git --no-pager diff --ignore-space-at-eol --name-only + if ($changedFiles) { + foreach ($file in $changedFiles) { + $filePath = Resolve-Path "${repoRoot}/${file}" + LogError "Generated code is not up to date in $file." -filepath $filePath + & git --no-pager diff --ignore-space-at-eol $filePath + } } } finally {