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) {
|
configure(rootProject) {
|
||||||
def urlVersion = project.baseVersion.replace('.', '_')
|
def urlVersion = project.baseVersion.replace('.', '_')
|
||||||
def refguideUrlVersion = project.baseVersion.replaceFirst(/^(\d+)\.(\d+).*$/, '$1_$2')
|
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
if (!skipLucene) {
|
|
||||||
luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', {
|
luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', {
|
||||||
if (project.version != project.baseVersion) {
|
if (project.version != project.baseVersion) {
|
||||||
// non-release build
|
// non-release build does not cross-link between modules.
|
||||||
new File(project('lucene:documentation').buildDir, 'site').toURI().toASCIIString().minus(~'/$')
|
return null
|
||||||
} else {
|
} else {
|
||||||
// release build
|
// release build
|
||||||
"https://lucene.apache.org/core/${urlVersion}"
|
"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() {
|
task documentation() {
|
||||||
|
|
|
@ -46,7 +46,7 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
task renderJavadoc(type: RenderJavadocTask) {
|
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"
|
group "documentation"
|
||||||
|
|
||||||
taskResources = resources
|
taskResources = resources
|
||||||
|
@ -82,13 +82,15 @@ def javaJavadocPackages = rootProject.file("${resources}/java11/")
|
||||||
def junitJavadocPackages = rootProject.file("${resources}/junit/")
|
def junitJavadocPackages = rootProject.file("${resources}/junit/")
|
||||||
allprojects {
|
allprojects {
|
||||||
project.tasks.withType(RenderJavadocTask) {
|
project.tasks.withType(RenderJavadocTask) {
|
||||||
title = "${project.path.startsWith(':lucene') ? 'Lucene' : 'Solr'} ${project.version} ${project.name} API"
|
title = "Lucene ${project.version} ${project.name} API"
|
||||||
|
|
||||||
offlineLinks += [
|
offlineLinks += [
|
||||||
"https://docs.oracle.com/en/java/javase/11/docs/api/": javaJavadocPackages,
|
"https://docs.oracle.com/en/java/javase/11/docs/api/": javaJavadocPackages,
|
||||||
"https://junit.org/junit4/javadoc/4.12/": junitJavadocPackages
|
"https://junit.org/junit4/javadoc/4.12/": junitJavadocPackages
|
||||||
]
|
]
|
||||||
|
|
||||||
|
luceneDocUrl = provider({ rootProject.luceneDocUrl })
|
||||||
|
|
||||||
// Set up custom doclet.
|
// Set up custom doclet.
|
||||||
dependsOn configurations.missingdoclet
|
dependsOn configurations.missingdoclet
|
||||||
docletpath = configurations.missingdoclet
|
docletpath = configurations.missingdoclet
|
||||||
|
@ -96,7 +98,6 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure project-specific tweaks and to-dos.
|
// Configure project-specific tweaks and to-dos.
|
||||||
if (!skipLucene) {
|
|
||||||
configure(project(":lucene:analysis:common")) {
|
configure(project(":lucene:analysis:common")) {
|
||||||
project.tasks.withType(RenderJavadocTask) {
|
project.tasks.withType(RenderJavadocTask) {
|
||||||
// TODO: fix missing javadocs
|
// TODO: fix missing javadocs
|
||||||
|
@ -216,13 +217,11 @@ if (!skipLucene) {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Fix for Java 11 Javadoc tool that cannot handle split packages between modules correctly.
|
// 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)
|
// (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
|
// 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).
|
// 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")) {
|
configure(project(":lucene:test-framework")) {
|
||||||
project.tasks.withType(RenderJavadocTask) {
|
project.tasks.withType(RenderJavadocTask) {
|
||||||
doLast {
|
doLast {
|
||||||
|
@ -241,10 +240,9 @@ if (!skipLucene) {
|
||||||
linksource = true
|
linksource = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Add cross-project documentation task dependencies:
|
// 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
|
// - the dependency is using dependsOn with a closure to enable lazy evaluation
|
||||||
configure(subprojects) {
|
configure(subprojects) {
|
||||||
project.tasks.withType(RenderJavadocTask) { task ->
|
project.tasks.withType(RenderJavadocTask) { task ->
|
||||||
|
@ -284,7 +282,8 @@ class RenderJavadocTask extends DefaultTask {
|
||||||
def offlineLinks = [:]
|
def offlineLinks = [:]
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
def luceneDocUrl = "${-> project.luceneDocUrl }"
|
@Optional
|
||||||
|
Property<String> luceneDocUrl = project.objects.property(String)
|
||||||
|
|
||||||
// default is to require full javadocs
|
// default is to require full javadocs
|
||||||
@Input
|
@Input
|
||||||
|
@ -298,7 +297,6 @@ class RenderJavadocTask extends DefaultTask {
|
||||||
@Input
|
@Input
|
||||||
List<String> javadocMissingIgnore = []
|
List<String> javadocMissingIgnore = []
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Optional
|
@Optional
|
||||||
@Input
|
@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
|
// 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
|
// 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)
|
// lucene-test-framework was first, or broken links to things like LuceneTestCase if lucene-core was first)
|
||||||
if (project.path != ':solr:test-framework') { //
|
|
||||||
findRenderTasksInDependencies()
|
findRenderTasksInDependencies()
|
||||||
.sort(false, Comparator.comparing { (it.project.name != 'core') as Boolean }.thenComparing(Comparator.comparing { it.path }))
|
.sort(false, Comparator.comparing { (it.project.name != 'core') as Boolean }.thenComparing(Comparator.comparing { it.path }))
|
||||||
.each { otherTask ->
|
.each { otherTask ->
|
||||||
def otherProject = otherTask.project
|
def otherProject = otherTask.project
|
||||||
// For relative links we compute the actual relative link between projects.
|
// For relative links we compute the actual relative link between projects.
|
||||||
def crossLuceneSolr = (otherProject.docroot != project.docroot)
|
if (relativeProjectLinks) {
|
||||||
if (relativeProjectLinks && !crossLuceneSolr) {
|
|
||||||
def pathTo = otherTask.outputDir.toPath().toAbsolutePath()
|
def pathTo = otherTask.outputDir.toPath().toAbsolutePath()
|
||||||
def pathFrom = outputDir.toPath().toAbsolutePath()
|
def pathFrom = outputDir.toPath().toAbsolutePath()
|
||||||
def relative = pathFrom.relativize(pathTo).toString().replace(File.separator, '/')
|
def relative = pathFrom.relativize(pathTo).toString().replace(File.separator, '/')
|
||||||
opts << ['-link', relative]
|
opts << ['-link', relative]
|
||||||
} else {
|
} else {
|
||||||
// For absolute links, we determine the target URL by assembling the full URL.
|
// For absolute links, we determine the target URL by assembling the full URL (if base is available).
|
||||||
allOfflineLinks.put("${luceneDocUrl}/${otherProject.relativeDocPath}/".toString(), otherTask.outputDir)
|
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()) {
|
!project.file("$dir/element-list").exists()) {
|
||||||
throw new GradleException("Expected pre-rendered package-list or element-list at ${dir}.")
|
throw new GradleException("Expected pre-rendered package-list or element-list at ${dir}.")
|
||||||
}
|
}
|
||||||
|
logger.lifecycle("Linking ${url} to ${dir}")
|
||||||
opts << [ '-linkoffline', url, dir ]
|
opts << [ '-linkoffline', url, dir ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue