Java Code Examples for org.gradle.api.file.ConfigurableFileCollection

The following examples show how to use org.gradle.api.file.ConfigurableFileCollection. 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: crnk-framework   Source File: ForkedGenerateTask.java    License: 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 2
Source Project: gradle-plugins   Source File: ResolveJavadocLinks.java    License: 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 3
Source Project: gradle-plugins   Source File: ResolveJavadocLinks.java    License: 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 Project: gradle-plugins   Source File: WarOverlayPlugin.java    License: 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
public ConfigurableFileCollection builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
 
Example 6
public ConfigurableFileCollection files(Object... paths) {
    return getFileOperations().files(paths);
}
 
Example 7
public ConfigurableFileCollection files(Object paths, Closure closure) {
    return ConfigureUtil.configure(closure, getFileOperations().files(paths));
}
 
Example 8
public ConfigurableFileCollection from(Object... paths) {
    GUtil.addToCollection(files, Arrays.asList(paths));
    return this;
}
 
Example 9
public ConfigurableFileCollection builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
 
Example 10
public ConfigurableFileCollection setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
 
Example 11
public ConfigurableFileCollection files(Object... paths) {
    return fileOperations.files(paths);
}
 
Example 12
public ConfigurableFileCollection files(Object paths, Closure configureClosure) {
    return ConfigureUtil.configure(configureClosure, fileOperations.files(paths));
}
 
Example 13
public ConfigurableFileCollection files(Object... paths) {
    return fileOperations.files(paths);
}
 
Example 14
public ConfigurableFileCollection files(Object paths, Closure closure) {
    return fileOperations.files(paths, closure);
}
 
Example 15
public ConfigurableFileCollection from(Object... paths) {
    GUtil.addToCollection(files, Arrays.asList(paths));
    return this;
}
 
Example 16
public ConfigurableFileCollection builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
 
Example 17
public ConfigurableFileCollection setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
 
Example 18
public ConfigurableFileCollection setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
 
Example 19
public ConfigurableFileCollection from(Object... paths) {
    GUtil.addToCollection(files, Arrays.asList(paths));
    return this;
}
 
Example 20
Source Project: commerce-gradle-plugin   Source File: MergePropertyFiles.java    License: Apache License 2.0 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getInputFiles() {
    return inputFiles;
}
 
Example 21
Source Project: playframework   Source File: TwirlCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getTwirlCompilerClasspath() {
    return twirlCompilerClasspath;
}
 
Example 22
Source Project: playframework   Source File: JavaScriptMinify.java    License: Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getCompilerClasspath() {
    return compilerClasspath;
}
 
Example 23
Source Project: playframework   Source File: RoutesCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getRoutesCompilerClasspath() {
    return routesCompilerClasspath;
}
 
Example 24
Source Project: playframework   Source File: PlayRun.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * The directories of the assets for the Play application (for live reload functionality).
 *
 * @return The directories of the assets
 */
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public ConfigurableFileCollection getAssetsDirs() {
    return assetsDirs;
}
 
Example 25
Source Project: curiostack   Source File: NativeImageTask.java    License: MIT License 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getClasspath() {
  return classpath;
}
 
Example 26
Source Project: curiostack   Source File: ExtractProtosTask.java    License: MIT License 4 votes vote down vote up
@InputFiles
public ConfigurableFileCollection getFiles() {
  return files;
}
 
Example 27
Source Project: clojurephant   Source File: ClojureScriptCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Internal
public ConfigurableFileCollection getSourceRoots() {
  return sourceRoots;
}
 
Example 28
Source Project: clojurephant   Source File: ClojureScriptCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getClasspath() {
  return classpath;
}
 
Example 29
Source Project: clojurephant   Source File: ClojureCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Internal
public ConfigurableFileCollection getSourceRoots() {
  return sourceRoots;
}
 
Example 30
Source Project: clojurephant   Source File: ClojureCompile.java    License: Apache License 2.0 4 votes vote down vote up
@Classpath
public ConfigurableFileCollection getClasspath() {
  return classpath;
}