mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 22:39:07 +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 ```
40 lines
1.1 KiB
JSON
40 lines
1.1 KiB
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "d94e4685c15581a8e5740ee6061d8b608645fd31",
|
|
"version-string": "1.22",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "38da693d53b70286fe05028daf4fa5f3418455fb",
|
|
"version-string": "1.22-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "adcfa1c019e553cc47661e3859255a86432fa21f",
|
|
"version-string": "1.22",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "f8a523b9f906e02780428f9ccd59454674c08009",
|
|
"version-string": "2017-10-25-8b1cd3753b184341e837b30383832645135d3d73-3",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "bebf555777010d231e125b65fa2eb8bd0abc5e86",
|
|
"version-string": "2017-10-25-8b1cd3753b184341e837b30383832645135d3d73-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "dcbccbe571362c8e2e05b4006ac37aeb71e774de",
|
|
"version-string": "2017-10-25-8b1cd3753b184341e837b30383832645135d3d73-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "53d4aa791e91e34c8e511293325bbf37a23fd354",
|
|
"version-string": "2017-10-25-8b1cd3753b184341e837b30383832645135d3d73",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|