mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-09 14:09:02 +08:00
b295670e4b
``` function Convert-Control { Param($full) .\vcpkg.exe format-manifest $full $root = $full.Substring(0, $full.Length - 7) # CONTROL $new = $root + 'vcpkg.json' $content = Get-Content -Raw $new $asJson = ConvertFrom-Json $content -AsHashtable -Depth 100 $oldVersion = $asJson['port-version'] if ($null -eq $oldVersion) { $oldVersionFull = $asJson['version-string'] Write-Host "Got version $oldVersionFull" $match = [System.Text.RegularExpressions.Regex]::Match($oldVersionFull, '^(.+)-(\d+)$') if ($match.Success -and -not [System.Text.RegularExpressions.Regex]::IsMatch($oldVersionFull, '^\d\d\d\d-\d\d-\d\d$')) { $newFullVersion = [string]$match.Groups[1].Value $oldVersion = [int]$match.Groups[2].Value Write-Host "newFullVersion $newFullVersion oldVersion $oldVersion" $newVersion = $oldVersion + 1 $asJson['version-string'] = $newFullVersion Write-Host "Previous version for $full extracted from version field -- setting version-string $newFullVersion and port-version $newVersion" } else { Write-Host "No previous version for $full -- setting 1" $newVersion = 1 } } else { $newVersion = [int]$oldVersion + 1 Write-Host "New version for $full : $newVersion" } $asJson['port-version'] = $newVersion $content = ConvertTo-Json $asJson -Depth 100 Set-Content -Path $new -Value $content .\vcpkg.exe format-manifest $new } Get-ChildItem ports\CONTROL -Recurse | Foreach-Object { Convert-Control $_.FullName } git commit -am "this message" .\vcpkg.exe x-add-version -all git commit -a --amend ```
20 lines
442 B
JSON
20 lines
442 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "1d75f114575faaf58492d7eca28e5caa3768811a",
|
|
"version-string": "1767ab87cffe",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "b54d1af1ee2c42b0b298fa3d40c7e283b3da015c",
|
|
"version-string": "1767ab87cffe-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "3e3ba2742cbbf9670330537de59a170c93dc43c0",
|
|
"version-string": "1767ab87cffe",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|