Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buckminster » buckminster.postbind?(How to force a refresh on an osgi.bundle)
buckminster.postbind? [message #735401] Tue, 11 October 2011 13:03 Go to next message
Fabian Baboschi is currently offline Fabian Baboschi
Messages: 40
Registered: December 2009
Member
Hi,

I have a few plugins (osgi.bundle) which download a zip file from an url in an ant action, depositing some jars found inside it somewhere in a lib/ folder, each inside their corresponding plugin. This action is called during buckminster.prebind. The problem is that the changes are not seen in the plugins unless I manually do a refresh on each of them. I need to do this every time these jars are updated/changed for eclipse to see the change.

I'd like to refresh the plugin (equivalent to pressing F5 in eclipse on the project) after this action finishes.
I found some eclipse ant tasks:
<eclipse.convertPath fileSystemPath="${sp:output}" property="outputProjectRelativePath"/>
<echo message="${sp:output} ${outputProjectRelativePath}" />
<eclipse.refreshLocal resource="${outputProjectRelativePath}" depth="infinite"/>
This code works if the plugin is already in the workspace when the bucknminster.prebind command is run, but fails if the plugin is not in the workspace (like it says in the manual, the buckminster.prebind is set to run before the component is bound to the workspace).

I'd like to know to which action/group/artifacts I could bind this code to so it works in both cases:
- if the plugin is in the workspace and also
- if it's not yet in the workspace (does something like buckminster.postbind exist?).

Thank you.
Re: buckminster.postbind? [message #738954 is a reply to message #735401] Sun, 16 October 2011 20:18 Go to previous messageGo to next message
Philip Bedingfield is currently offline Philip Bedingfield
Messages: 42
Registered: August 2011
Member
I'd like to know the answer to this as well. I want to run some java code after it is bound to the workplace.

Anyone? A workaround perhaps?
Re: buckminster.postbind? [message #739143 is a reply to message #738954] Mon, 17 October 2011 02:14 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3228
Registered: July 2009
Senior Member
On 2011-10-17 02:18, Philip Bedingfield wrote:
> I'd like to know the answer to this as well. I want to run some java code after it is bound to the workplace.
>
> Anyone? A workaround perhaps?

One thing that you could try is to use a .cspex to add a prerequisite to the generated 'eclipse.build' action. If I'm
not mistaking, such a prerequisite will execute just prior to the eclipse build which means that it will kick in after
the bind. It's not a one time action (it happens on every perform) but that shouldn't matter if all that it does is a
refresh.

- thomas
Re: buckminster.postbind? [message #739880 is a reply to message #739143] Mon, 17 October 2011 20:07 Go to previous messageGo to next message
Philip Bedingfield is currently offline Philip Bedingfield
Messages: 42
Registered: August 2011
Member
Actually, what I'm after is to run some code after it's built.
So I don't think a prerequisite to eclipse.build is going to help me.
I guess I'm more after a postBuild hook.
Re: buckminster.postbind? [message #740545 is a reply to message #739880] Tue, 18 October 2011 12:17 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
On 10/18/11 2:07 AM, Philip Bedingfield wrote:
> Actually, what I'm after is to run some code after it's built. So I
> don't think a prerequisite to eclipse.build is going to help me. I guess
> I'm more after a postBuild hook.
In that case, you can simply wrap the top level build action in a
specialized action that first calls the original, and then your post action.

- henrik
Re: buckminster.postbind? [message #741107 is a reply to message #735401] Wed, 19 October 2011 03:30 Go to previous messageGo to next message
Fabian Baboschi is currently offline Fabian Baboschi
Messages: 40
Registered: December 2009
Member
For me, the .cspex file approach with the action prerequisites on eclipse.build works.
Thank you for your really fast help.
Re: buckminster.postbind? [message #787346 is a reply to message #735401] Tue, 31 January 2012 08:30 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi,

i would like to implement some kind of post.build functionality. this works with the proprietary my.build action:

<public name="my.build" actor="null">
   <prerequisites>
	<attribute name="eclipse.build" />
	<attribute name="datapackage.export" /> 
	<attribute name="datapackage.update" />
   </prerequisites>
</public>


but how can i enhance the existing eclipse.build action with my additional stuff.
using alterAction i can only set prerequisites, there's no postrequistes.

thanks for your help
jakob
Re: buckminster.postbind? [message #788018 is a reply to message #787346] Wed, 01 February 2012 03:50 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3228
Registered: July 2009
Senior Member
Hi Jakob,

Buckminster builds are issued as actions. Either from the Buckminster menu in the IDE or by use of the headless perform
command. What you do with your 'my.build' function is exactly right. It will be called after the eclipse.build action
has executed.

Perhaps you want something to execute during the the Eclipse incremental build phase? You can do that too, but not from
a CSpec. You're then entering the domain of eclipse builders and they are defined in the .project file of the Eclipse
project. The 'eclipse.build' in Buckminster will call the Eclipse builder which in turn uses those definitions. You can
read more about that here:

http://www.eclipse.org/articles/Article-Builders/builders.html

HTH,
- thomas


On 01/31/2012 02:30 PM, Jakob Braeuchi wrote:
> hi,
>
> i would like to implement some kind of post.build functionality. this works with the proprietary my.build action:
>
>
> <public name="my.build" actor="null">
> <prerequisites>
> <attribute name="eclipse.build" />
> <attribute name="datapackage.export" /> <attribute name="datapackage.update" />
> </prerequisites>
> </public>
>
>
> but how can i enhance the existing eclipse.build action with my additional stuff. using alterAction i can only set
> prerequisites, there's no postrequistes.
>
> thanks for your help
> jakob
Re: buckminster.postbind? [message #789000 is a reply to message #788018] Thu, 02 February 2012 08:43 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
Hi Thomas,

thank you for your answer. I used eclipse.build only as a sample. Actually i would like to add a postrequisite to an arbitrary action; or if not possible override an action.

<public name="eclipse.build" actor="null">
 <POSTrequisites>
  <attribute name="datapackage.export" /> <attribute name="datapackage.update" />
 </postrequisites>
</public>

or

<public name="eclipse.build" actor="null">
 <prerequisites>
  <attribute name="SUPER.eclipse.build[/b]" />
  <attribute name="datapackage.export" /> <attribute name="datapackage.update" />
 </prerequisites>
</public>


Jakob
Re: buckminster.postbind? [message #789111 is a reply to message #789000] Thu, 02 February 2012 11:03 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
I think thomas' suggestion was to do everything you need at "postbind"
as builders. They work in headless as well. Naturally they have to be
present in the environment that is doing the building.

The advantage is that they also work if someone is doing the work manually.

Regards
- henrik

On 2012-02-02 14:43, Jakob Braeuchi wrote:
> Hi Thomas,
>
> thank you for your answer. I used eclipse.build only as a sample.
> Actually i would like to add a postrequisite to an arbitrary action; or
> if not possible override an action.
>
>
> <public name="eclipse.build" actor="null">
> <POSTrequisites>
> <attribute name="datapackage.export" /> <attribute
> name="datapackage.update" />
> </postrequisites>
> </public>
>
> or
>
>
> <public name="eclipse.build" actor="null">
> <prerequisites>
> <attribute name="SUPER.eclipse.build[/b]" />
> <attribute name="datapackage.export" /> <attribute
> name="datapackage.update" />
> </prerequisites>
> </public>
>
>
> Jakob
Re: buckminster.postbind? [message #789586 is a reply to message #789111] Fri, 03 February 2012 01:36 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi henrik,

i'm not looking specifically for a builder. eclipse.build was used as a sample only.
if i would like to add a "postrequisite" ie. to the bundle.jar action; could i use a builder as well ?

jakob
Re: buckminster.postbind? [message #789771 is a reply to message #789586] Fri, 03 February 2012 06:40 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
On 2012-03-02 7:36, Jakob Braeuchi wrote:
> hi henrik,
>
> i'm not looking specifically for a builder. eclipse.build was used as a
> sample only.
> if i would like to add a "postrequisite" ie. to the bundle.jar action;
> could i use a builder as well ?

The Eclipse builder framework allows you to run processes (that
typically build something :)), they can do whatever you want. They can
be configured to run after some other builder, be interactive, trigger
rebuilds etc.

If you want additional things to happen before/after/around something
that already exists - like bundle.jar action and you can't modify all
the places where this specific bundle.jar action is used/called then you
can use a cspex to 'inject a wrapper action' called bundle.jar action
after first having renamed the original bundle.jar action. Your injected
'wrapping' action should have the (renamed) original bundle.jar as a
prerequisite. (I think this has been described earlier in this forum,
don't remember if there is an example in BuckyBook, I think I included
one that shows how to perform an Obfuscation action).

However, since "bundle.jar" is invoked after all the builders have
executed the required additional work would already have taken place if
it was implemented using builders.

Hope that helps.
- henri
Re: buckminster.postbind? [message #789826 is a reply to message #789771] Fri, 03 February 2012 08:05 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi henrik,

i'm very interested in injecting a wrapper action ! That sounds exactly like the thing i'm looking for.
can't find a sample in the booky book, could you please provide one ?

thank jakob
Re: buckminster.postbind? [message #789887 is a reply to message #789826] Fri, 03 February 2012 09:33 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
On 2012-03-02 14:05, Jakob Braeuchi wrote:
> hi henrik,
>
> i'm very interested in injecting a wrapper action ! That sounds exactly
> like the thing i'm looking for.
> can't find a sample in the booky book, could you please provide one ?

Here is one example where an obfuscator is being used, there is a rename
of a group in the sample. http://www.eclipse.org/forums/index.php/m/652957/

This bug report contains an example where the bundle.jars is being
manipulated to exclude fragements.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=321776

Here is another example;
http://www.eclipse.org/forums/index.php/mv/msg/175043/557586/#msg_557586


Basically...
- rename "foo.bar" to "foo.bar.original"
- add a new "foo.bar" with "foo.bar.original" as prerequisite
- do whatever you need to do in your new "foo.bar" - like calling an ant
script

<alterXXX>
<rename oldName="foo.bar" newName="foo.bar.original"/>
</alterXXX>

where alterXXX is one of the alterGroups, alterArtifacts, etc. available
in the cspex. Unfortunately a description of the rename seems to be
missing in the BuckyBook.

You can then add
<alter ...>
<public name="foo.bar")
...

</alter ...>

Hope that helps.
- henrik
Re: buckminster.postbind? [message #791955 is a reply to message #789887] Mon, 06 February 2012 08:12 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi henrik,

thanks for the links to the samples.
i tried to replace eclipse.build with the wrapper action by renaming eclipse.build to original.eclipse.build:

	<actions>
		<private name="datapackage.export" actor="ant">
			<actorProperties>
				<property key="buildFile" value="build/exportDatapackage.ant" />
				<property key="targets" value="bdv.datapackage.export" />
			</actorProperties>
			<properties>
				<property key="get.dir" value="${buckminster.home}" />
			</properties>
			<prerequisites alias="input"> 
				<attribute alias="bdv.data" name="original.eclipse.build"/>
				<attribute alias="admin.services.lib" name="admin.services.lib" />
			</prerequisites>					
		</private>
		
		<private name="datapackage.update" actor="ant">
			<actorProperties>
				<property key="buildFile" value="build/updateDatapackage.ant" />
				<property key="targets" value="svn.update" />
			</actorProperties>
		</private>

		<public name="get.datapackage" actor="null">
			<prerequisites>
				<attribute name="datapackage.export" />
				<attribute name="datapackage.update" />
			</prerequisites>
		</public>
		
		<!-- overwrite eclipse.build -->
		<public name="eclipse.build" actor="null">
			<prerequisites>
                               <attribute name="original.eclipse.build"/>
                               <attribute name="get.datapackage"/>
			</prerequisites> 
		</public>		
		
	</actions>
	
	<artifacts>
		<public name="datapackage" path="datapackage/datapackage.xml" />
		<private name="admin.services.lib" path="lib/ch.rtc.bdv.admin.services.interfaces.jar" /> 
	</artifacts>		
	
	<alterActions>
		<!-- overwrite eclipse.build -->
		<rename oldName="eclipse.build" newName="original.eclipse.build"/>
	</alterActions>


when i try to execute my eclipse.build action i get the following error (using debug option).
it looks like the actor is missing for the renamed action:

Actions to perform (in order)
ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build
ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#datapackage.export
ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#datapackage.update
ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#get.datapackage
ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#eclipse.build
Action ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build refers to actor with id null but no such actor has been registered with extension-point org.eclipse.buckminster.core.actors


Jakob
Re: buckminster.postbind? [message #791968 is a reply to message #791955] Mon, 06 February 2012 08:26 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
Since your wrapper is not an action (there is not code to execute
associated with it), you need to use a group.

The reference to an "attribute" is resolved using name, i.e. it is ok to
change the type from action to group.

Something like this:

<groups>
<!-- overwrite eclipse.build -->
<public name="eclipse.build">
<prerequisites>
<attribute name="original.eclipse.build"/>
<attribute name="get.datapackage"/>
</prerequisites>
</public>
</groups>

Regards
- henrik

On 2012-06-02 14:12, Jakob Braeuchi wrote:
> hi henrik,
>
> thanks for the links to the samples.
> i tried to replace eclipse.build with the wrapper action by renaming
> eclipse.build to original.eclipse.build:
>
>
> <actions>
> <private name="datapackage.export" actor="ant">
> <actorProperties>
> <property key="buildFile" value="build/exportDatapackage.ant" />
> <property key="targets" value="bdv.datapackage.export" />
> </actorProperties>
> <properties>
> <property key="get.dir" value="${buckminster.home}" />
> </properties>
> <prerequisites alias="input"> <attribute alias="bdv.data"
> name="original.eclipse.build"/>
> <attribute alias="admin.services.lib" name="admin.services.lib" />
> </prerequisites>
> </private>
>
> <private name="datapackage.update" actor="ant">
> <actorProperties>
> <property key="buildFile" value="build/updateDatapackage.ant" />
> <property key="targets" value="svn.update" />
> </actorProperties>
> </private>
>
> <public name="get.datapackage" actor="null">
> <prerequisites>
> <attribute name="datapackage.export" />
> <attribute name="datapackage.update" />
> </prerequisites>
> </public>
>
> <!-- overwrite eclipse.build -->
> <public name="eclipse.build" actor="null">
> <prerequisites>
> <attribute name="original.eclipse.build"/>
> <attribute name="get.datapackage"/>
> </prerequisites> </public>
>
> </actions>
>
> <artifacts>
> <public name="datapackage" path="datapackage/datapackage.xml" />
> <private name="admin.services.lib"
> path="lib/ch.rtc.bdv.admin.services.interfaces.jar" /> </artifacts>
>
> <alterActions>
> <!-- overwrite eclipse.build -->
> <rename oldName="eclipse.build" newName="original.eclipse.build"/>
> </alterActions>
>
>
> when i try to execute my eclipse.build action i get the following error
> (using debug option).
> it looks like the actor is missing for the renamed action:
>
> Actions to perform (in order)
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#datapackage.export
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#datapackage.update
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#get.datapackage
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#eclipse.build
> Action
> ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build
> refers to actor with id null but no such actor has been registered with
> extension-point org.eclipse.buckminster.core.actors
>
>
> Jakob
Re: buckminster.postbind? [message #792658 is a reply to message #791968] Tue, 07 February 2012 03:44 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi henrik,

i replaced my action eclipse.build with a group with the same name.
unfortunately the group does not work.

...
	<groups>
	    <!-- overwrite eclipse.build -->
	    <public name="eclipse.build"> 
              <attribute name="original.eclipse.build"/>
              <attribute name="get.datapackage"/>
	    </public>		
	</groups>
	
	<artifacts>
		<public name="datapackage" path="datapackage/datapackage.xml" />
		<private name="admin.services.lib" path="lib/ch.rtc.bdv.admin.services.interfaces.jar" /> 
	</artifacts>		
	
	<alterActions>
	    <!-- overwrite eclipse.build -->
	    <rename oldName="eclipse.build" newName="original.eclipse.build"/>
	</alterActions>


i get an error during the build:

ERROR [0003] : java.lang.ClassCastException: org.eclipse.buckminster.core.cspec.model.Group cannot be cast to org.eclipse.buckminster.core.cspec.model.Action

btw i do not understand why the renamed eclipse.build action complains about a missing actor; is this a bug ?

thanks
jakob
Re: buckminster.postbind? [message #792904 is a reply to message #792658] Tue, 07 February 2012 09:53 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3228
Registered: July 2009
Senior Member
Jakob,

The eclipse.build is an internal action that represents the workspace build. It cannot be replaced with a group. You can
add a new group that uses the eclipse.build as a prerequisite and adds additional things though.

Regards,
Thomas Hallgren



On 02/07/2012 09:44 AM, Jakob Braeuchi wrote:
> hi henrik,
>
> i replaced my action eclipse.build with a group with the same name.
> unfortunately the group does not work.
>
>
> ...
> <groups>
> <!-- overwrite eclipse.build -->
> <public name="eclipse.build"> <attribute name="original.eclipse.build"/>
> <attribute name="get.datapackage"/>
> </public>
> </groups>
>
> <artifacts>
> <public name="datapackage" path="datapackage/datapackage.xml" />
> <private name="admin.services.lib" path="lib/ch.rtc.bdv.admin.services.interfaces.jar" /> </artifacts>
>
> <alterActions>
> <!-- overwrite eclipse.build -->
> <rename oldName="eclipse.build" newName="original.eclipse.build"/>
> </alterActions>
>
>
> i get an error during the build:
>
> ERROR [0003] : java.lang.ClassCastException: org.eclipse.buckminster.core.cspec.model.Group cannot be cast to
> org.eclipse.buckminster.core.cspec.model.Action
>
> btw i do not understand why the renamed eclipse.build action complains about a missing actor; is this a bug ?
>
> thanks
> jakob
>
Re: buckminster.postbind? [message #793180 is a reply to message #792904] Tue, 07 February 2012 16:24 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi thomas,

my first try was to replace eclipse.build with my own action, but then the actor was missing in the renamed action.

Action ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build refers to actor with id null but no such actor has been registered with extension-point org.eclipse.buckminster.core.actors


thanks
jakob

[Updated on: Tue, 07 February 2012 16:24]

Report message to a moderator

Re: buckminster.postbind? [message #793187 is a reply to message #793180] Tue, 07 February 2012 16:31 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3228
Registered: July 2009
Senior Member
Hi Jakob,

You cannot replace the eclipse.build action. It's an internal action that acts as a placeholder for the workspace
builder. Think of it as a hook to that builder. You can either call it directly or use it as a prerequisite in other
actions. That's it.

- thomas



On 02/07/2012 10:24 PM, Jakob Braeuchi wrote:
> hi thomas,
>
> my first try was to replace eclipse.build with my own action, but then actor was missing in the renamed action.
> Action ch.rtc.bdv.data:osgi.bundle$1.0.0.qualifier#original.eclipse.build refers to actor with id null but no such actor
> has been registered with extension-point org.eclipse.buckminster.core.actors
>
>
> thanks jakob
Re: buckminster.postbind? [message #794360 is a reply to message #793187] Thu, 09 February 2012 02:35 Go to previous messageGo to next message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
hi thomas,

thanks for the clear statement.
i'd like to see it in the bucky book in the chapter about replacing actions Wink

jakob
Re: buckminster.postbind? [message #794779 is a reply to message #794360] Thu, 09 February 2012 12:46 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
On 2012-09-02 8:35, Jakob Braeuchi wrote:
> hi thomas,
>
> thanks for the clear statement. i'd like to see it in the bucky book in
> the chapter about replacing actions ;)

Please log an enhancement request marked with "[documentation]".

- henrik
Re: buckminster.postbind? [message #800512 is a reply to message #794779] Fri, 17 February 2012 01:56 Go to previous message
Jakob Braeuchi is currently offline Jakob Braeuchi
Messages: 69
Registered: July 2009
Location: Switzerland
Member
done https://bugs.eclipse.org/bugs/show_bug.cgi?id=371847

jakob
Previous Topic:multi-platform RCP build: from the PDE and headless
Next Topic:how to distinguish required and addtional bundles
Goto Forum:
  


Current Time: Thu Aug 21 16:11:50 EDT 2014

Powered by FUDForum. Page generated in 0.03269 seconds