sourceSet.getJava().srcDir(String.format("src/%s/java", sourceSet.getName()));
sourceSet.getResources().srcDir(String.format("src/%s/resources", sourceSet.getName()));
sourceSet.compiledBy(sourceSet.getClassesTaskName());
FunctionalSourceSet functionalSourceSet = projectSourceSet.create(sourceSet.getName());
Classpath compileClasspath = new SourceSetCompileClasspath(sourceSet);
DefaultJavaSourceSet javaSourceSet = instantiator.newInstance(DefaultJavaSourceSet.class, "java", sourceSet.getJava(), compileClasspath, functionalSourceSet);
functionalSourceSet.add(javaSourceSet);
JvmResourceSet resourceSet = instantiator.newInstance(DefaultJvmResourceSet.class, "resources", sourceSet.getResources(), functionalSourceSet);
functionalSourceSet.add(resourceSet);
BinaryContainer binaryContainer = project.getExtensions().getByType(BinaryContainer.class);
ClassDirectoryBinarySpec binary = binaryContainer.create(String.format("%sClasses", sourceSet.getName()), ClassDirectoryBinarySpec.class);
ConventionMapping conventionMapping = new DslObject(binary).getConventionMapping();
conventionMapping.map("classesDir", new Callable<File>() {