All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xtext.gradle.idea.IdeaDevelopmentPlugin Maven / Gradle / Ivy

There is a newer version: 2.0.9-alpha.3
Show newest version
package org.xtext.gradle.idea;

import java.io.File;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.gradle.api.Action;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.api.tasks.TaskContainer;
import org.xtext.gradle.idea.tasks.DownloadIdea;
import org.xtext.gradle.idea.tasks.DownloadPlugins;
import org.xtext.gradle.idea.tasks.GradleExtensions;
import org.xtext.gradle.idea.tasks.IdeaExtension;
import org.xtext.gradle.idea.tasks.IdeaPluginDependencies;
import org.xtext.gradle.idea.tasks.IdeaPluginRepositories;

@SuppressWarnings("all")
public class IdeaDevelopmentPlugin implements Plugin {
  public final static String IDEA_DEVELOPMENT_EXTENSION_NAME = "ideaDevelopment";
  
  public final static String IDEA_TASK_GROUP = "Intellij Idea";
  
  @Override
  public void apply(final Project project) {
    ExtensionContainer _extensions = project.getExtensions();
    IdeaExtension _create = _extensions.create(IdeaDevelopmentPlugin.IDEA_DEVELOPMENT_EXTENSION_NAME, IdeaExtension.class, project);
    final Procedure1 _function = new Procedure1() {
      @Override
      public void apply(final IdeaExtension it) {
        File _rootDir = project.getRootDir();
        File _divide = GradleExtensions.operator_divide(_rootDir, "ideaHome");
        it.setIdeaHome(_divide);
      }
    };
    final IdeaExtension idea = ObjectExtensions.operator_doubleArrow(_create, _function);
    TaskContainer _tasks = project.getTasks();
    DownloadIdea _create_1 = _tasks.create("downloadIdea", DownloadIdea.class);
    final Procedure1 _function_1 = new Procedure1() {
      @Override
      public void apply(final DownloadIdea it) {
        it.setGroup(IdeaDevelopmentPlugin.IDEA_TASK_GROUP);
        it.setDescription("Downloads Intellij Idea");
      }
    };
    final DownloadIdea downloadIdea = ObjectExtensions.operator_doubleArrow(_create_1, _function_1);
    idea.setDownloadIdea(downloadIdea);
    final Action _function_2 = new Action() {
      @Override
      public void execute(final Project it) {
        File _ideaHome = idea.getIdeaHome();
        downloadIdea.setIdeaHome(_ideaHome);
        String _ideaVersion = idea.getIdeaVersion();
        downloadIdea.setIdeaVersion(_ideaVersion);
      }
    };
    project.afterEvaluate(_function_2);
    TaskContainer _tasks_1 = project.getTasks();
    DownloadPlugins _create_2 = _tasks_1.create("downloadPlugins", DownloadPlugins.class);
    final Procedure1 _function_3 = new Procedure1() {
      @Override
      public void apply(final DownloadPlugins it) {
        it.setDescription("Downloads Idea plugin dependencies");
        it.setGroup(IdeaDevelopmentPlugin.IDEA_TASK_GROUP);
      }
    };
    final DownloadPlugins downloadPlugins = ObjectExtensions.operator_doubleArrow(_create_2, _function_3);
    idea.setDownloadPlugins(downloadPlugins);
    final Action _function_4 = new Action() {
      @Override
      public void execute(final Project it) {
        File _buildDir = project.getBuildDir();
        File _divide = GradleExtensions.operator_divide(_buildDir, "pluginDependencies");
        downloadPlugins.setDestinationDir(_divide);
        IdeaPluginRepositories _pluginRepositories = idea.getPluginRepositories();
        downloadPlugins.setPluginRepositories(_pluginRepositories);
        IdeaPluginDependencies _pluginDependencies = idea.getPluginDependencies();
        downloadPlugins.setPluginDependencies(_pluginDependencies);
      }
    };
    project.afterEvaluate(_function_4);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy