2021-08-24 06:33:36 -04:00
|
|
|
import org.gradle.internal.jvm.Jvm
|
|
|
|
|
2020-03-11 11:09:26 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership.
|
|
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
* (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-04-08 19:44:07 -04:00
|
|
|
// generate javadocs by calling javadoc tool
|
|
|
|
// see https://docs.oracle.com/en/java/javase/11/tools/javadoc.html
|
|
|
|
|
2020-08-31 09:35:14 -04:00
|
|
|
def resources = scriptResources(buildscript)
|
|
|
|
|
2020-03-11 11:09:26 -04:00
|
|
|
allprojects {
|
|
|
|
plugins.withType(JavaPlugin) {
|
2020-09-02 08:29:17 -04:00
|
|
|
configurations {
|
|
|
|
missingdoclet
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
missingdoclet "org.apache.lucene.tools:missing-doclet"
|
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
ext {
|
|
|
|
relativeDocPath = project.path.replaceFirst(/:\w+:/, "").replace(':', '/')
|
|
|
|
}
|
2020-04-12 06:55:56 -04:00
|
|
|
|
|
|
|
// We disable the default javadoc task and have our own
|
|
|
|
// javadoc rendering task below. The default javadoc task
|
|
|
|
// will just invoke 'renderJavadoc' (to allow people to call
|
|
|
|
// conventional task name).
|
|
|
|
tasks.matching { it.name == "javadoc" }.all {
|
|
|
|
enabled = false
|
|
|
|
dependsOn "renderJavadoc"
|
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
task renderJavadoc(type: RenderJavadocTask) {
|
2021-03-18 05:18:07 -04:00
|
|
|
description "Generates Javadoc API documentation for each module. This directly invokes javadoc tool."
|
2020-03-11 11:09:26 -04:00
|
|
|
group "documentation"
|
|
|
|
|
2020-08-31 09:35:14 -04:00
|
|
|
taskResources = resources
|
2020-03-11 11:09:26 -04:00
|
|
|
dependsOn sourceSets.main.compileClasspath
|
2020-08-31 09:35:14 -04:00
|
|
|
classpath = sourceSets.main.compileClasspath
|
2020-09-02 08:29:17 -04:00
|
|
|
srcDirSet = sourceSets.main.java
|
2024-02-25 10:32:30 -05:00
|
|
|
releaseVersion = rootProject.minJavaVersion
|
2020-03-11 11:09:26 -04:00
|
|
|
|
2020-08-31 09:35:14 -04:00
|
|
|
outputDir = project.javadoc.destinationDir
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
|
2022-01-05 14:42:02 -05:00
|
|
|
if (project.path == ':lucene:luke' || !(project in rootProject.ext.mavenProjects)) {
|
2021-12-19 02:51:13 -05:00
|
|
|
// These projects are not part of the public API so we don't render their javadocs
|
|
|
|
// as part of the site's creation. A side-effect of this is that javadocs would not
|
|
|
|
// be linted for these projects. To avoid this, we connect the regular javadoc task
|
|
|
|
// to check so that everything is validated.
|
|
|
|
project.tasks.getByName("check").dependsOn renderJavadoc
|
|
|
|
} else {
|
|
|
|
task renderSiteJavadoc(type: RenderJavadocTask) {
|
|
|
|
description "Generates Javadoc API documentation for the site (relative links)."
|
|
|
|
group "documentation"
|
|
|
|
|
|
|
|
taskResources = resources
|
|
|
|
dependsOn sourceSets.main.compileClasspath
|
|
|
|
classpath = sourceSets.main.compileClasspath
|
|
|
|
srcDirSet = sourceSets.main.java
|
2024-02-25 10:32:30 -05:00
|
|
|
releaseVersion = rootProject.minJavaVersion
|
2021-12-19 02:51:13 -05:00
|
|
|
|
|
|
|
relativeProjectLinks = true
|
|
|
|
|
2023-07-24 10:38:19 -04:00
|
|
|
enableSearch = true
|
|
|
|
|
2021-12-19 02:51:13 -05:00
|
|
|
// Place the documentation under the documentation directory.
|
|
|
|
// docroot is defined in 'documentation.gradle'
|
|
|
|
outputDir = project.docroot.toPath().resolve(project.relativeDocPath).toFile()
|
|
|
|
}
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
// Set up titles and link up some offline docs for all documentation
|
|
|
|
// (they may be unused but this doesn't do any harm).
|
2020-08-31 09:35:14 -04:00
|
|
|
|
2024-02-29 09:06:47 -05:00
|
|
|
def javaJavadocPackages = rootProject.file("${resources}/java21/")
|
2020-08-31 09:35:14 -04:00
|
|
|
def junitJavadocPackages = rootProject.file("${resources}/junit/")
|
2020-05-14 07:16:16 -04:00
|
|
|
allprojects {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
2021-03-18 05:18:07 -04:00
|
|
|
title = "Lucene ${project.version} ${project.name} API"
|
2020-05-14 07:16:16 -04:00
|
|
|
|
|
|
|
offlineLinks += [
|
2024-02-29 08:37:09 -05:00
|
|
|
"https://docs.oracle.com/en/java/javase/21/docs/api/": javaJavadocPackages,
|
2020-05-14 07:16:16 -04:00
|
|
|
"https://junit.org/junit4/javadoc/4.12/": junitJavadocPackages
|
|
|
|
]
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
luceneDocUrl = provider({ rootProject.luceneDocUrl })
|
|
|
|
|
2020-09-02 08:29:17 -04:00
|
|
|
// Set up custom doclet.
|
|
|
|
dependsOn configurations.missingdoclet
|
|
|
|
docletpath = configurations.missingdoclet
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configure project-specific tweaks and to-dos.
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:analysis:common")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure([
|
|
|
|
project(":lucene:analysis:kuromoji"),
|
|
|
|
project(":lucene:analysis:nori"),
|
|
|
|
project(":lucene:analysis:opennlp"),
|
|
|
|
project(":lucene:analysis:smartcn"),
|
|
|
|
project(":lucene:benchmark"),
|
|
|
|
project(":lucene:codecs"),
|
|
|
|
project(":lucene:grouping"),
|
|
|
|
project(":lucene:highlighter"),
|
|
|
|
project(":lucene:luke"),
|
|
|
|
project(":lucene:monitor"),
|
|
|
|
project(":lucene:queries"),
|
|
|
|
project(":lucene:queryparser"),
|
|
|
|
project(":lucene:replicator"),
|
|
|
|
project(":lucene:spatial-extras"),
|
|
|
|
]) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure([
|
|
|
|
project(":lucene:analysis:icu"),
|
|
|
|
project(":lucene:analysis:morfologik"),
|
|
|
|
project(":lucene:analysis:phonetic"),
|
|
|
|
project(":lucene:analysis:stempel"),
|
|
|
|
project(":lucene:classification"),
|
|
|
|
project(":lucene:demo"),
|
|
|
|
project(":lucene:expressions"),
|
|
|
|
project(":lucene:facet"),
|
|
|
|
project(":lucene:join"),
|
|
|
|
project(":lucene:spatial3d"),
|
|
|
|
project(":lucene:suggest"),
|
|
|
|
]) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing @param tags
|
|
|
|
javadocMissingLevel = "method"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:backward-codecs")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing @param tags
|
|
|
|
javadocMissingLevel = "method"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:test-framework")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:sandbox")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2022-01-05 14:42:02 -05:00
|
|
|
configure(project(":lucene:spatial-test-fixtures")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:misc")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
2020-09-02 08:29:17 -04:00
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(":lucene:core")) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// TODO: fix missing javadocs
|
|
|
|
javadocMissingLevel = "class"
|
|
|
|
// some packages are fixed already
|
|
|
|
javadocMissingMethod = [
|
|
|
|
"org.apache.lucene.util.automaton",
|
|
|
|
"org.apache.lucene.analysis.standard",
|
|
|
|
"org.apache.lucene.analysis.tokenattributes",
|
|
|
|
"org.apache.lucene.document",
|
|
|
|
"org.apache.lucene.search.similarities",
|
|
|
|
"org.apache.lucene.index",
|
|
|
|
"org.apache.lucene.codecs",
|
|
|
|
"org.apache.lucene.codecs.lucene50",
|
|
|
|
"org.apache.lucene.codecs.lucene60",
|
|
|
|
"org.apache.lucene.codecs.lucene80",
|
|
|
|
"org.apache.lucene.codecs.lucene84",
|
|
|
|
"org.apache.lucene.codecs.lucene86",
|
|
|
|
"org.apache.lucene.codecs.lucene87",
|
|
|
|
"org.apache.lucene.codecs.perfield"
|
|
|
|
]
|
2020-09-02 08:29:17 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-18 05:18:07 -04:00
|
|
|
configure(project(':lucene:demo')) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) {
|
|
|
|
// For the demo, we link the example source in the javadocs, as it's ref'ed elsewhere
|
|
|
|
linksource = true
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
// Add cross-project documentation task dependencies:
|
2021-03-18 05:18:07 -04:00
|
|
|
// - each RenderJavaDocs task gets a dependency to all tasks with the same name in its dependencies
|
2020-05-14 07:16:16 -04:00
|
|
|
// - the dependency is using dependsOn with a closure to enable lazy evaluation
|
|
|
|
configure(subprojects) {
|
|
|
|
project.tasks.withType(RenderJavadocTask) { task ->
|
|
|
|
task.dependsOn {
|
|
|
|
task.project.configurations.implementation.allDependencies.withType(ProjectDependency).collect { dep ->
|
|
|
|
def otherProject = dep.dependencyProject
|
|
|
|
return otherProject.tasks.findByName(task.name)
|
2020-04-08 19:44:07 -04:00
|
|
|
}
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:58:16 -04:00
|
|
|
class OfflineLink implements Serializable {
|
|
|
|
@Input
|
|
|
|
String url
|
|
|
|
|
|
|
|
@InputDirectory
|
|
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
|
|
|
@IgnoreEmptyDirectories
|
|
|
|
File location
|
|
|
|
|
|
|
|
OfflineLink(String url, File location) {
|
|
|
|
this.url = url
|
|
|
|
this.location = location
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@CacheableTask
|
2020-05-14 07:16:16 -04:00
|
|
|
class RenderJavadocTask extends DefaultTask {
|
|
|
|
@InputFiles
|
2021-11-01 16:58:16 -04:00
|
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
|
|
|
@IgnoreEmptyDirectories
|
2020-05-14 07:16:16 -04:00
|
|
|
@SkipWhenEmpty
|
|
|
|
SourceDirectorySet srcDirSet;
|
|
|
|
|
|
|
|
@OutputDirectory
|
|
|
|
File outputDir
|
|
|
|
|
2020-05-15 18:14:05 -04:00
|
|
|
@CompileClasspath
|
2020-05-14 07:16:16 -04:00
|
|
|
FileCollection classpath
|
|
|
|
|
2020-09-02 08:29:17 -04:00
|
|
|
@CompileClasspath
|
|
|
|
FileCollection docletpath
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
@Input
|
|
|
|
String title
|
|
|
|
|
|
|
|
@Input
|
|
|
|
boolean linksource = false
|
|
|
|
|
2023-07-24 10:38:19 -04:00
|
|
|
@Input
|
|
|
|
boolean enableSearch = false
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
@Input
|
|
|
|
boolean relativeProjectLinks = false
|
|
|
|
|
2024-02-25 10:32:30 -05:00
|
|
|
@Input
|
|
|
|
JavaVersion releaseVersion
|
|
|
|
|
2021-11-01 16:58:16 -04:00
|
|
|
@Internal
|
|
|
|
Map<String, File> offlineLinks = [:]
|
|
|
|
|
|
|
|
// Computes cacheable inputs from the map in offlineLinks.
|
|
|
|
@Nested
|
|
|
|
List<OfflineLink> getCacheableOfflineLinks() {
|
|
|
|
return offlineLinks.collect { url, location -> new OfflineLink(url, location) }
|
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
|
|
|
|
@Input
|
2021-03-18 05:18:07 -04:00
|
|
|
@Optional
|
2021-08-24 06:33:36 -04:00
|
|
|
final Property<String> luceneDocUrl = project.objects.property(String)
|
2020-05-14 07:16:16 -04:00
|
|
|
|
2020-09-02 08:29:17 -04:00
|
|
|
// default is to require full javadocs
|
|
|
|
@Input
|
|
|
|
String javadocMissingLevel = "parameter"
|
|
|
|
|
|
|
|
// anything in these packages is checked with level=method. This allows iteratively fixing one package at a time.
|
|
|
|
@Input
|
|
|
|
List<String> javadocMissingMethod = []
|
|
|
|
|
|
|
|
// default is not to ignore any elements, should only be used to workaround split packages
|
|
|
|
@Input
|
|
|
|
List<String> javadocMissingIgnore = []
|
|
|
|
|
2021-03-23 05:39:09 -04:00
|
|
|
@Input
|
|
|
|
@Optional
|
|
|
|
ListProperty<String> extraOpts = project.objects.listProperty(String)
|
|
|
|
|
2020-07-21 03:19:38 -04:00
|
|
|
@Optional
|
|
|
|
@Input
|
2021-08-24 06:33:36 -04:00
|
|
|
final Property<String> executable = project.objects.property(String).convention(
|
|
|
|
project.provider { Jvm.current().javadocExecutable.toString() })
|
2020-08-31 09:35:14 -04:00
|
|
|
|
2021-11-01 16:58:16 -04:00
|
|
|
@InputDirectory
|
|
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
|
|
|
@IgnoreEmptyDirectories
|
|
|
|
File taskResources
|
2020-08-31 09:35:14 -04:00
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
/** Utility method to recursively collect all tasks with same name like this one that we depend on */
|
|
|
|
private Set findRenderTasksInDependencies() {
|
|
|
|
Set found = []
|
|
|
|
def collectDeps
|
|
|
|
collectDeps = { task -> task.taskDependencies.getDependencies(task).findAll{ it.name == this.name && it.enabled && !found.contains(it) }.each{
|
|
|
|
found << it
|
|
|
|
collectDeps(it)
|
|
|
|
}}
|
|
|
|
collectDeps(this)
|
|
|
|
return found
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
@TaskAction
|
|
|
|
public void render() {
|
2021-12-19 02:51:13 -05:00
|
|
|
def srcDirs = srcDirSet.sourceDirectories.filter { dir -> dir.exists() }
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
def optionsFile = project.file("${getTemporaryDir()}/javadoc-options.txt")
|
|
|
|
|
|
|
|
// create the directory, so relative link calculation knows that it's a directory:
|
|
|
|
outputDir.mkdirs();
|
|
|
|
|
|
|
|
def opts = []
|
2021-12-19 02:51:13 -05:00
|
|
|
|
|
|
|
def overviewSourceSetDir = srcDirs.filter { dir -> project.file("${dir}/overview.html").exists() }.singleFile
|
|
|
|
opts << [ '-overview', project.file("${overviewSourceSetDir}/overview.html") ]
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << [ '-d', outputDir ]
|
|
|
|
opts << '-protected'
|
|
|
|
opts << [ '-encoding', 'UTF-8' ]
|
|
|
|
opts << [ '-charset', 'UTF-8' ]
|
|
|
|
opts << [ '-docencoding', 'UTF-8' ]
|
2023-07-24 10:38:19 -04:00
|
|
|
if (!enableSearch) {
|
|
|
|
opts << '-noindex'
|
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << '-author'
|
|
|
|
opts << '-version'
|
|
|
|
if (linksource) {
|
|
|
|
opts << '-linksource'
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << '-use'
|
|
|
|
opts << [ '-locale', 'en_US' ]
|
|
|
|
opts << [ '-windowtitle', title ]
|
|
|
|
opts << [ '-doctitle', title ]
|
|
|
|
if (!classpath.isEmpty()) {
|
|
|
|
opts << [ '-classpath', classpath.asPath ]
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << [ '-bottom', "<i>Copyright © 2000-${project.buildYear} Apache Software Foundation. All Rights Reserved.</i>" ]
|
|
|
|
|
|
|
|
opts << [ '-tag', 'lucene.experimental:a:WARNING: This API is experimental and might change in incompatible ways in the next release.' ]
|
|
|
|
opts << [ '-tag', 'lucene.internal:a:NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.' ]
|
|
|
|
opts << [ '-tag', "lucene.spi:t:SPI Name (case-insensitive: if the name is 'htmlStrip', 'htmlstrip' can be used when looking up the service)." ]
|
|
|
|
|
2020-09-02 08:29:17 -04:00
|
|
|
opts << [ '-doclet', "org.apache.lucene.missingdoclet.MissingDoclet" ]
|
|
|
|
opts << [ '-docletpath', docletpath.asPath ]
|
|
|
|
opts << [ '--missing-level', javadocMissingLevel ]
|
|
|
|
if (javadocMissingIgnore) {
|
|
|
|
opts << [ '--missing-ignore', String.join(',', javadocMissingIgnore) ]
|
|
|
|
}
|
|
|
|
if (javadocMissingMethod) {
|
|
|
|
opts << [ '--missing-method', String.join(',', javadocMissingMethod) ]
|
|
|
|
}
|
|
|
|
|
|
|
|
opts << [ '-quiet' ]
|
|
|
|
|
2021-03-23 05:39:09 -04:00
|
|
|
// Add all extra options, if any.
|
|
|
|
opts.addAll(extraOpts.orElse([]).get())
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
def allOfflineLinks = [:]
|
|
|
|
allOfflineLinks.putAll(offlineLinks)
|
|
|
|
|
|
|
|
// Resolve inter-project links:
|
|
|
|
// - find all (enabled) tasks this tasks depends on (with same name), calling findRenderTasksInDependencies()
|
|
|
|
// - sort the tasks preferring those whose project name equals 'core', then lexigraphical by path
|
|
|
|
// - for each task get output dir to create relative or absolute link
|
2021-03-18 05:18:07 -04:00
|
|
|
findRenderTasksInDependencies()
|
|
|
|
.sort(false, Comparator.comparing { (it.project.name != 'core') as Boolean }.thenComparing(Comparator.comparing { it.path }))
|
|
|
|
.each { otherTask ->
|
|
|
|
def otherProject = otherTask.project
|
|
|
|
// For relative links we compute the actual relative link between projects.
|
|
|
|
if (relativeProjectLinks) {
|
|
|
|
def pathTo = otherTask.outputDir.toPath().toAbsolutePath()
|
|
|
|
def pathFrom = outputDir.toPath().toAbsolutePath()
|
|
|
|
def relative = pathFrom.relativize(pathTo).toString().replace(File.separator, '/')
|
|
|
|
opts << ['-link', relative]
|
|
|
|
} else {
|
|
|
|
// For absolute links, we determine the target URL by assembling the full URL (if base is available).
|
|
|
|
def value = luceneDocUrl.getOrElse(null)
|
|
|
|
if (value) {
|
|
|
|
allOfflineLinks.put("${value}/${otherProject.relativeDocPath}/".toString(), otherTask.outputDir)
|
2021-03-08 08:59:08 -05:00
|
|
|
}
|
2020-07-27 19:04:21 -04:00
|
|
|
}
|
2021-03-18 05:18:07 -04:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
// Add offline links.
|
|
|
|
allOfflineLinks.each { url, dir ->
|
|
|
|
// Some sanity check/ validation here to ensure dir/package-list or dir/element-list is present.
|
|
|
|
if (!project.file("$dir/package-list").exists() &&
|
|
|
|
!project.file("$dir/element-list").exists()) {
|
|
|
|
throw new GradleException("Expected pre-rendered package-list or element-list at ${dir}.")
|
2020-04-08 19:44:07 -04:00
|
|
|
}
|
2021-03-18 06:04:45 -04:00
|
|
|
logger.info("Linking ${url} to ${dir}")
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << [ '-linkoffline', url, dir ]
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
|
2024-02-25 10:32:30 -05:00
|
|
|
opts << [ '--release', releaseVersion.toString() ]
|
2020-05-14 07:16:16 -04:00
|
|
|
opts << '-Xdoclint:all,-missing'
|
2020-04-08 19:44:07 -04:00
|
|
|
|
2021-03-23 05:39:09 -04:00
|
|
|
// Increase Javadoc's heap.
|
|
|
|
opts += [ "-J-Xmx512m" ]
|
|
|
|
// Force locale to be "en_US" (fix for: https://bugs.openjdk.java.net/browse/JDK-8222793)
|
|
|
|
opts += [ "-J-Duser.language=en", "-J-Duser.country=US" ]
|
|
|
|
|
|
|
|
// -J options have to be passed on command line, they are not interpreted if passed via args file.
|
|
|
|
def jOpts = opts.findAll { opt -> opt instanceof String && opt.startsWith("-J") }
|
|
|
|
opts.removeAll(jOpts)
|
|
|
|
|
2021-12-19 02:51:13 -05:00
|
|
|
// Collect all source files, for now excluding module descriptors.
|
|
|
|
opts.addAll(
|
|
|
|
srcDirs.collectMany { dir ->
|
|
|
|
project.fileTree(dir: dir, include: "**/*.java", exclude: "**/module-info.java").files
|
|
|
|
}.collect { it.toString() }
|
|
|
|
)
|
|
|
|
|
|
|
|
// handle doc-files manually since in explicit source file mode javadoc does not copy them.
|
|
|
|
srcDirs.each { File dir ->
|
|
|
|
project.copy {
|
|
|
|
into outputDir
|
|
|
|
|
|
|
|
from(dir, {
|
|
|
|
include "**/doc-files/**"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-23 05:39:09 -04:00
|
|
|
// Temporary file that holds all javadoc options for the current task (except jOpts)
|
2020-05-14 07:16:16 -04:00
|
|
|
optionsFile.withWriter("UTF-8", { writer ->
|
|
|
|
// escapes an option with single quotes or whitespace to be passed in the options.txt file for
|
|
|
|
def escapeJavadocOption = { String s -> (s =~ /[ '"]/) ? ("'" + s.replaceAll(/[\\'"]/, /\\$0/) + "'") : s }
|
2020-03-11 11:09:26 -04:00
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
opts.each { entry ->
|
|
|
|
if (entry instanceof List) {
|
|
|
|
writer.write(entry.collect { escapeJavadocOption(it as String) }.join(" "))
|
|
|
|
} else {
|
|
|
|
writer.write(escapeJavadocOption(entry as String))
|
2020-04-08 19:44:07 -04:00
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
writer.write('\n')
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
2020-05-14 07:16:16 -04:00
|
|
|
})
|
2020-03-11 11:09:26 -04:00
|
|
|
|
2021-08-24 06:33:36 -04:00
|
|
|
def javadocCmd = project.file(executable.get())
|
2021-08-24 07:18:01 -04:00
|
|
|
logger.info("Javadoc executable used: ${javadocCmd}")
|
2020-07-21 03:19:38 -04:00
|
|
|
|
2021-03-30 08:38:13 -04:00
|
|
|
project.quietExec {
|
2020-05-14 07:16:16 -04:00
|
|
|
executable javadocCmd
|
2020-03-11 11:09:26 -04:00
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
args += [ "@${optionsFile}" ]
|
2021-03-23 05:39:09 -04:00
|
|
|
args += jOpts
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
// append some special table css, prettify css
|
|
|
|
ant.concat(destfile: "${outputDir}/stylesheet.css", append: "true", fixlastline: "true", encoding: "UTF-8") {
|
2021-11-11 02:54:59 -05:00
|
|
|
filelist(dir: taskResources, files:
|
|
|
|
["table_padding.css",
|
|
|
|
"custom_styles.css",
|
|
|
|
"prettify/prettify.css"].join(" ")
|
|
|
|
)
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
2020-08-30 08:01:04 -04:00
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
// append prettify to scripts
|
|
|
|
ant.concat(destfile: "${outputDir}/script.js", append: "true", fixlastline: "true", encoding: "UTF-8") {
|
2020-08-30 08:01:04 -04:00
|
|
|
filelist(dir: project.file("${taskResources}/prettify"), files: "prettify.js inject-javadocs.js")
|
2020-05-14 07:16:16 -04:00
|
|
|
}
|
2020-08-30 08:01:04 -04:00
|
|
|
|
2020-05-14 07:16:16 -04:00
|
|
|
ant.fixcrlf(srcdir: outputDir, includes: "stylesheet.css script.js", eol: "lf", fixlast: "true", encoding: "UTF-8")
|
2020-03-11 11:09:26 -04:00
|
|
|
}
|
|
|
|
}
|