org.gradle.api.file.ConfigurableFileCollection Java Examples

The following examples show how to use org.gradle.api.file.ConfigurableFileCollection. 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: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(FileCollection classpath) {
    if (classpath instanceof Configuration) {
        return Stream.of((Configuration) classpath);
    }
    else if (classpath instanceof UnionFileCollection) {
        return ((UnionFileCollection) classpath).getSources()
                .stream()
                .flatMap(this::findConfigurations);
    }
    else if (classpath instanceof ConfigurableFileCollection) {
        return ((ConfigurableFileCollection) classpath).getFrom()
                .stream()
                .flatMap(this::findConfigurations);

    }
    return Stream.empty();
}
 
Example #2
Source File: ForkedGenerateTask.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
private void initClassPath() {
    RuntimeClassLoaderFactory classLoaderFactory = new RuntimeClassLoaderFactory(getProject(), module);

    Set<File> classpath = new HashSet<>();
    classpath.addAll(classLoaderFactory.getProjectLibraries());
    try {
        for (URL pluginUrl : classLoaderFactory.getPluginUrls()) {
            classpath.add(Paths.get(pluginUrl.toURI()).toFile());
        }
    } catch (URISyntaxException e) {
        throw new IllegalStateException(e);
    }

    Project project = getProject();
    ConfigurableFileCollection files = project.files(classpath.toArray());
    setClasspath(files);
}
 
Example #3
Source File: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(FileCollection classpath) {
    if (classpath instanceof Configuration) {
        return Stream.of((Configuration) classpath);
    }
    else if (classpath instanceof UnionFileCollection) {
        return ((UnionFileCollection) classpath).getSources()
                .stream()
                .flatMap(this::findConfigurations);
    }
    else if (classpath instanceof ConfigurableFileCollection) {
        return ((ConfigurableFileCollection) classpath).getFrom()
                .stream()
                .flatMap(this::findConfigurations);

    }
    return Stream.empty();
}
 
Example #4
Source File: WarOverlayPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private void configureOverlay(WarOverlay overlay, Callable<FileTree> warTree) {
    War warTask = overlay.getWarTask();

    String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
    String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());

    File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
    Action<CopySpec> extractOverlay = copySpec -> {
        copySpec.into(destinationDir);
        copySpec.from(warTree);
    };

    Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);

    overlay.getWarCopySpec().from(extractOverlayTask);

    if (overlay.isEnableCompilation()) {

        if (!destinationDir.exists() || isEmpty(destinationDir)) {
            project.sync(extractOverlay);
        }

        project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);

        ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
                .builtBy(extractOverlayTask);

        project.getDependencies().add(getClasspathConfigurationName(overlay), classes);

        FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
                .matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));

        project.getDependencies().add(getClasspathConfigurationName(overlay), libs);
    }
}
 
Example #5
Source File: DefaultScript.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection files(Object... paths) {
    return fileOperations.files(paths);
}
 
Example #6
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getIncludeDirs() {
    return includeDirs;
}
 
Example #7
Source File: AbstractProject.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection files(Object paths, Closure closure) {
    return ConfigureUtil.configure(closure, getFileOperations().files(paths));
}
 
Example #8
Source File: AbstractProject.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection files(Object paths, Closure closure) {
    return fileOperations.files(paths, closure);
}
 
Example #9
Source File: AbstractProject.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection files(Object... paths) {
    return fileOperations.files(paths);
}
 
Example #10
Source File: DefaultScript.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection files(Object paths, Closure configureClosure) {
    return ConfigureUtil.configure(configureClosure, fileOperations.files(paths));
}
 
Example #11
Source File: LombokTask.java    From gradle-plugins with MIT License 4 votes vote down vote up
@Classpath
ConfigurableFileCollection getLombokClasspath();
 
Example #12
Source File: DefaultConfigurableFileCollection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
 
Example #13
Source File: DefaultConfigurableFileCollection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
 
Example #14
Source File: DefaultConfigurableFileCollection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileCollection from(Object... paths) {
    GUtil.addToCollection(files, Arrays.asList(paths));
    return this;
}
 
Example #15
Source File: ClojureCheck.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getClasspath() {
  return classpath;
}
 
Example #16
Source File: AggregateJavadocPlugin.java    From gradle-plugins with MIT License 4 votes vote down vote up
@Override
public void apply(Project project) {

    aggregateJavadoc = project.getTasks().register("aggregateJavadoc", Javadoc.class, aggregateJavadoc -> {
        aggregateJavadoc.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
        aggregateJavadoc.getConventionMapping().map("destinationDir", new Callable<Object>() {
            @Override
            public Object call() {
                File docsDir = Optional.ofNullable(project.getConvention().findPlugin(JavaPluginConvention.class))
                        .map(JavaPluginConvention::getDocsDir)
                        .orElse(new File(project.getBuildDir(), "docs"));
                return new File(docsDir, "aggregateJavadoc");
            }
        });
    });

    project.allprojects(p ->
            p.getPlugins().withType(JavaPlugin.class, jp ->
                    aggregateJavadoc.configure(aj -> {
                        TaskProvider<Javadoc> javadoc = p.getTasks().named(JavaPlugin.JAVADOC_TASK_NAME, Javadoc.class);

                        aj.source(javadoc.map(Javadoc::getSource));

                        if (aj.getClasspath() instanceof ConfigurableFileCollection) {
                            ((ConfigurableFileCollection) aj.getClasspath()).from(javadoc.map(Javadoc::getClasspath));
                        }
                        else {
                            ConfigurableFileCollection classpath = project.files();
                            classpath.from(aj.getClasspath());
                            classpath.from(javadoc.map(Javadoc::getClasspath));
                            aj.setClasspath(classpath);
                        }

                        StandardJavadocDocletOptions options = (StandardJavadocDocletOptions) javadoc.get().getOptions();
                        StandardJavadocDocletOptions aggregateOptions = (StandardJavadocDocletOptions) aj.getOptions();

                        options.getLinks().forEach(link -> {
                            if (!aggregateOptions.getLinks().contains(link)) {
                                aggregateOptions.getLinks().add(link);
                            }
                        });
                        options.getLinksOffline().forEach(link -> {
                            if (!aggregateOptions.getLinksOffline().contains(link)) {
                                aggregateOptions.getLinksOffline().add(link);
                            }
                        });
                        options.getJFlags().forEach(jFlag -> {
                            if (!aggregateOptions.getJFlags().contains(jFlag)) {
                                aggregateOptions.getJFlags().add(jFlag);
                            }
                        });
                    })
            )
    );
}
 
Example #17
Source File: LombokTask.java    From gradle-plugins with MIT License 4 votes vote down vote up
@Classpath
ConfigurableFileCollection getLombokClasspath();
 
Example #18
Source File: Make.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public final ConfigurableFileCollection getMakeFiles() {
    return makeFiles;
}
 
Example #19
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getIncludeDirs() {
    return includeDirs;
}
 
Example #20
Source File: Make.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public final ConfigurableFileCollection getMakeFiles() {
    return makeFiles;
}
 
Example #21
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getLinkFiles() {
    return linkFiles;
}
 
Example #22
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getIncludeDirs() {
    return includeDirs;
}
 
Example #23
Source File: Make.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public final ConfigurableFileCollection getMakeFiles() {
    return makeFiles;
}
 
Example #24
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getLinkFiles() {
    return linkFiles;
}
 
Example #25
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getIncludeDirs() {
    return includeDirs;
}
 
Example #26
Source File: ClojureCheck.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Internal
public ConfigurableFileCollection getSourceRoots() {
  return sourceRoots;
}
 
Example #27
Source File: ClojureCompile.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getClasspath() {
  return classpath;
}
 
Example #28
Source File: ClojureCompile.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Internal
public ConfigurableFileCollection getSourceRoots() {
  return sourceRoots;
}
 
Example #29
Source File: ClojureScriptCompile.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getClasspath() {
  return classpath;
}
 
Example #30
Source File: ClojureScriptCompile.java    From clojurephant with Apache License 2.0 4 votes vote down vote up
@Internal
public ConfigurableFileCollection getSourceRoots() {
  return sourceRoots;
}