Skip to content

Commit 8a28f29

Browse files
committed
feat: Add MD5 checksum generation to build_all.bat
- Introduced a new feature to generate and save MD5 checksums for built files in `build_all.bat`. - Added a new cyan color code for terminal output to enhance visibility. - Included messages to inform users about the successful generation and location of the MD5 checksum file. These changes improve the build process by providing users with a way to verify the integrity of the built files.
1 parent 374b509 commit 8a28f29

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/build_all.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set "GREEN=[32m"
99
set "RED=[31m"
1010
set "YELLOW=[33m"
1111
set "RESET=[0m"
12+
set "CYAN=[36m"
1213

1314
:: 设置编译优化标志
1415
set "LDFLAGS=-s -w"
@@ -59,6 +60,11 @@ set platforms[3].suffix=
5960
:: 设置开始时间
6061
set start_time=%time%
6162

63+
:: 创建 MD5 信息文件
64+
echo MD5 Checksums > ..\bin\md5_checksums.txt
65+
echo ============= >> ..\bin\md5_checksums.txt
66+
echo. >> ..\bin\md5_checksums.txt
67+
6268
:: 编译所有目标
6369
echo 开始编译所有平台...
6470

@@ -82,6 +88,13 @@ for /L %%i in (0,1,3) do (
8288

8389
if !errorlevel! equ 0 (
8490
echo %GREEN%Build successful: !outfile!%RESET%
91+
92+
:: 计算并显示 MD5
93+
certutil -hashfile "!outfile!" MD5 | findstr /v "CertUtil" | findstr /v "MD5" > md5.tmp
94+
set /p MD5=<md5.tmp
95+
del md5.tmp
96+
echo !MD5! cursor_id_modifier_v%VERSION%_!os!_!arch!!suffix!!ext! >> ..\bin\md5_checksums.txt
97+
echo %CYAN%MD5: !MD5!%RESET%
8598
) else (
8699
echo %RED%Build failed for !os! !arch!%RESET%
87100
)
@@ -93,7 +106,13 @@ set /a duration = %end_time:~0,2% * 3600 + %end_time:~3,2% * 60 + %end_time:~6,2
93106

94107
echo.
95108
echo %GREEN%所有构建完成! 总耗时: %duration%%RESET%
109+
echo %CYAN%MD5 校验值已保存到 bin/md5_checksums.txt%RESET%
96110
if exist "..\bin" dir /b "..\bin"
97111

112+
:: 显示 MD5 校验文件内容
113+
echo.
114+
echo %YELLOW%MD5 校验值:%RESET%
115+
type ..\bin\md5_checksums.txt
116+
98117
pause
99118
endlocal

0 commit comments

Comments
 (0)