vcpkg/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
nicole mazzuca 0fec1340eb
[vcpkg manifest] Add documentation! (#13488)
* [vcpkg docs] add docs for manifest files

These are just for the maintainer docs,
not user docs.

* [vcpkg] EBNF-ify platform expression parsing

this modifies nothing about what strings are accepted or rejected,
it just moves stuff around.

also adds tests.

* [vcpkg docs] add manifest mode example

* [wip] docs for augustin

also fix tabs

* [vcpkg manifest] switch to using maps for features

* Apply suggestions from code review

* un-experimentize format-manifest

* flesh out the user manifest mode docs

* CRs

* billy CRs

* final personal pass-thru
2020-09-14 15:07:02 -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" '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 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
}