Skip to content

Commit 3cd2807

Browse files
committed
Fix links to shadow configuration
1 parent dedc9c0 commit 3cd2807

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

build.gradle

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ subprojects {
303303
if (project.plugins.hasPlugin(BuildPlugin)) {
304304
String artifactsHost = VersionProperties.elasticsearch.isSnapshot() ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
305305
Closure sortClosure = { a, b -> b.group <=> a.group }
306-
Closure depJavadocClosure = { dep ->
306+
Closure depJavadocClosure = { shadowed, dep ->
307307
if (dep.group == null || false == dep.group.startsWith('org.elasticsearch')) {
308308
return
309309
}
310310
Project upstreamProject = dependencyToProject(dep)
311311
if (upstreamProject == null) {
312312
return
313313
}
314-
if (project.plugins.hasPlugin(ShadowPlugin)) {
314+
if (shadowed) {
315315
/*
316316
* Include the source of shadowed upstream projects so we don't
317317
* to publish their javadoc.
@@ -331,13 +331,27 @@ subprojects {
331331
*/
332332
project.javadoc.classpath += upstreamProject.javadoc.classpath
333333
} else {
334+
// Link to non-shadowed dependant projects
334335
project.javadoc.dependsOn "${upstreamProject.path}:javadoc"
335336
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
336337
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${upstreamProject.buildDir}/docs/javadoc/"
337338
}
338339
}
339-
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
340-
project.configurations.compileOnly.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
340+
boolean hasShadow = project.plugins.hasPlugin(ShadowPlugin)
341+
project.configurations.compile.dependencies
342+
.findAll()
343+
.toSorted(sortClosure)
344+
.each({ c -> depJavadocClosure(hasShadow, c) })
345+
project.configurations.compileOnly.dependencies
346+
.findAll()
347+
.toSorted(sortClosure)
348+
.each({ c -> depJavadocClosure(hasShadow, c) })
349+
if (hasShadow) {
350+
project.configurations.shadow.dependencies
351+
.findAll()
352+
.toSorted(sortClosure)
353+
.each({ c -> depJavadocClosure(false, c) })
354+
}
341355
}
342356
}
343357
}

0 commit comments

Comments
 (0)