An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Reuse the pinned Windows resource tool in release builds
Danielea8dd4e47bf9
diff --git a/docs/RELEASE-VERIFICATION.zh-CN.md b/docs/RELEASE-VERIFICATION.zh-CN.mdindex 7cd895a106..ba310a9014 100644--- a/docs/RELEASE-VERIFICATION.zh-CN.md+++ b/docs/RELEASE-VERIFICATION.zh-CN.md@@ -351,6 +351,7 @@ python -X utf8 scripts/verify-release.py check D:/releases/siyuan --version 3.8.- 本地前端生产构建一次,Linux 前端在 WSL 中构建- Windows 在全新目录构建两个架构内核,生成临时 Electron Builder 配置启用证书签名,不修改仓库 YAML,不复用开发内核目录;默认生成两个 NSIS 包并检查 Authenticode 签名+- Windows 资源工具固定为 `goversioninfo v1.7.0`:先检查 `GOBIN`(未设置时为 `GOPATH/bin`)下的工具及其 Go 模块版本,匹配时直接复用,仅缺失或版本不符时安装该固定版本,安装后再次验证;不在每次构建时查询 `latest`- Linux 调用现有 `scripts/linux-build.sh --target=all`,收集双架构 TAR、AppImage、DEB、RPM 共八个包- Android 在本次临时目录生成新 AAR,确认内核版本和架构后复制到工程;生成并复制新 `app.zip`,再运行 `gradlew clean buildReleaseTask` 生成四个渠道包;官方版收集为 `siyuan-版本号.apk`(例如 `siyuan-3.8.9.apk`),不带 `official` 或 `release` 后缀,其他渠道保持原文件名- 鸿蒙仅构建并复制 ARM64 真机内核,不构建 x86_64 模拟器内核;release 工程须保持 ARM64 ABI 筛选及排除 x86_64 库的配置。使用同一份新 `app.zip`,通过 Hvigor release 模式执行 `assembleApp`,对应 DevEco Studio 的“构建 - 编译 Hap(s)/APP(s) - 编译 APP(s)”,只收集 `build/outputs/default/siyuan-harmony-default-signed.app`,缺少签名产物时失败,不收集 `unsigned.app` 或单独的 HAPdiff --git a/scripts/build-release.py b/scripts/build-release.pyindex 9d8d7b441e..100713b399 100644--- a/scripts/build-release.py+++ b/scripts/build-release.py@@ -26,6 +26,8 @@ SPEC = importlib.util.spec_from_file_location("verify_release", Path(__file__).wVERIFY = importlib.util.module_from_spec(SPEC)SPEC.loader.exec_module(VERIFY)PLATFORMS = ("windows", "linux", "android", "harmony")+GOVERSIONINFO_MODULE = "github.com/josephspurrier/goversioninfo"+GOVERSIONINFO_VERSION = "v1.7.0"ACTIVE_RECORD = None@@ -581,11 +583,26 @@ class Builder:self.windows_arch(arch, config)def windows_tools(self):- run(["go", "install", "github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest"], ROOT / "kernel")go_bin = run(["go", "env", "GOBIN"], ROOT, capture=True)if not go_bin:go_bin = str(Path(run(["go", "env", "GOPATH"], ROOT, capture=True).split(os.pathsep)[0]) / "bin")- run([Path(go_bin) / "goversioninfo.exe", "-platform-specific=true", "-icon=resource/icon.ico",+ tool = Path(go_bin) / "goversioninfo.exe"+ def matches():+ if not tool.is_file():+ return False+ try:+ metadata = run(["go", "version", "-m", tool], ROOT, capture=True)+ except BuildError:+ return False+ return re.search(r"(?m)^\s*mod\s+" + re.escape(GOVERSIONINFO_MODULE) ++ r"\s+" + re.escape(GOVERSIONINFO_VERSION) + r"(?:\s|$)", metadata) is not None+ if not matches():+ run(["go", "install", GOVERSIONINFO_MODULE + "/cmd/goversioninfo@" + GOVERSIONINFO_VERSION], ROOT / "kernel")+ if not matches():+ raise BuildError("Windows 资源工具安装后的版本不匹配")+ else:+ print(f"复用 Windows 资源工具:{GOVERSIONINFO_VERSION}", flush=True)+ run([tool, "-platform-specific=true", "-icon=resource/icon.ico","-manifest=resource/goversioninfo.exe.manifest"], ROOT / "kernel")def windows_kernel(self, arch):diff --git a/scripts/test_build_release.py b/scripts/test_build_release.pyindex f62e4b069f..d3e2e47d56 100644--- a/scripts/test_build_release.py+++ b/scripts/test_build_release.py@@ -316,6 +316,30 @@ class BuildTests(unittest.TestCase):with self.assertRaises(build.BuildError):self.builder.collect([self.root / "missing.apk"], "Android", time.time())+ def test_windows_resource_tool_reuses_matching_version_and_pins_install(self):+ for current in (build.GOVERSIONINFO_VERSION, "v0.0.0", None):+ tool = self.root / "bin/goversioninfo.exe"+ tool.unlink(missing_ok=True)+ version = [current]+ if current:+ self.write(tool)+ commands = []+ def run(command, cwd, env=None, capture=False):+ commands.append(command)+ if command == ["go", "env", "GOBIN"]:+ return str(tool.parent)+ if command[:3] == ["go", "version", "-m"]:+ return "mod " + build.GOVERSIONINFO_MODULE + " " + version[0]+ if command[:2] == ["go", "install"]:+ self.assertEqual(command[2], build.GOVERSIONINFO_MODULE + "/cmd/goversioninfo@" + build.GOVERSIONINFO_VERSION)+ self.write(tool)+ version[0] = build.GOVERSIONINFO_VERSION+ return ""+ with self.subTest(current=current), patch.object(build, "run", side_effect=run):+ self.builder.windows_tools()+ self.assertEqual(sum(command[:2] == ["go", "install"] for command in commands),+ 0 if current == build.GOVERSIONINFO_VERSION else 1)+def test_old_kernel_version_is_rejected(self):path = self.write(self.root / "libkernel.so", kernel("3.8.3"))with self.assertRaises(build.BuildError):@@ -338,6 +362,10 @@ class BuildTests(unittest.TestCase):commands.append(command)if command[:3] in (["go", "env", "GOBIN"], ["go", "env", "GOPATH"]):return str(self.root / "go-bin")+ if command[:2] == ["go", "install"]:+ self.write(self.root / "go-bin/goversioninfo.exe")+ if command[:3] == ["go", "version", "-m"]:+ return "mod " + build.GOVERSIONINFO_MODULE + " " + build.GOVERSIONINFO_VERSIONif command[:2] == ["go", "build"]:self.write(command[command.index("-o") + 1])if command[0] == "node":