Search in sources :

Example 1 with ExternalDependency

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

the class WizardConfigurationTest method inlinedTestProjectsAddTheirDependenciesToTheMainProject.

@Test
public void inlinedTestProjectsAddTheirDependenciesToTheMainProject() {
    TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject();
    _testProject.setEnabled(true);
    this.config.setSourceLayout(SourceLayout.MAVEN);
    final Consumer<ExternalDependency> _function = (ExternalDependency testDependency) -> {
        final Function1<ExternalDependency, Boolean> _function_1 = (ExternalDependency it) -> {
            return Boolean.valueOf(((Objects.equal(it.getMaven().getArtifactId(), testDependency.getMaven().getArtifactId()) && Objects.equal(it.getP2().getBundleId(), testDependency.getP2().getBundleId())) && Objects.equal(it.getP2().getPackages(), testDependency.getP2().getPackages())));
        };
        Assert.assertTrue(IterableExtensions.<ExternalDependency>exists(this.config.getRuntimeProject().getExternalDependencies(), _function_1));
    };
    this.config.getRuntimeProject().getTestProject().getExternalDependencies().forEach(_function);
}
Also used : ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) TestProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestProjectDescriptor) Test(org.junit.Test)

Example 2 with ExternalDependency

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

the class UiProjectDescriptor method getExternalDependencies.

@Override
public Set<ExternalDependency> getExternalDependencies() {
    LinkedHashSet<ExternalDependency> _xblockexpression = null;
    {
        final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
        Set<ExternalDependency> _externalDependencies = super.getExternalDependencies();
        Iterables.<ExternalDependency>addAll(deps, _externalDependencies);
        ExternalDependency _createXtextDependency = ExternalDependency.createXtextDependency("org.eclipse.xtext.ui");
        deps.add(_createXtextDependency);
        ExternalDependency _createXtextDependency_1 = ExternalDependency.createXtextDependency("org.eclipse.xtext.ui.shared");
        deps.add(_createXtextDependency_1);
        ExternalDependency _createXtextDependency_2 = ExternalDependency.createXtextDependency("org.eclipse.xtext.ui.codetemplates.ui");
        deps.add(_createXtextDependency_2);
        ExternalDependency _externalDependency = new ExternalDependency();
        final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
            final Procedure1<ExternalDependency.P2Coordinates> _function_1 = (ExternalDependency.P2Coordinates it_1) -> {
                it_1.setBundleId("org.eclipse.ui.editors");
                it_1.setVersion("3.5.0");
            };
            it.p2(_function_1);
        };
        ExternalDependency _doubleArrow = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency, _function);
        deps.add(_doubleArrow);
        ExternalDependency _externalDependency_1 = new ExternalDependency();
        final Procedure1<ExternalDependency> _function_1 = (ExternalDependency it) -> {
            final Procedure1<ExternalDependency.P2Coordinates> _function_2 = (ExternalDependency.P2Coordinates it_1) -> {
                it_1.setBundleId("org.eclipse.ui.ide");
                it_1.setVersion("3.5.0");
            };
            it.p2(_function_2);
        };
        ExternalDependency _doubleArrow_1 = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency_1, _function_1);
        deps.add(_doubleArrow_1);
        boolean _isEnabled = this.getConfig().getIdeProject().isEnabled();
        boolean _not = (!_isEnabled);
        if (_not) {
            Set<ExternalDependency> _externalDependencies_1 = this.getConfig().getIdeProject().getExternalDependencies();
            Iterables.<ExternalDependency>addAll(deps, _externalDependencies_1);
        }
        _xblockexpression = deps;
    }
    return _xblockexpression;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1)

Example 3 with ExternalDependency

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

the class WebProjectDescriptor method getExternalDependencies.

@Override
public Set<ExternalDependency> getExternalDependencies() {
    final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
    Set<ExternalDependency> _externalDependencies = super.getExternalDependencies();
    Iterables.<ExternalDependency>addAll(deps, _externalDependencies);
    ExternalDependency _createXtextDependency = ExternalDependency.createXtextDependency("org.eclipse.xtext.xbase.web");
    deps.add(_createXtextDependency);
    ExternalDependency _createXtextDependency_1 = ExternalDependency.createXtextDependency("org.eclipse.xtext.web.servlet");
    deps.add(_createXtextDependency_1);
    ExternalDependency _createMavenDependency = ExternalDependency.createMavenDependency("org.eclipse.xtend:org.eclipse.xtend.lib:${xtextVersion}");
    deps.add(_createMavenDependency);
    ExternalDependency _createMavenDependency_1 = ExternalDependency.createMavenDependency(("org.webjars:requirejs:" + WebProjectDescriptor.REQUIREJS_VERSION));
    deps.add(_createMavenDependency_1);
    ExternalDependency _createMavenDependency_2 = ExternalDependency.createMavenDependency(("org.webjars:jquery:" + WebProjectDescriptor.JQUERY_VERSION));
    deps.add(_createMavenDependency_2);
    ExternalDependency _createMavenDependency_3 = ExternalDependency.createMavenDependency(("org.webjars:ace:" + WebProjectDescriptor.ACE_VERSION));
    deps.add(_createMavenDependency_3);
    ExternalDependency _createMavenDependency_4 = ExternalDependency.createMavenDependency(("org.eclipse.jetty:jetty-annotations:" + WebProjectDescriptor.JETTY_VERSION));
    final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
        ExternalDependency.MavenCoordinates _maven = it.getMaven();
        _maven.setScope(Scope.PROVIDED);
    };
    ExternalDependency _doubleArrow = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_createMavenDependency_4, _function);
    deps.add(_doubleArrow);
    ExternalDependency _createMavenDependency_5 = ExternalDependency.createMavenDependency(("org.slf4j:slf4j-simple:" + WebProjectDescriptor.SLF4J_VERSION));
    final Procedure1<ExternalDependency> _function_1 = (ExternalDependency it) -> {
        ExternalDependency.MavenCoordinates _maven = it.getMaven();
        _maven.setScope(Scope.PROVIDED);
    };
    ExternalDependency _doubleArrow_1 = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_createMavenDependency_5, _function_1);
    deps.add(_doubleArrow_1);
    return deps;
}
Also used : ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency)

Example 4 with ExternalDependency

use of org.eclipse.xtext.xtext.wizard.ExternalDependency 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)

Example 5 with ExternalDependency

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

the class ProjectDescriptor method getExternalDependencies.

public Set<ExternalDependency> getExternalDependencies() {
    final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
    Set<EPackageInfo> _ePackageInfos = this.config.getEcore2Xtext().getEPackageInfos();
    for (final EPackageInfo ePackage : _ePackageInfos) {
        ExternalDependency _createBundleDependency = ExternalDependency.createBundleDependency(ePackage.getBundleID());
        deps.add(_createBundleDependency);
    }
    return deps;
}
Also used : ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency) EPackageInfo(org.eclipse.xtext.xtext.wizard.EPackageInfo)

Aggregations

ExternalDependency (org.eclipse.xtext.xtext.wizard.ExternalDependency)7 LinkedHashSet (java.util.LinkedHashSet)2 Set (java.util.Set)2 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)2 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1 EPackageInfo (org.eclipse.xtext.xtext.wizard.EPackageInfo)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 TestProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestProjectDescriptor)1 Test (org.junit.Test)1