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

org.xtext.gradle.idea.tasks.IdeaPluginDependencies Maven / Gradle / Ivy

package org.xtext.gradle.idea.tasks;

import com.google.common.base.Objects;
import java.util.Comparator;
import java.util.TreeSet;
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.gradle.api.Project;
import org.xtext.gradle.idea.tasks.IdeaPluginDependency;

@FinalFieldsConstructor
@SuppressWarnings("all")
public class IdeaPluginDependencies {
  private final Project project;
  
  private final TreeSet dependencies = CollectionLiterals.newTreeSet(new Comparator() {
    @Override
    public int compare(final IdeaPluginDependency $0, final IdeaPluginDependency $1) {
      String _id = $0.getId();
      String _id_1 = $1.getId();
      return _id.compareTo(_id_1);
    }
  });
  
  private final TreeSet projectDependencies = CollectionLiterals.newTreeSet(new Comparator() {
    @Override
    public int compare(final IdeaPluginDependency $0, final IdeaPluginDependency $1) {
      String _id = $0.getId();
      String _id_1 = $1.getId();
      return _id.compareTo(_id_1);
    }
  });
  
  public IdeaPluginDependency id(final String id) {
    IdeaPluginDependency _xblockexpression = null;
    {
      final IdeaPluginDependency dependency = new IdeaPluginDependency(id);
      this.dependencies.add(dependency);
      _xblockexpression = dependency;
    }
    return _xblockexpression;
  }
  
  public IdeaPluginDependency project(final String id) {
    IdeaPluginDependency _xblockexpression = null;
    {
      this.project.evaluationDependsOn(id);
      final IdeaPluginDependency dependency = new IdeaPluginDependency(id);
      this.projectDependencies.add(dependency);
      _xblockexpression = dependency;
    }
    return _xblockexpression;
  }
  
  public Iterable getEndorsedDependencies() {
    final Function1 _function = new Function1() {
      @Override
      public Boolean apply(final IdeaPluginDependency it) {
        String _version = it.getVersion();
        return Boolean.valueOf(Objects.equal(_version, null));
      }
    };
    return IterableExtensions.filter(this.dependencies, _function);
  }
  
  public Iterable getExternalDependencies() {
    final Function1 _function = new Function1() {
      @Override
      public Boolean apply(final IdeaPluginDependency it) {
        String _version = it.getVersion();
        return Boolean.valueOf((!Objects.equal(_version, null)));
      }
    };
    return IterableExtensions.filter(this.dependencies, _function);
  }
  
  public TreeSet getProjectDependencies() {
    return this.projectDependencies;
  }
  
  public IdeaPluginDependencies(final Project project) {
    super();
    this.project = project;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy