Skip to content

Instantly share code, notes, and snippets.

@Y-Less
Last active October 24, 2017 08:02
Show Gist options
  • Save Y-Less/476726e1f4aa514ee97e to your computer and use it in GitHub Desktop.
Save Y-Less/476726e1f4aa514ee97e to your computer and use it in GitHub Desktop.
Spawn a single compile and run.
@echo off
set MODE=%~1
set TARGET=%~2
set FLAGS=%~3
set NAME=%MODE%%TARGET%
call :setup
call :build
call :run
echo.
goto :eof
:build
echo #define COMPILE_FLAGS "%FLAGS%" > "%NAME%\compile_flags.txt"
pawno\pawncc.exe "gamemodes\%MODE%.pwn" -v0 -i"%NAME%" -i"pawno\include" -;+ -(+ %FLAGS% _DEBUG=0 TEST_AUTO_EXIT=true -o"%NAME%\gamemodes\mode.amx" > nul
goto :eof
:setup
rem Remove old versions
del logs\%NAME%.txt 2> nul
rem Create subdirectories
rmdir /S /Q %NAME% 2> nul
mkdir %NAME%
cd %NAME%
mkdir gamemodes
mklink samp-server.exe ..\samp-server.exe > nul
mklink samp-npc.exe ..\samp-npc.exe > nul
mklink /D plugins ..\plugins > nul
mkdir scriptfiles
rem Give the targe paths relative to their location not where we are now
mklink /D scriptfiles\DANGEROUS_SERVER_ROOT .. > nul
mklink /D scriptfiles\YSI ..\..\scriptfiles\YSI > nul
rem Copy the important files
rem Write the current test to the config file
copy /A /Y ..\server_test.cfg server.cfg > nul
cd ..
goto :eof
:run
rem Run the server with the custom server.cfg - it closes itself after
cd %NAME%
samp-server.exe
rem Copy server-log.txt somewhere
if exist "server_log.txt" (
move /Y server_log.txt ..\logs\%NAME%.txt > nul
)
cd ..
rmdir /S /Q %NAME%
goto :eof
@Y-Less
Copy link
Author

Y-Less commented Oct 24, 2017

I changed how "scriptfiles" is done. It isn't just a link to the original now, but a directory with two more links inside. This is so DANGEROUS_SERVER_ROOT points at the current test's root, not the original root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment