I am creating an Eclipse RCP application.
我正在创建一个Eclipse RCP应用程序。
I am following Joel's advice in the following article "Daily Builds are your friend":
我在下面的文章“Daily Builds是你的朋友”中遵循Joel的建议:
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.
所以,我编写了一个很好的构建脚本,它创建了一个Eclipse RCP产品,并对代码运行单元测试。然后将所有结果分发到开发人员列表中(在一些抱怨之后)。现在我的下一步,我希望它创建我通常使用inno setup编译器手动创建的安装程序包。
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.
问题是,如何自动创建此包?我想我可以从ant自动生成inno安装文件,然后从命令行调用编译器,但我不知道这是否可行。
Any tips for this task? Maybe any other setup application that can be used from ant?
有关此任务的任何提示吗?也许任何其他可以从蚂蚁使用的设置应用程序?
2 个解决方案
#1
7
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.
确保它很简单,Inno项目是一个纯文本文件,因此您甚至可以通过ant轻松编辑安装程序脚本,但我建议您通过脚本创建一个单独的小包含文件。您可以存储“变量”,例如您在安装开始时显示的版本+内部版本号。
put this line to your setupper:
将此行添加到您的安装程序:
#include "settings.txt"
and make settings.txt have something like this
并使settings.txt有这样的东西
#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:
下面是我的构建脚本中的一个片段,用于编译安装程序。你需要像这样从ant执行批处理文件:
<exec dir="." executable="cmd" os="Windows NT">
<arg line="/c build.bat"/>
</exec>
sample batch build.bat:
示例批量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
#2
10
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.:
自动化安装程序构建时的另一个好方法是使用GetFileVersion预处理器(ISPP)宏。这样你就不必以硬编码的形式复制你的(二进制)文件的版本号(比如在Tom的settings.txt中) - 安装程序编译器只会从文件的版本资源中读取它。例如。:
#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.:
此外,您可以通过/ d命令行开关将符号转发给编译器,例如:
iscc.exe /dSpecialEdition ...
and then later use these in ifdef
s to create different types of installer (stupid example follows):
然后在ifdefs中使用这些来创建不同类型的安装程序(下面是愚蠢的例子):
[Registry]
#ifdef SpecialEdition
Root: HKLM; Subkey: Software\MyCompany\MyApp; ValueName: SpecialEdition; ValueType: dword; ValueData: 1 ...
#endif
#1
7
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.
确保它很简单,Inno项目是一个纯文本文件,因此您甚至可以通过ant轻松编辑安装程序脚本,但我建议您通过脚本创建一个单独的小包含文件。您可以存储“变量”,例如您在安装开始时显示的版本+内部版本号。
put this line to your setupper:
将此行添加到您的安装程序:
#include "settings.txt"
and make settings.txt have something like this
并使settings.txt有这样的东西
#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:
下面是我的构建脚本中的一个片段,用于编译安装程序。你需要像这样从ant执行批处理文件:
<exec dir="." executable="cmd" os="Windows NT">
<arg line="/c build.bat"/>
</exec>
sample batch build.bat:
示例批量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
#2
10
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.:
自动化安装程序构建时的另一个好方法是使用GetFileVersion预处理器(ISPP)宏。这样你就不必以硬编码的形式复制你的(二进制)文件的版本号(比如在Tom的settings.txt中) - 安装程序编译器只会从文件的版本资源中读取它。例如。:
#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.:
此外,您可以通过/ d命令行开关将符号转发给编译器,例如:
iscc.exe /dSpecialEdition ...
and then later use these in ifdef
s to create different types of installer (stupid example follows):
然后在ifdefs中使用这些来创建不同类型的安装程序(下面是愚蠢的例子):
[Registry]
#ifdef SpecialEdition
Root: HKLM; Subkey: Software\MyCompany\MyApp; ValueName: SpecialEdition; ValueType: dword; ValueData: 1 ...
#endif