[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Checking if CDT build has failed
|
On 10 March 2011 17:19, Максим Леонов <c.progger@xxxxxxxxx> wrote:
> I have this problem: i am writing eclipse plugin, which uses CDT to build
> it's project with special settings. So i use IProject's function void
> build(int kind, IProgressMonitor monitor). Due to specification (
> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/IProject.html
> ), it must throw a CoreException if build fails. But CDT does not throws
> this exception, if build fails.
The JavaDoc is perhaps misleading. Build failure, for the platform is
considered to be an internal error in the builder itself, rather than
a compile error in a file. So we only throw a CoreException when
something goes wrong.
> So how can i detect that CDT build has
> failed?
Look for error markers, something like:
private boolean isProjectSuccesfullyBuild(IProject project) {
boolean result = false;
try {
result = project.findMaxProblemSeverity(IMarker.PROBLEM, true,
IResource.DEPTH_INFINITE) < IMarker.SEVERITY_ERROR;
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
}
return result;
}
Cheers,
James