Search in sources :

Example 1 with DelegatingClassloader

use of org.eclipse.xtend.core.tests.macro.DelegatingClassloader 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;
}
Also used : CompilationTestHelper(org.eclipse.xtext.xbase.testing.CompilationTestHelper) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) DelegatingClassloader(org.eclipse.xtend.core.tests.macro.DelegatingClassloader) FileProjectConfig(org.eclipse.xtext.workspace.FileProjectConfig) URI(org.eclipse.emf.common.util.URI) XtendFile(org.eclipse.xtend.core.xtend.XtendFile) File(java.io.File)

Aggregations

File (java.io.File)1 URI (org.eclipse.emf.common.util.URI)1 DelegatingClassloader (org.eclipse.xtend.core.tests.macro.DelegatingClassloader)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 FileProjectConfig (org.eclipse.xtext.workspace.FileProjectConfig)1 CompilationTestHelper (org.eclipse.xtext.xbase.testing.CompilationTestHelper)1