Java Code Examples for org.gradle.api.internal.file.DefaultSourceDirectorySet

The following examples show how to use org.gradle.api.internal.file.DefaultSourceDirectorySet. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: web3j-gradle-plugin   Source File: Web3jPlugin.java    License: Apache License 2.0 6 votes vote down vote up
private SourceDirectorySet buildSourceDirectorySet(final SourceSet sourceSet) {

        final String displayName = capitalize((CharSequence) sourceSet.getName()) + " Solidity ABI";

        final SourceDirectorySet directorySet =
                new DefaultSourceDirectorySet(
                        sourceSet.getName(),
                        displayName,
                        new IdentityFileResolver(),
                        new DefaultDirectoryFileTreeFactory());

        directorySet.srcDir(buildOutputDir(sourceSet));
        directorySet.include("**/*.abi");

        return directorySet;
    }
 
Example 2
public DefaultSourceSet(String name, FileResolver fileResolver) {
    this.name = name;
    displayName = GUtil.toWords(this.name);

    String javaSrcDisplayName = String.format("%s Java source", displayName);

    javaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    javaSource.getFilter().include("**/*.java");

    allJavaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    allJavaSource.getFilter().include("**/*.java");
    allJavaSource.source(javaSource);

    String resourcesDisplayName = String.format("%s resources", displayName);
    resources = new DefaultSourceDirectorySet(resourcesDisplayName, fileResolver);
    resources.getFilter().exclude(new Spec<FileTreeElement>() {
        public boolean isSatisfiedBy(FileTreeElement element) {
            return javaSource.contains(element.getFile());
        }
    });

    String allSourceDisplayName = String.format("%s source", displayName);
    allSource = new DefaultSourceDirectorySet(allSourceDisplayName, fileResolver);
    allSource.source(resources);
    allSource.source(javaSource);
}
 
Example 3
public DefaultSourceSet(String name, FileResolver fileResolver) {
    this.name = name;
    displayName = GUtil.toWords(this.name);

    String javaSrcDisplayName = String.format("%s Java source", displayName);

    javaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    javaSource.getFilter().include("**/*.java");

    allJavaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    allJavaSource.getFilter().include("**/*.java");
    allJavaSource.source(javaSource);

    String resourcesDisplayName = String.format("%s resources", displayName);
    resources = new DefaultSourceDirectorySet(resourcesDisplayName, fileResolver);
    resources.getFilter().exclude(new Spec<FileTreeElement>() {
        public boolean isSatisfiedBy(FileTreeElement element) {
            return javaSource.contains(element.getFile());
        }
    });

    String allSourceDisplayName = String.format("%s source", displayName);
    allSource = new DefaultSourceDirectorySet(allSourceDisplayName, fileResolver);
    allSource.source(resources);
    allSource.source(javaSource);
}
 
Example 4
public DefaultSourceSet(String name, FileResolver fileResolver) {
    this.name = name;
    displayName = GUtil.toWords(this.name);

    String javaSrcDisplayName = String.format("%s Java source", displayName);

    javaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    javaSource.getFilter().include("**/*.java");

    allJavaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    allJavaSource.getFilter().include("**/*.java");
    allJavaSource.source(javaSource);

    String resourcesDisplayName = String.format("%s resources", displayName);
    resources = new DefaultSourceDirectorySet(resourcesDisplayName, fileResolver);
    resources.getFilter().exclude(new Spec<FileTreeElement>() {
        public boolean isSatisfiedBy(FileTreeElement element) {
            return javaSource.contains(element.getFile());
        }
    });

    String allSourceDisplayName = String.format("%s source", displayName);
    allSource = new DefaultSourceDirectorySet(allSourceDisplayName, fileResolver);
    allSource.source(resources);
    allSource.source(javaSource);
}
 
Example 5
public DefaultSourceSet(String name, FileResolver fileResolver) {
    this.name = name;
    displayName = GUtil.toWords(this.name);

    String javaSrcDisplayName = String.format("%s Java source", displayName);

    javaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    javaSource.getFilter().include("**/*.java");

    allJavaSource = new DefaultSourceDirectorySet(javaSrcDisplayName, fileResolver);
    allJavaSource.getFilter().include("**/*.java");
    allJavaSource.source(javaSource);

    String resourcesDisplayName = String.format("%s resources", displayName);
    resources = new DefaultSourceDirectorySet(resourcesDisplayName, fileResolver);
    resources.getFilter().exclude(new Spec<FileTreeElement>() {
        public boolean isSatisfiedBy(FileTreeElement element) {
            return javaSource.contains(element.getFile());
        }
    });

    String allSourceDisplayName = String.format("%s source", displayName);
    allSource = new DefaultSourceDirectorySet(allSourceDisplayName, fileResolver);
    allSource.source(resources);
    allSource.source(javaSource);
}
 
Example 6
public DefaultScalaSourceSet(String displayName, FileResolver fileResolver) {
    scala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    scala.getFilter().include("**/*.java", "**/*.scala");
    allScala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    allScala.getFilter().include("**/*.scala");
    allScala.source(scala);
}
 
Example 7
public DefaultGroovySourceSet(String displayName, FileResolver fileResolver) {
    groovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    groovy.getFilter().include("**/*.java", "**/*.groovy");
    allGroovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    allGroovy.source(groovy);
    allGroovy.getFilter().include("**/*.groovy");
}
 
Example 8
public DefaultScalaSourceSet(String displayName, FileResolver fileResolver) {
    scala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    scala.getFilter().include("**/*.java", "**/*.scala");
    allScala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    allScala.getFilter().include("**/*.scala");
    allScala.source(scala);
}
 
Example 9
public DefaultGroovySourceSet(String displayName, FileResolver fileResolver) {
    groovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    groovy.getFilter().include("**/*.java", "**/*.groovy");
    allGroovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    allGroovy.source(groovy);
    allGroovy.getFilter().include("**/*.groovy");
}
 
Example 10
public void apply(final Project target) {
    target.getPlugins().apply(JvmLanguagePlugin.class);

    BinaryContainer jvmBinaryContainer = target.getExtensions().getByType(BinaryContainer.class);
    jvmBinaryContainer.withType(ClassDirectoryBinary.class).all(new Action<ClassDirectoryBinary>() {
        public void execute(final ClassDirectoryBinary binary) {
            final BinaryNamingScheme namingScheme = ((BinaryInternal) binary).getNamingScheme();
            binary.getSource().withType(JavaSourceSet.class).all(new Action<JavaSourceSet>() {
                public void execute(JavaSourceSet javaSourceSet) {
                    // TODO: handle case where binary has multiple JavaSourceSet's
                    JavaCompile compileTask = target.getTasks().create(namingScheme.getTaskName("compile", "java"), JavaCompile.class);
                    configureCompileTask(compileTask, javaSourceSet, binary);
                    binary.builtBy(compileTask);
                }
            });
        }
    });

    ProjectSourceSet projectSourceSet = target.getExtensions().getByType(DefaultProjectSourceSet.class);
    projectSourceSet.all(new Action<FunctionalSourceSet>() {
        public void execute(final FunctionalSourceSet functionalSourceSet) {
            functionalSourceSet.registerFactory(JavaSourceSet.class, new NamedDomainObjectFactory<JavaSourceSet>() {
                public JavaSourceSet create(String name) {
                    return instantiator.newInstance(DefaultJavaSourceSet.class, name,
                            instantiator.newInstance(DefaultSourceDirectorySet.class, name, fileResolver),
                            instantiator.newInstance(DefaultClasspath.class, fileResolver,
                                    target.getTasks()), functionalSourceSet);
                }
            });
        }
    });
}
 
Example 11
public DefaultScalaSourceSet(String displayName, FileResolver fileResolver) {
    scala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    scala.getFilter().include("**/*.java", "**/*.scala");
    allScala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    allScala.getFilter().include("**/*.scala");
    allScala.source(scala);
}
 
Example 12
public DefaultGroovySourceSet(String displayName, FileResolver fileResolver) {
    groovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    groovy.getFilter().include("**/*.java", "**/*.groovy");
    allGroovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    allGroovy.source(groovy);
    allGroovy.getFilter().include("**/*.groovy");
}
 
Example 13
public DefaultScalaSourceSet(String displayName, FileResolver fileResolver) {
    scala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    scala.getFilter().include("**/*.java", "**/*.scala");
    allScala = new DefaultSourceDirectorySet(String.format("%s Scala source", displayName), fileResolver);
    allScala.getFilter().include("**/*.scala");
    allScala.source(scala);
}
 
Example 14
public DefaultGroovySourceSet(String displayName, FileResolver fileResolver) {
    groovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    groovy.getFilter().include("**/*.java", "**/*.groovy");
    allGroovy = new DefaultSourceDirectorySet(String.format("%s Groovy source", displayName), fileResolver);
    allGroovy.source(groovy);
    allGroovy.getFilter().include("**/*.groovy");
}
 
Example 15
public void apply(final Project target) {
    target.getPlugins().apply(JvmLanguagePlugin.class);

    BinaryContainer jvmBinaryContainer = target.getExtensions().getByType(BinaryContainer.class);
    jvmBinaryContainer.withType(ClassDirectoryBinary.class).all(new Action<ClassDirectoryBinary>() {
        public void execute(final ClassDirectoryBinary binary) {
            final BinaryNamingScheme namingScheme = ((BinaryInternal) binary).getNamingScheme();
            binary.getSource().withType(JavaSourceSet.class).all(new Action<JavaSourceSet>() {
                public void execute(JavaSourceSet javaSourceSet) {
                    // TODO: handle case where binary has multiple JavaSourceSet's
                    JavaCompile compileTask = target.getTasks().create(namingScheme.getTaskName("compile", "java"), JavaCompile.class);
                    configureCompileTask(compileTask, javaSourceSet, binary);
                    binary.builtBy(compileTask);
                }
            });
        }
    });

    ProjectSourceSet projectSourceSet = target.getExtensions().getByType(DefaultProjectSourceSet.class);
    projectSourceSet.all(new Action<FunctionalSourceSet>() {
        public void execute(final FunctionalSourceSet functionalSourceSet) {
            functionalSourceSet.registerFactory(JavaSourceSet.class, new NamedDomainObjectFactory<JavaSourceSet>() {
                public JavaSourceSet create(String name) {
                    return instantiator.newInstance(DefaultJavaSourceSet.class, name,
                            instantiator.newInstance(DefaultSourceDirectorySet.class, name, fileResolver),
                            instantiator.newInstance(DefaultClasspath.class, fileResolver,
                                    target.getTasks()), functionalSourceSet);
                }
            });
        }
    });
}
 
Example 16
public AntlrSourceVirtualDirectoryImpl(String parentDisplayName, FileResolver fileResolver) {
    final String displayName = String.format("%s Antlr source", parentDisplayName);
    antlr = new DefaultSourceDirectorySet(displayName, fileResolver);
    antlr.getFilter().include("**/*.g");
}
 
Example 17
public DefaultPrebuiltLibrary(String name, FileResolver fileResolver) {
    this.name = name;
    headers = new DefaultSourceDirectorySet("headers", fileResolver);
    binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
}
 
Example 18
@Inject
public DefaultJvmResourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, "JVM resources", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 19
@Inject
public DefaultJavaSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, "Java source", new DefaultSourceDirectorySet("source", fileResolver));
    this.compileClasspath = new EmptyClasspath();
}
 
Example 20
@Inject
public DefaultObjectiveCSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "Objective-C source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 21
public AbstractHeaderExportingSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver, String typeName, SourceDirectorySet source) {
    super(name, parent, typeName, source);
    this.exportedHeaders = new DefaultSourceDirectorySet("exported headers", fileResolver);
    this.implicitHeaders = new DefaultSourceDirectorySet("implicit headers", fileResolver);
}
 
Example 22
public DefaultWindowsResourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
   super(name, parent, fileResolver, "windows resources", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 23
public DefaultCppSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "C++ source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 24
@Inject
public DefaultCSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "C source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 25
public DefaultAssemblerSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, "assembler source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 26
@Inject
public DefaultObjectiveCppSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "Objective-C++ source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example 27
public AntlrSourceVirtualDirectoryImpl(String parentDisplayName, FileResolver fileResolver) {
    final String displayName = String.format("%s Antlr source", parentDisplayName);
    antlr = new DefaultSourceDirectorySet(displayName, fileResolver);
    antlr.getFilter().include("**/*.g");
}
 
Example 28
public DefaultPrebuiltLibrary(String name, FileResolver fileResolver) {
    this.name = name;
    headers = new DefaultSourceDirectorySet("headers", fileResolver);
    binaries = new DefaultDomainObjectSet<NativeBinary>(NativeBinary.class);
}
 
Example 29
@Inject
public DefaultObjectiveCSourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
    super(name, parent, project, "Objective-C source", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}
 
Example 30
public DefaultWindowsResourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
   super(name, parent, project, "windows resources", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}