简体   繁体   中英

Can ANT parametrize InnoSetup script?

The final step of building our java application (using ANT script) involves Inno Setup to package everything in a nice windows installer.

We are now upgrading our ANT script to generate both a 32-bit and a 64-bit version of our application. Our question is thus: how can we parametrize our Inno Setup config file so that it can generate both a x86 and a x64 version (it would thus be called 2x by the ANT script, with a parameter indicating the x86/x64).

In the Inno Setup config file, there is only 1 line that needs to be changed based on this parameter:

ArchitecturesInstallIn64BitMode=x64

And this is how we call Inno Setup command line from ANT:

<exec executable="C:\Program Files (x86)\Inno Setup 5\iscc.exe">
    <arg value="/cc" />
    <arg value="${dir.create_setup}/CreateSetup.iss" />
</exec>

Any help / hint on how to do this would be greatly appreciated !

Thanks, Thomas

Use copy task with filtering, may be used for other dynamic values also.
your iss configfile template has :

ArchitecturesInstallIn64BitMode=@32or64@

your build.xml has :

<filter token="32or64" value="${32or64}"/>
<copy file="foobar.iss" tofile="foobaz.iss" filtering="true" overwrite="true"/>

<exec executable="C:\Program Files (x86)\Inno Setup 5\iscc.exe">
 <arg value="/cc" />
 <arg value="foobaz.iss" />
</exec>

then start your ant file with userproperty 32or64 like that :

ant -f build.xml -D32or64=x64

or

ant -f build.xml -D32or64=x86

copy task with filtering will replace the token @32or64@ with the value of userproperty 32or64, so foobaz.iss has either :

ArchitecturesInstallIn64BitMode=x64

or

ArchitecturesInstallIn64BitMode=x86

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM