| 1 |
/* |
| 2 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
* or more contributor license agreements. See the NOTICE file |
| 4 |
* distributed with this work for additional information |
| 5 |
* regarding copyright ownership. The ASF licenses this file |
| 6 |
* to you under the Apache License, Version 2.0 (the |
| 7 |
* "License"); you may not use this file except in compliance |
| 8 |
* with the License. You may obtain a copy of the License at |
| 9 |
* |
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
* |
| 12 |
* Unless required by applicable law or agreed to in writing, |
| 13 |
* software distributed under the License is distributed on an |
| 14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 |
* KIND, either express or implied. See the License for the |
| 16 |
* specific language governing permissions and limitations |
| 17 |
* under the License. |
| 18 |
*/ |
| 19 |
task doc(dependsOn: ['javadocAll', 'groovydocAll', 'docGDK']) { |
| 20 |
ext.footer = 'Copyright © 2003-2019 The Apache Software Foundation. All rights reserved.' |
| 21 |
ext.title = "Groovy ${groovyVersion}" |
| 22 |
} |
| 23 |
|
| 24 |
def javadocSpec = { |
| 25 |
maxMemory = javaDoc_mx |
| 26 |
project.configure(options) { |
| 27 |
windowTitle = doc.title |
| 28 |
docTitle = doc.title |
| 29 |
locale = 'en_US' |
| 30 |
encoding = 'UTF-8' |
| 31 |
author = true |
| 32 |
version = true |
| 33 |
overview = rootProject.file('src/main/overviewj.html') |
| 34 |
footer = doc.footer |
| 35 |
source = rootProject.useIndy()?'8':'8' |
| 36 |
links('file:///usr/share/doc/ant/api/', 'file:///usr/share/doc/default-jdk/api/', |
| 37 |
'file:///usr/share/doc/libservlet-api-java/api', |
| 38 |
'file:///usr/share/doc/junit4/api/') |
| 39 |
failOnError = false |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
def groovydocSpec = { |
| 44 |
use = true |
| 45 |
if (project != rootProject) source = project.sourceSets.main.allSource |
| 46 |
classpath = javadoc.classpath |
| 47 |
ext.windowtitle = doc.title |
| 48 |
ext.doctitle = doc.title |
| 49 |
header = doc.title |
| 50 |
footer = doc.footer |
| 51 |
if (gradle.gradleVersion.startsWith('2.')) { |
| 52 |
overview = rootProject.file('src/main/overview.html') |
| 53 |
} else { |
| 54 |
overviewText = resources.text.fromFile(rootProject.file('src/main/overview.html')) |
| 55 |
} |
| 56 |
includePrivate = false |
| 57 |
link 'file:///usr/share/doc/libservlet-api-java/api', 'javax.servlet.', 'javax.management.' |
| 58 |
link 'file:///usr/share/doc/default-jdk/api/', 'java.', 'org.xml.', 'javax.', 'org.w3c.' |
| 59 |
link 'file:///usr/share/doc/ant/api/', 'org.apache.tools.ant.' |
| 60 |
link 'file:///usr/share/doc/junit4/api/', 'org.junit.' |
| 61 |
} |
| 62 |
|
| 63 |
allprojects { |
| 64 |
javadoc javadocSpec |
| 65 |
groovydoc groovydocSpec |
| 66 |
} |
| 67 |
|
| 68 |
// Root project has an extra 'all' javadoc task |
| 69 |
task javadocAll(type: Javadoc) |
| 70 |
javadocAll { |
| 71 |
destinationDir = new File(buildDir, 'alljavadoc') |
| 72 |
source = javadoc.source |
| 73 |
classpath = javadoc.classpath |
| 74 |
subprojects.each { sp -> |
| 75 |
source += sp.javadoc.source |
| 76 |
classpath += sp.javadoc.classpath |
| 77 |
} |
| 78 |
} |
| 79 |
javadocAll javadocSpec |
| 80 |
|
| 81 |
// Root project has an extra 'all' groovydoc task |
| 82 |
task groovydocAll(type: Groovydoc) |
| 83 |
groovydocAll { |
| 84 |
dependsOn( { project(':groovy-groovydoc').classes }) |
| 85 |
dependsOn( { project(':groovy-docgenerator').classes }) |
| 86 |
destinationDir = new File(buildDir, 'allgroovydoc') |
| 87 |
source = groovydoc.source |
| 88 |
classpath = groovydoc.classpath |
| 89 |
groovyClasspath = groovydoc.groovyClasspath |
| 90 |
subprojects.each { sp -> |
| 91 |
source += sp.groovydoc.source |
| 92 |
classpath += sp.groovydoc.classpath |
| 93 |
groovyClasspath += sp.groovydoc.groovyClasspath |
| 94 |
} |
| 95 |
} |
| 96 |
groovydocAll groovydocSpec |
| 97 |
|
| 98 |
// when docgenerator is run by the build, it requires a groovy-release-info file |
| 99 |
// but the file is only generated by the 'jar' task, so as a workaround, we copy |
| 100 |
// it into the docgenerator classes |
| 101 |
task docProjectVersionInfo(type: Copy) { |
| 102 |
destinationDir = file("${project(':groovy-docgenerator').buildDir}/classes/main") |
| 103 |
into('META-INF') { |
| 104 |
from('src/main/META-INF/groovy-release-info.properties') { |
| 105 |
filter(rootProject.propertiesFilter, org.apache.tools.ant.filters.ReplaceTokens) |
| 106 |
} |
| 107 |
} |
| 108 |
from('subprojects/groovy-docgenerator/src/main/resources') |
| 109 |
} |
| 110 |
|
| 111 |
task docGDK { |
| 112 |
// ext.extraDocGDKclasses = [] |
| 113 |
// TODO don't hard-code these |
| 114 |
ext.destinationDir = "$buildDir/html/groovy-jdk" |
| 115 |
inputs.files sourceSets.main.runtimeClasspath + configurations.tools |
| 116 |
outputs.dir destinationDir |
| 117 |
} |
| 118 |
|
| 119 |
if (JavaVersion.current().isJava8Compatible()) { |
| 120 |
javadocAll.options.source = '8' |
| 121 |
javadocAll.options.noTimestamp() |
| 122 |
} |
| 123 |
|
| 124 |
if (JavaVersion.current().isJava8Compatible()) { |
| 125 |
allprojects { |
| 126 |
tasks.withType(Javadoc) { |
| 127 |
// disable the crazy super-strict doclint tool in Java 8 |
| 128 |
options.addStringOption('Xdoclint:none', '-quiet') |
| 129 |
options.noTimestamp() |
| 130 |
} |
| 131 |
} |
| 132 |
} |