Is it possible to use a variable for the <platforms> setting in a component's folder?

Comments

3 comments

  • Avatar
    wojciechka

    Unfortunately it is currently not possible to use variables in the <platforms> tag.

    You can use <shouldPackRuleList> to determine if a folder should be packed. Similarly you can use folder's <ruleList> at runtime to determine if a folder should be installed.

    0
    Comment actions Permalink
  • Avatar
    twiga

    Thanks for your answer, that clarifies things.

    I've already tried to use <shouldPackRuleList> but this has another drawback. I set three variables pack_windows_platform_files, pack_osx_platform_files and pack_linux_platform_files and used this for the <shouldPackRuleList> on folders and components like so

    <shouldPackRuleList>
        <isTrue value="${pack_windows_platform_files}"/>
    </shouldPackRuleList>
    

    That works well with two of three flavours I have to build:

    • For the cd rom multiplatform network installer that should include and install all files for all platforms on the target machine I set all three variables to true in <preBuildActionList> and all files are included in the build.
    • For single platform download installers this also works well. In <preBuildActionList> I'm comparing the platform_name and setting my variables accordingly (so only one of them is true):
      <setInstallerVariable name="pack_windows_platform_files" value="1">
      <ruleList>
      <compareText text="${platform_name}" value="windows"/>
      </ruleList>
      </setInstallerVariable>

    However I was not able to get this to work properly for cd rom installers that should include the files for only one or two platforms and and should install files only for the target machine's platform.

    I've noticed InstallBuilder performing n+1 passes for a cd rom build, first the platform_name says cdrom, then windows and so on with all the cdRomPlatforms set. This would fit perfectly with setting my variables depending on the platform_name. But unfortunately it seems that on the first pass with platform_name=cdrom the <shouldPackRuleList> tags are evaluated with their current value and a sort of list is constructed that contains only the components that evaluate to true in the <shouldPackRuleList>. At least only these components are processed in later passes.

    So it seems to be not possible to have a variable here that changes the value between the build passes as I would need it (e.g. pack_windows_platform_files is false for the first pass with platform_name=cdrom and true for the second pass with platform_name=windows).

    The only workaround is to set my variables to true for all cdRomPlatforms in the build in the first cdRom pass already but then simply all files are packed. This is what I'm doing now for the moment finding no better solution.

    Do you see another possibility to have variable settings at build time?

    0
    Comment actions Permalink
  • Avatar
    wojciechka

    I believe what you are doing and describe in the answer above is probably the best solution in this case.

    You can also use the XML below to detect if build is a cdrom build and then set variable such as pack_windows_platform_files accordingly.

    <preBuildActionList> <setInstallerVariable> <name>cdrom_build</name> <value>1</value> <ruleList> <compareValues> <logic>equals</logic> <value1>${platform_name}</value1> <value2>cdrom</value2> </compareValues> </ruleList> </setInstallerVariable> <if> <actionList> <showInfo> <text>CDROM - building common files</text> </showInfo> </actionList> <conditionRuleList> <compareValues> <logic>equals</logic> <value1>${platform_name}</value1> <value2>cdrom</value2> </compareValues> <isTrue> <value>${cdrom_build}</value> </isTrue> </conditionRuleList> </if> <if> <actionList> <showInfo> <text>CDROM - building Windows platform</text> </showInfo> </actionList> <conditionRuleList> <compareValues> <logic>equals</logic> <value1>${platform_name}</value1> <value2>windows</value2> </compareValues> <isTrue> <value>${cdrom_build}</value> </isTrue> </conditionRuleList> </if> </preBuildActionList>

    0
    Comment actions Permalink

Please sign in to leave a comment.