-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
f8e975d
commit 9606917
Showing
5 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
scripts/azure-pipelines/windows/Check-ManifestFormatting.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory=$True)] | ||
[string]$Directory | ||
) | ||
|
||
git status --porcelain $Directory | ForEach-Object { | ||
(-split $_)[1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters