mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 02:49:01 +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 ```
50 lines
1.2 KiB
JSON
50 lines
1.2 KiB
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "4fb8813de02bd243b25d9ed93065f9f9cba09e93",
|
|
"version-string": "2020-02-07",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "d0ac4605d18f07a2a3087a71be8c84f6ad0fbfa8",
|
|
"version-string": "2020-02-07",
|
|
"port-version": 1
|
|
},
|
|
{
|
|
"git-tree": "7d418d32b5bf4d25c51cc84fe67186a03c289c15",
|
|
"version-string": "2020-02-07",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "b8d549421281befb7d6d5c5056275d245c17c69c",
|
|
"version-string": "20170730_git-5",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "a52a19ce11fc752a0256720a3cac9514de58742e",
|
|
"version-string": "20170730_git-4",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "f4224207001b084a57bb179a658890e3029ed6c6",
|
|
"version-string": "20170730_git-3",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "9596412729bf6ca5cc6290b37a451be668c7d3c5",
|
|
"version-string": "20170730_git-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "4a825f4f5c10a40d9604ad9f3a2d20a14b1f26d4",
|
|
"version-string": "20170730_git-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "72ea0e28f85e20e62aa30a045d9672c6c50b595d",
|
|
"version-string": "20170730_git",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|