project.getLogger().debug( "Applying Hibernate enhancement action to SourceSet.{}", sourceSet.getName() ); final Task compileTask = project.getTasks().findByName( sourceSet.getCompileJavaTaskName() ); compileTask.doLast( new Action<Task>() {
String getCompileJavaTaskName() { return this.sourceSet.getCompileJavaTaskName(); } }
private static JavaCompile getCompileJavaTask(Project project, SourceSet sourceSet) { return (JavaCompile) project.getTasks().getByName(sourceSet.getCompileJavaTaskName()); }
private ImmutableBiMap<String, String> getModuleNameIbiTaskName(final Project project, final SourceSetContainer sourceSets) { return sourceSets.stream() .flatMap(ss -> stream(ss.getAllJava().matching(pattern -> pattern.include("**/" + MODULE_INFO_JAVA))) .map(moduleInfoJavaFile -> immutableEntry( ss.getCompileJavaTaskName(), parseModuleName(moduleInfoJavaFile.toPath(), newJavaParser((JavaCompile) project.getTasks().getByName(ss.getCompileJavaTaskName()))) ) ) ) .collect(toImmutableBiMap( Entry::getKey, Entry::getValue )) ; }
project.getTasks().getByName(s.getCompileJavaTaskName()).dependsOn(t.getPath()); t.doLast(t2 -> { Set<File> resolve = Collections.singleton(null);
private void configureGosuCompile(JavaBasePlugin javaPlugin, SourceSet sourceSet, GosuSourceSet gosuSourceSet) { String compileTaskName = sourceSet.getCompileTaskName("gosu"); GosuCompile gosuCompile = _project.getTasks().create(compileTaskName, GosuCompile.class); javaPlugin.configureForSourceSet(sourceSet, gosuCompile); gosuCompile.dependsOn(sourceSet.getCompileJavaTaskName()); gosuCompile.setDescription("Compiles the " + sourceSet.getName() + " Gosu source"); gosuCompile.setSource(gosuSourceSet.getGosu()); gosuCompile.setSourceRoots(gosuSourceSet.getGosu().getSrcDirs()); _project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName); }
@Override public void apply(Project project) { project.getPluginManager().apply( "java" ); final SnifferExtension snifferExtension = Helper.maybeCreateExtension( project ); project.getConfigurations().maybeCreate( CONFIGURATION_NAME ); final CheckTask checkTask = project.getTasks().create( CheckTask.STANDARD_NAME, CheckTask.class ); project.getTasks().add( checkTask ); project.afterEvaluate( p -> { for ( SourceSet sourceSet : snifferExtension.getCheck().getSourceSets() ) { Task compileTask = p.getTasks().findByName( sourceSet.getCompileTaskName( "groovy" ) ); if ( compileTask == null ) { compileTask = p.getTasks().findByName( sourceSet.getCompileJavaTaskName() ); } if ( compileTask == null ) { throw new RuntimeException( "Could not locate compile task for sourceSet [" + sourceSet.getName() + "]" ); } checkTask.dependsOn( compileTask ); } } ); } }
sourceSet.getJava().srcDir(outputDir); project.getTasks().getByName(sourceSet.getCompileJavaTaskName()).dependsOn(velocityTask);
/** * Create and configure default compileGosu and compileTestGosu tasks * Gradle 4.0+: call local equivalent of o.g.a.p.i.SourceSetUtil.configureForSourceSet(sourceSet, gosuSourceSet.getGosu(), gosuCompile, _project) * Gradle 2.x, 3.x: call javaPlugin.configureForSourceSet(sourceSet, gosuCompile); */ private void configureGosuCompile(JavaBasePlugin javaPlugin, SourceSet sourceSet, GosuSourceSet gosuSourceSet) { String compileTaskName = sourceSet.getCompileTaskName("gosu"); GosuCompile gosuCompile = _project.getTasks().create(compileTaskName, GosuCompile.class); VersionNumber gradleVersion = VersionNumber.parse(_project.getGradle().getGradleVersion()); if(gradleVersion.compareTo(VersionNumber.parse("4.0")) >= 0) { //Gradle 4.0+ configureForSourceSet(sourceSet, gosuSourceSet.getGosu(), gosuCompile, _project); } else { javaPlugin.configureForSourceSet(sourceSet, gosuCompile); gosuCompile.setDescription("Compiles the " + gosuSourceSet.getGosu() + "."); } gosuCompile.dependsOn(sourceSet.getCompileJavaTaskName()); gosuCompile.setSource((Object) gosuSourceSet.getGosu()); // Gradle 4.0 overloads setSource; must upcast to Object for backwards compatibility _project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName); }
private void configureClasspathScan(SourceSet sourceSet) { String taskName = sourceSet.getTaskName("scan", "Classpath"); File baseDir = new File(this.project.getBuildDir(), "joinfaces/" + sourceSet.getName()); ClasspathScan scanTask = this.project.getTasks().create(taskName, ClasspathScan.class); scanTask.getDestinationDir().set(baseDir); this.project.afterEvaluate(p -> { scanTask.getClasspath().from(p.getConfigurations().getByName(sourceSet.getRuntimeClasspathConfigurationName())); scanTask.getClasspath().from(p.getTasks().getByName(sourceSet.getCompileJavaTaskName())); p.getPlugins().withType(GroovyPlugin.class, groovyPlugin -> scanTask.getClasspath().from(p.getTasks().getByName(sourceSet.getCompileTaskName("groovy"))) ); p.getPlugins().withType(ScalaBasePlugin.class, scalaBasePlugin -> scanTask.getClasspath().from(p.getTasks().getByName(sourceSet.getCompileTaskName("scala"))) ); if (p.getPlugins().hasPlugin("kotlin") || p.getPlugins().hasPlugin("org.jetbrains.kotlin.jvm")) { scanTask.getClasspath().from(p.getTasks().getByName(sourceSet.getCompileTaskName("kotlin"))); } sourceSet.getOutput().dir(Collections.singletonMap("builtBy", scanTask), scanTask.getDestinationDir()); }); } }
task.setOutput(dir); JavaCompile compile = (JavaCompile) this.project.getTasks().getByName(main.getCompileJavaTaskName()); compile.dependsOn("blossomSourceReplacementJava"); compile.setSource(dir);
public void execute(final SourceSet sourceSet) { FregeSourceSetDirectoryFactory factory = new FregeSourceSetDirectoryFactory((ProjectInternal) project, fileResolver); final DefaultFregeSourceSet fregeSourceSet = new DefaultFregeSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), factory); new DslObject(sourceSet).getConvention().getPlugins().put("frege", fregeSourceSet); final String defaultSourcePath = String.format("src/%s/frege", sourceSet.getName()); fregeSourceSet.getFrege().srcDir(defaultSourcePath); sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() { public boolean isSatisfiedBy(FileTreeElement element) { return fregeSourceSet.getFrege().contains(element.getFile()); } }); sourceSet.getAllJava().source(fregeSourceSet.getFrege()); sourceSet.getAllSource().source(fregeSourceSet.getFrege()); String compileTaskName = sourceSet.getCompileTaskName("frege"); FregeCompile compile = project.getTasks().create(compileTaskName, FregeCompile.class); compile.setModule(project.file(defaultSourcePath).getAbsolutePath()); javaBasePlugin.configureForSourceSet(sourceSet, compile); compile.getConventionMapping().map("fregepath", new Callable() { public Object call() throws Exception { return sourceSet.getCompileClasspath(); } }); compile.dependsOn(sourceSet.getCompileJavaTaskName()); compile.setDescription(String.format("Compiles the %s Frege source.", sourceSet.getName())); compile.setSource(fregeSourceSet.getFrege()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName); sourceSet.compiledBy(compile); } });
JavaCompile compile = (JavaCompile) project.getTasks().getByName(set.getCompileJavaTaskName()); compile.dependsOn(task); compile.setSource(dir);
compile.dependsOn(project.getTasks().getByName(sourceSet.getCompileJavaTaskName())); compile.dependsOn(project.getTasks().getByName(sourceSet.getProcessResourcesTaskName())); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compile);
sourceJar.from(main.getOutput().getResourcesDir()); sourceJar.setClassifier("sources"); sourceJar.dependsOn(main.getCompileJavaTaskName(), main.getProcessResourcesTaskName(), getSourceSetFormatted(main, TMPL_TASK_RETROMAP_RPL));
project.getTasks().getByName(sourceSet.getCompileJavaTaskName());
TaskProvider<JavaCompile> compileTaskProvider = project.getTasks().named(sourceSet.getCompileJavaTaskName(), JavaCompile.class, compileJava -> { compileJava.dependsOn(generateLombokConfig); compileJava.getOptions().getCompilerArgs().add("-Xlint:-processing");