From 26ff3737e1f441f882c8063ec6baef583f6d295d Mon Sep 17 00:00:00 2001 From: Abel Salgado Romero Date: Fri, 1 Mar 2024 00:45:57 +0100 Subject: [PATCH] Fix missing groovydocs --- build.gradle | 4 +- docs/build.gradle | 64 +++++++++++++---------- docs/gradle/utilities.gradle | 18 ------- gradle/gradle-plugin-documentation.gradle | 2 +- 4 files changed, 39 insertions(+), 49 deletions(-) delete mode 100644 docs/gradle/utilities.gradle diff --git a/build.gradle b/build.gradle index 9e67e2716..fadeda0d3 100644 --- a/build.gradle +++ b/build.gradle @@ -126,7 +126,7 @@ subprojects { eachDependency { DependencyResolveDetails details -> if (details.requested.group == 'org.codehaus.groovy') { details.useVersion GroovySystem.version - details.because 'THe same version as Grodale Groovy is required' + details.because 'The same version as Gradle Groovy is required' } } } @@ -165,7 +165,7 @@ subprojects { apply from: 'gradle/coveralls.gradle' -task syncWrapper( type : Copy ) { +task syncWrapper(type: Copy) { from 'gradle', { include 'wrapper/**' } diff --git a/docs/build.gradle b/docs/build.gradle index 564a695fc..2cd20f5f6 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -14,12 +14,13 @@ ext { asciidoctorCombinedDocsDir = file("${buildDir}/docs/combined") docProjects = [ - 'asciidoctoreditorconfig', - 'base', 'jvm', 'jvm-epub', 'jvm-gems', 'jvm-pdf', - 'jvm-leanpub', - 'jvm-slides', 'slides-export', -// 'kindlegen', - 'js' + new IncludedProject(name: 'asciidoctoreditorconfig', dir: 'asciidoctoreditorconfig'), + new IncludedProject(name: 'asciidoctor-gradle-base', dir: 'base'), + new IncludedProject(name: 'asciidoctor-gradle-jvm-gems', dir: 'gems'), + new IncludedProject(name: 'asciidoctor-gradle-js', dir: 'js'), + new IncludedProject(name: 'asciidoctor-gradle-jvm', dir: 'jvm'), + new IncludedProject(name: 'asciidoctor-gradle-jvm-epub', dir: 'jvm-epub'), + new IncludedProject(name: 'asciidoctor-gradle-jvm-pdf', dir: 'jvm-pdf'), ] } @@ -30,8 +31,6 @@ allprojects { apply plugin: 'org.asciidoctor.jvm.convert' apply plugin: 'org.asciidoctor.editorconfig' -apply from: "${rootDir}/gradle/utilities.gradle" -//apply from: "${rootDir}/gradle/asciidoctor-config.gradle" configurations { asciidocExtensions @@ -41,14 +40,14 @@ dependencies { // asciidocExtensions 'com.bmuschko:asciidoctorj-tabbed-code-extension:0.1' } -task prepareSources( type: Sync) { +task prepareSources(type: Sync) { group 'documentation' description 'Copy sources from all plugin projects' into asciidoctorSourceSyncDir docProjects.each { proj -> from pluginProjectDir(proj), { - into pluginDirName(proj) + into proj.dir include 'src/**' exclude '**/META-INF/**' } @@ -63,21 +62,17 @@ asciidoctor { group 'documentation' description 'Build HTML documentation' - baseDirFollowsSourceDir() dependsOn prepareSources + baseDirFollowsSourceDir() + // configurations 'asciidocExtensions' sourceDir 'src/docs/asciidoc' -// configurations 'asciidocExtensions' - - sources { - include 'index.adoc' - } - + sources { include 'index.adoc' } attributes toc: 'right', - toclevels: 2, - 'source-highlighter': 'rouge' + toclevels: 2, + 'source-highlighter': 'rouge' docProjects.each { proj -> - attributes "plugin-${proj}" : file("${prepareSources.destinationDir}/${pluginDirName(proj)}/src") + attributes "plugin-${proj.dir}": file("${prepareSources.destinationDir}/${proj.dir}/src") } } @@ -87,7 +82,7 @@ task generateIndex { ext { outputFile = file("${buildDir}/docs/index-source/index.adoc") } - + inputs.property 'docProjects', docProjects outputs.file outputFile @@ -98,14 +93,14 @@ task generateIndex { w.println '' w.println "* link:./user-guide/[User guide]" - docProjects.sort().each { proj -> - w.println "* link:./api-${pluginDirName(proj)}/[API: ${pluginDirName(proj)}]" + docProjects*.dir.sort().each { projDir -> + w.println "* link:./api-${projDir}/[API: ${projDir}]" } } } } -task asciidocIndex( type: org.asciidoctor.gradle.jvm.AsciidoctorTask ) { +task asciidocIndex(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) { group 'documentation' description 'Generate HTML index' @@ -114,20 +109,20 @@ task asciidocIndex( type: org.asciidoctor.gradle.jvm.AsciidoctorTask ) { outputDir "${buildDir}/docs/index" } -task combineDocs (type : Sync) { +task combineDocs(type: Sync) { group 'documentation' description 'Combine all generated documentation into a single tree' - into asciidoctorCombinedDocsDir + dependsOn docProjects.collect { includedBuildTask(it, 'groovydoc') } + into asciidoctorCombinedDocsDir from asciidocIndex - from asciidoctor, { into 'user-guide' } docProjects.each { proj -> from "${pluginProjectDir(proj)}/build/docs/groovydoc", { - into "api-${pluginDirName(proj)}" + into "api-${proj.dir}" } } } @@ -138,3 +133,16 @@ asciidoctorEditorConfig { additionalAttributes asciidoctor.asciidoctorj dependsOn prepareSources } + +class IncludedProject implements Serializable { + String name + String dir +} + +File pluginProjectDir(IncludedProject pluginName) { + new File(rootProject.projectDir.parentFile, pluginName.dir) +} + +TaskReference includedBuildTask(IncludedProject proj, String task) { + gradle.includedBuild('asciidoctor-gradle-plugin').task(":${proj.name}:${task}") +} diff --git a/docs/gradle/utilities.gradle b/docs/gradle/utilities.gradle deleted file mode 100644 index fba9a0450..000000000 --- a/docs/gradle/utilities.gradle +++ /dev/null @@ -1,18 +0,0 @@ -ext { - asciidoctorGradleProjectDir = rootProject.projectDir.parentFile - - pluginDirName = { String pluginName -> - switch(pluginName) { - case 'kindlegen': - return 'kindlegen-gradle' - case 'jvm-gems': - return 'gems' - default: - pluginName - } - } - - pluginProjectDir = { String pluginName -> - new File( asciidoctorGradleProjectDir, pluginDirName(pluginName)) - } -} diff --git a/gradle/gradle-plugin-documentation.gradle b/gradle/gradle-plugin-documentation.gradle index 22c268a42..3b26da145 100644 --- a/gradle/gradle-plugin-documentation.gradle +++ b/gradle/gradle-plugin-documentation.gradle @@ -8,7 +8,7 @@ groovydoc { footer = "Copyright © ${copyrightYear} the original author or authors. All rights reserved." includePrivate = false link "https://docs.gradle.org/${gradle.gradleVersion}/javadoc/", 'org.gradle.' - link 'http://docs.oracle.com/javase/8/docs/api/', 'java.', 'org.xml.', 'javax.', 'org.w3c.' + link 'https://docs.oracle.com/javase/8/docs/api/', 'java.', 'org.xml.', 'javax.', 'org.w3c.' } javadoc {