Release 3.8.2.4: unify Windows/macOS GUI on glaze HTTP host.
Auto-bump build number on each compile; ship versioned Windows artifacts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,7 +6,7 @@ cd "$(dirname "$0")/.."
|
||||
# Prefer local toolchain if present.
|
||||
export PATH="$(pwd)/.tools/go/bin:/tmp/go-sdk/go/bin:/usr/local/go/bin:$PATH"
|
||||
|
||||
python3 scripts/sync-version.py
|
||||
python3 scripts/bump-build.py
|
||||
|
||||
VERSION="$(python3 - <<'PY'
|
||||
import re
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# Increment BuildNumber in update.go and sync version artifacts (no Python required).
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
|
||||
$updateGo = Join-Path $Root "internal\update\update.go"
|
||||
$text = [IO.File]::ReadAllText($updateGo)
|
||||
$m = [regex]::Match($text, 'const BuildNumber\s*=\s*(\d+)')
|
||||
if (-not $m.Success) { throw "cannot find BuildNumber in update.go" }
|
||||
$old = [int]$m.Groups[1].Value
|
||||
$new = $old + 1
|
||||
$text2 = [regex]::Replace($text, 'const BuildNumber\s*=\s*\d+', "const BuildNumber = $new", 1)
|
||||
[IO.File]::WriteAllText($updateGo, $text2)
|
||||
Write-Host "BuildNumber: $old -> $new"
|
||||
|
||||
$verM = [regex]::Match($text2, 'CurrentVersion\s*=\s*"([^"]+)"')
|
||||
if (-not $verM.Success) { throw "cannot find CurrentVersion" }
|
||||
$ver = $verM.Groups[1].Value
|
||||
$parts = @($ver.Split('.') | ForEach-Object { [int]$_ })
|
||||
while ($parts.Count -lt 3) { $parts += 0 }
|
||||
$major, $minor, $patch = $parts[0], $parts[1], $parts[2]
|
||||
$full = "$ver.$new"
|
||||
$display = "$ver+$new"
|
||||
$versionCode = $major * 1000000 + $minor * 10000 + $patch * 100 + $new
|
||||
|
||||
$viPath = Join-Path $Root "versioninfo.json"
|
||||
$vi = [IO.File]::ReadAllText($viPath)
|
||||
$vi = [regex]::Replace($vi, '("FileVersion"\s*:\s*\{\s*"Major"\s*:\s*)\d+', "`${1}$major", 1)
|
||||
$vi = [regex]::Replace($vi, '("Minor"\s*:\s*)\d+(\s*,\s*"Patch")', "`${1}$minor`${2}", 1)
|
||||
$vi = [regex]::Replace($vi, '("Patch"\s*:\s*)\d+(\s*,\s*"Build")', "`${1}$patch`${2}", 1)
|
||||
$vi = [regex]::Replace($vi, '("Build"\s*:\s*)\d+', "`${1}$new", 2)
|
||||
$vi = [regex]::Replace($vi, '("FileVersion"\s*:\s*")\d+\.\d+\.\d+\.\d+(")', "`${1}$full`${2}")
|
||||
$vi = [regex]::Replace($vi, '("ProductVersion"\s*:\s*")\d+\.\d+\.\d+\.\d+(")', "`${1}$full`${2}")
|
||||
[IO.File]::WriteAllText($viPath, $vi)
|
||||
Write-Host "updated versioninfo.json -> $full"
|
||||
|
||||
$batPath = Join-Path $Root "build-macos.bat"
|
||||
$bat = [IO.File]::ReadAllText($batPath)
|
||||
$bat2 = [regex]::Replace(
|
||||
$bat,
|
||||
'-version\s+\d+\.\d+\.\d+\s+-build\s+\d+\.\d+\.\d+\.\d+',
|
||||
"-version $ver -build $full"
|
||||
)
|
||||
if ($bat2 -ne $bat) {
|
||||
[IO.File]::WriteAllText($batPath, $bat2)
|
||||
Write-Host "updated build-macos.bat -> $ver $full"
|
||||
}
|
||||
|
||||
$gradlePath = Join-Path $Root "android\app\build.gradle.kts"
|
||||
if (Test-Path $gradlePath) {
|
||||
$g = [IO.File]::ReadAllText($gradlePath)
|
||||
$g2 = [regex]::Replace($g, 'versionCode\s*=\s*[\d_]+', "versionCode = $versionCode")
|
||||
$g2 = [regex]::Replace($g2, 'versionName\s*=\s*"[^"]+"', "versionName = `"$display`"")
|
||||
if ($g2 -ne $g) {
|
||||
[IO.File]::WriteAllText($gradlePath, $g2)
|
||||
Write-Host "updated android gradle -> $display $versionCode"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "bump complete: $full"
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Increment BuildNumber in update.go, then sync versioninfo / macOS bat / Android."""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
UPDATE_GO = ROOT / "internal" / "update" / "update.go"
|
||||
|
||||
|
||||
def bump() -> int:
|
||||
text = UPDATE_GO.read_text(encoding="utf-8")
|
||||
m = re.search(r"const BuildNumber\s*=\s*(\d+)", text)
|
||||
if not m:
|
||||
raise SystemExit("cannot find BuildNumber in update.go")
|
||||
n = int(m.group(1)) + 1
|
||||
text2, count = re.subn(
|
||||
r"const BuildNumber\s*=\s*\d+",
|
||||
f"const BuildNumber = {n}",
|
||||
text,
|
||||
count=1,
|
||||
)
|
||||
if count != 1:
|
||||
raise SystemExit("failed to rewrite BuildNumber")
|
||||
UPDATE_GO.write_text(text2, encoding="utf-8")
|
||||
print(f"BuildNumber: {m.group(1)} -> {n}", flush=True)
|
||||
return n
|
||||
|
||||
|
||||
def main() -> None:
|
||||
bump()
|
||||
sync = ROOT / "scripts" / "sync-version.py"
|
||||
r = subprocess.run([sys.executable, str(sync)], cwd=ROOT, check=False)
|
||||
if r.returncode != 0:
|
||||
raise SystemExit(r.returncode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user