views:

1311

answers:

2

I am creating an Eclipse RCP application.

I am following Joel's advice in the following article "Daily Builds are your friend":

http://www.joelonsoftware.com/articles/fog0000000023.html

So, I've written a nice build script that creates an Eclipse RCP product and that runs unit tests on the code. All results are then distributed to the developer's list (after some grumbling). Now my next step, I want it to create the setup package that I normally create manually using the inno setup compiler.

The question is, how would I get around creating this package automatically? I guess I can generate the inno setup file automatically from ant, and then invoke the compiler from the command line, but I don't know if this is possible.

Any tips for this task? Maybe any other setup application that can be used from ant?

+4  A: 

sure its easy, Inno project is a plain text file so you can even edit setupper script easily by ant, however I would recommend creating a separate small include file by your script. You can have store there "variables" such as version+build number that you show in begin of setup.

put this line to your setupper:

#include "settings.txt"

and make settings.txt have something like this

#define myver=xxx.xxx
#define tags

now you don't need to touch the actual setupper code from build script.

below is a snippet from my build script to compile the setupper. you need to execute batch file from ant like this:

exec dir="." executable="cmd" os="Windows NT">
  arg line="/c build.bat"/>
/exec>

sample batch build.bat:

set isxpath="c:\program files\inno setup 5"
set isx=%isxpath%\iscc.exe
set iwz=myproj.iss
if not exist %isx% set errormsg=%isx% not found && goto errorhandler
%isx% "%iwz%" /O"%buildpath%" /F"MySetupper.exe" >>%logfile%
goto :eof
Tom
Thanks! Great response. I did google it but I found no easy way to do this right away. I had an idea on how to proceed, But I was not 100% sure. The suggestion of the include file is really neat, as I can generate that from my other build options.
Mario Ortegón
nice to hear, let me know if you need another INNO tips
Tom
+4  A: 

Another nice trick when automating installer building is to use the GetFileVersion preprocessor (ISPP) macro. That way you won't have to duplicate your (binary) files' version numbers in hardcoded form (like in Tom's settings.txt) - the installer compiler will simply read it from the files' version resources that way. E.g.:

#define AppName "My App"
#define SrcApp "MyApp.exe"
#define FileVerStr GetFileVersion(SrcApp)
#define StripBuild(str VerStr) Copy(VerStr, 1, RPos(".", VerStr)-1)
#define AppVerStr StripBuild(FileVerStr)

[Setup]
AppName={#AppName}
AppVersion={#AppVerStr}
AppVerName={#AppName} {#AppVerStr}
UninstallDisplayName={#AppName} {#AppVerStr}
VersionInfoVersion={#FileVerStr}
VersionInfoTextVersion={#AppVerStr}
OutputBaseFilename=MyApp-{#FileVerStr}-setup

Furthermore, you can forward symbols to the compiler via the /d commandline switch, e.g.:

iscc.exe /dSpecialEdition ...

and then later use these in ifdefs to create different types of installer (stupid example follows):

[Registry]
#ifdef SpecialEdition
Root: HKLM; Subkey: Software\MyCompany\MyApp; ValueName: SpecialEdition; ValueType: dword; ValueData: 1 ...
#endif
Oliver Giesen
Where do you get teh ISPP.exe? I don't see a preprocessor tool in my folder and I get errors when compiling.
Tim
the easiest way to get it is to download the Quick Start Pack from the InnoSetup homepage. This includes the compiler, the preprocessor and several other enhancements.
Oliver Giesen
Here's the link: http://www.jrsoftware.org/isdl.php#qsp
Oliver Giesen
thanks - I found it after some more looking.
Tim