Skip to content

Commit

Permalink
Merge pull request #768 from grails/build-docs
Browse files Browse the repository at this point in the history
Fix building documentation
  • Loading branch information
puneetbehl committed Oct 10, 2023
2 parents 935d46f + 389d712 commit 9567e78
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
28 changes: 18 additions & 10 deletions docs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ext {
githubBranch = "8.0.x"
datastoreGithubBranch = "8.0.x"
checkOutDir = "build/checkout"
explicitGormSrc = System.getProperty("gorm.src") ?: (project.hasProperty('gorm.src') ? project.getProperty("gorm.src") : null)
gormSrc = explicitGormSrc ? file(explicitGormSrc).absolutePath : "$checkOutDir/gorm-src"
Expand Down Expand Up @@ -52,13 +52,15 @@ dependencies {
}

asciidoctor {
baseDirFollowsSourceDir()
resources {
from("${project.projectDir}/src/docs/asciidoc/images")
into "./images"
}

attributes 'experimental' : 'true',
'compat-mode' : 'true',
'toc' : 'left',
'icons' : 'font',
'reproducible' : '',
'version' : project.version,
Expand All @@ -68,7 +70,7 @@ asciidoctor {

task fetchSource {
outputs.dir layout.buildDirectory.dir('checkout')
inputs.properties(branch: githubBranch)
inputs.properties(branch: datastoreGithubBranch)

onlyIf {
println "GORM SRC=$explicitGormSrc"
Expand All @@ -80,27 +82,32 @@ task fetchSource {
if (isReleaseVersion) {
ant.get src: "https://github.com/grails/grails-data-mapping/archive/refs/tags/v${gormVersion}.zip", dest: zipFile, verbose: true
} else {
ant.get src: "https://github.com/grails/grails-data-mapping/archive/refs/heads/${githubBranch}.zip", dest: zipFile, verbose: true
ant.get src: "https://github.com/grails/grails-data-mapping/archive/refs/heads/${datastoreGithubBranch}.zip", dest: zipFile, verbose: true
}

ant.unzip src: zipFile, dest: checkOutDir, {
mapper type: "regexp", from: "(grails-\\S*?/)(.*)", to: "gorm-src/\\2"
}
println "GORM source code downloaded."
}

}


task copyDocs(type:Copy, dependsOn:asciidoctor) {
from "${project.buildDir}/asciidoc/html5"
into "${project.buildDir}/docs/manual"
mustRunAfter('asciidoctor', 'groovydoc')
finalizedBy('cleanAsciidoc')
from project(':docs').layout.buildDirectory.dir('docs/asciidoc')
into project(':docs').layout.buildDirectory.dir('docs/manual')
}

task cleanAsciidoc(type: Delete, dependsOn: copyDocs) {
dependsOn('copyDocs')
delete project(':docs').layout.buildDirectory.dir('docs/asciidoc')
}

tasks.withType(Groovydoc) {
dependsOn('fetchSource')
docTitle = "GORM for Hibernate 5 - ${project.version}"
destinationDir = project.file("build/docs/api")
destinationDir = project.file('build/docs/api')

def files
for (p in coreProjects) {
Expand Down Expand Up @@ -129,10 +136,11 @@ task copyResources(type:Copy) {
task docs(dependsOn:[asciidoctor, groovydoc, copyDocs, copyResources] +
subprojects.findAll { project -> project.tasks.findByName('groovydoc')}
.collect { project -> project.tasks.groovydoc }
)
) {
}

task assembleDocsDist(type: Zip) {
dependsOn docs
dependsOn 'docs', 'copyDocs'
from "${project.buildDir}/docs"
include '*'
include '*/**'
Expand Down
3 changes: 2 additions & 1 deletion docs/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= GORM for Hibernate
Graeme Rocher, Puneet Behl
:revnumber: {version}
:imagesdir: ./images
:source-highlighter: coderay
:last-update-label!:
Expand All @@ -9,7 +10,7 @@ Graeme Rocher, Puneet Behl
[[introduction]]
== Introduction

include::introduction.adoc[]
include::{includedir}/introduction.adoc[]

[[releaseHistory]]
=== Release History
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
gradleEnterprise {
server = 'https://ge.grails.org'
buildScan {
publishAlways()
publishAlwaysIf(System.getenv('CI') == 'true')
publishIfAuthenticated()
uploadInBackground = System.getenv("CI") == null
capture {
Expand Down

0 comments on commit 9567e78

Please sign in to comment.