From bb4c48505a19b4f96b56bfdb2a8db4cf6ace18d7 Mon Sep 17 00:00:00 2001 From: tokisaki galaxy Date: Mon, 19 Oct 2026 16:00:20 +0800 Subject: [PATCH] server: accept a semver prerelease suffix in the product version 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. 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. --- server/CMakeLists.txt | 5 ++++- server/scripts/lcompile-release.ps1 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 56937097..56f90b5f 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -43,7 +43,10 @@ else() file(STRINGS "${MSIME_VERSION_FILE}" MSIME_PRODUCT_VERSION LIMIT_COUNT 1) endif() string(STRIP "${MSIME_PRODUCT_VERSION}" MSIME_PRODUCT_VERSION) -if(NOT MSIME_PRODUCT_VERSION MATCHES "^[0-9]+(\\.[0-9]+)*$") +# 版本主体必须是数字段;允许一个可选的连字符后缀(semver 预发布段),dev-build 用它携带 +# 日期与 commit(0.7.1-dev.20261019.),设置窗口关于页原样显示。关于页的 ParseVersion +# 会剥掉后缀做更新检查的数字比较,所以后缀不影响版本判定。 +if(NOT MSIME_PRODUCT_VERSION MATCHES "^[0-9]+(\\.[0-9]+)*(-[0-9A-Za-z.-]+)?$") message(FATAL_ERROR "Invalid product version in ${MSIME_VERSION_FILE}: '${MSIME_PRODUCT_VERSION}'") endif() configure_file( diff --git a/server/scripts/lcompile-release.ps1 b/server/scripts/lcompile-release.ps1 index a112b0bb..e77a3473 100644 --- a/server/scripts/lcompile-release.ps1 +++ b/server/scripts/lcompile-release.ps1 @@ -2,7 +2,7 @@ [CmdletBinding()] param( [string]$ManifestTool = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\mt.exe', - [ValidatePattern('^\d+\.\d+\.\d+$')] + [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,