Skip to content

Commit 1fb7b7b

Browse files
committed
Add Gradle task publishGuide
Closes gh-4
1 parent d3ae208 commit 1fb7b7b

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ version = project.projectVersion
2121
group = "org.graceframework"
2222

2323
apply plugin: "java-library"
24+
apply plugin: "groovy"
2425
apply plugin: "io.github.gradle-nexus.publish-plugin"
2526
apply plugin: "maven-publish"
2627
apply plugin: "signing"
2728
apply plugin: "idea"
29+
apply from: 'gradle/docs.gradle'
2830

2931
allprojects {
3032
repositories {

gradle/docs.gradle

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath "org.graceframework:grace-docs:$graceVersion"
7+
}
8+
}
9+
10+
apply plugin: 'java-library'
11+
12+
def DOCUMENTATION_GROUP = 'Documentation'
13+
14+
repositories {
15+
mavenCentral()
16+
}
17+
18+
configurations {
19+
documentation
20+
}
21+
22+
dependencies {
23+
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"
24+
documentation "org.apache.groovy:groovy:$groovyVersion"
25+
documentation "org.apache.groovy:groovy-ant:$groovyVersion"
26+
documentation "org.apache.groovy:groovy-cli-picocli:$groovyVersion"
27+
}
28+
29+
def cleanTask = project.tasks.findByName('clean')
30+
if (cleanTask == null) {
31+
task clean(type: Delete) {
32+
delete(buildDir)
33+
}
34+
}
35+
else {
36+
cleanTask.doLast {
37+
ant.delete(dir: 'build/docs')
38+
}
39+
}
40+
41+
tasks.withType(Groovydoc) {
42+
group = DOCUMENTATION_GROUP
43+
docTitle = "Grace Data Reactive - ${project.version}"
44+
destinationDir = project.file('build/docs/api')
45+
def files = []
46+
project.rootProject.subprojects
47+
.findAll { !it.name != 'docs' && !it.name.startsWith('examples') }
48+
.each { subproject ->
49+
if(subproject.file('src/main/groovy').exists()) {
50+
files += subproject.files('src/main/groovy')
51+
}
52+
}
53+
if (project.file('src/main/groovy').exists()) {
54+
files += project.files('src/main/groovy')
55+
}
56+
source = files
57+
classpath += configurations.documentation
58+
}
59+
60+
task publishGuide(type: grails.doc.gradle.PublishGuide) {
61+
group = DOCUMENTATION_GROUP
62+
description = 'Generate Guide'
63+
dependsOn groovydoc
64+
65+
sourceRepo = "https://github.com/grace-plugins/grace-inertia/edit/main/docs"
66+
sourceDir = project.file('docs')
67+
resourcesDir = project.file('docs/resources')
68+
targetDir = project.file("${buildDir}/docs")
69+
propertiesFiles = [project.file('docs/resources/doc.properties')]
70+
asciidoc = true
71+
properties = [
72+
'safe': 'UNSAFE',
73+
'version': project.version,
74+
'api': '../api',
75+
'sourceDir': rootProject.projectDir.absolutePath,
76+
'sourcedir': rootProject.projectDir.absolutePath,
77+
'groovyapi': "http://docs.groovy-lang.org/${groovyVersion}/html/gapi/"
78+
]
79+
}
80+
81+
task docs(dependsOn:[groovydoc, publishGuide]) {
82+
group = DOCUMENTATION_GROUP
83+
}
84+
85+
def assembleTask = project.tasks.findByName('assemble')
86+
if (assembleTask == null) {
87+
task assemble(dependsOn: docs, type:Zip) {
88+
baseName = "${project.name}-${project.version}"
89+
destinationDir = new File(project.buildDir, 'distributions')
90+
from project.files("${buildDir}/docs")
91+
}
92+
}

0 commit comments

Comments
 (0)