org.gosulang.gradle.tasks.DefaultGosuSourceSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-gosu-plugin Show documentation
Show all versions of gradle-gosu-plugin Show documentation
Gosu language compiler for Gradle. Built with Gradle 5.1.1.
This has also been tested extensively with Gradle version(s): 5.1.1
** Gradle versions below 2.12 are no longer supported **
Projects applying this plugin require a compile-time dependency on the gosu-core-api library.
This version requires Gosu 1.13.9 or greater, or 1.14.2 or greater.
Please include this in the depencencies closure:
dependencies {
compile group: 'org.gosu-lang.gosu', name: 'gosu-core-api', version: '1.14.12'
}
package org.gosulang.gradle.tasks;
import groovy.lang.Closure;
import org.gradle.api.Action;
import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.internal.file.SourceDirectorySetFactory; //TODO unavoidable use of internal API
import org.gradle.api.tasks.SourceSet;
import org.gradle.util.ConfigureUtil;
import org.gradle.util.GUtil;
import java.util.Arrays;
import java.util.List;
public class DefaultGosuSourceSet implements GosuSourceSet {
private final SourceDirectorySet _gosu;
private final SourceDirectorySet _allGosu;
private static final List _gosuAndJavaExtensions = Arrays.asList("**/*.java", "**/*.gs", "**/*.gsx", "**/*.gst", "**/*.gsp");
private static final List _gosuExtensionsOnly = _gosuAndJavaExtensions.subList(1, _gosuAndJavaExtensions.size());
private final String name;
private final String baseName;
private final String displayName;
public DefaultGosuSourceSet( String name, SourceDirectorySetFactory sourceDirectorySetFactory ) {
this.name = name;
this.baseName = name.equals(SourceSet.MAIN_SOURCE_SET_NAME) ? "" : GUtil.toCamelCase(name);
displayName = GUtil.toWords(this.name);
_gosu = sourceDirectorySetFactory.create("gosu", displayName + " Gosu source");
_gosu.getFilter().include(_gosuAndJavaExtensions);
_allGosu = sourceDirectorySetFactory.create("gosu", displayName + " Gosu source");
_allGosu.getFilter().include(_gosuExtensionsOnly);
_allGosu.source(_gosu);
}
public String getName() {
return name;
}
@Override
public String toString() {
return "source set '" + getDisplayName() + "'";
}
public String getDisplayName() {
return displayName;
}
@Override
public SourceDirectorySet getGosu() {
return _gosu;
}
@Override
public GosuSourceSet gosu( Closure configureClosure ) {
ConfigureUtil.configure(configureClosure, getGosu());
return this;
}
@Override
public GosuSourceSet gosu( Action super SourceDirectorySet> configureAction) {
configureAction.execute(getGosu());
return this;
}
@Override
public SourceDirectorySet getAllGosu() {
return _allGosu;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy