org.xtext.gradle.idea.tasks.IdeaRepository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xtext-idea-gradle-plugin Show documentation
Show all versions of xtext-idea-gradle-plugin Show documentation
A plugin for for building IntelliJ IDEA Xtext plugins
package org.xtext.gradle.idea.tasks;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import java.io.File;
import java.util.ArrayList;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Pure;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.file.FileCopyDetails;
import org.gradle.api.internal.file.copy.DestinationRootCopySpec;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Sync;
@SuppressWarnings("all")
public class IdeaRepository extends Sync {
@Input
@Accessors
private String rootUrl;
private final ArrayList files = CollectionLiterals.newArrayList();
public IdeaRepository() {
DestinationRootCopySpec _rootSpec = this.getRootSpec();
final Action _function = new Action() {
@Override
public void execute(final FileCopyDetails it) {
File _file = it.getFile();
IdeaRepository.this.files.add(_file);
}
};
_rootSpec.eachFile(_function);
}
@Override
protected void copy() {
try {
super.copy();
File _destinationDir = this.getDestinationDir();
final File pluginDescriptor = new File(_destinationDir, "updatePlugins.xml");
StringConcatenation _builder = new StringConcatenation();
_builder.append("");
_builder.newLine();
_builder.append("");
_builder.newLine();
{
for(final File it : this.files) {
_builder.append("\t");
_builder.append(" ");
_builder.newLine();
}
}
_builder.append(" ");
_builder.newLine();
Files.write(_builder, pluginDescriptor, Charsets.UTF_8);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Pure
public String getRootUrl() {
return this.rootUrl;
}
public void setRootUrl(final String rootUrl) {
this.rootUrl = rootUrl;
}
}