Search in sources :

Example 6 with ConfigurableFileCollection

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

the class ScalaPlugin method configureScaladoc.

private static void configureScaladoc(final Project project) {
    project.getTasks().withType(ScalaDoc.class, new Action<ScalaDoc>() {

        @Override
        public void execute(ScalaDoc scalaDoc) {
            final SourceSet main = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName("main");
            scalaDoc.getConventionMapping().map("classpath", new Callable<FileCollection>() {

                @Override
                public FileCollection call() throws Exception {
                    ConfigurableFileCollection files = project.files();
                    files.from(main.getOutput());
                    files.from(main.getCompileClasspath());
                    return files;
                }
            });
            scalaDoc.setSource(InvokerHelper.invokeMethod(main, "getScala", null));
        }
    });
    ScalaDoc scalaDoc = project.getTasks().create(SCALA_DOC_TASK_NAME, ScalaDoc.class);
    scalaDoc.setDescription("Generates Scaladoc for the main source code.");
    scalaDoc.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
}
Also used : SourceSet(org.gradle.api.tasks.SourceSet) JavaPluginConvention(org.gradle.api.plugins.JavaPluginConvention) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) ScalaDoc(org.gradle.api.tasks.scala.ScalaDoc) Callable(java.util.concurrent.Callable)

Example 7 with ConfigurableFileCollection

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

the class DefaultIdeArtifactRegistry method getIdeArtifacts.

@Override
public FileCollection getIdeArtifacts(final Class<? extends IdeProjectMetadata> type) {
    return fileOperations.files(new Callable<List<FileCollection>>() {

        @Override
        public List<FileCollection> call() {
            return CollectionUtils.collect(getIdeArtifactMetadata(type), new Transformer<FileCollection, Reference<?>>() {

                @Override
                public FileCollection transform(Reference<?> result) {
                    ConfigurableFileCollection singleton = fileOperations.files(result.get().getFile());
                    singleton.builtBy(result.getBuildDependencies());
                    return singleton;
                }
            });
        }
    });
}
Also used : Transformer(org.gradle.api.Transformer) IncludedBuildTaskReference(org.gradle.composite.internal.IncludedBuildTaskReference) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) List(java.util.List)

Example 8 with ConfigurableFileCollection

use of org.gradle.api.file.ConfigurableFileCollection in project crnk-framework by crnk-project.

the class ForkedGenerateTypescriptTask method initClassPath.

private void initClassPath() {
    RuntimeClassLoaderFactory classLoaderFactory = new RuntimeClassLoaderFactory(getProject());
    Set<File> classpath = new HashSet<>();
    classpath.addAll(classLoaderFactory.getProjectLibraries());
    try {
        classpath.add(Paths.get(classLoaderFactory.getPluginUrl().toURI()).toFile());
    } catch (URISyntaxException e) {
        throw new IllegalStateException(e);
    }
    Project project = getProject();
    ConfigurableFileCollection files = project.files(classpath.toArray());
    setClasspath(files);
}
Also used : Project(org.gradle.api.Project) RuntimeClassLoaderFactory(io.crnk.gen.runtime.RuntimeClassLoaderFactory) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) URISyntaxException(java.net.URISyntaxException) File(java.io.File) HashSet(java.util.HashSet)

Example 9 with ConfigurableFileCollection

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

the class GroovyBasePlugin method configureGroovydoc.

private void configureGroovydoc() {
    project.getTasks().withType(Groovydoc.class).configureEach(groovydoc -> {
        groovydoc.getConventionMapping().map("groovyClasspath", () -> {
            FileCollection groovyClasspath = groovyRuntime.inferGroovyClasspath(groovydoc.getClasspath());
            // Jansi is required to log errors when generating Groovydoc
            ConfigurableFileCollection jansi = project.getObjects().fileCollection().from(moduleRegistry.getExternalModule("jansi").getImplementationClasspath().getAsFiles());
            return groovyClasspath.plus(jansi);
        });
        groovydoc.getConventionMapping().map("destinationDir", () -> javaPluginExtension().getDocsDir().dir("groovydoc").get().getAsFile());
        groovydoc.getConventionMapping().map("docTitle", () -> projectExtension(ReportingExtension.class).getApiDocTitle());
        groovydoc.getConventionMapping().map("windowTitle", () -> projectExtension(ReportingExtension.class).getApiDocTitle());
    });
}
Also used : ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) FileCollection(org.gradle.api.file.FileCollection) Groovydoc(org.gradle.api.tasks.javadoc.Groovydoc)

Example 10 with ConfigurableFileCollection

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

the class JvmPluginsHelper method configureForSourceSet.

private static void configureForSourceSet(final SourceSet sourceSet, final SourceDirectorySet sourceDirectorySet, AbstractCompile compile, final Project target) {
    compile.setDescription("Compiles the " + sourceDirectorySet.getDisplayName() + ".");
    compile.setSource(sourceSet.getJava());
    ConfigurableFileCollection classpath = compile.getProject().getObjects().fileCollection();
    classpath.from((Callable<Object>) () -> sourceSet.getCompileClasspath().plus(target.files(sourceSet.getJava().getClassesDirectory())));
    compile.getConventionMapping().map("classpath", () -> classpath);
}
Also used : ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) DslObject(org.gradle.api.internal.plugins.DslObject)

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