Buckminster code generation in IDE/Headless [message #689503] |
Mon, 27 June 2011 18:32  |
Eclipse User |
|
|
|
Hi all, i am new to Buckminster and i played around with code generation but i can't find a solution. Let's say i have a component A which needs some "generated" java code from B. The generated code will be generated from an ant target in comp B.
I have found some help in the Buckybook (ant actor and generator definition in cspex) but it only works if i call the "generateCode" Target manually (right click on the plugin and invoke action). How can i handle the code generation automatically in IDE and headless? (materialize manually and all other steps have to be done automatically..)
Is there a simple Buckminster "Code generation" example somewhere?
thanks for your help!
|
|
|
Re: Buckminster code generation in IDE/Headless [message #689517 is a reply to message #689503] |
Mon, 27 June 2011 18:53   |
Eclipse User |
|
|
|
You can create a "composite" action that depends on other action using prerequisites as here:
<public name="create.product" actor="ant">
<actorProperties>
<property key="buildFile" value="build/product.ant" />
<property key="targets" value="create.product" />
</actorProperties>
<prerequisites alias="repository">
<attribute name="site.p2" />
</prerequisites>
<products alias="destination" base="${buckminster.output}">
<path path="eclipse/" />
</products>
</public>
site.p2 action will be called before create.product is executed.
HTH,
Alex
[Updated on: Mon, 27 June 2011 18:54] by Moderator Report message to a moderator
|
|
|
Re: Buckminster code generation in IDE/Headless [message #689589 is a reply to message #689503] |
Mon, 27 June 2011 22:46   |
Eclipse User |
|
|
|
The principle is to override one of the default buckminster "targets"
(typically a group). IIRC there is an example in the book, i.e. renaming
the original, adding a new with the same name that includes the custom step.
- henrik
On 6/27/11 8:32 PM, forums-noreply@eclipse.org wrote:
> Hi all, i am new to Buckminster and i played around with code generation
> but i can't find a solution. Let's say i have a component A which needs
> some "generated" java code from B. The generated code will be generated
> from an ant target in comp B.
> I have found some help in the Buckybook (ant actor and generator
> definition in cspex) but it only works if i call the "generateCode"
> Target manually (right click on the plugin and invoke action). How can i
> handle the code generation automatically in IDE and headless?
> (materialize manually and all other steps have to be done automatically..)
>
> Is there a simple Buckminster "Code generation" example somewhere?
>
> thanks for your help!
|
|
|
Re: Buckminster code generation in IDE/Headless [message #690164 is a reply to message #689517] |
Wed, 29 June 2011 05:25   |
Eclipse User |
|
|
|
hi, i have read the examples in the buckybook but for me its already unclear. I have to generate some classes from xml database description for our osgi based product. So i don't want to generate "jar" files. I only want to generate my *.java files and the whole workspace will be compiled successfully.
Let's say:
- build some java plugin project's
- then generate the database java files in a java plugin project
- go on with the whole workspace build
(all automatically!)
So how can i handle this? I don't know all generated files i only know the source zip files (1 zip files results in n java db description java files). Maybe the "action" can watch on the timestamp of the "source xml database description files" and know if the java files have to be generated or not...
thx dops
|
|
|
Re: Buckminster code generation in IDE/Headless [message #690288 is a reply to message #690164] |
Wed, 29 June 2011 10:14  |
Eclipse User |
|
|
|
this is an example of my cspex:
<?xml version="1.0" encoding="UTF-8"?>
<cspecExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bc="http://www.eclipse.org/buckminster/Common-1.0" xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
<dependencies>
<dependency name="build-env-properties" componentType="unknown" />
</dependencies>
<generators>
</generators>
<artifacts>
</artifacts>
<actions>
<!-- The action to generate the missing class -->
<public name="run.generator" actor="ant">
<actorProperties>
<property key="buildFile" value="simpleGenerator.xml" />
<property key="targets" value="generate" />
</actorProperties>
<products alias="run.generator.output" base="gen"
upToDatePolicy="DEFAULT" />
</public>
<public name="eclipse.build_" actor="eclipse.build" always="true">
<prerequisites>
<!-- <attribute name="eclipse.build.requirements"/> -->
<attribute name="run.generator" />
<!-- <attribute name="eclipse.build.source" /> -->
</prerequisites>
<products base="bin/">
<path path="." />
</products>
</public>
</actions>
<groups>
</groups>
<alterDependencies>
</alterDependencies>
<alterArtifacts>
</alterArtifacts>
<alterActions>
</alterActions>
<alterGroups>
</alterGroups>
</cspecExtension>
Right click on the plugin -> invoke Action -> start eclipse.build_ works
But i don't want to click to generate the files. If i change the action to eclipse.build following exception occurs
Project refresh on xxxx failed: Attribute eclipse.build is defined more then once in component xxxx
if i move it to "alterActions" nothing happens...
|
|
|
Powered by
FUDForum. Page generated in 0.05219 seconds