use of org.erlide.dialyzer.internal.builder.DialyzerBuilder in project erlide_eclipse by erlang.
the class InternalBuilder method build.
@Override
public IProject[] build(final BuildKind kind, final IErlProject erlProject, final BuildNotifier notifier) throws CoreException {
final long time = System.currentTimeMillis();
final IProject project = erlProject.getWorkspaceProject();
if (project == null || !project.isAccessible()) {
return null;
}
final DialyzerBuilder dialyzerBuilder = new DialyzerBuilder(project);
if (BuilderHelper.isDebugging()) {
ErlLogger.trace("build", "Start " + project.getName() + ": " + kind);
}
try {
initializeBuilder(notifier);
// TODO validate source and include directories
final ErlangProjectProperties properties = erlProject.getProperties();
final IPath out = properties.getOutputDir();
final IResource outr = project.findMember(out);
if (outr != null) {
try {
outr.setDerived(true, null);
outr.refreshLocal(IResource.DEPTH_ZERO, null);
} catch (final CoreException e) {
// ignore it
}
}
if (delta != null && delta.getAffectedChildren().length != 0) {
handleAppFile(project, project.getLocation().toPortableString() + "/" + out, properties.getSourceDirs());
}
handleErlangFiles(erlProject, project, kind, delta, notifier);
dialyzerBuilder.build(notifier);
if (project.findMember("rebar.config") != null) {
final IResource buildr = project.findMember("_build");
if (buildr != null) {
try {
buildr.setDerived(true, null);
buildr.refreshLocal(IResource.DEPTH_ZERO, null);
} catch (final CoreException e) {
// ignore it
}
}
}
} catch (final OperationCanceledException e) {
if (BuilderHelper.isDebugging()) {
ErlLogger.debug("Build of " + project.getName() + " was canceled.");
}
} catch (final Exception e) {
ErlLogger.error(e);
final String msg = NLS.bind(BuilderMessages.build_inconsistentProject, e.getLocalizedMessage(), e.getClass().getName());
MarkerUtils.createProblemMarker(project, null, msg, 0, IMarker.SEVERITY_ERROR);
} finally {
cleanup(notifier);
if (BuilderHelper.isDebugging()) {
ErlLogger.trace("build", " Done " + project.getName() + " took " + Long.toString(System.currentTimeMillis() - time));
}
}
return null;
}
use of org.erlide.dialyzer.internal.builder.DialyzerBuilder in project erlide_eclipse by erlang.
the class InternalBuilder method clean.
@Override
public void clean(final IErlProject erlProject, final BuildNotifier notifier) {
final IProject currentProject = erlProject.getWorkspaceProject();
if (currentProject == null || !currentProject.isAccessible()) {
return;
}
final DialyzerBuilder dialyzerBuilder = new DialyzerBuilder(currentProject);
if (BuilderHelper.isDebugging()) {
ErlLogger.trace("build", // $NON-NLS-1$
"Cleaning " + currentProject.getName() + " @ " + new Date(System.currentTimeMillis()));
}
try {
initializeBuilder(notifier);
MarkerUtils.removeProblemMarkersFor(currentProject);
final IFolder bf = currentProject.getFolder(erlProject.getProperties().getOutputDir());
if (bf.exists()) {
cleanupOutput(bf, notifier);
}
dialyzerBuilder.clean(notifier);
} catch (final Exception e) {
ErlLogger.error(e);
final String msg = NLS.bind(BuilderMessages.build_inconsistentProject, e.getLocalizedMessage(), e.getClass().getName());
MarkerUtils.createProblemMarker(currentProject, null, msg, 0, IMarker.SEVERITY_ERROR);
} finally {
cleanup(notifier);
if (BuilderHelper.isDebugging()) {
ErlLogger.debug(// $NON-NLS-1$
"Finished cleaning " + currentProject.getName() + " @ " + new Date(System.currentTimeMillis()));
}
}
}
Aggregations