use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ParserDB method run.
private void run(final IErlModel model, final Collection<SourcePathProvider> sourcePathProviders, final boolean includeTests) throws ErlModelException {
// we include all projects in workspace - create one for OTP too
int normal = 0;
int test = 0;
final Collection<IErlProject> projects = model.getErlangProjects();
for (final IErlProject project : projects) {
final Collection<IErlModule> modules = project.getModulesAndIncludes();
for (final IErlModule module : modules) {
if (isTest(module.getResource().getLocation().toPortableString())) {
test++;
} else {
normal++;
}
handleModule(module);
}
if (includeTests) {
// final TestCodeBuilder builder = new TestCodeBuilder();
// try {
// final Set<BuildResource> resources = builder
// .getAffectedResources(
// (IProject) project.getResource(),
// new NullProgressMonitor(), false);
// for (final BuildResource res : resources) {
// if (res.getResource().isLinked()
// || res.getResource().isDerived()) {
// System.out.println("SKIP!!!! " + res.getResource());
// continue;
// }
// test++;
// final IErlModule module = ErlModelManager
// .getInstance().getModel().findModule(
// (IFile) res.getResource());
// handleModule(module);
// }
// } catch (final CoreException e) {
// ErlLogger.error(e);
// }
}
}
ParserDB.out.println("--- " + normal + " " + test);
System.out.println("--- " + normal + " " + test);
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ParserDB method getTestSourcePaths.
public List<String> getTestSourcePaths(final Collection<SourcePathProvider> sourcePathProviders, final Collection<IErlProject> projects) {
final List<String> spaths = Lists.newArrayList();
for (final IErlProject project : projects) {
final Set<IPath> paths = Sets.newHashSet();
for (final SourcePathProvider provider : sourcePathProviders) {
final IProject resource = (IProject) project.getResource();
paths.addAll(provider.getSourcePathsForModel(resource));
}
for (final IPath path : paths) {
spaths.add(path.toPortableString());
}
}
Collections.sort(spaths);
return spaths;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class SearchCoreUtil method getWorkspaceScope.
public static ErlSearchScope getWorkspaceScope(final boolean addExternals, final boolean addOtp) throws ErlModelException {
final ErlSearchScope result = new ErlSearchScope();
final Collection<IErlProject> erlangProjects = ErlangEngine.getInstance().getModel().getErlangProjects();
for (final IErlProject i : erlangProjects) {
final Collection<IErlModule> modules = i.getModulesAndIncludes();
for (final IErlModule j : modules) {
result.addModule(j);
}
// addProjectEbin(i, result);
}
final Set<String> externalModulePaths = new HashSet<>();
for (final IErlProject project : erlangProjects) {
SearchCoreUtil.addExternalModules(project, result, externalModulePaths, addExternals, addOtp);
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class DialyzerUtils method collectModulesFromResource.
public static Set<IErlModule> collectModulesFromResource(final IErlElementLocator model, final IResource resource) throws ErlModelException {
final Set<IErlModule> result = Sets.newHashSet();
final IErlElement element = model.findElement(resource, true);
if (element == null) {
return result;
}
if (element instanceof IErlFolder) {
final IErlFolder folder = (IErlFolder) element;
folder.open(null);
result.addAll(folder.getModules());
} else if (element instanceof IErlModule) {
final IErlModule module = (IErlModule) element;
result.add(module);
} else if (element instanceof IErlProject) {
final IErlProject project = (IErlProject) element;
project.open(null);
result.addAll(project.getModules());
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlangEclipseBuilder method build.
@Override
public IProject[] build(final int kind, final Map<String, String> args, final IProgressMonitor monitor) throws CoreException {
final IProject project = getProject();
if (project == null || !project.isAccessible()) {
return null;
}
final IErlProject erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
final ProjectConfigType config = erlProject.getConfigType();
final BuilderTool tool = erlProject.getBuilderProperties().getBuilderTool();
if (!validateBuildConfiguration(erlProject)) {
ErlLogger.warn("Builder tool and config mismatch: " + tool + " " + config);
monitor.setCanceled(true);
}
final ErlangBuilder builder = ErlangBuilderFactory.get(tool);
if (builder != null) {
final BuildNotifier notifier = new BuildNotifier(monitor, project);
if (builder instanceof InternalBuilder) {
// temporary hack; rebar builder will not need this
((InternalBuilder) builder).setDelta(getDelta(project));
}
builder.build(ErlangBuilder.BuildKind.get(kind), erlProject, notifier);
}
return null;
}
Aggregations