mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 11:19:00 +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 ```
30 lines
702 B
JSON
30 lines
702 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "7fd6a2ea2fbded3b2e1de5e98ee81b59beaa14d4",
|
|
"version-string": "alias",
|
|
"port-version": 1
|
|
},
|
|
{
|
|
"git-tree": "ca605f2187feef6d74eabacbdf7e83216b4241e5",
|
|
"version-string": "alias",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "8610eb82f35617b9df9fe3a520dba4b18bdf1c6d",
|
|
"version-string": "2018-04-18-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "ef73a5c4513b200bcd4c5d2f7564b15042c892f7",
|
|
"version-string": "2018-04-18-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "c66278e6e9f1e2e1900d6a784460203d5f9367dd",
|
|
"version-string": "2018-04-18",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|