Search in sources :

Example 1 with AssembleDslDocTask

use of gradlebuild.docs.dsl.docbook.AssembleDslDocTask 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)

Aggregations

AssembleDslDocTask (gradlebuild.docs.dsl.docbook.AssembleDslDocTask)1 ExtractDslMetaDataTask (gradlebuild.docs.dsl.source.ExtractDslMetaDataTask)1 Configuration (org.gradle.api.artifacts.Configuration)1 ConfigurableFileTree (org.gradle.api.file.ConfigurableFileTree)1