Search in sources :

Example 11 with PomFile

use of org.eclipse.xtext.xtext.wizard.PomFile in project xtext-core by eclipse.

the class TestProjectDescriptor method pom.

@Override
public PomFile pom() {
    PomFile _pom = super.pom();
    final Procedure1<PomFile> _function = (PomFile it) -> {
        String _xifexpression = null;
        boolean _isEclipsePluginProject = this.isEclipsePluginProject();
        if (_isEclipsePluginProject) {
            _xifexpression = "eclipse-test-plugin";
        } else {
            _xifexpression = "jar";
        }
        it.setPackaging(_xifexpression);
        StringConcatenation _builder = new StringConcatenation();
        {
            if (((this.isEclipsePluginProject() && this.needsUiHarness()) && this.isAtLeastJava9())) {
                _builder.append("<properties>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("<tycho.testArgLine>--add-modules=ALL-SYSTEM</tycho.testArgLine>");
                _builder.newLine();
                _builder.append("</properties>");
                _builder.newLine();
            }
        }
        _builder.append("<build>");
        _builder.newLine();
        {
            if (((!this.isEclipsePluginProject()) && Objects.equal(this.getConfig().getSourceLayout(), SourceLayout.PLAIN))) {
                _builder.append("\t");
                _builder.append("<testSourceDirectory>");
                String _sourceFolder = this.sourceFolder(Outlet.TEST_JAVA);
                _builder.append(_sourceFolder, "\t");
                _builder.append("</testSourceDirectory>");
                _builder.newLineIfNotEmpty();
                _builder.append("\t");
                _builder.append("<testResources>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t");
                _builder.append("<testResource>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("<directory>");
                String _sourceFolder_1 = this.sourceFolder(Outlet.TEST_RESOURCES);
                _builder.append(_sourceFolder_1, "\t\t\t");
                _builder.append("</directory>");
                _builder.newLineIfNotEmpty();
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("<excludes>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t\t\t");
                _builder.append("<exclude>**/*.java</exclude>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t\t\t");
                _builder.append("<exclude>**/*.xtend</exclude>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("</excludes>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("\t");
                _builder.append("</testResource>");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("</testResources>");
                _builder.newLine();
            }
        }
        _builder.append("\t");
        _builder.append("<plugins>");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("<plugin>");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("<groupId>org.eclipse.xtend</groupId>");
        _builder.newLine();
        _builder.append("\t\t\t");
        _builder.append("<artifactId>xtend-maven-plugin</artifactId>");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("</plugin>");
        _builder.newLine();
        {
            boolean _isEclipsePluginProject_1 = this.isEclipsePluginProject();
            if (_isEclipsePluginProject_1) {
                _builder.append("\t\t");
                _builder.append("<plugin>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<groupId>org.eclipse.tycho</groupId>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<artifactId>tycho-surefire-plugin</artifactId>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<version>${tycho-version}</version>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<configuration>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t");
                _builder.append("<failIfNoTests>false</failIfNoTests>");
                _builder.newLine();
                {
                    boolean _needsUiHarness = this.needsUiHarness();
                    if (_needsUiHarness) {
                        _builder.append("\t\t");
                        _builder.append("\t\t");
                        _builder.append("<useUIHarness>true</useUIHarness>");
                        _builder.newLine();
                    }
                }
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("</configuration>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("</plugin>");
                _builder.newLine();
                {
                    boolean _needsUiHarness_1 = this.needsUiHarness();
                    if (_needsUiHarness_1) {
                        _builder.append("\t\t");
                        _builder.append("<plugin>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t");
                        _builder.append("<groupId>org.eclipse.tycho</groupId>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t");
                        _builder.append("<artifactId>target-platform-configuration</artifactId>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t");
                        _builder.append("<configuration>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t");
                        _builder.append("<dependency-resolution>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t");
                        _builder.append("<extraRequirements>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("<!-- to get the org.eclipse.osgi.compatibility.state plugin");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("if the target platform is Luna or later.");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("(backward compatible with kepler and previous versions)");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("see https://bugs.eclipse.org/bugs/show_bug.cgi?id=492149 -->");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("<requirement>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t\t");
                        _builder.append("<type>eclipse-feature</type>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t\t");
                        _builder.append("<id>org.eclipse.rcp</id>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t\t");
                        _builder.append("<versionRange>0.0.0</versionRange>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t\t");
                        _builder.append("</requirement>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t\t");
                        _builder.append("</extraRequirements>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t\t");
                        _builder.append("</dependency-resolution>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("\t");
                        _builder.append("</configuration>");
                        _builder.newLine();
                        _builder.append("\t\t");
                        _builder.append("</plugin>");
                        _builder.newLine();
                    }
                }
            }
        }
        {
            boolean _isEclipsePluginProject_2 = this.isEclipsePluginProject();
            boolean _not = (!_isEclipsePluginProject_2);
            if (_not) {
                _builder.append("\t\t");
                _builder.append("<plugin>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<groupId>org.codehaus.mojo</groupId>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<artifactId>build-helper-maven-plugin</artifactId>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<version>1.9.1</version>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("<executions>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t");
                _builder.append("<execution>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("<id>add-test-source</id>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("<phase>initialize</phase>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("<goals>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("<goal>add-test-source</goal>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("<goal>add-test-resource</goal>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("</goals>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("<configuration>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("<sources>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t");
                _builder.append("<source>");
                String _sourceFolder_2 = this.sourceFolder(Outlet.TEST_SRC_GEN);
                _builder.append(_sourceFolder_2, "\t\t\t\t\t\t\t");
                _builder.append("</source>");
                _builder.newLineIfNotEmpty();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("</sources>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("<resources>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t");
                _builder.append("<resource>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t\t");
                _builder.append("<directory>");
                String _sourceFolder_3 = this.sourceFolder(Outlet.TEST_SRC_GEN);
                _builder.append(_sourceFolder_3, "\t\t\t\t\t\t\t\t");
                _builder.append("</directory>");
                _builder.newLineIfNotEmpty();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t\t");
                _builder.append("<excludes>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t\t\t");
                _builder.append("<exclude>**/*.java</exclude>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t\t");
                _builder.append("</excludes>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t\t");
                _builder.append("</resource>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t\t");
                _builder.append("</resources>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t\t");
                _builder.append("</configuration>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t\t");
                _builder.append("</execution>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("</executions>");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("</plugin>");
                _builder.newLine();
            }
        }
        _builder.append("\t");
        _builder.append("</plugins>");
        _builder.newLine();
        _builder.append("</build>");
        _builder.newLine();
        it.setBuildSection(_builder.toString());
    };
    return ObjectExtensions.<PomFile>operator_doubleArrow(_pom, _function);
}
Also used : PomFile(org.eclipse.xtext.xtext.wizard.PomFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 12 with PomFile

use of org.eclipse.xtext.xtext.wizard.PomFile in project xtext-core by eclipse.

the class ProjectDescriptor method getFiles.

public Iterable<? extends AbstractFile> getFiles() {
    final List<TextFile> files = CollectionLiterals.<TextFile>newArrayList();
    boolean _isEclipsePluginProject = this.isEclipsePluginProject();
    if (_isEclipsePluginProject) {
        PlainTextFile _file = this.file(Outlet.META_INF, "MANIFEST.MF", this.manifest());
        files.add(_file);
        PlainTextFile _file_1 = this.file(Outlet.ROOT, "build.properties", this.buildProperties());
        files.add(_file_1);
    }
    boolean _isEclipseFeatureProject = this.isEclipseFeatureProject();
    if (_isEclipseFeatureProject) {
        PlainTextFile _file_2 = this.file(Outlet.ROOT, "build.properties", this.buildProperties());
        files.add(_file_2);
    }
    if ((this.config.needsGradleBuild() && this.isPartOfGradleBuild())) {
        GradleBuildFile _buildGradle = this.buildGradle();
        files.add(_buildGradle);
    }
    if ((this.config.needsMavenBuild() && this.isPartOfMavenBuild())) {
        PomFile _pom = this.pom();
        files.add(_pom);
    }
    return files;
}
Also used : GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) PlainTextFile(org.eclipse.xtext.xtext.wizard.PlainTextFile) PomFile(org.eclipse.xtext.xtext.wizard.PomFile) TextFile(org.eclipse.xtext.xtext.wizard.TextFile) PlainTextFile(org.eclipse.xtext.xtext.wizard.PlainTextFile)

Aggregations

PomFile (org.eclipse.xtext.xtext.wizard.PomFile)12 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 TestProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestProjectDescriptor)3 ProjectDescriptor (org.eclipse.xtext.xtext.wizard.ProjectDescriptor)2 UiProjectDescriptor (org.eclipse.xtext.xtext.wizard.UiProjectDescriptor)2 Test (org.junit.Test)2 Charset (java.nio.charset.Charset)1 XtextVersion (org.eclipse.xtext.util.XtextVersion)1 AbstractFile (org.eclipse.xtext.xtext.wizard.AbstractFile)1 GradleBuildFile (org.eclipse.xtext.xtext.wizard.GradleBuildFile)1 IdeProjectDescriptor (org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor)1 LanguageServer (org.eclipse.xtext.xtext.wizard.LanguageServer)1 Outlet (org.eclipse.xtext.xtext.wizard.Outlet)1 PlainTextFile (org.eclipse.xtext.xtext.wizard.PlainTextFile)1 ProjectLayout (org.eclipse.xtext.xtext.wizard.ProjectLayout)1 RuntimeTestProjectDescriptor (org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor)1 SourceLayout (org.eclipse.xtext.xtext.wizard.SourceLayout)1 TestedProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor)1 TextFile (org.eclipse.xtext.xtext.wizard.TextFile)1 WebProjectDescriptor (org.eclipse.xtext.xtext.wizard.WebProjectDescriptor)1