mirror of
https://github.com/coreybutler/nvm-windows.git
synced 2025-09-04 11:48:53 +00:00
Now using goxc for build process.
This commit is contained in:
39
build.bat
39
build.bat
@@ -1,17 +1,35 @@
|
||||
@echo off
|
||||
SET INNOSETUP=%CD%\nvm.iss
|
||||
SET ORIG=%CD%
|
||||
SET GOPATH=%CD%\src
|
||||
SET GOBIN=%CD%\bin
|
||||
SET GOARCH=386
|
||||
|
||||
REM Get the version number from the setup file
|
||||
for /f "tokens=*" %%i in ('findstr /n . %INNOSETUP% ^| findstr ^4:#define') do set L=%%i
|
||||
set version=%L:~24,-1%
|
||||
|
||||
REM Get the version number from the core executable
|
||||
for /f "tokens=*" %%i in ('findstr /n . %GOPATH%\nvm.go ^| findstr ^NvmVersion^| findstr ^21^') do set L=%%i
|
||||
set goversion=%L:~19,-1%
|
||||
|
||||
IF NOT %version%==%goversion% GOTO VERSIONMISMATCH
|
||||
|
||||
SET DIST=%CD%\dist\%version%
|
||||
|
||||
REM Build the executable
|
||||
echo Building NVM for Windows
|
||||
SET DIST=%CD%\dist\%version%
|
||||
SET GOPATH=%CD%\src
|
||||
SET GOBIN=%CD%\bin
|
||||
SET GOARCH=386
|
||||
go build -o %GOBIN%\nvm.exe %GOPATH%\nvm.go
|
||||
rm %GOBIN%\nvm.exe
|
||||
cd %GOPATH%
|
||||
goxc -arch="386" -os="windows" -n="nvm" -d="%GOBIN%" -o="%GOBIN%\nvm{{.Ext}}" -tasks-=package
|
||||
cd %ORIG%
|
||||
rm %GOBIN%\src.exe
|
||||
rm %GOPATH%\src.exe
|
||||
rm %GOPATH%\nvm.exe
|
||||
|
||||
REM Clean the dist directory
|
||||
rm -rf "%DIST%"
|
||||
mkdir "%DIST%"
|
||||
|
||||
REM Create the "noinstall" zip
|
||||
echo Generating nvm-noinstall.zip
|
||||
@@ -22,8 +40,15 @@ echo Generating nvm-setup.zip
|
||||
buildtools\iscc %INNOSETUP% /o%DIST%
|
||||
buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"
|
||||
rm "%DIST%\nvm-setup.exe"
|
||||
|
||||
cls
|
||||
echo --------------------------
|
||||
echo Release %version% available in %DIST%
|
||||
GOTO COMPLETE
|
||||
|
||||
:VERSIONMISMATCH
|
||||
echo The version number in nvm.iss does not match the version in src\nvm.go
|
||||
echo - nvm.iss line #4: %version%
|
||||
echo - nvm.go line #21: %goversion%
|
||||
EXIT /B
|
||||
|
||||
:COMPLETE
|
||||
@echo on
|
||||
|
Reference in New Issue
Block a user