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

The following examples show how to use org.gradle.api.internal.file.DefaultSourceDirectorySet. 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 File: DefaultSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #2
Source File: DefaultSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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
Source File: Web3jPlugin.java    From web3j-gradle-plugin with 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 #4
Source File: DefaultSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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
Source File: DefaultSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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
Source File: JavaLanguagePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #7
Source File: JavaLanguagePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #8
Source File: DefaultGroovySourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #9
Source File: DefaultScalaSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #10
Source File: DefaultGroovySourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #11
Source File: DefaultScalaSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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
Source File: DefaultGroovySourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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
Source File: DefaultScalaSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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
Source File: DefaultGroovySourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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
Source File: DefaultScalaSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #16
Source File: DefaultObjectiveCSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultObjectiveCSourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
    super(name, parent, project, "Objective-C source", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}
 
Example #17
Source File: DefaultWindowsResourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultWindowsResourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
   super(name, parent, fileResolver, "windows resources", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #18
Source File: DefaultCppSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultCppSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "C++ source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #19
Source File: DefaultCSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultCSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "C source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #20
Source File: DefaultAssemblerSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultAssemblerSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, "assembler source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #21
Source File: DefaultObjectiveCppSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultObjectiveCppSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "Objective-C++ source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #22
Source File: DefaultObjectiveCSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultObjectiveCSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, fileResolver, "Objective-C source", new DefaultSourceDirectorySet("source", fileResolver));
}
 
Example #23
Source File: DefaultJavaSourceSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultJavaSourceSet(String name, FunctionalSourceSet parent, FileResolver fileResolver) {
    super(name, parent, "Java source", new DefaultSourceDirectorySet("source", fileResolver));
    this.compileClasspath = new EmptyClasspath();
}
 
Example #24
Source File: AntlrSourceVirtualDirectoryImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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 #25
Source File: DefaultPrebuiltLibrary.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultPrebuiltLibrary(String name, FileResolver fileResolver) {
    this.name = name;
    headers = new DefaultSourceDirectorySet("headers", fileResolver);
    binaries = new DefaultDomainObjectSet<NativeBinary>(NativeBinary.class);
}
 
Example #26
Source File: AbstractHeaderExportingSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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 #27
Source File: DefaultWindowsResourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultWindowsResourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
   super(name, parent, project, "windows resources", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}
 
Example #28
Source File: DefaultCppSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultCppSourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
    super(name, parent, project, "C++ source", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}
 
Example #29
Source File: DefaultCSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public DefaultCSourceSet(String name, FunctionalSourceSet parent, ProjectInternal project) {
    super(name, parent, project, "C source", new DefaultSourceDirectorySet("source", project.getFileResolver()));
}
 
Example #30
Source File: AbstractHeaderExportingSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AbstractHeaderExportingSourceSet(String name, FunctionalSourceSet parent, ProjectInternal project, String typeName, SourceDirectorySet source) {
    super(name, parent, typeName, source);
    this.exportedHeaders = new DefaultSourceDirectorySet("exported headers", project.getFileResolver());
    this.implicitHeaders = new DefaultSourceDirectorySet("implicit headers", project.getFileResolver());
}