How to pass parameters from Java FX Ant task to Inno Setup?

半腔热情 提交于 2019-12-08 02:08:10

问题


I am new to JavaFX and only have some basic knowledge about Ant. At the moment I am learning how to use the FX Ant tasks to deploy an application. Edit: By using <fx:deploy nativeBundles="exe" ../> Ant automaticly uses Inno Setup to create a setup file with the .exe extension.

Since our company has some affiliated companies, most of our applications need to be deployed once for each of them. This is because some Windows Registry entries are created and they should look like this (not my idea, the management wants it to be like this!):

"HKCU\Software\affiliated company name\AppName\Settings"

Now I would like to know, if it's possible to pass a parameter from my build.xml to the .iss to insert the bold part dynamically.

I found this question , where passing /DMyParameterName=MyValue to the Inno Setup compiler (ISC) is suggested, but I don't know how to do this from the build.xml since I can't find any direct call to the ISC.

I hope you can understand my problem (English isn't my native language). If you need more information to be able to help me please feel free to ask, I will try to add them as fast as possible.


回答1:


The Java FX does not allow you to pass any additional arguments to ISCC.exe.

At least according to OpenJFX source code:

//run candle
ProcessBuilder pb = new ProcessBuilder(
        TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(params),
        "/o"+outdir.getAbsolutePath(),
        getConfig_ExeProjectFile(params).getAbsolutePath());
pb = pb.directory(EXE_IMAGE_DIR.fetchFrom(params));
IOUtils.exec(pb, VERBOSE.fetchFrom(params));

You might do with setting an environment variable instead of parameter and consume it using this syntax:

{%VARNAME}

See InnoSetup Constants documentation.


For those looking for a pure Ant solution (no Java FX):

The InnoSetup compiler (ISCC.exe) is a normal console executable.

You run the compiler using a basic Exec Ant task:

<project>
  <exec executable="ISCC.exe">
    <arg value="Example1.iss"/>
    <arg value="/DMyParameterName=MyValue"/>
  </exec>
</project>


来源:https://stackoverflow.com/questions/30374416/how-to-pass-parameters-from-java-fx-ant-task-to-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!