Mar*_*gón 3 java eclipse rcp inno-setup
我正在创建一个Eclipse RCP应用程序.
我在以下文章"Daily Builds是你的朋友"中遵循Joel的建议:
http://www.joelonsoftware.com/articles/fog0000000023.html
所以,我编写了一个很好的构建脚本,它创建了一个Eclipse RCP产品,并对代码运行单元测试.然后将所有结果分发到开发人员列表中(在一些抱怨之后).现在我的下一步,我希望它创建我通常使用inno setup编译器手动创建的安装程序包.
问题是,如何自动创建此包?我想我可以从ant自动生成inno安装文件,然后从命令行调用编译器,但我不知道这是否可行.
有关此任务的任何提示吗?也许任何其他可以从蚂蚁使用的设置应用程序?
Oli*_*sen 10
自动化安装程序构建时的另一个好方法是使用GetFileVersion预处理器(ISPP)宏.这样你就不必以硬编码的形式复制你的(二进制)文件的版本号(就像汤姆一样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
Run Code Online (Sandbox Code Playgroud)
此外,您可以通过/d命令行开关将符号转发到编译器,例如:
iscc.exe /dSpecialEdition ...
Run Code Online (Sandbox Code Playgroud)
然后在ifdefs中使用这些来创建不同类型的安装程序(下面是愚蠢的例子):
[Registry]
#ifdef SpecialEdition
Root: HKLM; Subkey: Software\MyCompany\MyApp; ValueName: SpecialEdition; ValueType: dword; ValueData: 1 ...
#endif
Run Code Online (Sandbox Code Playgroud)
确保它很容易,Inno项目是一个纯文本文件,所以你甚至可以通过ant轻松编辑setupper脚本,但是我建议你用脚本创建一个单独的小包含文件.您可以存储"变量",例如您在安装开始时显示的版本+内部版本号.
将此行放入您的安装程序:
#include "settings.txt"
Run Code Online (Sandbox Code Playgroud)
并使settings.txt有这样的东西
#define myver=xxx.xxx
#define tags
Run Code Online (Sandbox Code Playgroud)
现在您不需要从构建脚本中触摸实际的安装程序代码.
下面是我的构建脚本中的一个片段,用于编译安装程序.你需要像这样从ant执行批处理文件:
<exec dir="." executable="cmd" os="Windows NT">
<arg line="/c build.bat"/>
</exec>
Run Code Online (Sandbox Code Playgroud)
样本批量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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5907 次 |
| 最近记录: |