[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Determining build operation completion
|
I found that it didn't work properly in all cases. For example, for
"clean" build manager launches asynchronously separate thread thread and
sets "done" state before real finish. Below is the code that works for
me (I found the idea in Eclipse sources (see
DebugUIPlugin:launchInForeground for example):
private boolean buildAndWaitForEnd(final IProject project, final int
kind) {
final IJobManager jobManager = Platform.getJobManager();
IWorkbench workbench = PlatformUI.getWorkbench();
IProgressService progressService = workbench.getProgressService();
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws
InvocationTargetException {
try {
project.build(kind, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
if (!monitor.isCanceled()) {
try {
jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, monitor);
jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, monitor);
} catch (InterruptedException e) {
// continue
}
}
}
};
try {
progressService.busyCursorWhile(runnable);
return true;
} catch (InterruptedException e) {
} catch (InvocationTargetException e2) {
System.out.println(e2.getCause().getLocalizedMessage());
}
return false;
}
Sennikovsky, Mikhail wrote:
Hi Wyatt, Craig,
One way to monitor the build status I could think of is via a progress
monitor passed to the IProject.build() method.
E.g. you could monitor the build process completion via the
IProgressMonitor.done() method. The method should be called when the
build process is completed.
You could also use the resource change listener mechanism (see
IWorkspace. addResourceChangeListener()) by monitoring the POST_BUILD
event.
Regards,
Mikhail
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Craig Rasmussen
Sent: Thursday, November 02, 2006 6:38 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Determining build operation completion
On Oct 27, 2006, at 4:18 PM, wspear wrote:
Greetings,
I am working on a plug-in that (re)builds a CDT project and then
performs some additional work once the build process is complete.
Presently I busy-wait for the executable file, to make sure that
the build operation is complete, because the build functions return
before the build is finalized. Currently I am using
IProject's .build function for building managed make projects and
IMakeTarget's .build function to build managed make projects. If
someone could point me toward a more appropriate way of making sure
that a given CDT build operation has finished (or failed) I would
really appreciate it.
Wyatt,
Did you get an answer to your question? You also need to think about
how to do this with standard make.
What do you do after build is complete?
Cheers,
Craig
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev