Add links to external classes in clients javadoc (#25998)
The client sniffer depends on the low-level REST client, while the Java high-level REST client and the transport client depend on Elasticsearch itself. Javadoc are not that useful unless they have links to the Elasticsearch classes in the latter case, and to the low-level REST client in the sniffer javadoc. This commit adds those links.
This commit is contained in:
parent
23858789f0
commit
1309dfd44d
|
@ -48,7 +48,6 @@ import org.gradle.util.GradleVersion
|
|||
|
||||
import java.time.ZoneOffset
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
/**
|
||||
* Encapsulates build configuration for elasticsearch projects.
|
||||
*/
|
||||
|
@ -79,7 +78,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
configureConfigurations(project)
|
||||
project.ext.versions = VersionProperties.versions
|
||||
configureCompile(project)
|
||||
configureJavadocJar(project)
|
||||
configureJavadoc(project)
|
||||
configureSourcesJar(project)
|
||||
configurePomGeneration(project)
|
||||
|
||||
|
@ -289,7 +288,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
project.configurations.provided.dependencies.all(disableTransitiveDeps)
|
||||
}
|
||||
|
||||
/** Adds repositores used by ES dependencies */
|
||||
/** Adds repositories used by ES dependencies */
|
||||
static void configureRepositories(Project project) {
|
||||
RepositoryHandler repos = project.repositories
|
||||
if (System.getProperty("repos.mavenlocal") != null) {
|
||||
|
@ -454,6 +453,30 @@ 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 {
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
|
||||
/** Adds a javadocJar task to generate a jar containing javadocs. */
|
||||
static void configureJavadocJar(Project project) {
|
||||
Jar javadocJarTask = project.task('javadocJar', type: Jar)
|
||||
|
@ -473,7 +496,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
project.assemble.dependsOn(sourcesJarTask)
|
||||
}
|
||||
|
||||
/** Adds additional manifest info to jars, and adds source and javadoc jars */
|
||||
/** Adds additional manifest info to jars */
|
||||
static void configureJars(Project project) {
|
||||
project.tasks.withType(Jar) { Jar jarTask ->
|
||||
// we put all our distributable files under distributions
|
||||
|
|
|
@ -99,4 +99,4 @@ thirdPartyAudit.excludes = [
|
|||
//commons-logging provided dependencies
|
||||
'javax.servlet.ServletContextEvent',
|
||||
'javax.servlet.ServletContextListener'
|
||||
]
|
||||
]
|
|
@ -54,4 +54,4 @@ namingConventions {
|
|||
testClass = 'com.carrotsearch.randomizedtesting.RandomizedTest'
|
||||
//we don't have integration tests
|
||||
skipIntegTestInDisguise = true
|
||||
}
|
||||
}
|
|
@ -27,7 +27,6 @@ dependencies {
|
|||
compile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
|
||||
compile "org.apache.lucene:lucene-test-framework:${versions.lucene}"
|
||||
compile "org.apache.lucene:lucene-codecs:${versions.lucene}"
|
||||
compile "org.elasticsearch.client:elasticsearch-rest-client:${version}"
|
||||
compile "commons-logging:commons-logging:${versions.commonslogging}"
|
||||
compile "commons-codec:commons-codec:${versions.commonscodec}"
|
||||
compile "org.elasticsearch:securemock:${versions.securemock}"
|
||||
|
|
Loading…
Reference in New Issue