Skip to content

Commit

Permalink
Fix missing groovydocs API (#720)
Browse files Browse the repository at this point in the history
Fix missing groovydocs not being collected during combineDocs task.
'docs' module build script reformatted and fix docs adding all required groovydoc tasks as a dependency for combineDocs.
  • Loading branch information
abelsromero committed Mar 1, 2024
1 parent 1a46d02 commit 66b4165
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 49 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
Expand Down Expand Up @@ -165,7 +165,7 @@ subprojects {

apply from: 'gradle/coveralls.gradle'

task syncWrapper( type : Copy ) {
task syncWrapper(type: Copy) {
from 'gradle', {
include 'wrapper/**'
}
Expand Down
64 changes: 36 additions & 28 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]
}

Expand All @@ -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
Expand All @@ -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/**'
}
Expand All @@ -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")
}
}

Expand All @@ -87,7 +82,7 @@ task generateIndex {
ext {
outputFile = file("${buildDir}/docs/index-source/index.adoc")
}

inputs.property 'docProjects', docProjects
outputs.file outputFile

Expand All @@ -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'

Expand All @@ -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}"
}
}
}
Expand All @@ -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}")
}
18 changes: 0 additions & 18 deletions docs/gradle/utilities.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/gradle-plugin-documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 66b4165

Please sign in to comment.