Two Environments

   

A common situation is developing a build script on one machine - the development machine - and needing it to also run on a second machine - the production machine. However, unless the two machines are set up identically, this can be tricky. One easy solution is to use User Variables: on each machine, simply create the necessary variables and define them as User. However, for centralised control and easier version control, you may wish to use a single shared INI file as follows.

 

Let's assume that whenever you do a build using the development machine (named John), you want it to take place in C:\Builds\Testing. When you do a build on the production machine (named Build), it takes place on J:\Builds\Latest

 

1. Create an INI file with the differences

 

First, create a .ini file in a shared location with the parameters. Give each section the name of the machine it applies to:

 

[Build]

BuildHome=J:\Builds\Latest

 

[John]

BuildHome=C:\Builds\Testing

 

Name the file something like "LocalParams.ini".

 

2. Make your build depend on these parameters

 

Define variables with the names you used in the INI file. Update all actions that use these locations to use the variables instead.

 

3. Load the INI file as the first step in the build

 

At the start of the build, add a "Load Variables from INI" that loads the relevant variables from the INI file. Use the %COMPUTERNAME% variable to load from the right section:

 

 

tt2env_Loadvars2

 

 

tt2env_Loadvars

 

 

4. The finished product

 

 

tt2env_Actionlist