Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Targlet requirement filter with oomph variable
Targlet requirement filter with oomph variable [message #1763394] Mon, 15 May 2017 08:30 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 275
Registered: December 2015
Senior Member
Hi,

I try to use an oomph variable in a targlet requirement filter, but it doesn't work. Does the filter attribute for targlet requirement not support references to oomph variables?
Re: Targlet requirement filter with oomph variable [message #1763424 is a reply to message #1763394] Mon, 15 May 2017 16:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29539
Registered: July 2009
Senior Member
Well, only attributes of type String (and URI I think) directly support variables... Of course a ${x} is not syntactically convertible to a Version instance so you have to use a substitution annotation. The URI is http://www.eclipse.org/oomph/setup/FeatureSubstitution and the key must be the name of the attribute (as spelled in the *.ecore) you're substituting. The value is evaluated as normally expected and the result is then converted to an instance of the EDataType of the EAttribute.
Re: Targlet requirement filter with oomph variable [message #1763430 is a reply to message #1763424] Mon, 15 May 2017 21:02 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 275
Registered: December 2015
Senior Member
I didn't explain too well. I wanted to do something like this:

<?xml version="1.0" encoding="UTF-8"?>
<setup:VariableTask
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
    name="groovy.version"
    defaultValue="2.1"
    storageURI="scope://Workspace"
    label="Groovy Compiler Version">
  <choice value="1.8"
      label="1.8"/>
  <choice value="2.0"
      label="2.0"/>
  <choice value="2.1"
      label="2.1"/>
  <choice value="2.3"
      label="2.3"/>
  <choice value="2.4"
      label="2.4"/>
  <choice value="2.5"
      label="2.5"/>
  <description>Select Groovy Version</description>
</setup:VariableTask>
[...]
<?xml version="1.0" encoding="UTF-8"?>
<targlets:Targlet
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:targlets="http://www.eclipse.org/oomph/targlets/1.0"
    xsi:schemaLocation="http://www.eclipse.org/oomph/targlets/1.0 http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/Targlets.ecore"
    name="Groovy Compiler">
  <requirement
      name="org.codehaus.groovy21.feature.feature.group"
      filter="(groovy.version=2.1)"/>
  <requirement
      name="org.codehaus.groovy22.feature.feature.group"
      filter="(groovy.version=2.2)"/>
[...]
</targlets:Targlet>


This doesn't work. But I found an alternative: I created multiple targlet tasks and set the filter attribute on the task rather than the requirement:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:setup.targlets="http://www.eclipse.org/oomph/setup/targlets/1.0"
    xsi:schemaLocation="http://www.eclipse.org/oomph/setup/targlets/1.0 http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/SetupTarglets.ecore">
  <setup.targlets:TargletTask
      filter="(groovy.version=2.1)">
    <targlet
        name="Groovy 2.1">
      <requirement
          name="org.codehaus.groovy21.feature.feature.group"
          filter=""/>
    </targlet>
  </setup.targlets:TargletTask>
  <setup.targlets:TargletTask
      filter="(groovy.version=2.3)">
    <targlet
        name="Groovy 2.3"
        activeRepositoryList="">
      <requirement
          name="org.codehaus.groovy23.feature.feature.group"
          filter=""/>
    </targlet>
  </setup.targlets:TargletTask>
  <setup.targlets:TargletTask
      filter="(groovy.version=2.4)">
    <targlet
        name="Groovy 2.4"
        activeRepositoryList="">
      <requirement
          name="org.codehaus.groovy24.feature.feature.group"
          filter=""/>
    </targlet>
  </setup.targlets:TargletTask>
</xmi:XMI>

Re: Targlet requirement filter with oomph variable [message #1763465 is a reply to message #1763430] Tue, 16 May 2017 12:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29539
Registered: July 2009
Senior Member
Though what I described for the requirement's version should work also for the requirement's filter...
Previous Topic:Empty variables dialog on startup
Next Topic:Restrict Target Platform to Neon+
Goto Forum:
  


Current Time: Fri Sep 21 02:49:14 GMT 2018

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

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

Back to the top