[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.amalgam] Re: Invoking xpand template options in 1.0M7

If you're going to invoke an Ant script programmatically using an action,
you should look into the AntRunner API provided by the platform.  Or, stick
to using launch invocation UI.  Just be sure to run using the workbench JVM,
and not a new one, in order to have easy access to all the ant libs.

You can also look into the GMF codebase to see how Xpand is invoked
programmatically from our UI contributions for running the code generator.

Best,
Rich


On 6/25/09 9:49 AM, in article 4A438066.1070005@xxxxxxxxxxxxxxx, "Bill
Hinge" <steve.orobec@xxxxxxxxxxxxxxx> wrote:

> Hi Rich
> 
> After a bit of fiddling about with other things I've come back to try
> this. I've created my UI as described in the book and referencing the
> amalgam examples.
> 
> Wrt to the ant script, am I correct in assuming that an ant script
> replaces the mwe script? Hence if I create my action class to run the
> script I just replace the file extension mwe by ant etc?
> 
> 
> Secondly , when I run my UI Xpand action against a saved model file I
> get the following error.
> 
> IOException: Unable to resolve plug-in
> "platform/plugin/..../templates/demo.ant"
> 
> I checked and the ant file does live in the plugins directory at
> .../templates/demo.ant. I'm presumably not setting some path somewhere
> 
> but not sure where I should do this (I have exported all my UI dirs in
> plugin.xml and checked the templates directory in build)
> 
> 
> 
> 
> regards
> Steve
> 
> 
> Richard Gronback wrote:
>> You'll need an Ant script (easiest way).  Here is an example of a QVTO
>> invocation, followed by several template invocations, as used in the Amalgam
>> build process:
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project name="amalgam" default="main"
>> xmlns:zzz="eclipse.org/gmf/2008/xpand">
>>     
>>     <tstamp/>
>>     <property name="product" value="dsltk"/> <!-- default is dsltk -->
>>         
>>     <target name="main">
>>         <qvto.interpretedTransformation
>>              
>> transformation="platform:/plugin/org.eclipse.amalgam.releng.builder/transfor
>> mations/processbuild.qvto">
>>              <targeturidef
>> targeturi="file:/${basedir}/builder/${product}/${product}.product"/>
>>              <targeturidef
>> targeturi="file:/${basedir}/builder/${product}/${product}.build"/>
>>              <targeturidef
>> targeturi="file:/${basedir}/out/build/${product}/${product}.product"/>
>>              <targeturidef
>> targeturi="file:/${basedir}/out/build/${product}/${product}.build"/>
>>              <configurationproperty name="date" value="${DSTAMP}"/>
>>              <configurationproperty name="time" value="${TSTAMP}"/>
>>         </qvto.interpretedTransformation>
>>         
>>         <mkdir dir="${basedir}/out/build/${product}/builder"/>
>> 
>>         <zzz:template name="build2properties::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             
>> outfile="${basedir}/out/build/${product}/builder/build.properties"/>
>>         <zzz:template name="build2customTargets::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             
>> outfile="${basedir}/out/build/${product}/builder/customTargets.xml"/>
>>         <zzz:template name="build2script::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             outfile="${basedir}/out/build/${product}/build.xml"/>
>>         <zzz:template name="build2site::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             outfile="${basedir}/out/build/${product}/site.xml"/>
>>         <zzz:template name="build2page::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             outfile="${basedir}/out/build/${product}/index.php"/>
>>         <zzz:template name="build2promote::Main"
>>             
>> inputURI="file:/${basedir}/out/build/${product}/${product}.build#/"
>>             
>> templateroot="platform:/plugin/org.eclipse.amalgam.releng.builder/templates/
>> ,platform:/plugin/org.eclipse.amalgam.releng.builder/transformations/"
>>             outfile="${basedir}/out/build/${product}/promote.xml"/>
>>     </target>
>> </project> 
>> 
>> 
>> On 6/5/09 11:22 AM, in article h0bd7o$41p$1@xxxxxxxxxxxxxxxxx, "Bill Hinge"
>> <steve.orobec@xxxxxxxxxxxxxxx> wrote:
>> 
>>> Hi
>>> 
>>> I'm a little confused on what my options are in invoking xpand
>>> templates in this build using the OCL/QVTO version of Xpand.
>>> 
>>> Following a post from Alex in the GMF newsgroup I've had a look
>>> at org.eclipse.gmf.codegen.util.Generator.
>>> 
>>> What I'm looking for is a way in my dsl project plugin/rcp to right
>>> click on a saved model file and generate 'code text' from a specific
>>> template(s).
>>> 
>>> In order to do this, do I need a workflow of some kind or must I
>>> manually code this all in java as part of some action? (any examples?)
>>> 
>>> regards
>>> Steve
>>> 
>> 

-- 
Thanks,
Rich