本文整理汇总了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());
}
});
}
});
}