use of org.eclipse.n4js.ui.internal.N4JSEclipseProject in project n4js by eclipse.
the class ExternalLibraryBuilder method doPerformOperation.
private List<IProject> doPerformOperation(N4JSExternalProject[] projects, BuildOperation operation, IProgressMonitor monitor) {
if (projects == null || projects.length == 0) {
return Collections.emptyList();
}
ISchedulingRule rule = getRule();
try {
Job.getJobManager().beginRule(rule, monitor);
VertexOrder<IN4JSProject> buildOrder = builtOrderComputer.getBuildOrder(projects);
// wrap as Arrays.asList returns immutable list
List<IN4JSProject> buildOrderList = new ArrayList<>(Arrays.asList(buildOrder.vertexes));
if (BuildOperation.CLEAN.equals(operation)) {
Collections.reverse(buildOrderList);
}
// Remove external projects that have the workspace counterpart if it is a build operation.
if (BuildOperation.BUILD.equals(operation)) {
for (Iterator<IN4JSProject> itr = buildOrderList.iterator(); itr.hasNext(); ) {
if (hasWorkspaceCounterpart(itr.next())) {
itr.remove();
}
}
}
ensureDynamicDependenciesSetForWorkspaceProjects();
String prefix = Strings.toFirstUpper(operation.toString().toLowerCase());
String projectNames = getProjectNames(buildOrderList);
LOGGER.info(prefix + "ing external libraries: " + projectNames);
SubMonitor subMonitor = SubMonitor.convert(monitor, buildOrderList.size());
List<IProject> actualBuildOrderList = new LinkedList<>();
for (IN4JSProject project : buildOrderList) {
LOGGER.info(prefix + "ing external library: " + project.getProjectId());
// bold cast
N4JSEclipseProject n4EclPrj = (N4JSEclipseProject) project;
operation.run(this, n4EclPrj, subMonitor.newChild(1));
IProject iProject = n4EclPrj.getProject();
actualBuildOrderList.add(iProject);
}
return actualBuildOrderList;
} finally {
Job.getJobManager().endRule(rule);
}
}
use of org.eclipse.n4js.ui.internal.N4JSEclipseProject 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