use of org.eclipse.xtext.resource.impl.ProjectDescription in project xtext-core by eclipse.
the class BuildManager method internalBuild.
protected List<IResourceDescription.Delta> internalBuild(final CancelIndicator cancelIndicator) {
final ArrayList<URI> allDirty = new ArrayList<URI>(this.dirtyFiles);
final HashMultimap<ProjectDescription, URI> project2dirty = HashMultimap.<ProjectDescription, URI>create();
for (final URI dirty : allDirty) {
{
final ProjectDescription projectManager = this.workspaceManager.getProjectManager(dirty).getProjectDescription();
project2dirty.put(projectManager, dirty);
}
}
final HashMultimap<ProjectDescription, URI> project2deleted = HashMultimap.<ProjectDescription, URI>create();
for (final URI deleted : this.deletedFiles) {
{
final ProjectDescription projectManager = this.workspaceManager.getProjectManager(deleted).getProjectDescription();
project2deleted.put(projectManager, deleted);
}
}
Set<ProjectDescription> _keySet = project2dirty.keySet();
Set<ProjectDescription> _keySet_1 = project2deleted.keySet();
Iterable<ProjectDescription> _plus = Iterables.<ProjectDescription>concat(_keySet, _keySet_1);
final List<ProjectDescription> sortedDescriptions = this.sortByDependencies(_plus);
final ArrayList<IResourceDescription.Delta> result = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
for (final ProjectDescription it : sortedDescriptions) {
{
final ProjectManager projectManager = this.workspaceManager.getProjectManager(it.getName());
final List<URI> projectDirty = IterableExtensions.<URI>toList(project2dirty.get(it));
final List<URI> projectDeleted = IterableExtensions.<URI>toList(project2deleted.get(it));
final IncrementalBuilder.Result partialResult = projectManager.doBuild(projectDirty, projectDeleted, result, cancelIndicator);
final Function1<IResourceDescription.Delta, URI> _function = (IResourceDescription.Delta it_1) -> {
return it_1.getUri();
};
allDirty.addAll(ListExtensions.<IResourceDescription.Delta, URI>map(partialResult.getAffectedResources(), _function));
Iterables.removeAll(this.dirtyFiles, projectDirty);
Iterables.removeAll(this.deletedFiles, projectDeleted);
result.addAll(partialResult.getAffectedResources());
}
}
return result;
}
use of org.eclipse.xtext.resource.impl.ProjectDescription in project xtext-core by eclipse.
the class BuildManager method doInitialBuild.
public List<IResourceDescription.Delta> doInitialBuild(final List<ProjectDescription> projects, final CancelIndicator indicator) {
final List<ProjectDescription> sortedDescriptions = this.sortByDependencies(projects);
final ArrayList<IResourceDescription.Delta> result = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
for (final ProjectDescription description : sortedDescriptions) {
{
final IncrementalBuilder.Result partialresult = this.workspaceManager.getProjectManager(description.getName()).doInitialBuild(indicator);
result.addAll(partialresult.getAffectedResources());
}
}
return result;
}
use of org.eclipse.xtext.resource.impl.ProjectDescription in project xtext-core by eclipse.
the class BuildOrderTest method testCycle1.
@Test
public void testCycle1() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a")));
};
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
cyclic.add(it);
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_1));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), cyclic);
}
use of org.eclipse.xtext.resource.impl.ProjectDescription in project xtext-core by eclipse.
the class BuildOrderTest method testJustOne.
@Test
public void testJustOne() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b")));
};
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
ProjectDescription _projectDescription_1 = new ProjectDescription();
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
it.setName("b");
};
final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
Assert.fail();
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_2));
final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
Assert.fail();
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), _function_3));
}
use of org.eclipse.xtext.resource.impl.ProjectDescription in project xtext-core by eclipse.
the class BuildOrderTest method testDiamond_1.
@Test
public void testDiamond_1() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b", "c", "d")));
};
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
ProjectDescription _projectDescription_1 = new ProjectDescription();
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
it.setName("b");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("c")));
};
final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
ProjectDescription _projectDescription_2 = new ProjectDescription();
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
it.setName("c");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("d")));
};
final ProjectDescription c = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_2, _function_2);
ProjectDescription _projectDescription_3 = new ProjectDescription();
final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
it.setName("d");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
};
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
Assert.fail();
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4));
}
Aggregations