vcpkg/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
ras0219 481738beae
[vcpkg] Add vcpkg export to E2E tests. Enable E2E tests on all platforms. (#12198)
* [vcpkg] Add `vcpkg export` to E2E tests. Enable E2E tests on MacOS.

* [vcpkg] Fix export --raw --output-dir=/path/ by changing directory to new export root

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2020-08-10 10:22:51 -07:00

50 lines
1.1 KiB
PowerShell

[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$Root,
[Parameter()]
[switch]$IgnoreErrors # allows one to just format
)
$portsTree = Get-Item "$Root/ports"
if (-not (Test-Path "$Root/.vcpkg-root"))
{
Write-Error "The vcpkg root was not at $Root"
throw
}
if (-not (Test-Path "$Root/vcpkg.exe"))
{
& "$Root/bootstrap-vcpkg.bat"
if (-not $?)
{
Write-Error "Bootstrapping vcpkg failed"
throw
}
}
& "$Root/vcpkg.exe" 'x-format-manifest' '--all'
if (-not $?)
{
Write-Error "Failed formatting manifests; are they well-formed?"
throw
}
$changedFiles = & "$PSScriptRoot/Get-ChangedFiles.ps1" -Directory $portsTree
if (-not $IgnoreErrors -and $null -ne $changedFiles)
{
$msg = @(
"",
"The formatting of the manifest files didn't match our expectation.",
"See https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#manifest for solution."
)
$msg += ""
$msg += "vcpkg should produce the following diff:"
$msg += git diff $portsTree
Write-Error ($msg -join "`n")
throw
}