Search in sources :

Example 1 with GradleBuildFile

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

the class IntellijProjectDescriptor method buildGradle.

@Override
public GradleBuildFile buildGradle() {
    GradleBuildFile _buildGradle = super.buildGradle();
    final Procedure1<GradleBuildFile> _function = (GradleBuildFile it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("//see https://github.com/xtext/xtext-gradle-plugin/tree/master/xtext-idea-gradle-plugin");
        _builder.newLine();
        _builder.append("apply plugin: \'org.xtext.idea-plugin\'");
        _builder.newLine();
        _builder.append("apply plugin: \'org.xtext.idea-repository\'");
        _builder.newLine();
        _builder.newLine();
        it.setPluginsSection(_builder.toString());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.newLine();
        _builder_1.append("ideaDevelopment {");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("ideaVersion = \'143.381.42\'");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("pluginRepositories {");
        _builder_1.newLine();
        {
            boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot();
            if (_isSnapshot) {
                _builder_1.append("\t\t");
                _builder_1.append("url \"https://hudson.eclipse.org/xtext/job/xtext-intellij/lastSuccessfulBuild/artifact/git-repo/intellij/build/ideaRepository/updatePlugins.xml\"");
                _builder_1.newLine();
            } else {
                _builder_1.append("\t\t");
                _builder_1.append("url \"http://download.eclipse.org/modeling/tmf/xtext/idea/${xtextVersion}/updatePlugins.xml\"");
                _builder_1.newLine();
            }
        }
        _builder_1.append("\t");
        _builder_1.append("}");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("pluginDependencies {");
        _builder_1.newLine();
        _builder_1.append("\t\t");
        _builder_1.append("id \'org.eclipse.xtext.idea\' version xtextVersion");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("}");
        _builder_1.newLine();
        _builder_1.append("}");
        _builder_1.newLine();
        _builder_1.newLine();
        _builder_1.append("ideaRepository.rootUrl = \"${buildDir}/ideaRepository\"");
        _builder_1.newLine();
        it.setAdditionalContent(_builder_1.toString());
    };
    return ObjectExtensions.<GradleBuildFile>operator_doubleArrow(_buildGradle, _function);
}
Also used : GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 2 with GradleBuildFile

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

the class RuntimeProjectDescriptor method buildGradle.

@Override
public GradleBuildFile buildGradle() {
    GradleBuildFile _buildGradle = super.buildGradle();
    final Procedure1<GradleBuildFile> _function = (GradleBuildFile it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("configurations {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("mwe2 {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("extendsFrom compile");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("dependencies {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("mwe2 \"org.eclipse.emf:org.eclipse.emf.mwe2.launch:");
        String _mweVersion = this.getConfig().getXtextVersion().getMweVersion();
        _builder.append(_mweVersion, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("mwe2 \"org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}\"");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("mwe2 \"org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}\"");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("mwe2 \"org.eclipse.xtext:xtext-antlr-generator:");
        String _antlrGeneratorVersion = this.getConfig().getXtextVersion().getAntlrGeneratorVersion();
        _builder.append(_antlrGeneratorVersion, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        {
            boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels();
            if (_isFromExistingEcoreModels) {
                _builder.append("\t");
                _builder.append("mwe2 \"org.eclipse.xtext:org.eclipse.xtext.generator:${xtextVersion}\"");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("mwe2 \"org.eclipse.xpand:org.eclipse.xpand:2.0.0\"");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("mwe2 \"org.eclipse.xpand:org.eclipse.xtend:2.0.0\"");
                _builder.newLine();
            }
        }
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("task generateXtextLanguage(type: JavaExec) {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("main = \'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("classpath = configurations.mwe2");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("inputs.file \"");
        String _sourceFolder = this.sourceFolder(Outlet.MAIN_JAVA);
        _builder.append(_sourceFolder, "\t");
        _builder.append("/");
        String _workflowFilePath = this.getWorkflowFilePath();
        _builder.append(_workflowFilePath, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("inputs.file \"");
        String _sourceFolder_1 = this.sourceFolder(Outlet.MAIN_JAVA);
        _builder.append(_sourceFolder_1, "\t");
        _builder.append("/");
        String _grammarFilePath = this.getGrammarFilePath();
        _builder.append(_grammarFilePath, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("outputs.dir \"");
        String _sourceFolder_2 = this.sourceFolder(Outlet.MAIN_SRC_GEN);
        _builder.append(_sourceFolder_2, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("args += \"");
        String _sourceFolder_3 = this.sourceFolder(Outlet.MAIN_JAVA);
        _builder.append(_sourceFolder_3, "\t");
        _builder.append("/");
        String _workflowFilePath_1 = this.getWorkflowFilePath();
        _builder.append(_workflowFilePath_1, "\t");
        _builder.append("\"");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("args += \"-p\"");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("args += \"rootPath=/${projectDir}/..\"");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("generateXtext.dependsOn(generateXtextLanguage)");
        _builder.newLine();
        _builder.append("clean.dependsOn(cleanGenerateXtextLanguage)");
        _builder.newLine();
        _builder.append("eclipse.classpath.plusConfigurations += [configurations.mwe2]");
        _builder.newLine();
        it.setAdditionalContent(_builder.toString());
    };
    return ObjectExtensions.<GradleBuildFile>operator_doubleArrow(_buildGradle, _function);
}
Also used : GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 3 with GradleBuildFile

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

the class WebProjectDescriptor method buildGradle.

@Override
public GradleBuildFile buildGradle() {
    GradleBuildFile _buildGradle = super.buildGradle();
    final Procedure1<GradleBuildFile> _function = (GradleBuildFile it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("plugins {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("id \'war\'");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        it.setPluginsSection(_builder.toString());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("task jettyRun(type:JavaExec) {");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("dependsOn(sourceSets.main.runtimeClasspath)");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("classpath = sourceSets.main.runtimeClasspath.filter{it.exists()}");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("main = \'");
        String _basePackage = this.getConfig().getLanguage().getBasePackage();
        _builder_1.append(_basePackage, "\t");
        _builder_1.append(".web.ServerLauncher\'");
        _builder_1.newLineIfNotEmpty();
        _builder_1.append("\t");
        _builder_1.append("standardInput = System.in");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("group = \'run\'");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("description = \'Starts an example Jetty server with your language\'");
        _builder_1.newLine();
        _builder_1.append("}");
        _builder_1.newLine();
        it.setAdditionalContent(_builder_1.toString());
    };
    return ObjectExtensions.<GradleBuildFile>operator_doubleArrow(_buildGradle, _function);
}
Also used : GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 4 with GradleBuildFile

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

the class IdeProjectDescriptor method buildGradle.

@Override
public GradleBuildFile buildGradle() {
    GradleBuildFile _buildGradle = super.buildGradle();
    final Procedure1<GradleBuildFile> _function = (GradleBuildFile it) -> {
        StringConcatenation _builder = new StringConcatenation();
        {
            LanguageServer _languageServer = this.getConfig().getLanguageServer();
            boolean _tripleEquals = (_languageServer == LanguageServer.FATJAR);
            if (_tripleEquals) {
                _builder.append("plugins {");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("id \'com.github.johnrengelman.shadow\' version \'2.0.0\'");
                _builder.newLine();
                _builder.append("}");
                _builder.newLine();
                _builder.newLine();
            }
        }
        it.setPluginsSection(_builder.toString());
        StringConcatenation _builder_1 = new StringConcatenation();
        {
            LanguageServer _languageServer_1 = this.getConfig().getLanguageServer();
            boolean _tripleNotEquals = (_languageServer_1 != LanguageServer.NONE);
            if (_tripleNotEquals) {
                _builder_1.newLine();
                _builder_1.append("apply plugin: \'application\'");
                _builder_1.newLine();
                {
                    LanguageServer _languageServer_2 = this.getConfig().getLanguageServer();
                    boolean _tripleEquals_1 = (_languageServer_2 == LanguageServer.FATJAR);
                    if (_tripleEquals_1) {
                        _builder_1.append("apply plugin: \'com.github.johnrengelman.shadow\'");
                        _builder_1.newLine();
                    }
                }
                _builder_1.append("mainClassName = \"org.eclipse.xtext.ide.server.ServerLauncher\"");
                _builder_1.newLine();
                _builder_1.newLine();
                {
                    LanguageServer _languageServer_3 = this.getConfig().getLanguageServer();
                    boolean _tripleEquals_2 = (_languageServer_3 == LanguageServer.FATJAR);
                    if (_tripleEquals_2) {
                        _builder_1.append("shadowJar {");
                        _builder_1.newLine();
                        _builder_1.append("\t");
                        _builder_1.append("from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)");
                        _builder_1.newLine();
                        _builder_1.append("\t");
                        _builder_1.append("configurations = [project.configurations.runtime]");
                        _builder_1.newLine();
                        _builder_1.append("\t");
                        _builder_1.append("exclude(\'META-INF/INDEX.LIST\', \'META-INF/*.SF\', \'META-INF/*.DSA\', \'META-INF/*.RSA\',\'schema/*\',");
                        _builder_1.newLine();
                        _builder_1.append("\t\t");
                        _builder_1.append("\'.options\', \'.api_description\', \'*.profile\', \'*.html\', \'about.*\', \'about_files/*\',");
                        _builder_1.newLine();
                        _builder_1.append("\t\t");
                        _builder_1.append("\'plugin.xml\', \'modeling32.png\', \'systembundle.properties\', \'profile.list\')");
                        _builder_1.newLine();
                        _builder_1.append("\t");
                        _builder_1.append("classifier = \'ls\'");
                        _builder_1.newLine();
                        _builder_1.append("\t");
                        _builder_1.append("append(\'plugin.properties\')");
                        _builder_1.newLine();
                        _builder_1.append("}");
                        _builder_1.newLine();
                    }
                }
            }
        }
        it.setAdditionalContent(_builder_1.toString());
    };
    return ObjectExtensions.<GradleBuildFile>operator_doubleArrow(_buildGradle, _function);
}
Also used : LanguageServer(org.eclipse.xtext.xtext.wizard.LanguageServer) GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 5 with GradleBuildFile

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

the class ParentProjectDescriptor method buildGradle.

@Override
public GradleBuildFile buildGradle() {
    GradleBuildFile _buildGradle = super.buildGradle();
    final Procedure1<GradleBuildFile> _function = (GradleBuildFile it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("buildscript {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("repositories {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("jcenter()");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("dependencies {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("classpath \'org.xtext:xtext-gradle-plugin:");
        String _xtextGradlePluginVersion = this.getConfig().getXtextVersion().getXtextGradlePluginVersion();
        _builder.append(_xtextGradlePluginVersion, "\t\t");
        _builder.append("\'");
        _builder.newLineIfNotEmpty();
        {
            boolean _isEnabled = this.getConfig().getIntellijProject().isEnabled();
            if (_isEnabled) {
                _builder.append("\t\t");
                _builder.append("classpath \'org.xtext:xtext-idea-gradle-plugin:");
                String _xtextGradlePluginVersion_1 = this.getConfig().getXtextVersion().getXtextGradlePluginVersion();
                _builder.append(_xtextGradlePluginVersion_1, "\t\t");
                _builder.append("\'");
                _builder.newLineIfNotEmpty();
            }
        }
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("subprojects {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("ext.xtextVersion = \'");
        XtextVersion _xtextVersion = this.getConfig().getXtextVersion();
        _builder.append(_xtextVersion, "\t");
        _builder.append("\'");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("repositories {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("jcenter()");
        _builder.newLine();
        {
            boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot();
            if (_isSnapshot) {
                _builder.append("\t\t");
                _builder.append("maven {");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("\t");
                _builder.append("url \'https://oss.sonatype.org/content/repositories/snapshots\'");
                _builder.newLine();
                _builder.append("\t\t");
                _builder.append("}");
                _builder.newLine();
            }
        }
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("\t");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply plugin: \'java\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply plugin: \'org.xtext.xtend\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply from: \"${rootDir}/gradle/source-layout.gradle\"");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply from: \"${rootDir}/gradle/maven-deployment.gradle\"");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply plugin: \'eclipse\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("apply plugin: \'idea\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("group = \'");
        String _baseName = this.getConfig().getBaseName();
        _builder.append(_baseName, "\t");
        _builder.append("\'");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("version = \'1.0.0-SNAPSHOT\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("sourceCompatibility = \'");
        String _javaVersion = this.getJavaVersion();
        _builder.append(_javaVersion, "\t");
        _builder.append("\'");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("targetCompatibility = \'");
        String _javaVersion_1 = this.getJavaVersion();
        _builder.append(_javaVersion_1, "\t");
        _builder.append("\'");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("configurations.all {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("exclude group: \'asm\'");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        it.setAdditionalContent(_builder.toString());
    };
    return ObjectExtensions.<GradleBuildFile>operator_doubleArrow(_buildGradle, _function);
}
Also used : GradleBuildFile(org.eclipse.xtext.xtext.wizard.GradleBuildFile) XtextVersion(org.eclipse.xtext.util.XtextVersion) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

GradleBuildFile (org.eclipse.xtext.xtext.wizard.GradleBuildFile)6 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 XtextVersion (org.eclipse.xtext.util.XtextVersion)1 LanguageServer (org.eclipse.xtext.xtext.wizard.LanguageServer)1 PlainTextFile (org.eclipse.xtext.xtext.wizard.PlainTextFile)1 PomFile (org.eclipse.xtext.xtext.wizard.PomFile)1 TextFile (org.eclipse.xtext.xtext.wizard.TextFile)1