Search in sources :

Example 6 with ConfigurableFileTree

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

the class GradleDslReferencePlugin method generateDslReference.

private void generateDslReference(Project project, ProjectLayout layout, TaskContainer tasks, ObjectFactory objects, GradleDocumentationExtension extension) {
    DslReference dslReference = extension.getDslReference();
    TaskProvider<ExtractDslMetaDataTask> dslMetaData = tasks.register("dslMetaData", ExtractDslMetaDataTask.class, task -> {
        task.source(extension.getDocumentedSource());
        task.getDestinationFile().convention(dslReference.getStagingRoot().file("dsl-meta-data.bin"));
    });
    TaskProvider<AssembleDslDocTask> dslDocbook = tasks.register("dslDocbook", AssembleDslDocTask.class, task -> {
        task.getSourceFile().convention(dslReference.getRoot().file("dsl.xml"));
        task.getPluginsMetaDataFile().convention(dslReference.getRoot().file("plugins.xml"));
        task.getClassDocbookDirectory().convention(dslReference.getRoot());
        task.getClassMetaDataFile().convention(dslMetaData.flatMap(ExtractDslMetaDataTask::getDestinationFile));
        task.getDestFile().convention(dslReference.getStagingRoot().file("dsl.xml"));
        task.getLinksFile().convention(dslReference.getStagingRoot().file("api-links.bin"));
    });
    TaskProvider<UserGuideTransformTask> dslStandaloneDocbook = tasks.register("dslStandaloneDocbook", UserGuideTransformTask.class, task -> {
        task.getVersion().convention(project.provider(() -> project.getVersion().toString()));
        task.getSourceFile().convention(dslDocbook.flatMap(AssembleDslDocTask::getDestFile));
        task.getLinksFile().convention(dslDocbook.flatMap(AssembleDslDocTask::getLinksFile));
        task.getDsldocUrl().convention("../dsl");
        task.getJavadocUrl().convention("../javadoc");
        task.getWebsiteUrl().convention("https://gradle.org");
        task.getDestFile().convention(dslReference.getStagingRoot().file("index.xml"));
    });
    Configuration userGuideTask = project.getConfigurations().create("userGuideTask");
    Configuration userGuideStyleSheetConf = project.getConfigurations().create("userGuideStyleSheets");
    TaskProvider<Docbook2Xhtml> dslHtml = tasks.register("dslHtml", Docbook2Xhtml.class, task -> {
        task.setGroup("documentation");
        task.setDescription("Generates DSL reference HTML documentation.");
        task.onlyIf(t -> !extension.getQuickFeedback().get());
        task.source(dslStandaloneDocbook);
        task.getStylesheetDirectory().convention(dslReference.getStylesheetDirectory());
        task.getStylesheetHighlightFile().convention(dslReference.getHighlightStylesheet());
        task.getDocbookStylesheets().from(userGuideStyleSheetConf);
        task.getClasspath().from(userGuideTask);
        task.getDestinationDirectory().convention(dslReference.getStagingRoot().dir("dsl"));
    });
    extension.dslReference(dslRef -> {
        // DSL ref has custom javascript
        ConfigurableFileTree js = objects.fileTree();
        js.from(dslReference.getRoot());
        js.include("*.js");
        dslRef.getResources().from(js);
        dslRef.getResources().from(extension.getCssFiles());
        dslRef.getRoot().convention(extension.getSourceRoot().dir("dsl"));
        dslRef.getStylesheetDirectory().convention(extension.getSourceRoot().dir("stylesheets"));
        dslRef.getHighlightStylesheet().convention(dslRef.getStylesheetDirectory().file("custom-highlight/custom-xslthl-config.xml"));
        dslRef.getStagingRoot().convention(extension.getStagingRoot().dir("dsl"));
        dslRef.getGeneratedMetaDataFile().convention(dslMetaData.flatMap(ExtractDslMetaDataTask::getDestinationFile));
        dslRef.getRenderedDocumentation().from(dslRef.getResources());
        dslRef.getRenderedDocumentation().from(dslHtml.flatMap(Docbook2Xhtml::getDestinationDirectory));
    });
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) ConfigurableFileTree(org.gradle.api.file.ConfigurableFileTree) AssembleDslDocTask(gradlebuild.docs.dsl.docbook.AssembleDslDocTask) ExtractDslMetaDataTask(gradlebuild.docs.dsl.source.ExtractDslMetaDataTask)

Example 7 with ConfigurableFileTree

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

the class DefaultFileOperations method fileTree.

@Override
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    ConfigurableFileTree fileTree = fileCollectionFactory.fileTree();
    ConfigureUtil.configureByMap(args, fileTree);
    return fileTree;
}
Also used : ConfigurableFileTree(org.gradle.api.file.ConfigurableFileTree)

Example 8 with ConfigurableFileTree

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

the class DefaultFileOperations method fileTree.

@Override
public ConfigurableFileTree fileTree(Object baseDir) {
    ConfigurableFileTree fileTree = fileCollectionFactory.fileTree();
    fileTree.from(baseDir);
    return fileTree;
}
Also used : ConfigurableFileTree(org.gradle.api.file.ConfigurableFileTree)

Example 9 with ConfigurableFileTree

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

the class DefaultProject method fileTree.

@Override
public ConfigurableFileTree fileTree(Object baseDir, Action<? super ConfigurableFileTree> configureAction) {
    ConfigurableFileTree fileTree = fileTree(baseDir);
    configureAction.execute(fileTree);
    return fileTree;
}
Also used : ConfigurableFileTree(org.gradle.api.file.ConfigurableFileTree)

Aggregations

ConfigurableFileTree (org.gradle.api.file.ConfigurableFileTree)9 File (java.io.File)3 Project (org.gradle.api.Project)2 Task (org.gradle.api.Task)2 Configuration (org.gradle.api.artifacts.Configuration)2 Predicate (com.google.common.base.Predicate)1 ImmutableList (com.google.common.collect.ImmutableList)1 NpmInstallTask (com.moowork.gradle.node.npm.NpmInstallTask)1 PublicApi (gradlebuild.basics.PublicApi)1 AssembleDslDocTask (gradlebuild.docs.dsl.docbook.AssembleDslDocTask)1 ExtractDslMetaDataTask (gradlebuild.docs.dsl.source.ExtractDslMetaDataTask)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1 Action (org.gradle.api.Action)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 Plugin (org.gradle.api.Plugin)1 UnknownTaskException (org.gradle.api.UnknownTaskException)1 Category (org.gradle.api.attributes.Category)1 DocsType (org.gradle.api.attributes.DocsType)1 Usage (org.gradle.api.attributes.Usage)1