2013-07-29 07:13:03 -04:00
|
|
|
@echo off
|
|
|
|
:: Nightbbuild2008.cmd
|
|
|
|
:: This script is run every night to produce a new version of MCServer, backup its PDB files and upload the packages to web.
|
|
|
|
:: When run without parameters, this script pauses at the end and waits for a keypress.
|
|
|
|
:: To run in an automated scheduler, add any parameter to disable waiting for a keystroke
|
|
|
|
::
|
2013-12-21 06:12:26 -05:00
|
|
|
:: The sript creates a symbol store (a database of PDB files) that can be used as a single entry in MSVC's symbol path,
|
|
|
|
:: then any executable / crashdump built by this script can be debugged and its symbols will be found automatically by MSVC,
|
|
|
|
:: without the users needing to specify the build version or anything.
|
|
|
|
:: In order to support pruning the symstore, a per-month store is created, so that old months can be removed when no longer needed.
|
|
|
|
::
|
2013-07-29 13:53:41 -04:00
|
|
|
:: This script expects a few tools on specific paths, you can pass the correct paths for your system as env vars "zip" and "vc"
|
|
|
|
:: This script assumes that "git", "symstore" and "touch" are available on PATH.
|
|
|
|
:: git comes from msysgit
|
|
|
|
:: symstore comes from Microsoft's Debugging Tools for Windows
|
|
|
|
:: touch comes from unxtools
|
2013-12-21 06:12:26 -05:00
|
|
|
:: This script is locale-dependent, because it parses the output of "time" and "date" shell commands
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
:: 7-zip executable (by default it should be on PATH):
|
|
|
|
if %zip%a == a set zip=7z
|
|
|
|
|
|
|
|
:: Visual C++ compiler executable name:
|
|
|
|
if %vc%a == a set vc="vcbuild.exe"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-21 13:28:00 -05:00
|
|
|
:: Check that the required environment vars are available:
|
|
|
|
if "a%ftppass%" == "a" (
|
|
|
|
echo You need to set FTP password in the ftppass environment variable to upload the files
|
|
|
|
goto haderror
|
|
|
|
)
|
|
|
|
if "a%ftpuser%" == "a" (
|
|
|
|
echo You need to set FTP username in the ftpuser environment variable to upload the files
|
|
|
|
goto haderror
|
|
|
|
)
|
|
|
|
if "a%ftpsite%" == "a" (
|
|
|
|
echo You need to set FTP server in the ftpsite environment variable to upload the files
|
|
|
|
goto haderror
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
:: Get the date and time into vars:
|
2014-01-09 03:45:21 -05:00
|
|
|
:: This is locale-dependent!
|
2013-07-29 13:53:41 -04:00
|
|
|
For /f "tokens=2-4 delims=/. " %%a in ('date /t') do (
|
|
|
|
set MYYEAR=%%c
|
|
|
|
set MYMONTH=%%b
|
|
|
|
set MYDAY=%%a
|
|
|
|
)
|
|
|
|
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set MYTIME=%%a_%%b)
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
echo Performing nightbuild of MC-Server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set DONOTPAUSE=y
|
|
|
|
|
|
|
|
:: Update the sources to the latest revision:
|
2013-07-29 13:53:41 -04:00
|
|
|
git pull
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
|
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
|
2013-08-16 04:17:37 -04:00
|
|
|
:: Update the external plugins to the latest revision:
|
2014-01-09 03:45:21 -05:00
|
|
|
git submodule update
|
2013-08-16 04:17:37 -04:00
|
|
|
if errorlevel 1 goto haderror
|
2014-01-09 03:45:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-16 04:17:37 -04:00
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
:: Get the Git commit ID into an environment var
|
|
|
|
For /f "tokens=1 delims=/. " %%a in ('git log -1 --oneline --no-abbrev-commit') do (set COMMITID=%%a)
|
|
|
|
if errorlevel 1 goto haderror
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
:: Test if the version is already present, using a "tagfile" that we create upon successful build
|
2013-12-21 13:28:00 -05:00
|
|
|
set TAGFOLDER=Install\%MYYEAR%_%MYMONTH%\
|
|
|
|
set TAGFILE=%TAGFOLDER%built_%COMMITID%.tag
|
|
|
|
echo Tag file: %TAGFILE%
|
2013-07-29 13:53:41 -04:00
|
|
|
if exist %TAGFILE% (
|
2013-07-29 07:13:03 -04:00
|
|
|
echo Latest version already present, bailing out
|
|
|
|
goto end
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-13 15:20:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
:: Configure the sources to use the MSVC2008 compiler:
|
|
|
|
cmake -G "Visual Studio 9 2008" .
|
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
:: Update the Bindings:
|
2013-07-29 07:13:03 -04:00
|
|
|
echo Updating Lua bindings
|
2013-12-21 13:28:00 -05:00
|
|
|
del src\Bindings\Bindings.cpp
|
|
|
|
del src\Bindings\Bindings.h
|
2013-07-29 07:13:03 -04:00
|
|
|
set ALLTOLUA_WAIT=N
|
2013-12-21 13:28:00 -05:00
|
|
|
cd src\Bindings
|
2013-07-29 07:13:03 -04:00
|
|
|
call AllToLua.bat
|
2013-12-21 13:28:00 -05:00
|
|
|
cd ..\..
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: Compile using VC2008 Express. Do a full rebuild.
|
|
|
|
echo Setting up VS environment...
|
|
|
|
call "%VS90COMNTOOLS%\vsvars32.bat"
|
|
|
|
echo Compiling MCServer...
|
|
|
|
title MCS Nightbuild
|
2014-01-13 15:20:06 -05:00
|
|
|
start "vc" /b /wait /low /min %vc% /r MCServer.sln "Release|Win32"
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-09 03:45:21 -05:00
|
|
|
:: Generate the .example.ini files by running the server without any ini files:
|
|
|
|
cd MCServer
|
|
|
|
del groups.ini
|
|
|
|
del settings.ini
|
|
|
|
del webadmin.ini
|
|
|
|
echo stop | MCServer
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2013-08-03 14:41:26 -04:00
|
|
|
:: Copy all the example ini files into the Install folder for zipping:
|
2014-01-09 03:45:21 -05:00
|
|
|
copy MCServer\groups.ini Install\groups.example.ini
|
|
|
|
copy MCServer\settings.ini Install\settings.example.ini
|
|
|
|
copy MCServer\webadmin.ini Install\webadmin.example.ini
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-03 14:41:26 -04:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
:: Use 7-zip to compress the resulting files into a single file:
|
2013-07-29 13:53:41 -04:00
|
|
|
set FILESUFFIX=%MYYEAR%_%MYMONTH%_%MYDAY%_%MYTIME%_%COMMITID%
|
|
|
|
echo FILESUFFIX=%FILESUFFIX%
|
2013-07-29 07:13:03 -04:00
|
|
|
copy MCServer\MCServer.exe Install\MCServer.exe
|
|
|
|
cd Install
|
2013-08-16 04:17:37 -04:00
|
|
|
%zip% a -mx9 -y MCServer_Win_%FILESUFFIX%.7z -scsWIN -i@Zip2008.list -xr!*.git*
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
:: Also pack PDBs into a separate archive:
|
2013-07-29 13:53:41 -04:00
|
|
|
%zip% a -mx9 -y Install\PDBs_%FILESUFFIX%.7z -scsWIN @Install\Zip2008_PDBs.list
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: upload to the FTP:
|
|
|
|
:upload
|
2013-07-29 13:53:41 -04:00
|
|
|
ncftpput -p %ftppass% -u %ftpuser% -T temp_ %ftpsite% / Install\MCServer_Win_%FILESUFFIX%.7z
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
2013-07-29 13:53:41 -04:00
|
|
|
ncftpput -p %ftppass% -u %ftpuser% -T temp_ %ftpsite% /PDBs Install\PDBs_%FILESUFFIX%.7z
|
2013-07-29 07:13:03 -04:00
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
echo Upload finished.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 13:53:41 -04:00
|
|
|
:: Create the tagfile so that we know that this CommitID has been built already
|
2013-12-21 13:28:00 -05:00
|
|
|
mkdir %TAGFOLDER%
|
2013-07-29 13:53:41 -04:00
|
|
|
touch %TAGFILE%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: Add the symbols to a global symbol cache
|
|
|
|
:: We want per-month symbol caches, so that the old ones can be easily deleted
|
|
|
|
set SYMBOLS=Symbols\%MYYEAR%_%MYMONTH%\
|
|
|
|
echo Storing symbols in %SYMBOLS%
|
|
|
|
|
|
|
|
symstore add /f MCServer\MCServer.* /s %SYMBOLS% /t MCServer
|
|
|
|
if errorlevel 1 goto haderror
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
goto end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:haderror
|
|
|
|
echo an error was encountered, check command output above
|
|
|
|
pause
|
|
|
|
goto finished
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:end
|
|
|
|
if "a%1" == "a" pause
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-22 04:02:11 -05:00
|
|
|
:finished
|