use of org.eclipse.n4js.xtext.workspace.BuildOrderInfo in project n4js by eclipse.
the class MockWorkspaceSupplier method createWorkspaceConfig.
/**
* Creates the configuration of the mocked test workspace.
* <p>
* The returned workspace configuration is expected to contain at least one project with at least one source folder
* that isn't a {@link N4JSSourceFolderSnapshotForPackageJson}. The corresponding folders and files are not expected
* to exist on disk.
* <p>
* Only invoked on demand and never more than once.
*/
protected N4JSWorkspaceConfigSnapshot createWorkspaceConfig() {
N4JSProjectConfigSnapshot projectConfig = createProjectConfig();
URI workspacePath = URIUtils.trimTrailingPathSeparator(projectConfig.getPath()).trimSegments(1);
ProjectSet projects = new ProjectSet(Collections.singleton(projectConfig));
BuildOrderInfo buildOrderInfo = new BuildOrderInfo(Collections.emptyList(), Collections.emptySet());
return new N4JSWorkspaceConfigSnapshot(workspacePath, projects, buildOrderInfo);
}
use of org.eclipse.n4js.xtext.workspace.BuildOrderInfo in project n4js by eclipse.
the class AbstractBuildOrderTest method assertBuildOrder.
final void assertBuildOrder(String buildOrder, Collection<Collection<String>> cycles) {
WorkspaceConfigSnapshot workspaceConfig = concurrentIndex.getWorkspaceConfigSnapshot();
BuildOrderInfo projectBuildOrderInfo = projectBuildOrderFactory.createBuildOrderInfo(workspaceConfig);
BuildOrderIterator boIterator = projectBuildOrderFactory.createBuildOrderIterator(workspaceConfig).visitAll();
try {
String names = IteratorExtensions.join(boIterator, ", ", it -> it.getName());
assertEquals(buildOrder, names);
} catch (Exception exc) {
throw new RuntimeException("Never happens since toString never throws an exception. Bogus xtext warning", exc);
}
assertEquals(cycles.size(), projectBuildOrderInfo.getProjectCycles().size());
Set<String> expectedCycles = cycles.stream().map(it -> Strings.join(", ", it)).collect(Collectors.toSet());
for (List<String> cycle : projectBuildOrderInfo.getProjectCycles()) {
String detectedCycle = Strings.join(", ", cycle);
assertTrue("Cycle " + detectedCycle + " not found in " + expectedCycles, expectedCycles.contains(detectedCycle));
}
}
Aggregations