-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathone_key_build.bat
More file actions
89 lines (76 loc) · 2.04 KB
/
Copy pathone_key_build.bat
File metadata and controls
89 lines (76 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@echo off
setlocal EnableExtensions
chcp 65001 >nul
title CodexCliPlus 离线构建
set "SEARCH_DIR=%~dp0"
set "REPO_PUSHED="
:find_repo_root
if exist "%SEARCH_DIR%CodexCliPlus.sln" (
set "REPO_ROOT=%SEARCH_DIR%"
goto repo_root_found
)
for %%I in ("%SEARCH_DIR%..") do set "PARENT_DIR=%%~fI\"
if /I "%PARENT_DIR%"=="%SEARCH_DIR%" (
call :fail "未找到 CodexCliPlus.sln,无法定位仓库根目录。" 1
exit /b 1
)
set "SEARCH_DIR=%PARENT_DIR%"
goto find_repo_root
:repo_root_found
pushd "%REPO_ROOT%" >nul 2>nul
if errorlevel 1 (
call :fail "无法进入仓库根目录。" 1
exit /b 1
)
set "REPO_PUSHED=1"
if not exist "src\BuildPipeline\OfflineBuilder\CodexCliPlus.OfflineBuilder.csproj" (
call :fail "未找到离线构建器项目。" 1
exit /b 1
)
where dotnet >nul 2>nul
if errorlevel 1 (
call :fail "未找到 dotnet,请先安装 global.json 指定的 .NET SDK 后重试。" 1
exit /b 1
)
if /I "%~1"=="--help" goto run_passthrough
if /I "%~1"=="-h" goto run_passthrough
if /I "%~1"=="help" goto run_passthrough
if "%~1"=="/?" goto run_passthrough
echo CodexCliPlus 离线构建
echo.
echo 正在构建离线安装包...
echo.
dotnet run --project "src\BuildPipeline\OfflineBuilder\CodexCliPlus.OfflineBuilder.csproj" --configuration Release -- %*
set "EXIT_CODE=%ERRORLEVEL%"
if "%EXIT_CODE%"=="0" (
echo.
echo 构建完成,窗口即将关闭。
if defined REPO_PUSHED popd >nul
ping -n 3 127.0.0.1 >nul
exit /b 0
)
echo.
echo CodexCliPlus 离线构建失败
echo.
echo 退出码:%EXIT_CODE%
echo.
if defined REPO_PUSHED popd >nul
pause
exit /b %EXIT_CODE%
:run_passthrough
dotnet run --project "src\BuildPipeline\OfflineBuilder\CodexCliPlus.OfflineBuilder.csproj" --configuration Release -- %*
set "EXIT_CODE=%ERRORLEVEL%"
if defined REPO_PUSHED popd >nul
exit /b %EXIT_CODE%
:fail
set "FAIL_MESSAGE=%~1"
set "FAIL_CODE=%~2"
if not defined FAIL_CODE set "FAIL_CODE=1"
cls
echo CodexCliPlus 离线构建失败
echo.
echo %FAIL_MESSAGE%
echo.
if defined REPO_PUSHED popd >nul
pause
exit /b %FAIL_CODE%