use of org.erlide.engine.model.root.IErlProject 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.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class BuilderHelper method getIncludeDirs.
public Collection<IPath> getIncludeDirs(final IProject project) {
final Collection<IPath> includeDirs = new ArrayList<>();
final IErlProject erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
if (erlProject == null) {
return includeDirs;
}
final Collection<IPath> projectIncludeDirs = erlProject.getProperties().getIncludeDirs();
final IPathVariableManager pvm = ResourcesPlugin.getWorkspace().getPathVariableManager();
for (final IPath inc : projectIncludeDirs) {
final IPath incPath = URIUtil.toPath(pvm.resolveURI(URIUtil.toURI(inc)));
if (incPath.isAbsolute()) {
includeDirs.add(incPath);
} else {
final IFolder folder = project.getFolder(incPath);
if (folder != null && folder.exists()) {
final IPath location = folder.getLocation();
if (location != null) {
includeDirs.add(location);
} else {
ErlLogger.warn("No location for %s", folder);
}
} else {
if (!BuilderHelper.reportedMissingFolders.contains(folder)) {
ErlLogger.warn("Inexistent location for %s", folder);
}
BuilderHelper.reportedMissingFolders.add(folder);
}
}
}
return includeDirs;
}
use of org.erlide.engine.model.root.IErlProject 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.engine.model.root.IErlProject 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.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class EdocExportWizard method performFinish.
@Override
public boolean performFinish() {
if (!validateFinish()) {
return false;
}
final Collection<IProject> projects = page.getSelectedResources();
final Map<String, OtpErlangObject> options = page.getOptions();
for (final IProject project : projects) {
if (!project.isAccessible()) {
ErlLogger.debug("EDOC: " + project.getName() + " is not accessible, skipping.");
continue;
}
ErlLogger.debug("EDOC: " + project.getName());
try {
final IFolder dest = project.getFolder(page.getDestination());
if (!dest.exists()) {
dest.create(true, true, null);
}
options.put("dir", new OtpErlangString(dest.getLocation().toString()));
final List<String> files = new ArrayList<>();
final IErlProject erlProject = ErlangEngine.getInstance().getModel().findProject(project);
for (final IPath dir : erlProject.getProperties().getSourceDirs()) {
final IFolder folder = project.getFolder(dir);
if (folder.isAccessible()) {
folder.accept(new IResourceVisitor() {
@Override
public boolean visit(final IResource resource) throws CoreException {
if ("erl".equals(resource.getFileExtension())) {
if (resource.isAccessible()) {
files.add(resource.getLocation().toString());
}
}
return true;
}
});
}
}
try {
ErlangEngine.getInstance().getEdocExportService().files(files, options);
} catch (final Exception e) {
ErlLogger.warn(e);
}
} catch (final CoreException e) {
ErlLogger.warn(e);
}
}
return true;
}
Aggregations