All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.freefair.gradle.plugins.maven.javadoc.AggregateJavadocClientPlugin Maven / Gradle / Ivy

There is a newer version: 8.11
Show newest version
package io.freefair.gradle.plugins.maven.javadoc;

import lombok.Getter;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.javadoc.Javadoc;

class AggregateJavadocClientPlugin implements Plugin {

    @Getter
    private ConfigurableFileCollection javadocClasspath;

    @Getter
    private TaskProvider collectJavadocClasspath;

    @Override
    public void apply(Project project) {
        collectJavadocClasspath = project.getTasks().register("collectJavadocClasspath");
        javadocClasspath = project.files().builtBy(collectJavadocClasspath);

        project.getPlugins().withType(JavaPlugin.class, javaPlugin -> {
            collectJavadocClasspath.configure(c -> {
                Javadoc javadoc = (Javadoc) project.getTasks().getByName(JavaPlugin.JAVADOC_TASK_NAME);
                c.setEnabled(javadoc.isEnabled());
                c.doFirst(t -> {
                    javadocClasspath
                            .from(javadoc.getClasspath().getFiles())
                            .builtBy(javadoc.getClasspath());
                });
            });
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy