aboutsummaryrefslogtreecommitdiff
path: root/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2020-07-07 14:09:33 -0700
committerGitHub <noreply@github.com>2020-07-07 14:09:33 -0700
commit9606917c81792c52097847fa8037907d92b161a2 (patch)
tree6b58b8ead45c5b917542fd1585452c3715f1f604 /scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
parentf8e975d44a6c8ae5855ece419696ea6abd050898 (diff)
downloadvcpkg-9606917c81792c52097847fa8037907d92b161a2.tar.gz
vcpkg-9606917c81792c52097847fa8037907d92b161a2.zip
[vcpkg ci] Update formatting CI (#12314)
* stage checking formatting this means that the port CI won't run if the formatting failed * fix invalid names * add formatting of manifests * fix dependsOn name * fix a thing * CRs * oops, typo
Diffstat (limited to 'scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1')
-rw-r--r--scripts/azure-pipelines/windows/Check-ManifestFormatting.ps151
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1 b/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
new file mode 100644
index 000000000..e4f52ae7b
--- /dev/null
+++ b/scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
@@ -0,0 +1,51 @@
+[CmdletBinding()]
+Param(
+ [Parameter(Mandatory=$True)]
+ [string]$Root,
+ [Parameter()]
+ [string]$DownloadsDirectory,
+ [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 [string]::IsNullOrEmpty($DownloadsDirectory))
+{
+ $env:VCPKG_DOWNLOADS = $DownloadsDirectory
+}
+
+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'
+$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.",
+ "If your build fails here, you need to run:"
+ )
+ $msg += " vcpkg x-format-manifest --all"
+ $msg += ""
+
+ $msg += "vcpkg should produce the following diff:"
+ $msg += git diff $portsTree
+
+ Write-Error ($msg -join "`n")
+ throw
+}