Using Torsion in an automated build process
by James Terry · in Torsion · 04/12/2007 (2:37 pm) · 3 replies
Hello, I am trying to create an automated build process solution using Torsion's precompile all feature.
Currently I have a batch file I run after grabbing a fresh copy from sourcesafe and running precompile all with Torsion, it deletes all the cs and dso files and renames my executable, etc, etc
I was wondering since Torsion precompiles your CS/GUI files using our executable, if it would be easy to come up with an automated way (i.e. a script file) that would achieve the same effect.
I have experimented a bit with creating a new main.cs that has
Anyone have any ideas?
Currently I have a batch file I run after grabbing a fresh copy from sourcesafe and running precompile all with Torsion, it deletes all the cs and dso files and renames my executable, etc, etc
I was wondering since Torsion precompiles your CS/GUI files using our executable, if it would be easy to come up with an automated way (i.e. a script file) that would achieve the same effect.
I have experimented a bit with creating a new main.cs that has
compile("common/main.cs");
compile("game/main.cs");
compile("game/server/game.cs");
...
...Anyone have any ideas?
#2
thanks,
James
04/13/2007 (1:29 pm)
Hmm, guess I'll have to whip something up in C++ or torquescript to grab all the files and call compile on em, seems simple enoughthanks,
James
#3
to get all the files compiled, hardest part was removing the %dir @ :/*.cs" and making it
and it ends up going through all the game directories and finding cs and gui files, and compiling them, works like a charm now :)
04/23/2007 (3:58 pm)
Ended up using your starter with http://www.garagegames.com/mg/forums/result.thread.php?qt=4736to get all the files compiled, hardest part was removing the %dir @ :/*.cs" and making it
function CompileFiles(%dir)
{
compileCSFiles(%dir);
compileGuiFiles(%dir);
}
function compileCSFiles(%dir)
{
%search = "*.cs";
for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
if(fileBase(%file) !$= "config.cs" && fileBase(%file) !$= "prefs.cs")
compile(%file);
}
function compileGuiFiles(%dir)
{
%search = "*.gui";
for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
compile(%file);
}and it ends up going through all the game directories and finding cs and gui files, and compiling them, works like a charm now :)
Associate Tom Spilman
Sickhead Games
If you look in your Torsion directory you'll see a torsion_precompile.cs file. This is the base script file used by Torsion to do the precompile step. You can see how stupid simple it is...
// Start the console logger in a "open, write, close" mode. setLogMode( 1 ); // PRECOMPILE_START // PRECOMPILE_END function onExit() { // This is just here to keep the thing // from bitching... curious that it does // not appear in the function dump. } quit();Torsion copies this script to the project working folder then adds compile() lines for each script to compile between the PRECOMPILE_START/END comments. Then it launches your EXE with torsion_precompile.cs on the command line.
And that's it... stupid simple.