use of org.eclipse.n4js.n4mf.ProjectDescription in project n4js by eclipse.
the class N4JSModel method getN4JSSourceContainers.
public ImmutableList<? extends IN4JSSourceContainer> getN4JSSourceContainers(N4JSProject project) {
ImmutableList.Builder<IN4JSSourceContainer> result = ImmutableList.builder();
URI location = project.getLocation();
ProjectDescription description = getProjectDescription(location);
if (description != null) {
List<SourceFragment> sourceFragments = newArrayList(from(description.getSourceFragment()));
sourceFragments.sort((f1, fDIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) -> f1.compareByFragmentType(fDIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT));
for (SourceFragment sourceFragment : sourceFragments) {
List<String> paths = sourceFragment.getPaths();
for (String path : paths) {
// XXX poor man's canonical path conversion. Consider headless compiler with npm projects.
final String relativeLocation = ".".equals(path) ? "" : path;
IN4JSSourceContainer sourceContainer = this.createProjectN4JSSourceContainer(project, sourceFragment.getSourceFragmentType(), relativeLocation);
result.add(sourceContainer);
}
}
}
return result.build();
}
use of org.eclipse.n4js.n4mf.ProjectDescription in project n4js by eclipse.
the class N4JSModel method getAllProvidedRuntimeLibraries.
private EList<ProvidedRuntimeLibraryDependency> getAllProvidedRuntimeLibraries(N4JSProject project) {
URI projectLocation = project.getLocation();
if (projectLocation == null)
return ECollections.emptyEList();
ProjectDescription description = getProjectDescription(projectLocation);
if (description == null)
return ECollections.emptyEList();
EList<ProvidedRuntimeLibraryDependency> runtimeLibraries = description.getAllProvidedRuntimeLibraries();
if (runtimeLibraries == null)
return ECollections.emptyEList();
return runtimeLibraries;
}
use of org.eclipse.n4js.n4mf.ProjectDescription in project n4js by eclipse.
the class N4JSModel method getSourceContainers.
public ImmutableList<IN4JSSourceContainer> getSourceContainers(N4JSArchive archive) {
ImmutableList.Builder<IN4JSSourceContainer> result = ImmutableList.builder();
URI location = archive.getLocation();
ProjectDescription description = getProjectDescription(location);
if (description != null) {
List<SourceFragment> sourceFragments = newArrayList(from(description.getSourceFragment()));
sourceFragments.sort((f1, fDIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) -> f1.compareByFragmentType(fDIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT));
for (SourceFragment sourceFragment : sourceFragments) {
List<String> paths = sourceFragment.getPaths();
for (String path : paths) {
result.add(createArchiveN4JSSourceContainer(archive, sourceFragment.getSourceFragmentType(), path));
}
}
}
return result.build();
}
use of org.eclipse.n4js.n4mf.ProjectDescription in project n4js by eclipse.
the class N4JSModel method getImplementedProjects.
public ImmutableList<? extends IN4JSProject> getImplementedProjects(N4JSProject project) {
ImmutableList.Builder<IN4JSProject> result = ImmutableList.builder();
URI location = project.getLocation();
ProjectDescription description = getProjectDescription(location);
if (description != null) {
result.addAll(resolveProjectReferences(project, description.getAllImplementedProjects()));
}
return result.build();
}
use of org.eclipse.n4js.n4mf.ProjectDescription in project n4js by eclipse.
the class N4JSModel method doGetLibraries.
protected ImmutableList<? extends IN4JSArchive> doGetLibraries(N4JSProject project, URI location) {
ImmutableList.Builder<IN4JSArchive> result = ImmutableList.builder();
ProjectDescription description = getProjectDescription(location);
if (description != null) {
description.getAllRequiredRuntimeLibraries().forEach(lib -> addArchiveFromDependency(project, location, lib, result));
description.getAllProjectDependencies().forEach(lib -> addArchiveFromDependency(project, location, lib, result));
}
return result.build();
}
Aggregations