mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 15: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 ```
40 lines
953 B
JSON
40 lines
953 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "9582485ed72df7ad43d20b3680e13eaeb76f76e7",
|
|
"version-string": "1.2.1",
|
|
"port-version": 3
|
|
},
|
|
{
|
|
"git-tree": "d05a10e23b006a8c29e74810a7062f7f13bae6da",
|
|
"version-string": "1.2.1",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "5759a8eadf7334bdac9cfd467786a7f178ce2b65",
|
|
"version-string": "1.2.1-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "0fcc8a66b1985d0eb5438de868d2117465286d79",
|
|
"version-string": "1.2.1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "108a211292ada68ac2b2fba6977d4c06a74461f8",
|
|
"version-string": "1.1.0-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "bbf85ac89ed48da6cb54c6245e68dfd806754c63",
|
|
"version-string": "1.1.0-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "38fe906677326d42240faa24a5aa987fb78f4df3",
|
|
"version-string": "1.1.0",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|