debug

= VALUE(©DEBUG©,,environ)

if debug = ©YES© then do

parms = parms ©/Ti+© end

icc parms ©/Fo©output input

exit result

Windows NT and 95 build scripts must be able to return a value for a return code. Because *.bat command ®les provide little support for programming logic and cannot return a value, use a compiled executable for your build script. TeamConnection provides two sample Windows build scripts and their source ®les. These samples, fhbwcomp.exe and fhbwlink.exe, are C programs for the Microsoft Visual C++ compiler and linker, respectively. Because these samples are C programs, they can also be used with the OS/2 build server with only slight modi®cations.

You can create the builder that invokes this build script using the following command:

teamc builder -create c_builder2 -script c_compile.cmd -parameters "/c" -from d:\teamc\c_compile.cmd

Where d:\teamc\c_compile.cmd is the ®le to be stored in the TeamConnection database and c_compile.cmd is the name of the local ®le that the build process creates and runs during a build.

To build hello.obj using the debug option, you use the following command:

teamc part -build hello.obj -parameters "debug=YES" -pool os2pool

The command issued by the build server is the following:

c_compile.cmd /c

In turn, the build script inspects the contents of the parameters it received in its argument list and from the environment, and it forms this command:

"icc /c /Ti+ /Fohello.obj hello.c"

Testing a build script

The easiest way to test a build script is to write a simple driver program that sets the environment variables that the build script will expect and then runs the script against local ®les.

For example, to test the example build script in ªWriting an executable ®le for a build scriptº on page 153, write a program that sets the TC_INPUT, TC_OUTPUT, and

154User's Guide

Page 174
Image 174
IBM SC34-4499-03 manual Testing a build script