use of org.eclipse.n4js.projectModel.IN4JSSourceContainerAware in project n4js by eclipse.
the class RuntimeEnvironmentsHelper method getEnvironemntWithAncestorsRecursive.
private void getEnvironemntWithAncestorsRecursive(IN4JSProject project, Set<IN4JSProject> environemtns) {
if (!project.getProjectType().equals(ProjectType.RUNTIME_ENVIRONMENT)) {
return;
}
Optional<IN4JSSourceContainerAware> maybePArent = project.getExtendedRuntimeEnvironment();
if (maybePArent.isPresent()) {
IN4JSProject parent = (IN4JSProject) maybePArent.get();
environemtns.add(parent);
getEnvironemntWithAncestorsRecursive(parent, environemtns);
}
return;
}
use of org.eclipse.n4js.projectModel.IN4JSSourceContainerAware in project n4js by eclipse.
the class N4JSModel method getProvidedRuntimeLibraries.
public ImmutableList<? extends IN4JSSourceContainerAware> getProvidedRuntimeLibraries(N4JSProject project) {
ImmutableList.Builder<IN4JSSourceContainerAware> providedRuntimes = ImmutableList.builder();
EList<ProvidedRuntimeLibraryDependency> runtimeLibraries = getAllProvidedRuntimeLibraries(project);
URI projectLocation = project.getLocation();
// GHOLD-249: If the project n4mf file has parse errors, we need a lot of null checks.
for (ProvidedRuntimeLibraryDependency runtimeLibrary : runtimeLibraries) {
if (null != runtimeLibrary.getProject()) {
URI location = workspace.getLocation(projectLocation, runtimeLibrary, PROJECT);
if (null == location) {
location = externalLibraryWorkspace.getLocation(projectLocation, runtimeLibrary, PROJECT);
}
if (null != location) {
providedRuntimes.add(getN4JSProject(location));
} else {
// Assuming archive (NFAR)
location = workspace.getLocation(projectLocation, runtimeLibrary, ARCHIVE);
if (null != location) {
providedRuntimes.add(getN4JSArchive(project, location));
}
}
}
}
return providedRuntimes.build();
}
use of org.eclipse.n4js.projectModel.IN4JSSourceContainerAware in project n4js by eclipse.
the class N4MFProjectDependencyStrategy method getProjectDependencies.
@Override
public List<IProject> getProjectDependencies(final IProject project) {
final IN4JSEclipseProject n4Project = core.create(project).orNull();
if (null != n4Project) {
// This covers project dependencies, tests (if any), required REs and required RLs and APIs.
final Collection<? extends IN4JSEclipseProject> dependencies = n4Project.getDependenciesAndImplementedApis();
// This is for the provided runtime libraries.
final Collection<IN4JSEclipseProject> providedRuntimeLibs = from(n4Project.getProvidedRuntimeLibraries()).filter(IN4JSEclipseProject.class).toList();
// This is for the extended RE, if specified.
final IN4JSSourceContainerAware srcContainerAware = n4Project.getExtendedRuntimeEnvironment().orNull();
final IN4JSEclipseProject extendedRE = srcContainerAware instanceof IN4JSEclipseProject ? (IN4JSEclipseProject) srcContainerAware : null;
int projectCount = dependencies.size() + providedRuntimeLibs.size();
if (null != extendedRE) {
projectCount++;
}
final IProject[] projects = new IProject[projectCount];
int i = 0;
for (final IN4JSEclipseProject dependency : dependencies) {
projects[i++] = dependency.getProject();
}
for (final IN4JSEclipseProject providedRuntimeLib : providedRuntimeLibs) {
projects[i++] = providedRuntimeLib.getProject();
}
if (null != extendedRE) {
projects[i] = extendedRE.getProject();
}
return from(asList(projects)).filter(p -> !(p instanceof ExternalProject)).toList();
} else {
return emptyList();
}
}
use of org.eclipse.n4js.projectModel.IN4JSSourceContainerAware in project n4js by eclipse.
the class BuildOrderComputer method getDependencies.
private Set<N4JSProject> getDependencies(IN4JSProject project) {
Set<N4JSProject> prjDependencies = new HashSet<>();
ImmutableList<? extends IN4JSSourceContainerAware> deps = project.getAllDirectDependencies();
for (IN4JSSourceContainerAware dep : deps) {
IN4JSProject pDep = core.findProject(dep.getLocation()).orNull();
boolean isValidDep = true;
isValidDep &= pDep != null && pDep.exists();
isValidDep &= !(pDep instanceof N4JSEclipseProject) || ((N4JSEclipseProject) pDep).getProject().isOpen();
if (isValidDep) {
prjDependencies.add((N4JSProject) pDep);
}
}
return prjDependencies;
}
Aggregations