mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 18: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 ```
35 lines
815 B
JSON
35 lines
815 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "d49ba83122c461ba6d57aa2768241cc07ff3e32e",
|
|
"version-string": "5.0.0",
|
|
"port-version": 1
|
|
},
|
|
{
|
|
"git-tree": "c259e9c0f2dbd8f9b73871032ee553973636403e",
|
|
"version-string": "5.0.0",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "74b2306427376ac85f557edc031006de7b053b76",
|
|
"version-string": "4.0.0",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "e3ecad8455cc7469e4e2b6ee8a7a4ae6330a0241",
|
|
"version-string": "3.1.1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "8bd3fe38212e48daaf2e5f04018df991dfe57bac",
|
|
"version-string": "3.1.0",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "9a94f0e34a171c57fb889fb3497f4f9bf90fd4b8",
|
|
"version-string": "3.0.1",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|