← Back to team overview

coapp-developers team mailing list archive

Some minor ptk changes


I'm adding a small tweak to the way that pTK handles build-command and clean-command scripts:

Currently, the batch file that gets emitted and run via cmd /c  looks like this:

@echo off
@cd ""{0}""

where :
{1} is the drive that the .buildinfo script is on
{0} is the directory that the .buildinfo script is in
{2} is the contents of the script from the .buildinfo file itself.

I'm going to tack on a footer onto the script too:

REM ===================================================================
REM ===================================================================
REM Everything went ok!
exit /b 0

REM ===================================================================
REM Something not ok :(
echo ERROR: Failure in script. aborting.
exit /b 1
REM ===================================================================

This makes it so that the .buildinfo author can easily use the double-pipe ( || ) on commands to abort the script and return an error code back to ptk:

// somewhere in my .buildinfo file

build-command : @"
rem call some command
msbuild /p:Platform=win32 /p:Configuration=Release zlibvc.sln || goto failed

rem if the about msbuild command failed, the script gets exited
rem ... continue script here ...

You can also use the double ampersand ( &&  ) to exit with success by stating && goto success after a command in the script

For those who didn't know about || and && in cmd batch files:

commandA && commandB      Run commandA, if it succeeds then run commandB
commandA || commandB      Run commandA, if it fails then run commandB

You can learn more here: http://ss64.com/nt/syntax-redirection.html

Follow ups