Search in sources :

Example 6 with ProjectDescriptor

use of org.eclipse.xtext.xtext.wizard.ProjectDescriptor 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 7 with ProjectDescriptor

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

the class WizardConfigurationTest method gradleEclipseClasspathIsIgnoredForPluginProjects.

@Test
public void gradleEclipseClasspathIsIgnoredForPluginProjects() {
    this.config.setPreferredBuildSystem(BuildSystem.GRADLE);
    UiProjectDescriptor _uiProject = this.config.getUiProject();
    _uiProject.setEnabled(true);
    IdeProjectDescriptor _ideProject = this.config.getIdeProject();
    _ideProject.setEnabled(true);
    final Function1<ProjectDescriptor, Boolean> _function = (ProjectDescriptor it) -> {
        return Boolean.valueOf(it.isEclipsePluginProject());
    };
    final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
        Assert.assertTrue(it.buildGradle().getContent().contains("eclipseClasspath.enabled=false"));
    };
    IterableExtensions.<ProjectDescriptor>filter(this.config.getEnabledProjects(), _function).forEach(_function_1);
}
Also used : UiProjectDescriptor(org.eclipse.xtext.xtext.wizard.UiProjectDescriptor) WebProjectDescriptor(org.eclipse.xtext.xtext.wizard.WebProjectDescriptor) TestProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestProjectDescriptor) TestedProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor) ProjectDescriptor(org.eclipse.xtext.xtext.wizard.ProjectDescriptor) IdeProjectDescriptor(org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor) RuntimeProjectDescriptor(org.eclipse.xtext.xtext.wizard.RuntimeProjectDescriptor) IntellijProjectDescriptor(org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor) UiProjectDescriptor(org.eclipse.xtext.xtext.wizard.UiProjectDescriptor) IdeProjectDescriptor(org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor) Test(org.junit.Test)

Example 8 with ProjectDescriptor

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

the class RuntimeProjectDescriptor method workflow.

public CharSequence workflow() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("module ");
    String _basePackagePath = this.getConfig().getLanguage().getBasePackagePath();
    String _plus = (_basePackagePath + "/Generate");
    String _simpleName = this.getConfig().getLanguage().getSimpleName();
    String _replaceAll = (_plus + _simpleName).replaceAll("/", ".");
    _builder.append(_replaceAll);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import org.eclipse.xtext.xtext.generator.*");
    _builder.newLine();
    _builder.append("import org.eclipse.xtext.xtext.generator.model.project.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("var rootPath = \"..\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("Workflow {");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("component = XtextGenerator {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("configuration = {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("project = StandardProjectConfig {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("baseName = \"");
    String _name = this.getName();
    _builder.append(_name, "\t\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t");
    _builder.append("rootPath = rootPath");
    _builder.newLine();
    {
        boolean _isEnabled = this.testProject.isEnabled();
        if (_isEnabled) {
            _builder.append("\t\t\t\t");
            _builder.append("runtimeTest = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        if ((this.getConfig().getIdeProject().isEnabled() && (!IterableExtensions.exists(Collections.<ProjectDescriptor>unmodifiableList(CollectionLiterals.<ProjectDescriptor>newArrayList(this.getConfig().getWebProject(), this.getConfig().getIntellijProject(), this.getConfig().getUiProject())), ((Function1<ProjectDescriptor, Boolean>) (ProjectDescriptor it) -> {
            return Boolean.valueOf(it.isEnabled());
        }))))) {
            _builder.append("\t\t\t\t");
            _builder.append("genericIde = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        boolean _isEnabled_1 = this.getConfig().getUiProject().isEnabled();
        if (_isEnabled_1) {
            _builder.append("\t\t\t\t");
            _builder.append("eclipsePlugin = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        boolean _isEnabled_2 = this.getConfig().getUiProject().getTestProject().isEnabled();
        if (_isEnabled_2) {
            _builder.append("\t\t\t\t");
            _builder.append("eclipsePluginTest = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        boolean _isEnabled_3 = this.getConfig().getIntellijProject().isEnabled();
        if (_isEnabled_3) {
            _builder.append("\t\t\t\t");
            _builder.append("ideaPlugin = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        boolean _isEnabled_4 = this.getConfig().getWebProject().isEnabled();
        if (_isEnabled_4) {
            _builder.append("\t\t\t\t");
            _builder.append("web = {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("\t");
            _builder.append("enabled = true");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    {
        SourceLayout _sourceLayout = this.getConfig().getSourceLayout();
        boolean _equals = Objects.equal(_sourceLayout, SourceLayout.MAVEN);
        if (_equals) {
            _builder.append("\t\t\t\t");
            _builder.append("mavenLayout = true");
            _builder.newLine();
        }
    }
    {
        boolean _isEclipsePluginProject = this.isEclipsePluginProject();
        if (_isEclipsePluginProject) {
            _builder.append("\t\t\t\t");
            _builder.append("createEclipseMetaData = true");
            _builder.newLine();
        }
    }
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("code = {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("encoding = \"");
    Charset _encoding = this.getConfig().getEncoding();
    _builder.append(_encoding, "\t\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t");
    _builder.append("lineDelimiter = \"");
    String _convertToJavaString = Strings.convertToJavaString(this.getConfig().getLineDelimiter());
    _builder.append(_convertToJavaString, "\t\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t");
    _builder.append("fileHeader = \"/*\\n * generated by Xtext \\${version}\\n */\"");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("language = StandardLanguage {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("name = \"");
    String _name_1 = this.getConfig().getLanguage().getName();
    _builder.append(_name_1, "\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("fileExtensions = \"");
    LanguageDescriptor.FileExtensions _fileExtensions = this.getConfig().getLanguage().getFileExtensions();
    _builder.append(_fileExtensions, "\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    {
        boolean _isEmpty = this.getConfig().getEcore2Xtext().getEPackageInfos().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            {
                final Function1<EPackageInfo, String> _function = (EPackageInfo it) -> {
                    return it.getGenmodelURI().toString();
                };
                Set<String> _set = IterableExtensions.<String>toSet(IterableExtensions.<EPackageInfo, String>map(this.getConfig().getEcore2Xtext().getEPackageInfos(), _function));
                for (final String genmodelURI : _set) {
                    _builder.append("\t\t\t");
                    _builder.append("referencedResource = \"");
                    _builder.append(genmodelURI, "\t\t\t");
                    _builder.append("\"");
                    _builder.newLineIfNotEmpty();
                }
            }
        }
    }
    {
        boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels();
        if (_isFromExistingEcoreModels) {
            _builder.append("\t\t\t");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}");
            _builder.newLine();
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("formatter = {");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("\t");
            _builder.append("generateStub = true");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("serializer = {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("generateStub = false");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("validator = {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("// composedCheck = \"org.eclipse.xtext.validation.NamesAreUniqueValidator\"");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : SourceLayout(org.eclipse.xtext.xtext.wizard.SourceLayout) RuntimeTestProjectDescriptor(org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor) WebProjectDescriptor(org.eclipse.xtext.xtext.wizard.WebProjectDescriptor) TestProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestProjectDescriptor) TestedProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor) ProjectDescriptor(org.eclipse.xtext.xtext.wizard.ProjectDescriptor) IdeProjectDescriptor(org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor) UiProjectDescriptor(org.eclipse.xtext.xtext.wizard.UiProjectDescriptor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Charset(java.nio.charset.Charset) LanguageDescriptor(org.eclipse.xtext.xtext.wizard.LanguageDescriptor) EPackageInfo(org.eclipse.xtext.xtext.wizard.EPackageInfo)

Example 9 with ProjectDescriptor

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

the class RuntimeProjectDescriptor method workflowLaunchConfig.

/**
 * @since 2.11
 */
private CharSequence workflowLaunchConfig() {
    CharSequence _xblockexpression = null;
    {
        ArrayList<ProjectDescriptor> projectsToRefresh = CollectionLiterals.<ProjectDescriptor>newArrayList();
        Set<ProjectDescriptor> _enabledProjects = this.getConfig().getEnabledProjects();
        Iterables.<ProjectDescriptor>addAll(projectsToRefresh, _enabledProjects);
        boolean _isEnabled = this.getConfig().getRuntimeProject().testProject.isEnabled();
        if (_isEnabled) {
            projectsToRefresh.add(this.getConfig().getRuntimeProject().testProject);
        }
        boolean _isEnabled_1 = this.getConfig().getUiProject().getTestProject().isEnabled();
        if (_isEnabled_1) {
            TestProjectDescriptor _testProject = this.getConfig().getUiProject().getTestProject();
            projectsToRefresh.add(_testProject);
        }
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;");
        {
            for (final ProjectDescriptor it : projectsToRefresh) {
                _builder.append("&lt;item path=&quot;/");
                String _name = it.getName();
                _builder.append(_name);
                _builder.append("&quot; type=&quot;4&quot;/&gt;&#10;");
            }
        }
        _builder.append(";&lt;/resources&gt;}");
        final String refreshAttr = _builder.toString();
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
        _builder_1.newLine();
        {
            boolean _isEclipsePluginProject = this.getConfig().getRuntimeProject().isEclipsePluginProject();
            if (_isEclipsePluginProject) {
                _builder_1.append("<launchConfiguration type=\"org.eclipse.emf.mwe2.launch.Mwe2LaunchConfigurationType\">");
                _builder_1.newLine();
                _builder_1.append("<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_PATHS\">");
                _builder_1.newLine();
                _builder_1.append("<listEntry value=\"/");
                String _name_1 = this.getConfig().getRuntimeProject().getName();
                _builder_1.append(_name_1);
                _builder_1.append("\"/>");
                _builder_1.newLineIfNotEmpty();
                _builder_1.append("</listAttribute>");
                _builder_1.newLine();
                _builder_1.append("<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_TYPES\">");
                _builder_1.newLine();
                _builder_1.append("<listEntry value=\"4\"/>");
                _builder_1.newLine();
                _builder_1.append("</listAttribute>");
                _builder_1.newLine();
                _builder_1.append("<listAttribute key=\"org.eclipse.debug.ui.favoriteGroups\">");
                _builder_1.newLine();
                _builder_1.append("<listEntry value=\"org.eclipse.debug.ui.launchGroup.debug\"/>");
                _builder_1.newLine();
                _builder_1.append("<listEntry value=\"org.eclipse.debug.ui.launchGroup.run\"/>");
                _builder_1.newLine();
                _builder_1.append("</listAttribute>");
                _builder_1.newLine();
                _builder_1.append("<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"");
                _builder_1.append(refreshAttr);
                _builder_1.append("\"/>");
                _builder_1.newLineIfNotEmpty();
                _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.MAIN_TYPE\" value=\"org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher\"/>");
                _builder_1.newLine();
                _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.PROGRAM_ARGUMENTS\" value=\"");
                String _basePackagePath = this.getConfig().getLanguage().getBasePackagePath();
                String _plus = (_basePackagePath + "/Generate");
                String _simpleName = this.getConfig().getLanguage().getSimpleName();
                String _replaceAll = (_plus + _simpleName).replaceAll("/", ".");
                _builder_1.append(_replaceAll);
                _builder_1.append("\"/>");
                _builder_1.newLineIfNotEmpty();
                _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.PROJECT_ATTR\" value=\"");
                String _name_2 = this.getConfig().getRuntimeProject().getName();
                _builder_1.append(_name_2);
                _builder_1.append("\"/>");
                _builder_1.newLineIfNotEmpty();
                _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.VM_ARGUMENTS\" value=\"-Xmx512m\"/>");
                _builder_1.newLine();
                _builder_1.append("</launchConfiguration>");
                _builder_1.newLine();
            } else {
                BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem();
                boolean _equals = Objects.equal(_preferredBuildSystem, BuildSystem.MAVEN);
                if (_equals) {
                    _builder_1.append("<launchConfiguration type=\"org.eclipse.m2e.Maven2LaunchConfigurationType\">");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_DEBUG_OUTPUT\" value=\"false\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"M2_GOALS\" value=\"clean generate-sources\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_NON_RECURSIVE\" value=\"false\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_OFFLINE\" value=\"false\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"M2_PROFILES\" value=\"\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<listAttribute key=\"M2_PROPERTIES\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"M2_RUNTIME\" value=\"EMBEDDED\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_SKIP_TESTS\" value=\"false\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<intAttribute key=\"M2_THREADS\" value=\"1\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_UPDATE_SNAPSHOTS\" value=\"false\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"M2_USER_SETTINGS\" value=\"\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<booleanAttribute key=\"M2_WORKSPACE_RESOLUTION\" value=\"true\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"");
                    _builder_1.append(refreshAttr);
                    _builder_1.append("\"/>");
                    _builder_1.newLineIfNotEmpty();
                    _builder_1.append("<booleanAttribute key=\"org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD\" value=\"true\"/>");
                    _builder_1.newLine();
                    _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.WORKING_DIRECTORY\" value=\"${workspace_loc:/");
                    String _name_3 = this.getConfig().getRuntimeProject().getName();
                    _builder_1.append(_name_3);
                    _builder_1.append("}\"/>");
                    _builder_1.newLineIfNotEmpty();
                    _builder_1.append("</launchConfiguration>");
                    _builder_1.newLine();
                } else {
                    BuildSystem _preferredBuildSystem_1 = this.getConfig().getPreferredBuildSystem();
                    boolean _equals_1 = Objects.equal(_preferredBuildSystem_1, BuildSystem.GRADLE);
                    if (_equals_1) {
                        _builder_1.append("<launchConfiguration type=\"org.eclipse.buildship.core.launch.runconfiguration\">");
                        _builder_1.newLine();
                        _builder_1.append("<listAttribute key=\"arguments\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<stringAttribute key=\"gradle_distribution\" value=\"GRADLE_DISTRIBUTION(WRAPPER)\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<listAttribute key=\"jvm_arguments\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<booleanAttribute key=\"show_console_view\" value=\"true\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<booleanAttribute key=\"show_execution_view\" value=\"true\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<listAttribute key=\"tasks\">");
                        _builder_1.newLine();
                        _builder_1.append("<listEntry value=\"build\"/>");
                        _builder_1.newLine();
                        _builder_1.append("</listAttribute>");
                        _builder_1.newLine();
                        _builder_1.append("<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"");
                        _builder_1.append(refreshAttr);
                        _builder_1.append("\"/>");
                        _builder_1.newLineIfNotEmpty();
                        _builder_1.append("<booleanAttribute key=\"org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD\" value=\"true\"/>");
                        _builder_1.newLine();
                        _builder_1.append("<stringAttribute key=\"org.eclipse.jdt.launching.WORKING_DIRECTORY\" value=\"${workspace_loc:/");
                        String _name_4 = this.getConfig().getRuntimeProject().getName();
                        _builder_1.append(_name_4);
                        _builder_1.append("}\"/>");
                        _builder_1.newLineIfNotEmpty();
                        _builder_1.append("</launchConfiguration>");
                        _builder_1.newLine();
                    }
                }
            }
        }
        _xblockexpression = _builder_1;
    }
    return _xblockexpression;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) RuntimeTestProjectDescriptor(org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor) WebProjectDescriptor(org.eclipse.xtext.xtext.wizard.WebProjectDescriptor) TestProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestProjectDescriptor) TestedProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor) ProjectDescriptor(org.eclipse.xtext.xtext.wizard.ProjectDescriptor) IdeProjectDescriptor(org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor) UiProjectDescriptor(org.eclipse.xtext.xtext.wizard.UiProjectDescriptor) ArrayList(java.util.ArrayList) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) BuildSystem(org.eclipse.xtext.xtext.wizard.BuildSystem) RuntimeTestProjectDescriptor(org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor) TestProjectDescriptor(org.eclipse.xtext.xtext.wizard.TestProjectDescriptor)

Example 10 with ProjectDescriptor

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

the class GradleBuildFile method getContent.

@Override
public String getContent() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append(this.pluginsSection);
    _builder.newLineIfNotEmpty();
    {
        boolean _isEmpty = IterableExtensions.isEmpty(this.getAllDependencies());
        boolean _not = (!_isEmpty);
        if (_not) {
            _builder.append("dependencies {");
            _builder.newLine();
            {
                Set<? extends ProjectDescriptor> _upstreamProjects = this.getProject().getUpstreamProjects();
                for (final ProjectDescriptor p : _upstreamProjects) {
                    _builder.append("\t");
                    _builder.append("compile project(\':");
                    String _name = p.getName();
                    _builder.append(_name, "\t");
                    _builder.append("\')");
                    _builder.newLineIfNotEmpty();
                }
            }
            {
                Iterable<ExternalDependency.MavenCoordinates> _mavenDependencies = this.getMavenDependencies();
                for (final ExternalDependency.MavenCoordinates dep : _mavenDependencies) {
                    _builder.append("\t");
                    String _gradleNotation = dep.getScope().getGradleNotation();
                    _builder.append(_gradleNotation, "\t");
                    _builder.append(" \"");
                    String _groupId = dep.getGroupId();
                    _builder.append(_groupId, "\t");
                    _builder.append(":");
                    String _artifactId = dep.getArtifactId();
                    _builder.append(_artifactId, "\t");
                    _builder.append(":");
                    String _version = dep.getVersion();
                    _builder.append(_version, "\t");
                    _builder.append("\"");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    }
    _builder.append(this.additionalContent);
    _builder.newLineIfNotEmpty();
    {
        boolean _isEclipsePluginProject = this.getProject().isEclipsePluginProject();
        if (_isEclipsePluginProject) {
            _builder.append("//this is an eclipse plugin project");
            _builder.newLine();
            _builder.append("eclipseClasspath.enabled=false");
            _builder.newLine();
            _builder.append("cleanEclipseClasspath.enabled=false");
            _builder.newLine();
        }
    }
    return _builder.toString();
}
Also used : ExternalDependency(org.eclipse.xtext.xtext.wizard.ExternalDependency) ProjectDescriptor(org.eclipse.xtext.xtext.wizard.ProjectDescriptor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

ProjectDescriptor (org.eclipse.xtext.xtext.wizard.ProjectDescriptor)11 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 IdeProjectDescriptor (org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor)7 TestProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestProjectDescriptor)7 TestedProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor)7 UiProjectDescriptor (org.eclipse.xtext.xtext.wizard.UiProjectDescriptor)6 WebProjectDescriptor (org.eclipse.xtext.xtext.wizard.WebProjectDescriptor)6 RuntimeProjectDescriptor (org.eclipse.xtext.xtext.wizard.RuntimeProjectDescriptor)4 IntellijProjectDescriptor (org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor)3 ProjectLayout (org.eclipse.xtext.xtext.wizard.ProjectLayout)3 RuntimeTestProjectDescriptor (org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor)3 Charset (java.nio.charset.Charset)2 ExternalDependency (org.eclipse.xtext.xtext.wizard.ExternalDependency)2 PomFile (org.eclipse.xtext.xtext.wizard.PomFile)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 XtextVersion (org.eclipse.xtext.util.XtextVersion)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1