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();