Search in sources :

Example 1 with Scope

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

the class PomFile method getContent.

@Override
public String getContent() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<modelVersion>4.0.0</modelVersion>");
    _builder.newLine();
    {
        ProjectDescriptor _project = this.getProject();
        ParentProjectDescriptor _parentProject = this.getProject().getConfig().getParentProject();
        boolean _notEquals = (!Objects.equal(_project, _parentProject));
        if (_notEquals) {
            _builder.append("\t");
            _builder.append("<parent>");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("\t");
            _builder.append("<groupId>");
            String _baseName = this.getProject().getConfig().getBaseName();
            _builder.append(_baseName, "\t\t");
            _builder.append("</groupId>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t");
            _builder.append("<artifactId>");
            String _name = this.getProject().getConfig().getParentProject().getName();
            _builder.append(_name, "\t\t");
            _builder.append("</artifactId>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t");
            _builder.append("<version>1.0.0-SNAPSHOT</version>");
            _builder.newLine();
            {
                ProjectLayout _projectLayout = this.getProject().getConfig().getProjectLayout();
                boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT);
                if (_equals) {
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<relativePath>../");
                    String _name_1 = this.getProject().getConfig().getParentProject().getName();
                    _builder.append(_name_1, "\t\t");
                    _builder.append("/pom.xml</relativePath>");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("\t");
            _builder.append("</parent>");
            _builder.newLine();
        } else {
            _builder.append("\t");
            _builder.append("<groupId>");
            String _baseName_1 = this.getProject().getConfig().getBaseName();
            _builder.append(_baseName_1, "\t");
            _builder.append("</groupId>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("<version>1.0.0-SNAPSHOT</version>");
            _builder.newLine();
        }
    }
    _builder.append("\t");
    _builder.append("<artifactId>");
    String _name_2 = this.getProject().getName();
    _builder.append(_name_2, "\t");
    _builder.append("</artifactId>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<packaging>");
    _builder.append(this.packaging, "\t");
    _builder.append("</packaging>");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append(this.buildSection, "\t");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
        boolean _isEclipsePluginProject = this.getProject().isEclipsePluginProject();
        boolean _not = (!_isEclipsePluginProject);
        if (_not) {
            _builder.append("\t");
            _builder.append("<dependencies>");
            _builder.newLine();
            {
                Set<? extends ProjectDescriptor> _upstreamProjects = this.getProject().getUpstreamProjects();
                for (final ProjectDescriptor p : _upstreamProjects) {
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<dependency>");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<groupId>${project.groupId}</groupId>");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<artifactId>");
                    String _name_3 = p.getName();
                    _builder.append(_name_3, "\t\t\t");
                    _builder.append("</artifactId>");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<version>${project.version}</version>");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("</dependency>");
                    _builder.newLine();
                }
            }
            {
                final Function1<ExternalDependency, ExternalDependency.MavenCoordinates> _function = (ExternalDependency it) -> {
                    return it.getMaven();
                };
                final Function1<ExternalDependency.MavenCoordinates, Boolean> _function_1 = (ExternalDependency.MavenCoordinates it) -> {
                    String _artifactId = it.getArtifactId();
                    return Boolean.valueOf((_artifactId != null));
                };
                Iterable<ExternalDependency.MavenCoordinates> _filter = IterableExtensions.<ExternalDependency.MavenCoordinates>filter(IterableExtensions.<ExternalDependency, ExternalDependency.MavenCoordinates>map(this.getProject().getExternalDependencies(), _function), _function_1);
                for (final ExternalDependency.MavenCoordinates dep : _filter) {
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<dependency>");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<groupId>");
                    String _groupId = dep.getGroupId();
                    _builder.append(_groupId, "\t\t\t");
                    _builder.append("</groupId>");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<artifactId>");
                    String _artifactId = dep.getArtifactId();
                    _builder.append(_artifactId, "\t\t\t");
                    _builder.append("</artifactId>");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("<version>");
                    String _version = dep.getVersion();
                    _builder.append(_version, "\t\t\t");
                    _builder.append("</version>");
                    _builder.newLineIfNotEmpty();
                    {
                        Scope _scope = dep.getScope();
                        boolean _notEquals_1 = (!Objects.equal(_scope, Scope.COMPILE));
                        if (_notEquals_1) {
                            _builder.append("\t");
                            _builder.append("\t");
                            _builder.append("\t");
                            _builder.append("<scope>");
                            String _mavenNotation = dep.getScope().getMavenNotation();
                            _builder.append(_mavenNotation, "\t\t\t");
                            _builder.append("</scope>");
                            _builder.newLineIfNotEmpty();
                        }
                    }
                    {
                        boolean _isOptional = dep.isOptional();
                        if (_isOptional) {
                            _builder.append("\t");
                            _builder.append("\t");
                            _builder.append("\t");
                            _builder.append("<optional>true</optional>");
                            _builder.newLine();
                        }
                    }
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("</dependency>");
                    _builder.newLine();
                }
            }
            _builder.append("\t");
            _builder.append("</dependencies>");
            _builder.newLine();
        }
    }
    _builder.append("\t");
    _builder.append(this.profileSection, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("</project>");
    _builder.newLine();
    return _builder.toString();
}
Also used : ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency) ProjectLayout(org.eclipse.xtext.xtext.wizard.ProjectLayout) ParentProjectDescriptor(org.eclipse.xtext.xtext.wizard.ParentProjectDescriptor) Scope(org.eclipse.xtext.xtext.wizard.Scope) ProjectDescriptor(org.eclipse.xtext.xtext.wizard.ProjectDescriptor) ParentProjectDescriptor(org.eclipse.xtext.xtext.wizard.ParentProjectDescriptor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 ExternalDependency (org.eclipse.xtext.xtext.wizard.ExternalDependency)1 ParentProjectDescriptor (org.eclipse.xtext.xtext.wizard.ParentProjectDescriptor)1 ProjectDescriptor (org.eclipse.xtext.xtext.wizard.ProjectDescriptor)1 ProjectLayout (org.eclipse.xtext.xtext.wizard.ProjectLayout)1 Scope (org.eclipse.xtext.xtext.wizard.Scope)1