Search in sources :

Example 21 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project applause by applause.

the class AndroidOutputConfigurationProvider method getOutputConfigurations.

@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    OutputConfiguration defaultOutput = new OutputConfiguration(ANDROID_DEFAULT_OUTPUT);
    defaultOutput.setDescription("Android Output Folder");
    defaultOutput.setOutputDirectory("../../$PROJECTNAME$-Android/.");
    defaultOutput.setOverrideExistingResources(true);
    defaultOutput.setCreateOutputDirectory(true);
    defaultOutput.setCleanUpDerivedResources(true);
    defaultOutput.setSetDerivedProperty(true);
    // Xtext 2.5 feature defaultOutput.setKeepLocalHistory(true);
    return newHashSet(defaultOutput);
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Example 22 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project xtext-xtend by eclipse.

the class XtendOutputConfigurationProvider method getOutputConfigurations.

@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
    defaultOutput.setDescription("Output folder for generated Java files");
    defaultOutput.setOutputDirectory("xtend-gen");
    defaultOutput.setOverrideExistingResources(true);
    defaultOutput.setCreateOutputDirectory(true);
    defaultOutput.setCanClearOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(true);
    defaultOutput.setSetDerivedProperty(true);
    defaultOutput.setKeepLocalHistory(false);
    return newHashSet(defaultOutput);
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Example 23 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project xtext-xtend by eclipse.

the class TestBatchCompiler method testProjectConfig.

@Test
public void testProjectConfig() {
    try {
        this.batchCompiler.compile();
        final FileProjectConfig project = this.batchCompiler.getProjectConfig();
        final String projectPath = new File(".").getCanonicalFile().getName();
        Assert.assertEquals(projectPath, project.getName());
        final OutputConfiguration output = this.batchCompiler.getOutputConfiguration();
        final String src = IterableExtensions.<FileSourceFolder>head(project.getSourceFolders()).getName();
        Assert.assertEquals("batch-compiler-data/test data", src.toString());
        final String target = output.getOutputDirectory(src);
        Assert.assertEquals("test-result", target.toString());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) FileProjectConfig(org.eclipse.xtext.workspace.FileProjectConfig) File(java.io.File) IgnoredBySmokeTest(org.eclipse.xtext.testing.smoketest.IgnoredBySmokeTest) Test(org.junit.Test)

Example 24 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project xtext-xtend by eclipse.

the class TestBatchCompiler method testProjectConfigMultipleSourceDirs6.

@Test
public void testProjectConfigMultipleSourceDirs6() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("dir1/ws/prj1/dir2/dir3/dir4/src1");
    _builder.append(File.pathSeparator);
    _builder.append("dir1/ws/prj1/dir2/dir3/src2");
    _builder.append(File.pathSeparator);
    _builder.append("dir1/ws/prj1/dir2/src3");
    _builder.append(File.pathSeparator);
    _builder.append("dir1/ws/prj1/src4");
    this.batchCompiler.setSourcePath(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("dir1/ws/prj1/dir2/dir3/dir4/dir5/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(4, 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("dir2/dir3/dir4/src1", it);
        Assert.assertEquals("dir2/dir3/dir4/dir5/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("dir2/dir3/src2", it);
        Assert.assertEquals("dir2/dir3/dir4/dir5/bin", output.getOutputDirectory(it));
    };
    ObjectExtensions.<String>operator_doubleArrow(_get_1, _function_2);
    String _get_2 = keyPaths.get(2);
    final Procedure1<String> _function_3 = (String it) -> {
        Assert.assertEquals("dir2/src3", it);
        Assert.assertEquals("dir2/dir3/dir4/dir5/bin", output.getOutputDirectory(it));
    };
    ObjectExtensions.<String>operator_doubleArrow(_get_2, _function_3);
    String _get_3 = keyPaths.get(3);
    final Procedure1<String> _function_4 = (String it) -> {
        Assert.assertEquals("src4", it);
        Assert.assertEquals("dir2/dir3/dir4/dir5/bin", output.getOutputDirectory(it));
    };
    ObjectExtensions.<String>operator_doubleArrow(_get_3, _function_4);
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) FileProjectConfig(org.eclipse.xtext.workspace.FileProjectConfig) FileSourceFolder(org.eclipse.xtext.workspace.FileSourceFolder) IgnoredBySmokeTest(org.eclipse.xtext.testing.smoketest.IgnoredBySmokeTest) Test(org.junit.Test)

Example 25 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project xtext-xtend by eclipse.

the class TestBatchCompiler method testProjectConfigMultipleSourceDirs2AbsPaths.

@Test
public void testProjectConfigMultipleSourceDirs2AbsPaths() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/tmp/ws/prj1/src");
    _builder.append(File.pathSeparator);
    _builder.append("/tmp/ws/prj1/src-gen");
    this.batchCompiler.setSourcePath(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("/tmp/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));
    };
    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));
    };
    ObjectExtensions.<String>operator_doubleArrow(_get_1, _function_2);
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) FileProjectConfig(org.eclipse.xtext.workspace.FileProjectConfig) FileSourceFolder(org.eclipse.xtext.workspace.FileSourceFolder) IgnoredBySmokeTest(org.eclipse.xtext.testing.smoketest.IgnoredBySmokeTest) Test(org.junit.Test)

Aggregations

OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)29 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)9 Test (org.junit.Test)9 IgnoredBySmokeTest (org.eclipse.xtext.testing.smoketest.IgnoredBySmokeTest)7 FileProjectConfig (org.eclipse.xtext.workspace.FileProjectConfig)7 FileSourceFolder (org.eclipse.xtext.workspace.FileSourceFolder)6 IContainer (org.eclipse.core.resources.IContainer)4 IFile (org.eclipse.core.resources.IFile)4 File (java.io.File)3 IMarker (org.eclipse.core.resources.IMarker)3 IProject (org.eclipse.core.resources.IProject)3 CoreException (org.eclipse.core.runtime.CoreException)3 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)3 IOException (java.io.IOException)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.core.runtime.Path)2 SubMonitor (org.eclipse.core.runtime.SubMonitor)2 URI (org.eclipse.emf.common.util.URI)2 BuildRequest (org.eclipse.xtext.build.BuildRequest)2 AbstractIncrementalBuilderTest (org.eclipse.xtext.testing.builder.AbstractIncrementalBuilderTest)2