本文整理匯總了Java中org.gradle.api.tasks.compile.GroovyCompile類的典型用法代碼示例。如果您正苦於以下問題:Java GroovyCompile類的具體用法?Java GroovyCompile怎麽用?Java GroovyCompile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GroovyCompile類屬於org.gradle.api.tasks.compile包,在下文中一共展示了GroovyCompile類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureSourceSetDefaults
import org.gradle.api.tasks.compile.GroovyCompile; //導入依賴的package包/類
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() {
public void execute(SourceSet sourceSet) {
final DefaultGroovySourceSet groovySourceSet = new DefaultGroovySourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), sourceDirectorySetFactory);
new DslObject(sourceSet).getConvention().getPlugins().put("groovy", groovySourceSet);
groovySourceSet.getGroovy().srcDir("src/" + sourceSet.getName() + "/groovy");
sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() {
public boolean isSatisfiedBy(FileTreeElement element) {
return groovySourceSet.getGroovy().contains(element.getFile());
}
});
sourceSet.getAllJava().source(groovySourceSet.getGroovy());
sourceSet.getAllSource().source(groovySourceSet.getGroovy());
String compileTaskName = sourceSet.getCompileTaskName("groovy");
GroovyCompile compile = project.getTasks().create(compileTaskName, GroovyCompile.class);
javaBasePlugin.configureForSourceSet(sourceSet, compile);
compile.dependsOn(sourceSet.getCompileJavaTaskName());
compile.setDescription("Compiles the " + sourceSet.getName() + " Groovy source.");
compile.setSource(groovySourceSet.getGroovy());
project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName);
}
});
}
示例2: configureSourceSetDefaults
import org.gradle.api.tasks.compile.GroovyCompile; //導入依賴的package包/類
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() {
public void execute(SourceSet sourceSet) {
final DefaultGroovySourceSet groovySourceSet = new DefaultGroovySourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), fileResolver);
new DslObject(sourceSet).getConvention().getPlugins().put("groovy", groovySourceSet);
groovySourceSet.getGroovy().srcDir(String.format("src/%s/groovy", sourceSet.getName()));
sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() {
public boolean isSatisfiedBy(FileTreeElement element) {
return groovySourceSet.getGroovy().contains(element.getFile());
}
});
sourceSet.getAllJava().source(groovySourceSet.getGroovy());
sourceSet.getAllSource().source(groovySourceSet.getGroovy());
String compileTaskName = sourceSet.getCompileTaskName("groovy");
GroovyCompile compile = project.getTasks().create(compileTaskName, GroovyCompile.class);
javaBasePlugin.configureForSourceSet(sourceSet, compile);
compile.dependsOn(sourceSet.getCompileJavaTaskName());
compile.setDescription(String.format("Compiles the %s Groovy source.", sourceSet.getName()));
compile.setSource(groovySourceSet.getGroovy());
project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName);
}
});
}
示例3: configureCompileDefaults
import org.gradle.api.tasks.compile.GroovyCompile; //導入依賴的package包/類
private void configureCompileDefaults() {
project.getTasks().withType(GroovyCompile.class, new Action<GroovyCompile>() {
public void execute(final GroovyCompile compile) {
compile.getConventionMapping().map("groovyClasspath", new Callable<Object>() {
public Object call() throws Exception {
return groovyRuntime.inferGroovyClasspath(compile.getClasspath());
}
});
}
});
}