use of org.erlide.backend.api.IBackend in project erlide_eclipse by erlang.
the class BackendManager method getBuildBackend.
@SuppressWarnings("null")
@Override
public IBackend getBuildBackend(@NonNull final IErlProject project) {
final RuntimeInfo info = project.getRuntimeInfo();
if (info == null) {
ErlLogger.info("Project %s has no runtime info, using ide", project.getName());
return getIdeBackend();
}
final String version = info.getVersion().asMajor().toString();
IBackend b = buildBackends.get(version);
if (b == null) {
b = factory.createBuildBackend(info);
buildBackends.put(version, b);
addBackend(b);
notifyBackendChange(b, BackendEvent.ADDED, null, null);
}
return b;
}
use of org.erlide.backend.api.IBackend in project erlide_eclipse by erlang.
the class InternalBuilder method fillAppFileDetails.
private void fillAppFileDetails(final IProject project, final String appSrc, final String destPath, final Collection<String> modules) {
try {
final IErlProject eproject = ErlangEngine.getInstance().getModel().findProject(project);
if (eproject == null) {
return;
}
final IBackend backend = BackendCore.getBackendManager().getBuildBackend(eproject);
backend.getOtpRpc().call("erlide_builder", "compile_app_src", "ssla", appSrc, destPath, modules);
} catch (final Exception e) {
ErlLogger.error(e);
}
}
use of org.erlide.backend.api.IBackend in project erlide_eclipse by erlang.
the class BuilderHelper method loadModule.
public static void loadModule(@NonNull final IProject project, final String module) {
try {
final IBackendManager backendManager = BackendCore.getBackendManager();
for (final IBackend b : backendManager.getExecutionBackends(project)) {
ErlLogger.debug(":: loading %s in %s", module, b.getName());
final IErlProject erlProject = ErlangEngine.getInstance().getModel().findProject(project);
final IPath path = project.getLocation().append(erlProject.getProperties().getOutputDir()).append(module + ".beam");
boolean ok = false;
final OtpErlangBinary bin = BeamUtil.getBeamBinary(module, path);
if (bin != null) {
ok = BeamLoader.loadBeam(b.getOtpRpc(), module, bin);
}
if (!ok) {
ErlLogger.error("Could not load %s", module);
}
backendManager.moduleLoaded(b, project, module);
}
} catch (final Exception e) {
ErlLogger.debug(e);
}
}
use of org.erlide.backend.api.IBackend in project erlide_eclipse by erlang.
the class DialyzerBuilder method build.
public void build(final BuildNotifier notifier) throws CoreException {
if (project == null) {
return;
}
DialyzerPreferences prefs = null;
prefs = DialyzerPreferences.get(project);
if (prefs == null || !prefs.getDialyzeOnCompile()) {
return;
}
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final Set<IErlModule> modules = DialyzerUtils.collectModulesFromResource(model, project);
final Set<IErlProject> projects = Sets.newHashSet();
projects.add(model.findProject(project));
DialyzerMarkerUtils.removeDialyzerMarkersFor(project);
if (!modules.isEmpty()) {
try {
final IErlProject eproject = model.findProject(project);
if (eproject == null) {
return;
}
final IBackend backend = BackendCore.getBackendManager().getBuildBackend(eproject);
DialyzerUtils.doDialyze(notifier.monitor, modules, projects, backend);
} catch (final InvocationTargetException e) {
ErlLogger.error(e);
} catch (final DialyzerErrorException e) {
ErlLogger.error(e);
final String msg = NLS.bind(BuilderMessages.build_dialyzerProblem, e.getLocalizedMessage());
DialyzerMarkerUtils.addProblemMarker(project, null, null, msg, 0, IMarker.SEVERITY_ERROR);
}
}
}
use of org.erlide.backend.api.IBackend in project erlide_eclipse by erlang.
the class SendToConsoleAction method getConsole.
private IErlangConsole getConsole(@NonNull final IProject aproject) {
final IBackendManager backendManager = BackendCore.getBackendManager();
final Set<IBackend> executionBackends = backendManager.getExecutionBackends(aproject);
final ErlConsoleManager erlConsoleManager = ErlideUIPlugin.getDefault().getErlConsoleManager();
IErlangConsole result = null;
for (final IBackend backend : executionBackends) {
result = erlConsoleManager.getConsole(backend);
if (result != null) {
break;
}
}
return result;
}
Aggregations