Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building documentation #768

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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