|
1 | | -buildscript { |
2 | | - repositories { |
3 | | - maven { |
4 | | - url = "https://plugins.gradle.org/m2/" |
5 | | - } |
6 | | - } |
7 | | - dependencies { |
8 | | - classpath "org.asciidoctor:asciidoctor-gradle-jvm:3.3.2" |
9 | | - } |
| 1 | +plugins { |
| 2 | + id 'groovy' |
| 3 | + id 'org.graceframework.grace-doc' |
10 | 4 | } |
11 | 5 |
|
12 | | -apply plugin: "org.asciidoctor.jvm.convert" |
| 6 | +def DOCUMENTATION_GROUP = 'Documentation' |
13 | 7 |
|
14 | 8 | repositories { |
15 | | - maven { |
16 | | - url = "https://repo.grails.org/grails/core" |
17 | | - } |
18 | | -} |
19 | | - |
20 | | -asciidoctor { |
21 | | - resources { |
22 | | - from('src/docs/images') |
23 | | - into "./images" |
24 | | - } |
25 | | - |
26 | | - attributes 'experimental' : 'true', |
27 | | - 'compat-mode' : 'true', |
28 | | - 'toc' : 'left', |
29 | | - 'icons' : 'font', |
30 | | - 'version' : project.version, |
31 | | - 'sourcedir' : "${rootProject.allprojects.find { it.name == 'views-core'}.projectDir}/src/main/groovy" |
| 9 | + mavenCentral() |
32 | 10 | } |
33 | 11 |
|
34 | 12 | configurations { |
35 | | - documentation.extendsFrom(compileClasspath) |
| 13 | + documentation |
36 | 14 | } |
37 | 15 |
|
38 | 16 | dependencies { |
39 | | - documentation project(path: ':views-json', configuration: 'compileOnly') |
40 | | - documentation project(path: ':views-markup', configuration: 'compileOnly') |
41 | | - documentation project(path: ':views-gradle', configuration: 'compileOnly') |
| 17 | + documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion" |
| 18 | + documentation "org.apache.groovy:groovy:$groovyVersion" |
| 19 | + documentation "org.apache.groovy:groovy-ant:$groovyVersion" |
42 | 20 | } |
43 | 21 |
|
44 | | -task apidocs(type: Groovydoc, group: 'documentation') { |
45 | | - def allProjects = rootProject.allprojects.findAll { project -> |
46 | | - ['views-core', 'views-json', 'views-json-testing-support', 'views-markup','views-gradle'].contains(project.name) |
| 22 | +def cleanTask = project.tasks.findByName('clean') |
| 23 | +if (cleanTask == null) { |
| 24 | + task clean(type: Delete) { |
| 25 | + delete(buildDir) |
47 | 26 | } |
48 | | - source allProjects.collect { project -> |
49 | | - project.files('src/main/groovy') |
50 | | - } |
| 27 | +} |
| 28 | +else { |
| 29 | + cleanTask.doLast { |
| 30 | + ant.delete(dir: 'build/docs') |
| 31 | + } |
| 32 | +} |
51 | 33 |
|
52 | | - destinationDir = new File(buildDir, 'docs/api') |
53 | | - // Might need a classpath |
54 | | - docTitle = "Grails Views ${version}" |
55 | | - |
56 | | - classpath = configurations.documentation |
57 | | - groovyClasspath = configurations.documentation |
| 34 | +tasks.withType(Groovydoc) { |
| 35 | + group = DOCUMENTATION_GROUP |
| 36 | + docTitle = "Grace Views - ${project.version}" |
| 37 | + destinationDir = project.file('build/docs/manual/api') |
| 38 | + def files = [] |
| 39 | + project.rootProject.subprojects |
| 40 | + .findAll { !it.name != 'docs' && !it.name.startsWith('examples') } |
| 41 | + .each { subproject -> |
| 42 | + if(subproject.file('src/main/groovy').exists()) { |
| 43 | + files += subproject.files('src/main/groovy') |
| 44 | + } |
| 45 | + if(subproject.file('src/main/java').exists()) { |
| 46 | + files += subproject.files('src/main/java') |
| 47 | + } |
| 48 | + } |
| 49 | + if (project.file('src/main/groovy').exists()) { |
| 50 | + files += project.files('src/main/groovy') |
| 51 | + } |
| 52 | + source = files |
| 53 | + classpath += configurations.documentation |
58 | 54 | } |
59 | 55 |
|
60 | | -task docs(type:Copy, dependsOn:[apidocs, asciidoctor], group:'documentation') { |
61 | | - from "$buildDir/asciidoc/html5" |
62 | | - into "$buildDir/docs" |
| 56 | +docs { |
| 57 | + dependsOn groovydoc |
| 58 | +} |
| 59 | + |
| 60 | +def assembleTask = project.tasks.findByName('assemble') |
| 61 | +if (assembleTask == null) { |
| 62 | + task assemble(dependsOn: docs, type:Zip) { |
| 63 | + baseName = "${project.name}-${project.version}" |
| 64 | + destinationDir = new File(project.buildDir, 'distributions') |
| 65 | + from project.files("${buildDir}/docs") |
| 66 | + } |
63 | 67 | } |
0 commit comments