chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
chcp 65001 >nul
|
||||
|
||||
set "EXE_NAME=spherical-gui"
|
||||
set "OUTPUT_DIR=..\..\bin"
|
||||
set "GOOS=windows"
|
||||
set "GOARCH=amd64"
|
||||
set "VERSION=dev"
|
||||
|
||||
for /f "tokens=*" %%a in ('git rev-parse --short HEAD 2^>nul') do set "COMMIT=%%a"
|
||||
if not defined COMMIT set "COMMIT=unknown"
|
||||
|
||||
for /f "tokens=*" %%a in ('powershell -Command "Get-Date -Format 'yyyy-MM-dd_HH:mm:ss'"') do set "BUILD_TIME=%%a"
|
||||
|
||||
set "LDFLAGS=-s -w -H=windowsgui -X main.Version=%VERSION% -X main.Commit=%COMMIT% -X main.BuildTime=%BUILD_TIME%"
|
||||
set "BUILD_FLAGS=-trimpath"
|
||||
|
||||
echo Cleaning up...
|
||||
if exist "%OUTPUT_DIR%" rmdir /s /q "%OUTPUT_DIR%"
|
||||
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"
|
||||
|
||||
echo Generating version info for Windows...
|
||||
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
|
||||
goversioninfo -icon=app.ico -manifest=app.manifest -64 -o=app.syso
|
||||
|
||||
echo Building %EXE_NAME% for %GOOS%/%GOARCH% ...
|
||||
set "CGO_ENABLED=0"
|
||||
go build %BUILD_FLAGS% -tags tempdll -ldflags "%LDFLAGS%" -o "%OUTPUT_DIR%\%EXE_NAME%.exe" .
|
||||
if errorlevel 1 (
|
||||
echo Build failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Copying config files...
|
||||
copy ".\config.json" "%OUTPUT_DIR%\config.json" >nul
|
||||
if errorlevel 1 (
|
||||
echo Copy config files failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Build completed: %OUTPUT_DIR%\%EXE_NAME%.exe
|
||||
|
||||
endlocal
|
||||
Reference in New Issue
Block a user