Home » Archived » Buckminster » Generate components during materialization
|
Re: Generate components during materialization [message #520358 is a reply to message #519899] |
Fri, 12 March 2010 05:18 |
Daniel Weber Messages: 51 Registered: July 2009 |
Member |
|
|
Hi again,
over at the buckminster.dev newsgroup, I found the following comment by Thomas Hallgren regarding generators:
"[...]The important thing to know is that in the tree of components, the generator must be declared before it is used so that the resolver, when it encounters the dependency to X, knows that X is generated and hence not expected to be resolved the normal way. The component A that expresses a dependency to X will not know how X came into existence.[...]"
This helped a little. I created a buckminster component which now declares the generator (and added a generatesType='osgi.bundle' attribute) and depends on the 'generating' component as well as the component using the generated component. When trying to resolve a query for this component, the state of the generated plugin is now shown as generated (was unresolved before) in the wizard. Yet it refuses to continue unless I check 'continue on error'. But still, the generator action is not executed during materialization.
When resolving the same query headlessly, it completes without error (even though continue on error is not set) but the generator is not called either (I replaced the null actor with a kind of "Hello World" ant script so that I can check whether it has been called).
Any ideas?
Regards,
Daniel
Daniel Weber wrote:
> Hi all,
>
> I'm trying to set up a generator which creates another component (of
> type osgi.bundle). But resolving my cquery fails because the
> generated component is reported missing. That's what I tried:
>
> * Created a plugin com.example.model * Added the following
> buckminster.cspex
>
>
> <cs:cspecExtension
> xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0">
> <cs:generators> <cs:generator generates="com.example.model.gen"
> attribute="generate"/> </cs:generators> <cs:actions> <cs:public
> name="generate" actor="null"/> </cs:actions> </cs:cspecExtension>
>
>
> (Of course, the null actor does not really create another component,
> I had an ant actor in there before. Just tried to make the example
> small.) Is this dummy actor enough to let the query be "resolved to
> wizard"? If not, are certain products required for such an action?
> When will the generate action actually be invoked?
>
> * Another bundle com.example.user depends on both com.example.model
> and com.example.model.gen, so the required dependencies should be OK
> for the generator to work. * I then created a cquery for
> com.example.user:
>
>
> <cq:componentQuery
> xmlns:cq="http://www.eclipse.org/buckminster/CQuery-1.0">
> <cq:rootRequest name="com.example.user" componentType="osgi.bundle"/>
> </cq:componentQuery>
>
>
> * When I open this in the cquery editor and try "Resolve to Wizard",
> the generated component is shown as unresolved and the wizard (quite
> correctly) refuses to continue.
>
> I guess some information is missing somewhere, isn't it? Or am I
> totally confused and generating component during materialization is
> not how it was intended to be used?
>
> Any help would be appreciated :)
>
> Regards, Daniel
>
> P.S.: Tried all this using Eclipse Galileo 3.5.2 (M20100211-1343).
|
|
|
Re: Generate components during materialization [message #520454 is a reply to message #520358] |
Fri, 12 March 2010 13:18 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
Actions are not called during materialization.
When materialization is done, you invoke some action, the dependencies
are followed, if there is a dependency on something generated, it will
be generated.
Does that help?
- henrik
Daniel Weber <DaWeber@harmanbecker.com> wrote:
> Hi again,
>
> over at the buckminster.dev newsgroup, I found the following comment
> by Thomas Hallgren regarding generators:
>
> "[...]The important thing to know is that in the tree of components,
> the generator must be declared before it is used so that the resolver,
> when it encounters the dependency to X, knows that X is generated and
> hence not expected to be resolved the normal way. The component A that
> expresses a dependency to X will not know how X came into
> existence.[...]"
>
> This helped a little. I created a buckminster component which now
> declares the generator (and added a generatesType='osgi.bundle'
> attribute) and depends on the 'generating' component as well as the
> component using the generated component. When trying to resolve a
> query for this component, the state of the generated plugin is now
> shown as generated (was unresolved before) in the wizard. Yet it
> refuses to continue unless I check 'continue on error'. But still, the
> generator action is not executed during materialization.
> When resolving the same query headlessly, it completes without error
> (even though continue on error is not set) but the generator is not
> called either (I replaced the null actor with a kind of "Hello World"
> ant script so that I can check whether it has been called).
>
> Any ideas?
>
> Regards,
> Daniel
>
>
> Daniel Weber wrote:
> > Hi all,
> > > I'm trying to set up a generator which creates another component
> > > (of
> > type osgi.bundle). But resolving my cquery fails because the
> > generated component is reported missing. That's what I tried:
> > > * Created a plugin com.example.model * Added the following
> > buckminster.cspex
> > > > <cs:cspecExtension
> > xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0"> >
> > <cs:generators> <cs:generator generates="com.example.model.gen" >
> > attribute="generate"/> </cs:generators> <cs:actions> <cs:public
> > name="generate" actor="null"/> </cs:actions> </cs:cspecExtension>
> > > > (Of course, the null actor does not really create another
> > > > component,
> > I had an ant actor in there before. Just tried to make the example
> > small.) Is this dummy actor enough to let the query be "resolved to
> > wizard"? If not, are certain products required for such an action?
> > When will the generate action actually be invoked?
> > > * Another bundle com.example.user depends on both
> > > com.example.model
> > and com.example.model.gen, so the required dependencies should be OK
> > for the generator to work. * I then created a cquery for
> > com.example.user:
> > > > <cq:componentQuery >
> > > > xmlns:cq="http://www.eclipse.org/buckminster/CQuery-1.0"> >
> > > > <cq:rootRequest name="com.example.user"
> > > > componentType="osgi.bundle"/>
> > </cq:componentQuery>
> > > > * When I open this in the cquery editor and try "Resolve to
> > > > Wizard",
> > the generated component is shown as unresolved and the wizard (quite
> > correctly) refuses to continue.
> > > I guess some information is missing somewhere, isn't it? Or am I
> > totally confused and generating component during materialization is
> > not how it was intended to be used?
> > > Any help would be appreciated :)
> > > Regards, Daniel
> > > P.S.: Tried all this using Eclipse Galileo 3.5.2 (M20100211-1343).
>
--
- henrik
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 17:06:21 GMT 2024
Powered by FUDForum. Page generated in 0.03022 seconds
|