|
| 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