qnc-server-old/build_and_package.bat
2024-09-14 10:48:09 +08:00

41 lines
897 B
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 > nul
setlocal
REM 设置配置文件路径环境变量
set CONFIG_PATH=config.yaml
REM 询问用户要打包成 Windows 还是 Linux
set /p OS="请选择要打包成的操作系统 (windows/linux): "
if /i "%OS%"=="windows" (
set GOOS=windows
set EXECUTABLE=qnc.exe
) else if /i "%OS%"=="linux" (
set GOOS=linux
set EXECUTABLE=qnc
) else (
echo 无效的选项,请选择 windows 或 linux
exit /b 1
)
REM 创建打包文件夹
mkdir dist
REM 交叉编译成对应的操作系统和架构
set GOARCH=amd64
go build -o dist/%EXECUTABLE% main.go
REM 将配置文件复制到打包文件夹
@REM copy config.yaml dist\config.yaml
@REM copy processed.json dist\processed.json
@REM xcopy ssl dist\ssl /E /I /Y
xcopy templates dist\templates /E /I /Y
xcopy merchant dist\merchant /E /I /Y
echo "打包完成文件夹已生成dist"
endlocal