The validation added in #1084 rejected anything but digits and dots, which is narrower than semver: a prerelease suffix after a hyphen is part of the spec, and the native about page's ParseVersion already strips such a suffix for the update check while displaying it verbatim. Allow exactly one hyphen segment of [0-9A-Za-z.-] after the numeric body, so dev builds can embed 0.7.1-dev.20261019.<hash> and the about page shows the full string. version.txt itself stays bare MAJOR.MINOR.PATCH and every release passes unchanged. lcompile-release.ps1 feeds the same override locally, so its ValidatePattern loosens in step.
35 lines
2.0 KiB
PowerShell
35 lines
2.0 KiB
PowerShell
# Configure and build the Server; do not reuse old binaries after a failed build.
|
|
[CmdletBinding()]
|
|
param(
|
|
[string]$ManifestTool = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\mt.exe',
|
|
[ValidatePattern('^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$')]
|
|
[string]$ProductVersion = '',
|
|
# ALL_BUILD also builds MetasequoiaImeServerTests and test_webview_contract, which the packaging
|
|
# step deletes again. The server target already depends on the watchdog, the three panels,
|
|
# Settings, DictionaryReplay and the OpenCC dictionaries, so it produces exactly the packaged
|
|
# set. The test jobs still build everything by passing -Target ALL_BUILD.
|
|
[string]$Target = 'MetasequoiaImeServer',
|
|
# The Visual Studio generator wires ZERO_CHECK into every target, so a build regenerates itself
|
|
# whenever CMakeLists.txt changes. Re-running configure up front only costs ~10s without
|
|
# changing the result, so do it once and let ZERO_CHECK handle the rest.
|
|
[switch]$Reconfigure
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$projectRoot = Split-Path -Parent $PSScriptRoot
|
|
$buildDirectory = Join-Path $projectRoot 'build-release'
|
|
Push-Location $projectRoot
|
|
try {
|
|
if ($Reconfigure -or $ProductVersion -or -not (Test-Path -LiteralPath (Join-Path $buildDirectory 'CMakeCache.txt'))) {
|
|
$cmakeArgs = @('--preset=vcpkg-release', "-DMSIME_PRODUCT_VERSION_OVERRIDE=$ProductVersion")
|
|
cmake @cmakeArgs
|
|
if ($LASTEXITCODE -ne 0) { throw "Server configure failed ($LASTEXITCODE)" }
|
|
}
|
|
cmake --build $buildDirectory --config Release --target $Target --parallel
|
|
if ($LASTEXITCODE -ne 0) { throw "Server build failed ($LASTEXITCODE)" }
|
|
# Keep the local SDK selection; the complete resource argument must reach mt.exe as one value.
|
|
$binary = Join-Path $buildDirectory 'bin/Release/MetasequoiaImeServer.exe'
|
|
& $ManifestTool `
|
|
-manifest (Join-Path $projectRoot 'MetasequoiaImeServer.manifest') "-outputresource:$binary;1"
|
|
if ($LASTEXITCODE -ne 0) { throw "Server manifest embedding failed ($LASTEXITCODE)" }
|
|
} finally { Pop-Location }
|