Files
JoyD/AutoRobot/Windows/build.bat

53 lines
1.1 KiB
Batchfile
Raw Permalink Normal View History

@echo off
chcp 65001 >nul
echo 构建开始..
echo ====================================================
REM 1. 编译Go项目
echo.
echo 编译Go项目...
cd /d "%~dp0\Robot"
call build.bat
if errorlevel 1 (
echo Go项目编译失败
exit /b 1
)
cd /d "%~dp0"
REM 2. 编译Web项目
echo.
echo 编译Web项目...
cd /d "%~dp0\Robot\Web"
call npm run build
if errorlevel 1 (
echo Web项目编译失败
exit /b 1
)
cd /d "%~dp0"
REM 3. 清理Output目录
echo.
echo 清理Output目录...
if exist "Output" (
rd /s /q "Output"
)
REM 4. 创建Output目录结构
echo 创建Output目录...
mkdir "Output" >nul 2>nul
mkdir "Output\Web" >nul 2>nul
REM 5. 复制Robot.exe到Output目录
echo 复制Robot.exe...
copy /y "%~dp0\Robot\Robot.exe" "%~dp0\Output\Robot.exe" >nul
REM 6. 复制Web的输出到Output\Web目录
echo 复制Web项目文件...
xcopy /s /e /y "%~dp0\Robot\Web\dist\*" "%~dp0\Output\Web\" >nul
REM 完成
echo.
echo ===== 构建完成 =====
echo 所有文件已成功输出到Output目录
echo - Output\Robot.exe
echo - Output\Web\*.*
echo ====================================================