Search in sources :

Example 1 with BuildSystem

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

Aggregations

ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 BuildSystem (org.eclipse.xtext.xtext.wizard.BuildSystem)1 IdeProjectDescriptor (org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor)1 ProjectDescriptor (org.eclipse.xtext.xtext.wizard.ProjectDescriptor)1 RuntimeTestProjectDescriptor (org.eclipse.xtext.xtext.wizard.RuntimeTestProjectDescriptor)1 TestProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestProjectDescriptor)1 TestedProjectDescriptor (org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor)1 UiProjectDescriptor (org.eclipse.xtext.xtext.wizard.UiProjectDescriptor)1 WebProjectDescriptor (org.eclipse.xtext.xtext.wizard.WebProjectDescriptor)1