← Back to team overview

coapp-developers team mailing list archive

Re: Some minor ptk changes

 

And, I'm adding @import "filename" to property sheets to allow you to include one property sheet in another (.autopkg, .buildinfo, etc).

G
________________________________
From: coapp-developers-bounces+garretts=microsoft.com@xxxxxxxxxxxxxxxxxxx [coapp-developers-bounces+garretts=microsoft.com@xxxxxxxxxxxxxxxxxxx] on behalf of Garrett Serack [garretts@xxxxxxxxxxxxx]
Sent: Thursday, January 19, 2012 10:04 AM
To: coapp-developers@xxxxxxxxxxxxxxxxxxx
Subject: [Coapp-developers] 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
@setlocal
{1}:
@cd ""{0}""
{2}

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 STANDARD ERROR HANDLING BLOCK
REM ===================================================================
REM Everything went ok!
:success
exit /b 0

REM ===================================================================
REM Something not ok :(
:failed
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:

example:
// 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

Notes:
--------------------------
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



References