Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Understanding variable in a setup + installation
Understanding variable in a setup + installation [message #1836715] Tue, 12 January 2021 18:13 Go to next message
NoDataFound - is currently offline NoDataFound -Friend
Messages: 10
Registered: October 2017
Junior Member
Hello,

I have made a configuration (setup:Configuration) which performs an installation, loading additionals plugins and configuring preferences.

While it works, I am also setting several variables, I am wondering how variable resolution work (I have read https://wiki.eclipse.org/Eclipse_Oomph_Authoring#Understanding_Setup_Tasks_and_Scopes but I have trouble understanding some part).

If I put this in the user.setup, the variable is not defined to the value Fira Code, unless I remove the declaration in the installation.setup:

<!-- user.setup -->
<setupTask xsi:type="setup:VariableTask" id="font" name="font" value="Fira Code" label="Default font"/>


It is defined like this in install.setup:

<!-- install.setup -->
<setupTask xsi:type="setup:VariableTask" id="font" name="font" defaultValue="Consolas" label="Default font"/>


I would assume that Oomph would look for variable font, in all scope (user, install, workspace), and resolve the value to the one defined in user.setup, but it won't.

What is the difference between value and defaultValue in this case?

Now, I also setup some variables to customize:

- Some plugins for SpotBugs
- The user dictionary

<!-- install.setup -->
<setupTask xsi:type="setup:VariableTask" 
           id="spotbugs.root" name="spotbugs.root"
           value="${install.root/spotbugs}" defaultValue="${install.root/spotbugs}" 
           label="Spotbug Contribution Root" />
<setupTask xsi:type="setup:VariableTask" 
           id="spotbugs.findsecbugs.location" name="spotbugs.findsecbugs.location" 
           type="FILE" 
           value="${spotbugs.root}/findsecbugs-plugin-${spotbugs.findsecbugs.version}.jar" 
           defaultValue="${spotbugs.root}/findsecbugs-plugin-${spotbugs.findsecbugs.version}.jar"
           storageURI="scope://Installation" label="Location of findsecbugs jar" />
 <setupTask xsi:type="setup:VariableTask" 
            id="userDictionary.location" name="userDictionary.location" 
            type="FILE"  value="${workspace.root/user-dictionnary.txt|canonical}" defaultValue="${workspace.root/user-dictionnary.txt|canonical}" 
            label="User dictionary" />


I notice in the UI, when displaying all variables, that:

- userDictionary.location is set to the actual value of ${workspace.root}, eg: D:\eclipse\workspace\user-dictionnary.txt (workspace.root is defined in user.setup)
- spotbugs.findsecbugs.location is set to the expression I used in the value/defaultValue


Why variables defined in user.setup are resolved, while other are not?

What the storageURI attribute purpose? And what scope://Installation does if set?

How, as an user, can I see the default value or its resolution ?

Finally, in the setup I also provide JRE I want to use:

<!-- install.setup -->
<setupTask xsi:type="jdt:JRETask" version="JavaSE-1.8" location="${jre.location-1.8}"/>
<setupTask xsi:type="jdt:JRETask" version="JavaSE-11" location="${jre.location-11}"/>


Is there a way for me to disable the field?

The rational is that Oomph is a little bit sensitive when I check/uncheck the "All variables", and when I scroll down, from time to time, I enter by mistake in the JRE 1.8 field and select a JRE 15 - which is not what I want :)

Regards,
NoDataFound


Re: Understanding variable in a setup + installation [message #1836728 is a reply to message #1836715] Wed, 13 January 2021 04:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33145
Registered: July 2009
Senior Member
Setup tasks, including variables, are gathered in a specific order in copySetup:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java#n4112

The ones that come later are the overrideFor the ones that come earlier:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/VariableTaskImpl.java#n602

So the variable is overridden with one that only has only a default value, which is the initial value shown in the prompted dialog.

I'm not sure exactly what you are seeing the all variables dialog. Perhaps the special behavior for install.root comes from this:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java#n2805

The scope tells where to store the prompted value, the user.setup (restricted, the installation.setup or the workspace.setup.

As a user you can only see the variables as they appear in the dialog. As a developer, you can look at the setup's Outline view.

I'm not sure what you mean by" disable the field". If you use a variable with choices those choices are available available....


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Understanding variable in a setup + installation [message #1836755 is a reply to message #1836728] Wed, 13 January 2021 10:57 Go to previous message
NoDataFound - is currently offline NoDataFound -Friend
Messages: 10
Registered: October 2017
Junior Member
Thank for the links.

Quote:
I'm not sure what you mean by" disable the field". If you use a variable with choices those choices are available available....

To better explain, when you display all variables, the screen display the JRE location (jre.location-1.8 and 11). In fact, I have more JREs configure in Oomph.
When I scroll down using mouse wheel to see all values, at some point, Oomph decide to scroll up (I don't know why), and when I scroll down again, I can see that from time to time the JRE 8 was changed to the latest JRE (15).
That's why I'd like to provide a read only value.






Previous Topic:How to use preference recorder?
Next Topic:How to set osgi.instance.area in installed config.ini
Goto Forum:
  


Current Time: Tue May 07 05:43:15 GMT 2024

Powered by FUDForum. Page generated in 5.03979 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top