Examples of IBackend


Examples of org.erlide.backend.api.IBackend

    }

    @Override
    public void run() {
        try {
            final IBackend backend = fConsole.getBackend();
            final ILaunch launch = backend.getData().getLaunch();
            if (launch != null) {
                terminate(launch);

                final Collection<IProject> projects = Lists.newArrayList(backend
                        .getData().getProjects());
                final IBackendManager backendManager = BackendCore.getBackendManager();
                for (final IProject project : projects) {
                    backendManager.removeExecutionBackend(project, backend);
                }

                setEnabled(false);
                fConsole.stop();
            }
            if (!backend.equals(BackendCore.getBackendManager().getIdeBackend())) {
                backend.dispose();
            }
        } catch (final DebugException e) {
            ErlLogger.error(e);
        }
    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

            return;
        }
        if (erlProject == null) {
            return;
        }
        final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                erlProject);
        if (backend == null) {
            final String message = "No backend with the required "
                    + "version could be found. Can't build.";
            MarkerUtils.createProblemMarker(project, null, message, 0,
                    IMarker.SEVERITY_ERROR);
            throw new BackendException(message);
        }
        final IErlModel model = ErlangEngine.getInstance().getModel();
        backend.addProjectPath(model.findProject(project));

        final Map<RpcFuture, IResource> results = new HashMap<RpcFuture, IResource>();
        for (final BuildResource bres : resourcesToBuild) {
            notifier.checkCancel();
            final IResource resource = bres.getResource();
            MarkerUtils.deleteMarkers(resource);
            if ("erl".equals(resource.getFileExtension())) {
                final String outputDir = erlProject.getProperties().getOutputDir()
                        .toString();
                final RpcFuture f = helper.startCompileErl(project, bres, outputDir,
                        backend.getOtpRpc(), compilerOptions, kind == BuildKind.FULL);
                if (f != null) {
                    results.put(f, resource);
                }
            } else if ("yrl".equals(resource.getFileExtension())) {
                final RpcFuture f = helper.startCompileYrl(project, resource,
                        backend.getOtpRpc(), compilerOptions);
                if (f != null) {
                    results.put(f, resource);
                }
            } else {
                ErlLogger.warn("Don't know how to compile: %s", resource.getName());
            }
        }

        final List<Entry<RpcFuture, IResource>> done = Lists.newArrayList();
        final List<Entry<RpcFuture, IResource>> waiting = Lists.newArrayList(results
                .entrySet());

        // TODO should use some kind of notification!
        while (!waiting.isEmpty()) {
            for (final Entry<RpcFuture, IResource> result : waiting) {
                notifier.checkCancel();
                OtpErlangObject r;
                try {
                    r = result.getKey().get(100, TimeUnit.MILLISECONDS);
                } catch (final Exception e) {
                    r = null;
                }
                if (r != null) {
                    final IResource resource = result.getValue();

                    helper.completeCompile(project, resource, r, backend.getOtpRpc(),
                            compilerOptions);
                    // notifier.compiled(resource.getLocation().toPortableString());

                    done.add(result);
                }
            }
            waiting.removeAll(done);
            done.clear();
        }
        helper.refreshOutputDir(project);

        try {
            helper.checkForClashes(backend.getOtpRpc(), project);
        } catch (final Exception e) {
        }
        backend.removeProjectPath(model.findProject(project));

    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

            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);
        }
    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

 
  public String getOsCommand(final IErlProject erlProject) {
    String _xblockexpression = null;
    {
      IBackendManager _backendManager = BackendCore.getBackendManager();
      final IBackend backend = _backendManager.getBuildBackend(erlProject);
      IOtpNodeProxy _nodeProxy = backend.getNodeProxy();
      String _otpHome = _nodeProxy.getOtpHome();
      Path _path = new Path(_otpHome);
      final IPath path = _path.append("bin/erl");
      String _xifexpression = null;
      SystemConfiguration _instance = SystemConfiguration.getInstance();
View Full Code Here

Examples of org.erlide.backend.api.IBackend

    public void crashedBackendShouldRestart() {
        final BackendData data = new BackendData(RuntimeCore.getRuntimeInfoCatalog()
                .getDefaultRuntime());
        data.setNodeName("fooz");
        data.setLongName(false);
        final IBackend b = BackendCore.getBackendManager().getFactory()
                .createBackend(data);
        assertThat("backend not running", b.isRunning());
        try {
            Thread.sleep(1000);
        } catch (final InterruptedException e) {
        }
        final Process oldProcess = b.getErtsProcess().getProcess();
        oldProcess.destroy();
        try {
            Thread.sleep(1000);
        } catch (final InterruptedException e) {
        }
        // this is needed to internally reset erts
        b.getErtsProcess().shutDown();
        assertThat("backend not running", b.isRunning());
        final Process newProcess = b.getErtsProcess().getProcess();
        assertThat(newProcess, is(not(oldProcess)));
    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

    public void closedBackendShouldNotRestart() {
        final BackendData data = new BackendData(RuntimeCore.getRuntimeInfoCatalog()
                .getDefaultRuntime());
        data.setNodeName("fooz");
        data.setLongName(false);
        final IBackend b = BackendCore.getBackendManager().getFactory()
                .createBackend(data);
        assertThat("backend not running", b.isRunning());
        try {
            Thread.sleep(1000);
        } catch (final InterruptedException e) {
        }
        b.dispose();
        try {
            Thread.sleep(1000);
        } catch (final InterruptedException e) {
        }

        assertThat("backend not running", !b.isRunning());
        final ErtsProcess erts = b.getErtsProcess();
        final Process newProcess = erts.getProcess();
        assertThat(newProcess, is(nullValue()));
    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

        }

        @Override
        protected IStatus run(final IProgressMonitor monitor) {
            if (!modules.isEmpty()) {
                IBackend backend = null;
                monitor.beginTask("Dialyzing", IProgressMonitor.UNKNOWN);

                try {
                    backend = createBackend();
                    DialyzerUtils.doDialyze(monitor, modules, projects, backend);
                } catch (final OperationCanceledException e) {
                    ErlLogger.debug("Dialyzer operation was canceled");
                    return Status.CANCEL_STATUS;
                } catch (final DialyzerErrorException e) {
                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage());
                } catch (final InvocationTargetException e) {
                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getCause()
                            .getMessage());
                } finally {
                    if (backend != null) {
                        backend.dispose();
                    }
                    monitor.done();
                }

                ErlLogger.debug("Dialyzer operation ended successfully");
View Full Code Here

Examples of org.erlide.backend.api.IBackend

            try {
                final IErlProject eproject = model.findProject(project);
                if (eproject == null) {
                    return null;
                }
                final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                        eproject);
                DialyzerUtils.doDialyze(monitor, modules, projects, backend);
            } catch (final InvocationTargetException e) {
                ErlLogger.error(e);
            } catch (final DialyzerErrorException e) {
View Full Code Here

Examples of org.erlide.backend.api.IBackend

            } catch (final CoreException e) {
                // ignore it
            }
        }

        final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                erlProject);
        if (backend == null) {
            final String message = "No backend with the required "
                    + "version could be found. Can't build.";
            MarkerUtils.createProblemMarker(project, null, message, 0,
                    IMarker.SEVERITY_ERROR);
            throw new BackendException(message);
        }

        final ErlangEventHandler handler = new BuilderEventHandler(backend.getName(),
                notifier, project, state);
        backend.getNodeProxy().registerEventListener(handler);
        try {
            try {
                final OtpErlangObject projectInfo = BuilderUtils
                        .createProjectInfo(erlProject);
                if (kind == BuildKind.FULL) {
                    backend.getOtpRpc().call(30000, "erlide_builder_rebar", "clean", "x",
                            projectInfo);
                }

                backend.getOtpRpc().call(30000, "erlide_builder_rebar", "build", "x",
                        projectInfo);

                if (compileEunit) {
                    backend.getOtpRpc().call(30000, "erlide_builder_rebar",
                            "build_eunit", "x", projectInfo);
                }

                if (runXref) {
                    backend.getOtpRpc().call(30000, "erlide_builder_rebar", "xref", "x",
                            projectInfo);
                }
                if (runEunit) {
                    backend.getOtpRpc().call(30000, "erlide_builder_rebar", "eunit", "x",
                            projectInfo);
                }

            } catch (final RpcException e) {
                ErlLogger.error(e);
            }
        } finally {
            backend.getNodeProxy().unregisterEventListener(handler);
        }
    }
View Full Code Here

Examples of org.erlide.backend.api.IBackend

        try {
            initializeBuilder(project, notifier);
            MarkerUtils.removeProblemMarkersFor(project);

            final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                    erlProject);
            if (backend == null) {
                final String message = "No backend with the required "
                        + "version could be found. Can't build.";
                MarkerUtils.createProblemMarker(project, null, message, 0,
                        IMarker.SEVERITY_ERROR);
                throw new BackendException(message);
            }

            try {
                final OtpErlangObject projectInfo = BuilderUtils
                        .createProjectInfo(erlProject);
                backend.getOtpRpc().call("erlide_builder_rebar", "clean", "x",
                        projectInfo);
                project.refreshLocal(IResource.DEPTH_INFINITE, null);

            } catch (final RpcException e) {
                ErlLogger.error(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.