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.<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.
This commit is contained in:
tokisaki galaxy committed 2026-10-19 16:00:20 +08:00
1 parent 43452f1ff9
commit bb4c48505a
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -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.<hash>),设置窗口关于页原样显示。关于页的 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(
+1 -1
View File
@@ -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,