-
Notifications
You must be signed in to change notification settings - Fork 207
/
javadoc.gradle
131 lines (120 loc) · 4.69 KB
/
javadoc.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Script for build javadoc and jsdoc
def currentYear = new Date().format("yyyy")
// general javadoc options
def javadocOptions = {
options.author true
options.use true
options.version true
options.showFromProtected()
options.addStringOption("charset", "UTF-8")
options.addBooleanOption("notimestamp", false)
options.addBooleanOption("-allow-script-in-comments", true)
options.addBooleanOption('Xdoclint:none', true)
options.addBooleanOption("breakiterator", true)
options.addStringOption("-source ${version}")
}
def footerMessage = '<p class="legalCopy"><small>Copyright © 2005-' + "${currentYear}" + ' Potix Corporation. All Rights Reserved.\n' +
'<script type="text/javascript">if (location.href.indexOf(\'zkoss.org\') >= 0) {var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));}</script><script type="text/javascript">if (location.href.indexOf(\'zkoss.org\') >= 0) {var pageTracker = _gat._getTracker("UA-121377-3");pageTracker._setDomainName("zkoss.org");pageTracker._initData();pageTracker._trackPageview();}</script>\n' +
'\t </small></p>\n'
def addJavadocFooter(dir, footerMessage) {
fileTree(dir: dir).matching {
include "**/*.html"
}.each { htmlFile ->
ant.replaceregexp(
file: htmlFile,
match: '<!-- ======== END OF BOTTOM NAVBAR ======= -->\n',
replace: '<!-- ======== END OF BOTTOM NAVBAR ======= -->\n' + footerMessage
)
}
}
// generate javadoc
task alljavadoc(type: Javadoc) {
if (gradle.includedBuilds.find {it.name == 'zkcml'} != null) {
dependsOn gradle.includedBuild('zkcml').task(':stateless:compileJava')
}
title = "$project.description ${version} API"
options.setWindowTitle("$project.description ${version} API")
configure javadocOptions
source zkprojects.values().collect { dir ->
"$dir/src/main/java"
}
// add immutables code-gen for generating Javadoc
source files("../zkcml/stateless/build/generated/sources")
// Can't get package.html into javadoc with gradle
exclude '**/package.html',
'**/ELParser.html',
'**/*.properties',
'**/*.jjt',
'**/**.template' //stateless action type template
destinationDir = file("$buildDir/docs/javadoc/zk")
subprojects.forEach(prj -> {
classpath += prj.sourceSets.main.compileClasspath
})
gradle.includedBuilds.each {
// println ">>>>>>>>$it.name"
if (it.name != 'zkthemes' && it.name != 'zksandbox') {
def rootGradle = it.properties['target'].properties['buildController'].gradle
it.properties['target'].properties['availableModules'].each {
def prj = rootGradle.rootProject.findProject(it.right.identityPath.toString())
if (!prj) {
prj = rootGradle.rootProject.findProject(it.right.projectPath.toString())
}
// println ">>> name: " + prj.name
if (prj) {
classpath += prj.configurations.compileClasspath
}
}
}
}
doLast {
addJavadocFooter("$buildDir/docs/javadoc/zk", footerMessage)
// copy xml and html to the destination since they might be referenced by package.html
subprojects {
copy {
from "$rootDir/$project.name/src/main/java"
include "org/zkoss/**/*.xml"
include "org/zkoss/**/*.html"
exclude "**/package.html"
into file("$buildDir/docs/javadoc/zk")
setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
}
}
}
}
// generate jsdoc
task alljsdoc(type: NpmTask) {
dependsOn alljavadoc
args = ['run', 'build:doc']
}
subprojects {
// build javadoc each subproject for bundle
task buildJavadoc(type: Javadoc) {
// dependsOn all subprojects jar for javadoc classpath
dependsOn rootProject.subprojects.collect { ":$it.name:jar" }
if (gradle.includedBuilds.find {it.name == 'zkcml'} != null) {
dependsOn gradle.includedBuild('zkcml').task(':jar')
}
title = "$project.description ${version} API"
options.setWindowTitle("$project.description ${version} API")
configure javadocOptions
options.links 'https://docs.oracle.com/javase/8/docs/api/'
source sourceSets.main.allJava
// Can't get package.html into javadoc with gradle
exclude '**/package.html',
'**/ELParser.html',
'**/*.properties',
'**/*.jjt',
'**/**.template' //stateless action type template
destinationDir = file("$buildDir/docs/javadoc")
// add jars in dist into classpath
classpath += configurations.compileClasspath
// add jars in other projects(zk & cml) into classpath
classpath += files(zkprojects.collect {prj, dir ->
"$dir/build/libs/$prj-${version}.jar"
})
doLast {
def shortFooterMessage = '<p class="legalCopy"><small>Copyright © ' + "${currentYear}." + ' All rights reserved.</small></p>\n'
addJavadocFooter("$buildDir/docs/javadoc", shortFooterMessage)
}
}
}