mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Build: Move javadoc linking to root build.gradle (#26529)
Javadoc linking between projects currently relies on projectSubstitutions. However, that is an extension variable that is not part of BuildPlugin. This commit moves the javadoc linking into the root build.gradle, alongside where projectSubstitutions are defined.
This commit is contained in:
parent
5c35bff1c3
commit
8ba4ff3be0
31
build.gradle
31
build.gradle
@ -204,7 +204,6 @@ task branchConsistency {
|
||||
}
|
||||
|
||||
subprojects {
|
||||
project.afterEvaluate {
|
||||
// ignore missing javadocs
|
||||
tasks.withType(Javadoc) { Javadoc javadoc ->
|
||||
// the -quiet here is because of a bug in gradle, in that adding a string option
|
||||
@ -214,15 +213,6 @@ subprojects {
|
||||
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
|
||||
javadoc.options.encoding='UTF8'
|
||||
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
|
||||
/*
|
||||
TODO: building javadocs with java 9 b118 is currently broken with weird errors, so
|
||||
for now this is commented out...try again with the next ea build...
|
||||
javadoc.executable = new File(project.javaHome, 'bin/javadoc')
|
||||
if (project.javaVersion == JavaVersion.VERSION_1_9) {
|
||||
// TODO: remove this hack! gradle should be passing this...
|
||||
javadoc.options.addStringOption('source', '8')
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Sets up the dependencies that we build as part of this project but
|
||||
@ -280,6 +270,27 @@ subprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle javadoc dependencies across projects. Order matters: the linksOffline for
|
||||
// org.elasticsearch:elasticsearch must be the last one or all the links for the
|
||||
// other packages (e.g org.elasticsearch.client) will point to core rather than
|
||||
// their own artifacts.
|
||||
if (project.plugins.hasPlugin(BuildPlugin)) {
|
||||
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
|
||||
Closure sortClosure = { a, b -> b.group <=> a.group }
|
||||
Closure depJavadocClosure = { dep ->
|
||||
if (dep.group != null && dep.group.startsWith('org.elasticsearch')) {
|
||||
String substitution = project.ext.projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
|
||||
if (substitution != null) {
|
||||
project.javadoc.dependsOn substitution + ':javadoc'
|
||||
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
|
||||
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${project.project(substitution).buildDir}/docs/javadoc/"
|
||||
}
|
||||
}
|
||||
}
|
||||
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
|
||||
project.configurations.provided.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,29 +455,9 @@ class BuildPlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
static void configureJavadoc(Project project) {
|
||||
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
|
||||
project.afterEvaluate {
|
||||
project.tasks.withType(Javadoc) {
|
||||
executable = new File(project.javaHome, 'bin/javadoc')
|
||||
}
|
||||
/*
|
||||
* Order matters, the linksOffline for org.elasticsearch:elasticsearch must be the last one
|
||||
* or all the links for the other packages (e.g org.elasticsearch.client) will point to core rather than their own artifacts
|
||||
*/
|
||||
Closure sortClosure = { a, b -> b.group <=> a.group }
|
||||
Closure depJavadocClosure = { dep ->
|
||||
if (dep.group != null && dep.group.startsWith('org.elasticsearch')) {
|
||||
String substitution = project.ext.projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
|
||||
if (substitution != null) {
|
||||
project.javadoc.dependsOn substitution + ':javadoc'
|
||||
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
|
||||
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${project.project(substitution).buildDir}/docs/javadoc/"
|
||||
}
|
||||
}
|
||||
}
|
||||
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
|
||||
project.configurations.provided.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
|
||||
}
|
||||
configureJavadocJar(project)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user