mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-11 21:59:05 +08:00
1c2af99415
* [vcpkg format-manifest] initial convert-control attempt TODO: manifest comments! we should keep $directives * Finalize x-format-manifest First, fix Json::parse -- "\c", for any c, was incorrectly parsed. It would emit the escaped character, and then parse the character, so that `\b` would give you { '\b', 'b' }. Second, canonicalize source paragraphs as we're parsing them. This found an error in qt5 -- The `declarative` feature was listed twice, and we now catch it, so I removed the second paragraph. Add PlatformExpression::complexity to allow ordering platform expressions in a somewhat reasonable way. Notes: - We allow `all_modules` as a feature name for back-compat with paraview - In order to actually convert CONTROL to vcpkg.json, we'd need to rename the qt5 `default` feature. - We need to add support for $directives in x-format-manifest * fix qt5 port * format * fix compile * fix tests for canonicalization * Clean up code * add error message for nothing to format * add extra_info field * add `const X&` overloads for `Object::insert[_or_replace]` * fix compile * simple CRs * add tests * format * Fix mosquitto port file also unmerge a line * fail the tests on malformed manifest * fix format_all * fix coroutine port-version * format manifests
57 lines
1.3 KiB
PowerShell
57 lines
1.3 KiB
PowerShell
[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'
|
|
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
|
|
}
|