Page 1 of 1

Store portable scenario association in xpr file

Posted: Sat Sep 13, 2014 11:47 pm
by martindholmes
Hi there,

I've trying to figure out how to do the following:

We have an ant file ("build-dist.xml") which is part of an ant scenario. I'd like to associate the ant build file itself with the scenario, so that when I have that file open, the scenario runs when I click on the red triangle button.

I can easily do this in the editor, with the result that the association is stored in the oxyOptionsSa16.0.xml file in my Oxygen directory:

Code: Select all

<scenarioAssociation>
<field name="url">
<String>file:/home/mholmes/DiskStation/mholmes/WorkData/tei/jtei/issue_repo/trunk/oxygen/oxygen_aux_files/ant/build-dist.xml</String>
</field>
<field name="scenarioIds">
<list>
<String>2/internal/jTEI (internal)/jtei-distro</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>ANT</String>
</list>
</field>
</scenarioAssociation>
However, I'd like to store this in the project's .xpr file, in such a way that it uses a path to the build file which is relative to the location of the .xpr file, making it portable.

There must be a straightforward way to do this, but I can't figure it out.

All help appreciated,
Martin

Re: Store portable scenario association in xpr file

Posted: Mon Sep 15, 2014 3:54 pm
by Ron Van den Branden
Hi Martin,

I've managed to set this association via Oxygen's "Configure Transformation Scenario(s)" wizard. When looking at the generated .xpr file, I noticed that the "url" field apparently just expects relative paths (with the .xpr project file as context):

Code: Select all


<scenarioAssociation>
<field name="url">
<String>oxygen_aux_files/ant/build-dist.xml</String>
</field>
<field name="scenarioIds">
<list>
<String>jtei-distro</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>ANT</String>
</list>
</field>
</scenarioAssociation>
This does the trick; in fact, adding explicit editor variables like ${pd} in the "url" field made the transformation association fail, so that doesn't work. Also, the "scenarioIds" field seems to just expect an ID for this scenario, so it doesn't have to point anywhere.

Best,

Ron

Re: Store portable scenario association in xpr file

Posted: Tue Sep 16, 2014 6:00 pm
by adrian
Hi,

The associations are stored together with the scenario. So, if the scenario is global, the associations are also global (stored in the oxyOptionsSa16.0.xml file). If you want the association(s) in the project file, you have to copy or move the scenario in the project options. In the "Configure Transformation Scenario(s)" dialog right click on the scenario name and pick "Change storage".
If the file is relative to the project file, the references in the associations will automatically be made relative.

Regarding ${pd}, the reason it doesn't work in the 'url' field is that it is expanded to a directory path, but you need a URL. So, instead, you should use the editor variable ${pdu} to refer to the project directory URL. Note that this is generally not necessary to do manually, Oxygen will do this automatically for you (at least in recent versions of Oxygen) after you browse and pick the file.

Regards,
Adrian