lucene/gradle/documentation/documentation.gradle
Mike Drob 08e38d3452
LUCENE-9488 Create Release Artifacts with Gradle (#1905)
* Build Lucene binary distribution using Gradle
* Generate SHA-512 checksums for all release artifacts
* Update documentation artifacts included in binaries
* Delete some additional Ant relics

Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
Co-authored-by: Uwe Schindler <uschindler@apache.org>
2020-10-08 14:25:51 -05:00

130 lines
3.8 KiB
Groovy

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
configure(rootProject) {
def urlVersion = project.baseVersion.replace('.', '_')
def refguideUrlVersion = project.baseVersion.replaceFirst(/^(\d+)\.(\d+).*$/, '$1_$2')
ext {
luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', {
if (project.version != project.baseVersion) {
// non-release build
project('lucene').file('build/documentation').toURI().toASCIIString()
} else {
// release build
"https://lucene.apache.org/core/${urlVersion}"
}
}())
solrDocUrl = project.propertyOrDefault('solr.javadoc.url', {
if (project.version != project.baseVersion) {
// non-release build
project('solr').file('build/documentation').toURI().toASCIIString()
} else {
// release build
"https://lucene.apache.org/solr/${urlVersion}"
}
}())
solrRefguideUrl = project.propertyOrDefault('solr.refguide.url', "https://lucene.apache.org/solr/guide/${refguideUrlVersion}")
}
task documentation() {
group = 'documentation'
description = 'Generate all documentation'
dependsOn ':lucene:documentation'
dependsOn ':solr:documentation'
}
}
// docroot will point to Lucene and Solr relative directory for each sub-project.
configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
ext {
docroot = file("${buildDir}/documentation")
}
configurations {
docs
}
task documentation() {
group = 'documentation'
description = "Generate ${project.name.capitalize()} documentation"
dependsOn subprojects.collect { prj ->
prj.tasks.matching { it.name == 'renderSiteJavadoc' }
}
dependsOn 'changesToHtml','copyDocumentationAssets',
'markdownToHtml','createDocumentationIndex'
}
task copyDocumentationAssets(type: Copy) {
includeEmptyDirs = false
from('site/html') // lucene
from('site/assets') // solr
into project.docroot
}
artifacts {
docs project.docroot, {
builtBy documentation
}
}
}
configure(project(':solr')) {
ext {
// required for the "simple" Solr docs shipped in tgz/zip files, only referring to online web pages:
docrootOnline = file("${buildDir}/docs-online")
}
configurations {
docsOnline
}
documentation {
// for Solr we also have a page shipped with zip/tgz that just points to online web pages:
dependsOn 'documentationOnline'
}
task documentationOnline() {
group = 'documentation'
description = "Generate stub Solr documentation pointing to web page (that's part of Solr TGZ)"
dependsOn 'copyOnlineDocumentationAssets','createOnlineDocumentationIndex','copyChangesToHtmlForOnline'
}
task copyChangesToHtmlForOnline(type: Copy) {
from project.docroot
into project.docrootOnline
include 'changes/**'
dependsOn 'changesToHtml'
}
task copyOnlineDocumentationAssets(type: Copy) {
includeEmptyDirs = false
from('site/assets')
into project.docrootOnline
}
artifacts {
docsOnline project.docrootOnline, {
builtBy documentationOnline
}
}
}