Search in sources :

Example 11 with ConfigurableFileCollection

use of org.gradle.api.file.ConfigurableFileCollection in project gradle by gradle.

the class JacocoMerge method executionData.

/**
 * Adds execution data generated by a task to the list of those to merge. Only tasks with a {@link JacocoTaskExtension} will be included; all others will be ignored.
 *
 * @param tasks one or more tasks to merge
 */
public void executionData(Task... tasks) {
    for (Task task : tasks) {
        JacocoTaskExtension extension = task.getExtensions().findByType(JacocoTaskExtension.class);
        if (extension != null) {
            ConfigurableFileCollection files = getProject().files(extension.getDestinationFile());
            files.builtBy(task);
            executionData(files);
        }
    }
}
Also used : Task(org.gradle.api.Task) CacheableTask(org.gradle.api.tasks.CacheableTask) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) JacocoTaskExtension(org.gradle.testing.jacoco.plugins.JacocoTaskExtension)

Example 12 with ConfigurableFileCollection

use of org.gradle.api.file.ConfigurableFileCollection in project gradle by gradle.

the class JavaExecHandleBuilder method getEffectiveArguments.

@Override
protected List<String> getEffectiveArguments() {
    List<String> arguments = getAllArguments();
    // Try to shorten command-line if necessary
    if (hasCommandLineExceedMaxLength(getExecutable(), arguments)) {
        try {
            File pathingJarFile = writePathingJarFile(classpath);
            ConfigurableFileCollection shortenedClasspath = fileCollectionFactory.configurableFiles();
            shortenedClasspath.from(pathingJarFile);
            List<String> shortenedArguments = getAllArguments(shortenedClasspath);
            LOGGER.info("Shortening Java classpath {} with {}", this.classpath.getFiles(), pathingJarFile);
            return shortenedArguments;
        } catch (IOException e) {
            LOGGER.info("Pathing JAR could not be created, Gradle cannot shorten the command line.", e);
        }
    }
    return arguments;
}
Also used : ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) IOException(java.io.IOException) File(java.io.File)

Example 13 with ConfigurableFileCollection

use of org.gradle.api.file.ConfigurableFileCollection in project gradle by gradle.

the class JavaExecHandleBuilder method setClasspath.

@Override
public JavaExecHandleBuilder setClasspath(FileCollection classpath) {
    // we need to create a new file collection container to avoid cycles. See: https://github.com/gradle/gradle/issues/8755
    ConfigurableFileCollection newClasspath = fileCollectionFactory.configurableFiles("classpath");
    newClasspath.setFrom(classpath);
    this.classpath = newClasspath;
    return this;
}
Also used : ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection)

Aggregations

ConfigurableFileCollection (org.gradle.api.file.ConfigurableFileCollection)13 File (java.io.File)4 Project (org.gradle.api.Project)3 Inject (javax.inject.Inject)2 Plugin (org.gradle.api.Plugin)2 Dependency (org.gradle.api.artifacts.Dependency)2 ImmutableAttributesFactory (org.gradle.api.internal.attributes.ImmutableAttributesFactory)2 ObjectFactory (org.gradle.api.model.ObjectFactory)2 ProviderFactory (org.gradle.api.provider.ProviderFactory)2 SetProperty (org.gradle.api.provider.SetProperty)2 TaskContainer (org.gradle.api.tasks.TaskContainer)2 TaskProvider (org.gradle.api.tasks.TaskProvider)2 LifecycleBasePlugin (org.gradle.language.base.plugins.LifecycleBasePlugin)2 NativeComponentFactory (org.gradle.language.internal.NativeComponentFactory)2 Dimensions (org.gradle.language.nativeplatform.internal.Dimensions)2 Dimensions.tryToBuildOnHost (org.gradle.language.nativeplatform.internal.Dimensions.tryToBuildOnHost)2 ToolChainSelector (org.gradle.language.nativeplatform.internal.toolchains.ToolChainSelector)2 UnexportMainSymbol (org.gradle.language.nativeplatform.tasks.UnexportMainSymbol)2 TargetMachine (org.gradle.nativeplatform.TargetMachine)2 TargetMachineFactory (org.gradle.nativeplatform.TargetMachineFactory)2