use of org.eclipse.xtext.workspace.FileProjectConfig in project xtext-xtend by eclipse.
the class ActiveAnnotationsRuntimeTest method compileMacroResourceSet.
public XtextResourceSet compileMacroResourceSet(final Pair<String, String> macroFile, final Pair<String, String> clientFile) {
final URI macroURI = this.copyToDisk(this.macroProject, macroFile);
final URI clientURI = this.copyToDisk(this.clientProject, clientFile);
File _file = new File(this.workspaceRoot, this.macroProject);
FileProjectConfig _fileProjectConfig = new FileProjectConfig(_file);
final Procedure1<FileProjectConfig> _function = (FileProjectConfig it) -> {
it.addSourceFolder("src");
};
final FileProjectConfig macroProjectConfig = ObjectExtensions.<FileProjectConfig>operator_doubleArrow(_fileProjectConfig, _function);
File _file_1 = new File(this.workspaceRoot, this.clientProject);
FileProjectConfig _fileProjectConfig_1 = new FileProjectConfig(_file_1);
final Procedure1<FileProjectConfig> _function_1 = (FileProjectConfig it) -> {
it.addSourceFolder("src");
};
final FileProjectConfig clientProjectConfig = ObjectExtensions.<FileProjectConfig>operator_doubleArrow(_fileProjectConfig_1, _function_1);
final XtextResourceSet macroResourceSet = this.resourceSetProvider.get();
ProjectConfigAdapter.install(macroResourceSet, macroProjectConfig);
macroResourceSet.setClasspathURIContext(this.getClass().getClassLoader());
macroResourceSet.createResource(macroURI);
final XtextResourceSet resourceSet = this.resourceSetProvider.get();
ProjectConfigAdapter.install(resourceSet, clientProjectConfig);
resourceSet.createResource(clientURI);
final IAcceptor<CompilationTestHelper.Result> _function_2 = (CompilationTestHelper.Result result) -> {
ClassLoader _classLoader = this.getClass().getClassLoader();
final DelegatingClassloader classLoader = new DelegatingClassloader(_classLoader, result);
resourceSet.setClasspathURIContext(classLoader);
this.compiler.setJavaCompilerClassPath(classLoader);
};
this.compiler.compile(macroResourceSet, _function_2);
return resourceSet;
}
use of org.eclipse.xtext.workspace.FileProjectConfig in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method setUp.
@Before
public void setUp() {
try {
final File tempDir = this.temporaryFolder.newFolder();
JavaIOFileSystemSupport _javaIOFileSystemSupport = new JavaIOFileSystemSupport();
final Procedure1<JavaIOFileSystemSupport> _function = (JavaIOFileSystemSupport it) -> {
final IProjectConfigProvider _function_1 = (ResourceSet it_1) -> {
File _file = new File(tempDir, "foo");
FileProjectConfig _fileProjectConfig = new FileProjectConfig(_file);
final Procedure1<FileProjectConfig> _function_2 = (FileProjectConfig it_2) -> {
it_2.addSourceFolder("src");
};
return ObjectExtensions.<FileProjectConfig>operator_doubleArrow(_fileProjectConfig, _function_2);
};
it.setProjectConfigProvider(_function_1);
IEncodingProvider.Runtime _runtime = new IEncodingProvider.Runtime();
it.setEncodingProvider(_runtime);
XtextResourceSet _xtextResourceSet = new XtextResourceSet();
it.setContext(_xtextResourceSet);
};
JavaIOFileSystemSupport _doubleArrow = ObjectExtensions.<JavaIOFileSystemSupport>operator_doubleArrow(_javaIOFileSystemSupport, _function);
this.fs = _doubleArrow;
this.createProject("foo");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.workspace.FileProjectConfig in project xtext-xtend by eclipse.
the class TestBatchCompiler method testProjectConfigMultipleSourceDirs4.
@Test
public void testProjectConfigMultipleSourceDirs4() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("ws/prj1/src");
_builder.append(File.pathSeparator);
_builder.append("ws/prj1/dir1/src-gen");
this.batchCompiler.setSourcePath(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("ws/prj1/bin");
this.batchCompiler.setOutputPath(_builder_1.toString());
this.batchCompiler.compile();
final FileProjectConfig project = this.batchCompiler.getProjectConfig();
Assert.assertEquals("prj1", project.getName());
final OutputConfiguration output = this.batchCompiler.getOutputConfiguration();
Assert.assertEquals(2, project.getSourceFolders().size());
final Function1<FileSourceFolder, String> _function = (FileSourceFolder it) -> {
return it.getName();
};
final List<String> keyPaths = IterableExtensions.<String>sort(IterableExtensions.<FileSourceFolder, String>map(project.getSourceFolders(), _function));
String _get = keyPaths.get(0);
final Procedure1<String> _function_1 = (String it) -> {
Assert.assertEquals("dir1/src-gen", it);
Assert.assertEquals("bin", output.getOutputDirectory(it));
};
ObjectExtensions.<String>operator_doubleArrow(_get, _function_1);
String _get_1 = keyPaths.get(1);
final Procedure1<String> _function_2 = (String it) -> {
Assert.assertEquals("src", it);
Assert.assertEquals("bin", output.getOutputDirectory(it));
};
ObjectExtensions.<String>operator_doubleArrow(_get_1, _function_2);
}
use of org.eclipse.xtext.workspace.FileProjectConfig in project xtext-xtend by eclipse.
the class TestBatchCompiler method testProjectConfigMultipleSourceDirs1.
@Test
public void testProjectConfigMultipleSourceDirs1() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("ws/prj1/src");
_builder.append(File.pathSeparator);
_builder.append("ws/prj1/src-gen");
this.batchCompiler.setSourcePath(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("ws/prj1/bin");
this.batchCompiler.setOutputPath(_builder_1.toString());
this.batchCompiler.compile();
final FileProjectConfig project = this.batchCompiler.getProjectConfig();
Assert.assertEquals("prj1", project.getName());
final OutputConfiguration output = this.batchCompiler.getOutputConfiguration();
Assert.assertEquals(2, project.getSourceFolders().size());
final Function1<FileSourceFolder, String> _function = (FileSourceFolder it) -> {
return it.getName();
};
final List<String> keyPaths = IterableExtensions.<String>sort(IterableExtensions.<FileSourceFolder, String>map(project.getSourceFolders(), _function));
String _get = keyPaths.get(0);
final Procedure1<String> _function_1 = (String it) -> {
Assert.assertEquals("src", it);
Assert.assertEquals("bin", output.getOutputDirectory(it).toString());
};
ObjectExtensions.<String>operator_doubleArrow(_get, _function_1);
String _get_1 = keyPaths.get(1);
final Procedure1<String> _function_2 = (String it) -> {
Assert.assertEquals("src-gen", it);
Assert.assertEquals("bin", output.getOutputDirectory(it).toString());
};
ObjectExtensions.<String>operator_doubleArrow(_get_1, _function_2);
}
use of org.eclipse.xtext.workspace.FileProjectConfig in project xtext-xtend by eclipse.
the class TestBatchCompiler method testProjectConfigMultipleSourceDirs5.
@Test
public void testProjectConfigMultipleSourceDirs5() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("ws/prj1/dir1/dir1a/src");
_builder.append(File.pathSeparator);
_builder.append("ws/prj1/dir3/dir3a/src-gen");
this.batchCompiler.setSourcePath(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("ws/prj1/dir2/dir2a/bin");
this.batchCompiler.setOutputPath(_builder_1.toString());
this.batchCompiler.compile();
final FileProjectConfig project = this.batchCompiler.getProjectConfig();
Assert.assertEquals("prj1", project.getName());
final OutputConfiguration output = this.batchCompiler.getOutputConfiguration();
Assert.assertEquals(2, project.getSourceFolders().size());
final Function1<FileSourceFolder, String> _function = (FileSourceFolder it) -> {
return it.getName();
};
final List<String> keyPaths = IterableExtensions.<String>sort(IterableExtensions.<FileSourceFolder, String>map(project.getSourceFolders(), _function));
String _get = keyPaths.get(0);
final Procedure1<String> _function_1 = (String it) -> {
Assert.assertEquals("dir1/dir1a/src", it);
Assert.assertEquals("dir2/dir2a/bin", output.getOutputDirectory(it));
};
ObjectExtensions.<String>operator_doubleArrow(_get, _function_1);
String _get_1 = keyPaths.get(1);
final Procedure1<String> _function_2 = (String it) -> {
Assert.assertEquals("dir3/dir3a/src-gen", it);
Assert.assertEquals("dir2/dir2a/bin", output.getOutputDirectory(it));
};
ObjectExtensions.<String>operator_doubleArrow(_get_1, _function_2);
}
Aggregations