Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible fix #2765: Add task to download package-list file from java as element-list #2766

1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -25,6 +25,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.42.0'
id 'biz.aQute.bnd.builder' version '6.3.1'
id 'ru.vyarus.animalsniffer' version '1.5.2'
id 'de.undercouch.download' version '5.3.0'
TimvdLippe marked this conversation as resolved.
Show resolved Hide resolved
}

description = 'Mockito mock objects library core API and implementation'
Expand Down
28 changes: 26 additions & 2 deletions gradle/mockito-core/javadoc.gradle
@@ -1,7 +1,31 @@
//It seems the gradle javadoc task works file by file and as such disable some features of javadoc tool
//such as link to packages, https://groups.google.com/d/msg/gradle-dev/R83dy_6PHMc/bgw0cUTMFAAJ

def java8DocsUrl = 'https://docs.oracle.com/javase/8/docs/api/'
def packageListUrl = "$java8DocsUrl/package-list"
def java8DocsDir = "$buildDir/javase-8-docs"

// Temporary workaround for https://github.com/mockito/mockito/issues/2765
// For Java 8, download the `package-list` as `element-list`
task downloadJava8ElementList(type: Download) {
src packageListUrl
// Since the JavaDoc output is generated in `$buildDir/javadoc`, specify a different location for this task
dest "$java8DocsDir/element-list"
overwrite true
}

// Temporary workaround for https://github.com/mockito/mockito/issues/2765
// For Java 9+, download the `package-list` as-is
task downloadJava9PlusPackageList(type: Download, dependsOn: downloadJava8ElementList) {
andrepaschoal marked this conversation as resolved.
Show resolved Hide resolved
src packageListUrl
// Since the JavaDoc output is generated in `$buildDir/javadoc`, specify a different location for this task
dest java8DocsDir
overwrite true
}

javadoc {
description "Creates javadoc html for Mockito API."
dependsOn downloadJava9PlusPackageList

// For more details on the format
// see https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html
Expand Down Expand Up @@ -38,8 +62,8 @@ javadoc {
options.noIndex = false
options.noNavBar = false
options.noTree = false
options.links = ['https://docs.oracle.com/javase/6/docs/api/',
'https://junit.org/junit4/javadoc/4.12/']
options.links('https://junit.org/junit4/javadoc/4.12/')
options.linksOffline(java8DocsUrl, java8DocsDir)
options.bottom("""
<script type="text/javascript" src="{@docRoot}/js/jdk6-project-version-insert.min.js"></script>
<script type="text/javascript" src="{@docRoot}/js/jquery-1.7.min.js"></script>
Expand Down