use of org.eclipse.n4js.tests.codegen.WorkspaceBuilder.YarnProjectBuilder in project n4js by eclipse.
the class XtSetupParser method parseWorkspace.
private static XtWorkspace parseWorkspace(TokenStream tokens, File xtFile, String xtFileContent) {
WorkspaceBuilder builder = new WorkspaceBuilder(new BuilderInfo());
YarnProjectBuilder yarnProjectBuilder = builder.addYarnProject(TestWorkspaceManager.YARN_TEST_PROJECT);
LOOP: while (tokens.hasNext()) {
switch(tokens.next()) {
case "Project":
case "JavaProject":
parseProject(tokens, xtFile, xtFileContent, yarnProjectBuilder);
break;
case "}":
break LOOP;
default:
Preconditions.checkState(false, ERROR + "Unexpected token in Workspace: " + tokens.lookLast() + " in file " + xtFile.getPath());
}
}
XtWorkspace xtWorkspace = builder.build(new XtWorkspace());
if (xtWorkspace.getProjects().size() == 1 && xtWorkspace.getProjects().get(0) instanceof YarnWorkspaceProject && ((YarnWorkspaceProject) xtWorkspace.getProjects().get(0)).getMemberProjects().size() == 1) {
YarnWorkspaceProject yarnWorkspaceProject = (YarnWorkspaceProject) xtWorkspace.getProjects().get(0);
if (yarnWorkspaceProject.getMemberProjects().size() == 1) {
Project project = yarnWorkspaceProject.getMemberProjects().iterator().next();
xtWorkspace.clearProjects();
xtWorkspace.addProject(project);
}
}
xtWorkspace.moduleNameOfXtFile = ((BuilderInfo) builder.builderInfo).moduleNameOfXtFile;
return xtWorkspace;
}
use of org.eclipse.n4js.tests.codegen.WorkspaceBuilder.YarnProjectBuilder in project n4js by eclipse.
the class XtSetupParser method parseProject.
private static void parseProject(TokenStream tokens, File xtFile, String xtFileContent, YarnProjectBuilder yarnProjectBuilder) {
String projectName = tokens.expectNameInQuotes();
ProjectBuilder prjBuilder = yarnProjectBuilder.addProject(projectName);
parseContainerRest(tokens, xtFile, xtFileContent, prjBuilder, ".", "Project");
}
Aggregations