Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Cascading build processes triggered by resource modification
Cascading build processes triggered by resource modification [message #335625] Thu, 16 April 2009 18:04 Go to next message
Andreas Schoeneck is currently offline Andreas Schoeneck
Messages: 22
Registered: July 2009
Junior Member
Hi everyone,

I am facing a strange problem with my builder.

Whenever I call the build process it leads into an infinite loop. It
seems that resource modification in the BuildJob (derived from
WorkspaceJob) re-triggers the build process and therefore keeps on looping.

protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {

IProject theProject = getProject();

BuildJob bj = new BuildJob(theProject);
bj.setRule(theProject);
bj.setPriority(WorkspaceJob.BUILD);
bj.schedule();

return null;
}

What I do in BuildJob::runInWorkspace is simply save a resource (EMF, in
my case). For simplification consider something like text file saving -
I tried this and indeed it also re-triggers the build process.

Also tried to set the resource to derived with no luck.

Also read something about bug 58649, but it seems to be the other side
of what I want to achieve.

Is there anything I can do to prevent the resource saving from trigger a
build process? Or any other workaround? Many thanks in advance.

Regards
Andy
Re: Cascading build processes triggered by resource modification [message #335627 is a reply to message #335625] Thu, 16 April 2009 22:12 Go to previous messageGo to next message
Andreas Schoeneck is currently offline Andreas Schoeneck
Messages: 22
Registered: July 2009
Junior Member
Seems to be related to absolute/relative paths. Don't know why.

If I use absolute paths, nothing is re-triggered.
Re: Cascading build processes triggered by resource modification [message #335633 is a reply to message #335625] Fri, 17 April 2009 05:25 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
> protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
> throws CoreException {
>
> IProject theProject = getProject();
>
> BuildJob bj = new BuildJob(theProject);
> bj.setRule(theProject);
> bj.setPriority(WorkspaceJob.BUILD);
> bj.schedule();
>
> return null;
> }

Why are you running a new job in the build() method? That method will
already be wrapped inside a job provided by the platform. You just have to
build the project in that method itself.

- Prakash

--

http://blog.eclipse-tips.com
Re: Cascading build processes triggered by resource modification [message #335639 is a reply to message #335633] Fri, 17 April 2009 10:38 Go to previous message
Andreas Schoeneck is currently offline Andreas Schoeneck
Messages: 22
Registered: July 2009
Junior Member
Thanks Prakash!

Your hint was very helpful. It seems that Eclipse can prevent cascading
build triggers if the triggers' source would be the build thread. When
using a different thread by invoking another Job this mechanism doesn't
work.

Regards,
Andy

Prakash G.R. schrieb:
> Why are you running a new job in the build() method? That method will
> already be wrapped inside a job provided by the platform. You just have to
> build the project in that method itself.
>
> - Prakash
>
Previous Topic:Re: Don't succeed to fetch bundles with p2IU, nor to use p2 director
Next Topic:Multiple versions of an extension
Goto Forum:
  


Current Time: Thu Oct 23 12:27:34 GMT 2014

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

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