11// It seems the gradle javadoc task works file by file and as such disable some features of javadoc tool
22// such as link to packages, https://groups.google.com/d/msg/gradle-dev/R83dy_6PHMc/bgw0cUTMFAAJ
3- def javaDocsDir = ' gradle/mockito-core/ java-docs'
3+ def javaDocsDir = ' gradle/java-docs'
44
55tasks. named(" javadoc" , Javadoc ) {
6+ inputs. dir(" src/main/javadoc" )
7+
68 description " Creates javadoc html for Mockito API."
79
810 // For more details on the format
9- // see https://docs.oracle.com/javase/8/docs/technotes/tools/windows /javadoc.html
11+ // see https://docs.oracle.com/en/java/javase/21/javadoc /javadoc.html
1012
1113 source = sourceSets. main. allJava
1214 destinationDir = layout. buildDirectory. dir(" javadoc" ). get(). asFile
@@ -25,38 +27,30 @@ tasks.named("javadoc", Javadoc) {
2527 // for this reason the javadoc output is suppressed and can be reactivated with --info option.
2628 exclude ' org/mockito/internal'
2729
30+ options. addBooleanOption(' -allow-script-in-comments' , true )
31+ options. addFileOption(' -add-stylesheet' , rootProject. file(" src/main/javadoc/mockito-theme.css" ))
32+ options. addStringOption(' Xwerror' , ' -quiet' )
33+ options. bottom("""
34+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/obsidian.min.css">
35+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
36+ <script>hljs.highlightAll();</script>
37+ """ . replaceAll(/ \r |\n |[ ]{8}/ , " " ))
38+ options. charSet = ' UTF-8'
39+ options. docEncoding = ' UTF-8'
2840 options. docTitle = """ <h1><a href="org/mockito/Mockito.html">Click to see examples</a>. Mockito ${ project.version} API.</h1>"""
29- options. windowTitle = " Mockito ${ project.version } API "
41+ options. encoding = ' UTF-8 '
3042 options. group(" Main package" , [" org.mockito" ])
43+ options. links(' https://junit.org/junit4/javadoc/4.13.2/' )
44+ options. linksOffline(' https://docs.oracle.com/en/java/javase/11/docs/api/' , javaDocsDir)
3145 options. memberLevel = JavadocMemberLevel . PROTECTED
3246 options. outputLevel = JavadocOutputLevel . QUIET
33- options. charSet = ' UTF-8'
34- options. encoding = ' UTF-8'
35- options. docEncoding = ' UTF-8'
36- options. use = true
3747 options. splitIndex = true
38- options. noDeprecated = false
39- options. noDeprecatedList = false
40- options. noIndex = false
41- options. noNavBar = false
42- options. noTree = false
43- options. links(' https://junit.org/junit4/javadoc/4.13.2/' )
44- options. linksOffline(' https://docs.oracle.com/en/java/javase/11/docs/api/' , javaDocsDir)
45- options. bottom("""
46- <script type="text/javascript" src="{@docRoot}/js/jdk6-project-version-insert.min.js"></script>
47- <script type="text/javascript" src="{@docRoot}/js/jquery-1.7.min.js"></script>
48- <script type="text/javascript" src="{@docRoot}/js/highlight-8.6-java/highlight.pack.js"></script>
49-
50- <link rel="stylesheet" type="text/css" href="{@docRoot}/js/highlight-8.6-java/styles/obsidian.css"/>
51- <script type="text/javascript" src="{@docRoot}/js/index.js" async defer></script>
52- """ . replaceAll(/ \r |\n |[ ]{8}/ , " " ))
53- options. stylesheetFile rootProject. file(" src/javadoc/stylesheet.css" )
54- options. addStringOption(' Xwerror' , ' -quiet' )
55- options. addBooleanOption(' -allow-script-in-comments' , true )
48+ options. use = true
49+ options. windowTitle = " Mockito ${ project.version} API"
5650
5751 doLast {
5852 copy {
59- from " src/javadoc"
53+ from " src/main/ javadoc"
6054 into layout. buildDirectory. dir(" javadoc" )
6155 }
6256 }
0 commit comments