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

Build Documentation #47

Merged
merged 1 commit into from
Nov 20, 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
75 changes: 74 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
id 'groovy'
id 'io.github.gradle-nexus.publish-plugin'
id "org.asciidoctor.jvm.convert" version "4.0.0-alpha.1"
}

version = projectVersion

repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo.grails.org/grails/core' }
}
Expand Down Expand Up @@ -34,6 +34,79 @@ if(isReleaseVersion) {
}
}

configurations {
documentation.extendsFrom compileClasspath
}

dependencies {
documentation libs.groovy
documentation libs.groovy.templates
documentation libs.groovy.ant
documentation libs.groovy.dateutil
documentation libs.groovy.cli.picocli

}

tasks.withType(Groovydoc) {
group = "documentation"
docTitle = "${project.title} - ${project.version}"
destinationDir = project.file("build/docs/api")
def files = []
project.rootProject.subprojects
.findAll { !it.name != 'docs' && !it.name.startsWith('examples') }
.each { subproject ->
if(subproject.file('src/main/groovy').exists()) {
files += subproject.files("src/main/groovy")
}
}
if(project.file('src/main/groovy').exists()) {
files += project.files("src/main/groovy")
}
source = files
classpath = configurations.documentation
}

task publishGuide(type: grails.doc.gradle.PublishGuide) {
group = "documentation"
description = 'Generate Guide'
dependsOn ["groovydoc"]

targetDir = project.file("${buildDir}/docs")
sourceRepo = "https://github.com/${githubSlug}/edit/${githubBranch}/src/main/docs"
sourceDir = new File(projectDir, "src/main/docs")
propertiesFiles = [ new File(rootProject.projectDir, "gradle.properties") ]
asciidoc = true
resourcesDir = project.layout.projectDirectory.dir("src/main/docs/resources").asFile
properties = [
'safe': 'UNSAFE',
'version': project.version,
'subtitle': project.projectDesc,
'api': '../api',
'sourceDir': rootProject.projectDir.absolutePath,
'sourcedir': rootProject.projectDir.absolutePath,
'javaee': 'https://docs.oracle.com/javaee/7/api/',
'javase': 'https://docs.oracle.com/en/java/javase/11/docs/api/',
'groovyapi': "https://docs.groovy-lang.org/${libs.versions.groovy.asProvider().get()}/html/gapi/",
'grailsapi': "https://docs.grails.org/${libs.versions.grails.asProvider().get()}/api/",
'gormapi': "https://gorm.grails.org/${libs.versions.gorm.get()}/api/",
'springapi': "https://docs.spring.io/spring/docs/${libs.versions.spring.get()}/javadoc-api/"
]
doLast {
ant.move(file:"${project.buildDir}/docs/guide/single.html",
tofile:"${project.buildDir}/docs/guide/index.html", overwrite:true)
new File(project.buildDir, "docs/index.html").text = '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=guide/index.html" />
</head>

</body>
</html>
'''
}
}

subprojects {

version = rootProject.version
Expand Down
5 changes: 1 addition & 4 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
plugins {

id 'groovy-gradle-plugin'
id 'maven-publish'

}

repositories {
Expand All @@ -11,10 +9,9 @@ repositories {
}

dependencies {

implementation libs.nexus.publish.gradle.plugin
implementation libs.grails.gradle.plugin
implementation libs.grails.views.gradle.plugin
implementation libs.groovydoc.gradle.plugin

implementation libs.grails.docs
}
137 changes: 0 additions & 137 deletions gradle/documentation.gradle

This file was deleted.

7 changes: 5 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ spock = '2.1-groovy-3.0'
spring = '5.3.30'

[libraries]
grails-docs = { module = "org.grails:grails-docs", version.ref = "grails" }
gpars = { module = 'org.codehaus.gpars:gpars', version.ref = 'gpars' }
gorm = { module = 'org.grails:grails-datastore-gorm', version.ref = 'gorm' }
gorm-test = { module = 'org.grails:grails-datastore-gorm-test', version.ref = 'gorm' }
groovy = { module = 'org.codehaus.groovy:groovy', version.ref = 'groovy' }
#groovy-ant = { module = 'org.codehaus.groovy:groovy-ant', version.ref = 'groovy' }
#groovy-cli-picocli = { module = 'org.codehaus.groovy:groovy-cli-picocli', version.ref = 'groovy' }
groovy-templates = { module = 'org.codehaus.groovy:groovy-templates', version.ref = 'groovy' }
groovy-ant = { module = 'org.codehaus.groovy:groovy-ant', version.ref = 'groovy' }
groovy-dateutil = { module = 'org.codehaus.groovy:groovy-dateutil', version.ref = 'groovy' }
groovy-cli-picocli = { module = 'org.codehaus.groovy:groovy-cli-picocli', version.ref = 'groovy' }
jansi = { module = 'org.fusesource.jansi:jansi', version.ref = 'jansi' }
javaparser-core = { module = 'com.github.javaparser:javaparser-core', version.ref = 'javaparser' }
javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation' }
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ include 'grails-plugin-async'
include 'grails-plugin-events'

// examples
include 'pubsub-demo'
project(':pubsub-demo').projectDir = new File(settingsDir, 'examples/pubsub-demo')
include 'examples-pubsub-demo'
project(':examples-pubsub-demo').projectDir = new File(settingsDir, 'examples/pubsub-demo')
Loading