|
|
|
Re: Variable value and default value [message #1799212 is a reply to message #1799206] |
Sun, 02 December 2018 12:52 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
You could use the following approach to conditionally define the default value of a variable:<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0">
<setup:EclipseIniTask
option="-Da.b.c="
value="${a.b.c}"
vm="true"/>
<setup:VariableTask
name="a.b.c"
defaultValue="foo"/>
<setup:VariableTask
filter="(a.b.c.default=*)"
name="a.b.c"
defaultValue="${a.b.c.default}"/>
</xmi:XMI>
This variable would still be prompted.
You could use the following very similar approach to define the value of a variable:<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0">
<setup:EclipseIniTask
option="-Da.b.c="
value="${a.b.c}"
vm="true"/>
<setup:VariableTask
name="a.b.c"
value="foo"/>
<setup:VariableTask
filter="(a.b.c.default=*)"
name="a.b.c"
value="${a.b.c.default}"/>
</xmi:XMI>
This variable would not be prompted and could be used in Simple mode.
Explaining how variable evaluation works is rather complicated. In the end, it's driven primarily by the actual use of the variables in the tasks. When used, the variable's value must be resolved, and to resolve, the actual definition of the variable is used, at which point the value of that variable is used, which could of course involve more variables needing to be resolved; if there is no such variable defined, the system properties or the environment variables are considered for the value. Defaults are used to initialize the UI field of any prompted variable (and if there are choices, the first choice acts like a default). But this only kicks in for Advanced mode and in that mode, the user can change the value to trigger re-evaluation. The user could even introduce new variable references in the field which could introduce yet another a variable that needs prompting, if it is not already defined.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04247 seconds