mirror of https://github.com/apache/lucene.git
Don't cross-link between modules for interim snapshot builds. (#21)
This commit is contained in:
parent
0e245171f1
commit
ca3de30aff
|
@ -17,34 +17,17 @@
|
|||
|
||||
configure(rootProject) {
|
||||
def urlVersion = project.baseVersion.replace('.', '_')
|
||||
def refguideUrlVersion = project.baseVersion.replaceFirst(/^(\d+)\.(\d+).*$/, '$1_$2')
|
||||
|
||||
ext {
|
||||
if (!skipLucene) {
|
||||
luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', {
|
||||
if (project.version != project.baseVersion) {
|
||||
// non-release build
|
||||
new File(project('lucene:documentation').buildDir, 'site').toURI().toASCIIString().minus(~'/$')
|
||||
// non-release build does not cross-link between modules.
|
||||
return null
|
||||
} else {
|
||||
// release build
|
||||
"https://lucene.apache.org/core/${urlVersion}"
|
||||
}
|
||||
}())
|
||||
} else {
|
||||
// TODO: The url should be constructed from actual dependency version... but this isn't available
|
||||
// at evaluation time. it'd have to be a lazy property provider.
|
||||
//
|
||||
// There are actually two questions -
|
||||
// 1) what to do about links to yet-unreleased Lucene versions and
|
||||
// 2) forgot what the second question was...
|
||||
//
|
||||
// For now, just hardcode the latest released version.
|
||||
// We could download Lucene javadoc artifacts for the actual dependency and just
|
||||
// link it locally (and publish it on Solr site). This would ensure the docs are always up-to-date,
|
||||
// even for Lucene snapshots.
|
||||
luceneDocVersion = "9_0_0-SNAPSHOT"
|
||||
luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', "https://lucene.apache.org/core/${luceneDocVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
task documentation() {
|
||||
|
|
|
@ -46,7 +46,7 @@ allprojects {
|
|||
}
|
||||
|
||||
task renderJavadoc(type: RenderJavadocTask) {
|
||||
description "Generates Javadoc API documentation for the main source code. This directly invokes javadoc tool."
|
||||
description "Generates Javadoc API documentation for each module. This directly invokes javadoc tool."
|
||||
group "documentation"
|
||||
|
||||
taskResources = resources
|
||||
|
@ -82,13 +82,15 @@ def javaJavadocPackages = rootProject.file("${resources}/java11/")
|
|||
def junitJavadocPackages = rootProject.file("${resources}/junit/")
|
||||
allprojects {
|
||||
project.tasks.withType(RenderJavadocTask) {
|
||||
title = "${project.path.startsWith(':lucene') ? 'Lucene' : 'Solr'} ${project.version} ${project.name} API"
|
||||
title = "Lucene ${project.version} ${project.name} API"
|
||||
|
||||
offlineLinks += [
|
||||
"https://docs.oracle.com/en/java/javase/11/docs/api/": javaJavadocPackages,
|
||||
"https://junit.org/junit4/javadoc/4.12/": junitJavadocPackages
|
||||
]
|
||||
|
||||
luceneDocUrl = provider({ rootProject.luceneDocUrl })
|
||||
|
||||
// Set up custom doclet.
|
||||
dependsOn configurations.missingdoclet
|
||||
docletpath = configurations.missingdoclet
|
||||
|
@ -96,7 +98,6 @@ allprojects {
|
|||
}
|
||||
|
||||
// Configure project-specific tweaks and to-dos.
|
||||
if (!skipLucene) {
|
||||
configure(project(":lucene:analysis:common")) {
|
||||
project.tasks.withType(RenderJavadocTask) {
|
||||
// TODO: fix missing javadocs
|
||||
|
@ -216,13 +217,11 @@ if (!skipLucene) {
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fix for Java 11 Javadoc tool that cannot handle split packages between modules correctly.
|
||||
// (by removing all the packages which are part of lucene-core)
|
||||
// See: https://issues.apache.org/jira/browse/LUCENE-8738?focusedCommentId=16818106&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16818106
|
||||
// LUCENE-9499: This workaround should be applied only to test-framework (we have no split package in other modules).
|
||||
if (!skipLucene) {
|
||||
configure(project(":lucene:test-framework")) {
|
||||
project.tasks.withType(RenderJavadocTask) {
|
||||
doLast {
|
||||
|
@ -241,10 +240,9 @@ if (!skipLucene) {
|
|||
linksource = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add cross-project documentation task dependencies:
|
||||
// - each RenderJavaDocs task gets a dependency to all tasks with same name in its dependencies
|
||||
// - each RenderJavaDocs task gets a dependency to all tasks with the same name in its dependencies
|
||||
// - the dependency is using dependsOn with a closure to enable lazy evaluation
|
||||
configure(subprojects) {
|
||||
project.tasks.withType(RenderJavadocTask) { task ->
|
||||
|
@ -284,7 +282,8 @@ class RenderJavadocTask extends DefaultTask {
|
|||
def offlineLinks = [:]
|
||||
|
||||
@Input
|
||||
def luceneDocUrl = "${-> project.luceneDocUrl }"
|
||||
@Optional
|
||||
Property<String> luceneDocUrl = project.objects.property(String)
|
||||
|
||||
// default is to require full javadocs
|
||||
@Input
|
||||
|
@ -298,7 +297,6 @@ class RenderJavadocTask extends DefaultTask {
|
|||
@Input
|
||||
List<String> javadocMissingIgnore = []
|
||||
|
||||
|
||||
@Nullable
|
||||
@Optional
|
||||
@Input
|
||||
|
@ -377,21 +375,21 @@ class RenderJavadocTask extends DefaultTask {
|
|||
// NOTE: explicitly exclude solr/test-framework, or attempting to link to lucene-test-framework because if we did javadoc would
|
||||
// attempt to link class refs in in org.apache.lucene, causing broken links. (either broken links to things like "Directory" if
|
||||
// lucene-test-framework was first, or broken links to things like LuceneTestCase if lucene-core was first)
|
||||
if (project.path != ':solr:test-framework') { //
|
||||
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.
|
||||
def crossLuceneSolr = (otherProject.docroot != project.docroot)
|
||||
if (relativeProjectLinks && !crossLuceneSolr) {
|
||||
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.
|
||||
allOfflineLinks.put("${luceneDocUrl}/${otherProject.relativeDocPath}/".toString(), otherTask.outputDir)
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,6 +401,7 @@ class RenderJavadocTask extends DefaultTask {
|
|||
!project.file("$dir/element-list").exists()) {
|
||||
throw new GradleException("Expected pre-rendered package-list or element-list at ${dir}.")
|
||||
}
|
||||
logger.lifecycle("Linking ${url} to ${dir}")
|
||||
opts << [ '-linkoffline', url, dir ]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue