Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Buckminster » Generate components during materialization
icon5.gif  Generate components during materialization [message #519899] Wed, 10 March 2010 12:38 Go to next message
Daniel Weber is currently offline Daniel WeberFriend
Messages: 51
Registered: July 2009
Member
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 Smile

Regards,
Daniel

P.S.: Tried all this using Eclipse Galileo 3.5.2 (M20100211-1343).
Re: Generate components during materialization [message #520358 is a reply to message #519899] Fri, 12 March 2010 05:18 Go to previous messageGo to next message
Daniel Weber is currently offline Daniel WeberFriend
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 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
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
Re: Generate components during materialization [message #520745 is a reply to message #520454] Mon, 15 March 2010 05:23 Go to previous message
Daniel Weber is currently offline Daniel WeberFriend
Messages: 51
Registered: July 2009
Member
Hi Henrik,

Henrik Lindberg wrote:
> 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?

It does. Seems like I was heading into the wrong direction after all.

Materialization accepts missing components if they are "marked"
generated but does not attempt to generate them. Got it.

Thanks a lot for the course correction ;)

Regards,
Daniel
Previous Topic:Survey, site.p2 defaults
Next Topic:Hudson Plug-in: Archiving and publishing an imported target?
Goto Forum:
  


Current Time: Thu Aug 05 12:29:21 GMT 2021

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

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

Back to the top