mirror of https://github.com/apache/lucene.git
SOLR-14824: remove cruft from the ref-guide gradle build and simpliy the publish process
some things being cleaned up here are simplifications of changes that were 1-to-1 ported from ant, others are left over from when we had a 'released' PDF and are no longer needed
This commit is contained in:
parent
ebb980fd7b
commit
5e034d7348
|
@ -126,61 +126,39 @@ ext {
|
||||||
buildContentDir = file("${buildDir}/content")
|
buildContentDir = file("${buildDir}/content")
|
||||||
mainPage = "index"
|
mainPage = "index"
|
||||||
|
|
||||||
|
// the "MAJOR.MINOR" version of solr this guide is about (guides aren't specific to BUGFIX releases)
|
||||||
|
// So on 'branch_9_9' where 'version' may be 9.9.0, 9.9.1, 9.9.9, etc..; solrDocsVersion = 9.9
|
||||||
solrDocsVersion = "${version}".replaceAll(/^(\d+\.\d+)(|\..*)$/, "\$1")
|
solrDocsVersion = "${version}".replaceAll(/^(\d+\.\d+)(|\..*)$/, "\$1")
|
||||||
solrDocsVersionPath = "${solrDocsVersion}".replaceAll(/^(\d+)\.(\d+)$/, "\$1_\$2_0")
|
|
||||||
|
|
||||||
solrGuideVersion = propertyOrDefault("solrGuideVersion", "${solrDocsVersion}-DRAFT")
|
// the "MAJOR_MINOR" version as a path for publishing the guide
|
||||||
|
// So on 'branch_9_9' where solrDocsVersion = 9.9; solrGuideVersionPath => 9_9
|
||||||
solrRootPath = '../../../../solr/'
|
solrGuideVersionPath = "${solrDocsVersion}".replaceAll(/^(\d+)\.(\d+)$/, "\$1_\$2")
|
||||||
solrGuideDraftStatus = solrGuideVersion.matches(/^\d+\.\d+(|\.\d+)$/) ? "" : "DRAFT"
|
|
||||||
solrGuideVersionPath = solrGuideVersion.replaceAll(/^(\d+)\.(\d+)(-DRAFT)?.*/, "\$1_\$2\$3")
|
|
||||||
|
|
||||||
javadocLink = "https://docs.oracle.com/en/java/javase/11/docs/api/"
|
|
||||||
|
|
||||||
if (project.hasProperty("local.javadocs")) {
|
if (project.hasProperty("local.javadocs")) {
|
||||||
htmlSolrJavadocs = "link:../../docs/"
|
htmlSolrJavadocs = "link:../../docs/"
|
||||||
htmlLuceneJavadocs = "link:../../../../lucene/build/docs/"
|
htmlLuceneJavadocs = "link:../../../../lucene/build/docs/"
|
||||||
} else {
|
} else {
|
||||||
htmlSolrJavadocs = "https://lucene.apache.org/solr/${solrDocsVersionPath}/"
|
// when linking to javadocs of code releases, which always use paths like "MAJOR_MINOR_BUGFIX"
|
||||||
htmlLuceneJavadocs = "https://lucene.apache.org/core/${solrDocsVersionPath}/"
|
// (even when 'BUGFIX' = 0), we link to the javadocs for the "MAJOR.MINOR.0" release
|
||||||
|
// So if solrGuideVersionPath = '9_9'; use '9_9_0' for javadoc links...
|
||||||
|
htmlSolrJavadocs = "https://lucene.apache.org/solr/${solrGuideVersionPath}_0/"
|
||||||
|
htmlLuceneJavadocs = "https://lucene.apache.org/core/${solrGuideVersionPath}_0/"
|
||||||
}
|
}
|
||||||
|
|
||||||
bareBonesDir = file("${buildDir}/bare-bones-html")
|
// ivy* props will be set in setupLazyProps
|
||||||
|
// (because they need to be computed after evaluation is complete).
|
||||||
|
templateProps = [
|
||||||
|
javadocLink: "https://docs.oracle.com/en/java/javase/11/docs/api/",
|
||||||
|
|
||||||
// Some additional version properties are lazily computed
|
solrGuideDraftStatus: propertyOrDefault("solrGuideDraft", "true").toBoolean() ? "DRAFT" : "",
|
||||||
// in setupLazyProps (because they need to be computed after evaluation is complete).
|
solrRootPath: project(':solr').projectDir.toString() + File.separator,
|
||||||
props = [
|
|
||||||
"solr-root-path" : solrRootPath,
|
|
||||||
"solr-guide-draft-status": solrGuideDraftStatus,
|
|
||||||
"solr-guide-version" : solrGuideVersion,
|
|
||||||
"solr-guide-version-path": solrGuideVersionPath,
|
|
||||||
"solr-docs-version" : solrDocsVersion,
|
|
||||||
"javadoc.link" : javadocLink,
|
|
||||||
"java-javadocs" : javadocLink,
|
|
||||||
"solr-javadocs" : htmlSolrJavadocs,
|
|
||||||
"html-solr-javadocs" : htmlSolrJavadocs,
|
|
||||||
"lucene-javadocs" : htmlLuceneJavadocs,
|
|
||||||
"html-lucene-javadocs" : htmlLuceneJavadocs,
|
|
||||||
"build-date" : buildDate,
|
|
||||||
"DSTAMP" : buildDate,
|
|
||||||
"build-year" : buildYear,
|
|
||||||
"current.year" : buildYear
|
|
||||||
]
|
|
||||||
|
|
||||||
asciiDocAttrs = [
|
solrDocsVersion: solrDocsVersion,
|
||||||
'common': [
|
solrGuideVersionPath: solrGuideVersionPath,
|
||||||
'attribute-missing' : 'warn',
|
htmlSolrJavadocs: htmlSolrJavadocs,
|
||||||
'icons' : 'font',
|
htmlLuceneJavadocs: htmlLuceneJavadocs,
|
||||||
'icon-set' : 'fa',
|
buildDate: buildDate,
|
||||||
'figure-caption!' : '',
|
buildYear: buildYear,
|
||||||
'idprefix' : '',
|
|
||||||
'idseparator' : '-',
|
|
||||||
'source-highlighter': 'coderay',
|
|
||||||
'solr-root-path' : solrRootPath,
|
|
||||||
],
|
|
||||||
'html' : [
|
|
||||||
'imagesdir': buildContentDir.toString()
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,25 +167,18 @@ task setupLazyProps {
|
||||||
// These properties have to be resolved after the configuration phase is complete (palantir's constraint)
|
// These properties have to be resolved after the configuration phase is complete (palantir's constraint)
|
||||||
// so we can't use them as input for caches.
|
// so we can't use them as input for caches.
|
||||||
[
|
[
|
||||||
["ivyversions./commons-codec/commons-codec", "commons-codec", "commons-codec"],
|
["ivyCommonsCodec", "commons-codec", "commons-codec"],
|
||||||
["ivyversions.io.dropwizard.metrics.version", "io.dropwizard.metrics", "metrics-core"],
|
["ivyDropwizardMetrics", "io.dropwizard.metrics", "metrics-core"],
|
||||||
["ivyversions.org.apache.logging.log4j.version", "org.apache.logging.log4j", "log4j-core"],
|
["ivyLog4j", "org.apache.logging.log4j", "log4j-core"],
|
||||||
["ivyversions./org.apache.opennlp/opennlp-tools", "org.apache.opennlp", "opennlp-tools"],
|
["ivyOpennlpTools", "org.apache.opennlp", "opennlp-tools"],
|
||||||
["ivyversions.org.apache.tika.version", "org.apache.tika", "tika-core"],
|
["ivyTika", "org.apache.tika", "tika-core"],
|
||||||
["ivyversions.org.apache.zookeeper.version", "org.apache.zookeeper", "zookeeper"],
|
["ivyZookeeper", "org.apache.zookeeper", "zookeeper"],
|
||||||
|
].each { p, depGroup, depId ->
|
||||||
["ivy-zookeeper-version", "org.apache.zookeeper", "zookeeper"],
|
templateProps[p] = getVersion(depGroup, depId, configurations.depVer)
|
||||||
["ivy-log4j-version", "org.apache.logging.log4j", "log4j-core"],
|
|
||||||
["ivy-tika-version", "org.apache.tika", "tika-core"],
|
|
||||||
["ivy-opennlp-version", "org.apache.opennlp", "opennlp-tools"],
|
|
||||||
["ivy-commons-codec-version", "commons-codec", "commons-codec"],
|
|
||||||
["ivy-dropwizard-version", "io.dropwizard.metrics", "metrics-core"]
|
|
||||||
].each { antProp, depGroup, depId ->
|
|
||||||
props[antProp] = getVersion(depGroup, depId, configurations.depVer)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit info about properties for clarity.
|
// Emit info about properties for clarity.
|
||||||
logger.warn("Building ref guide with:\n" + props.collect({ k, v -> " ${k} -> ${v}" }).join('\n'))
|
logger.warn("Building ref guide with:\n" + templateProps.collect({ k, v -> " ${k} -> ${v}" }).join('\n'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,9 +186,7 @@ task prepareSources(type: Sync) {
|
||||||
dependsOn setupLazyProps
|
dependsOn setupLazyProps
|
||||||
|
|
||||||
// If replaceable properties change, we have to rerun the task.
|
// If replaceable properties change, we have to rerun the task.
|
||||||
inputs.properties props
|
inputs.properties templateProps
|
||||||
|
|
||||||
def dummyAntProject = new org.apache.tools.ant.Project()
|
|
||||||
|
|
||||||
from(file("src"), {
|
from(file("src"), {
|
||||||
exclude '**/*.template'
|
exclude '**/*.template'
|
||||||
|
@ -227,15 +196,9 @@ task prepareSources(type: Sync) {
|
||||||
include '**/*.template'
|
include '**/*.template'
|
||||||
rename '(.+)\\.template', '$1'
|
rename '(.+)\\.template', '$1'
|
||||||
filteringCharset = 'UTF-8'
|
filteringCharset = 'UTF-8'
|
||||||
filter(org.apache.tools.ant.filters.ExpandProperties, project: dummyAntProject)
|
expand(templateProps)
|
||||||
})
|
})
|
||||||
|
|
||||||
doFirst {
|
|
||||||
props.each { k, v ->
|
|
||||||
dummyAntProject.setProperty(k, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
into buildContentDir
|
into buildContentDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,60 +225,6 @@ task buildNavDataFiles(type: JavaExec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task bareBonesAsciiDoctor {
|
|
||||||
dependsOn buildNavDataFiles
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
// Regenerate fully.
|
|
||||||
project.delete(bareBonesDir)
|
|
||||||
bareBonesDir.mkdirs()
|
|
||||||
|
|
||||||
// Convert each file separately so that folders are preserved.
|
|
||||||
Path source = buildContentDir.toPath().toAbsolutePath().normalize()
|
|
||||||
Path target = bareBonesDir.toPath().toAbsolutePath().normalize()
|
|
||||||
|
|
||||||
Asciidoctor adoc = Asciidoctor.Factory.create()
|
|
||||||
fileTree(source, {
|
|
||||||
include "**/*.adoc"
|
|
||||||
exclude "**/_*"
|
|
||||||
}).each { file ->
|
|
||||||
Path relative = source.relativize(file.toPath())
|
|
||||||
Path targetDir = target.resolve(relative).getParent()
|
|
||||||
|
|
||||||
def opts = OptionsBuilder.options()
|
|
||||||
.backend('html5')
|
|
||||||
.docType("book")
|
|
||||||
.headerFooter(false)
|
|
||||||
.safe(SafeMode.UNSAFE)
|
|
||||||
.baseDir(source.toFile())
|
|
||||||
.toDir(targetDir.toFile())
|
|
||||||
.destinationDir(targetDir.toFile())
|
|
||||||
.mkDirs(true)
|
|
||||||
.attributes(asciiDocAttrs.common + asciiDocAttrs.html + props)
|
|
||||||
|
|
||||||
adoc.convertFile(file, opts)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task bareBonesHtmlValidation(type: JavaExec) {
|
|
||||||
dependsOn bareBonesAsciiDoctor
|
|
||||||
description("Builds (w/o Jekyll) a very simple html version of the guide and runs link/anchor validation on it")
|
|
||||||
|
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
main = 'CheckLinksAndAnchors'
|
|
||||||
workingDir = buildContentDir
|
|
||||||
|
|
||||||
args([
|
|
||||||
"${bareBonesDir}",
|
|
||||||
"-bare-bones"
|
|
||||||
])
|
|
||||||
|
|
||||||
if (project.hasProperty("local.javadocs")) {
|
|
||||||
args += "-check-all-relative-links"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task buildSiteJekyll(type: com.github.jrubygradle.JRubyExec) {
|
task buildSiteJekyll(type: com.github.jrubygradle.JRubyExec) {
|
||||||
dependsOn buildNavDataFiles
|
dependsOn buildNavDataFiles
|
||||||
|
|
||||||
|
@ -347,7 +256,7 @@ task buildSite(type: JavaExec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook up custom tasks with standard tasks.
|
// Hook up custom tasks with standard tasks.
|
||||||
check.dependsOn bareBonesHtmlValidation
|
check.dependsOn buildSite
|
||||||
|
|
||||||
// Do not hook site building to assemble, at least for now.
|
// Do not hook site building to assemble, at least for now.
|
||||||
// assemble.dependsOn buildSite
|
// assemble.dependsOn buildSite
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# NOTE: Ant converts _config.yml.template into create _config.yml and performs ant property substitution.
|
# NOTE: gradle converts _config.yml.template into create _config.yml and performs script engine substitutions
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -68,22 +68,21 @@ asciidoc: {}
|
||||||
# NOTE: If you add any attributes here for use in adoc files, you almost certainly need to also add
|
# NOTE: If you add any attributes here for use in adoc files, you almost certainly need to also add
|
||||||
# them to the <asciidoctor:convert/> ant task for precommit validation as well.
|
# them to the <asciidoctor:convert/> ant task for precommit validation as well.
|
||||||
solr-attributes: &solr-attributes-ref
|
solr-attributes: &solr-attributes-ref
|
||||||
solr-root-path: "../../../"
|
solr-root-path: "${solrRootPath}"
|
||||||
solr-guide-draft-status: "${solr-guide-draft-status}"
|
solr-guide-draft-status: "${solrGuideDraftStatus}"
|
||||||
solr-guide-version: "${solr-guide-version}"
|
solr-guide-version-path: "${solrGuideVersionPath}"
|
||||||
solr-guide-version-path: "${solr-guide-version-path}"
|
solr-docs-version: "${solrDocsVersion}"
|
||||||
solr-docs-version: "${solr-docs-version}"
|
java-javadocs: "${javadocLink}"
|
||||||
java-javadocs: "${javadoc.link}"
|
solr-javadocs: "${htmlSolrJavadocs}"
|
||||||
solr-javadocs: "${html-solr-javadocs}"
|
lucene-javadocs: "${htmlLuceneJavadocs}"
|
||||||
lucene-javadocs: "${html-lucene-javadocs}"
|
build-date: "${buildDate}"
|
||||||
build-date: "${DSTAMP}"
|
build-year: "${buildYear}"
|
||||||
build-year: "${current.year}"
|
ivy-commons-codec-version: "${ivyCommonsCodec}"
|
||||||
ivy-commons-codec-version: "${ivyversions./commons-codec/commons-codec}"
|
ivy-dropwizard-version: "${ivyDropwizardMetrics}"
|
||||||
ivy-dropwizard-version: "${ivyversions.io.dropwizard.metrics.version}"
|
ivy-log4j-version: "${ivyLog4j}"
|
||||||
ivy-log4j-version: "${ivyversions.org.apache.logging.log4j.version}"
|
ivy-opennlp-version: "${ivyOpennlpTools}"
|
||||||
ivy-opennlp-version: "${ivyversions./org.apache.opennlp/opennlp-tools}"
|
ivy-tika-version: "${ivyTika}"
|
||||||
ivy-tika-version: "${ivyversions.org.apache.tika.version}"
|
ivy-zookeeper-version: "${ivyZookeeper}"
|
||||||
ivy-zookeeper-version: "${ivyversions.org.apache.zookeeper.version}"
|
|
||||||
|
|
||||||
asciidoctor:
|
asciidoctor:
|
||||||
safe: 0
|
safe: 0
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 footer">
|
<div class="col-lg-12 footer">
|
||||||
©{{ site.solr-attributes.build-year }} {{site.company_name}}. All rights reserved. <br />
|
©{{ site.solr-attributes.build-year }} {{site.company_name}}. All rights reserved. <br />
|
||||||
{% if page.last_updated %}<p>Page last updated:</span> {{page.last_updated}}<br/>{% endif %} Site Version: {{ site.solr-attributes.solr-guide-version }} <br />Site last generated: {{ site.solr-attributes.build-date }} <br />
|
{% if page.last_updated %}<p>Page last updated:</span> {{page.last_updated}}<br/>{% endif %} Solr Version: {{ site.solr-attributes.solr-docs-version }} <br />Site last generated: {{ site.solr-attributes.build-date }} <br />
|
||||||
<p><img src="{{ "images/solr-sunOnly-small.png" }}" alt="Apache Solr"/></p>
|
<p><img src="{{ "images/solr-sunOnly-small.png" }}" alt="Apache Solr"/></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="description" content="{% if page.description %}{{ page.description | strip_html | strip_newlines | truncate: 160 }}{% endif %}">
|
<meta name="description" content="{% if page.description %}{{ page.description | strip_html | strip_newlines | truncate: 160 }}{% endif %}">
|
||||||
<meta name="keywords" content="{{page.tags}}{% if page.tags %}, {% endif %} {{page.keywords}}">
|
<meta name="keywords" content="{{page.tags}}{% if page.tags %}, {% endif %} {{page.keywords}}">
|
||||||
{% comment %}NOTE: explicitly using the GUIDE version here (not solr) {% endcomment %}
|
<title>{% if page_id != "index" %}{{ page.title }} | {% endif %}{{ site.site_title }} {{ site.solr-attributes.solr-docs-version}}</title>
|
||||||
<title>{% if page_id != "index" %}{{ page.title }} | {% endif %}{{ site.site_title }} {{ site.solr-attributes.solr-guide-version}}</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||||
|
|
|
@ -184,7 +184,7 @@ ul.nav li ul {
|
||||||
|
|
||||||
/* end navgoco sidebar */
|
/* end navgoco sidebar */
|
||||||
|
|
||||||
/* When '-Dsolr-guide-version' is not set during the build, the Guide is
|
/* When 'solr-guide-draft-status: DRAFT' is in _config.yml, the Guide is
|
||||||
considered a Draft and includes a notice in the sidebar to that effect */
|
considered a Draft and includes a notice in the sidebar to that effect */
|
||||||
|
|
||||||
.sidebar-header p.draft-notice {
|
.sidebar-header p.draft-notice {
|
||||||
|
|
|
@ -43,7 +43,7 @@ The build process generates the page hierarchy and builds the HTML pages with cu
|
||||||
To build the HTML, from the top level of the project, run:
|
To build the HTML, from the top level of the project, run:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
$ gradlew clean solr:solr-ref-guide:buildSite
|
$ ./gradlew clean solr:solr-ref-guide:buildSite
|
||||||
|
|
||||||
This will produce pages with a DRAFT watermark across them. While these are fine for initial DRAFT publication, see the section <<Publish the Final Guide>> for steps to produce final production-ready HTML pages.
|
This will produce pages with a DRAFT watermark across them. While these are fine for initial DRAFT publication, see the section <<Publish the Final Guide>> for steps to produce final production-ready HTML pages.
|
||||||
|
|
||||||
|
@ -72,11 +72,9 @@ Since the Guide has already been uploaded to SVN, you need to overwrite the exis
|
||||||
Build the Guide locally with a parameter for the Guide version. This requires the same <<Pre-Requisites,pre-requisites>> from above.
|
Build the Guide locally with a parameter for the Guide version. This requires the same <<Pre-Requisites,pre-requisites>> from above.
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
$gradlew clean solr:solr-ref-guide:buildSite -PsolrGuideVersion=X.Y
|
$ ./gradlew solr:solr-ref-guide:buildSite -PsolrGuideDraft=false
|
||||||
|
|
||||||
where `X.Y` is the version you want to publish (i.e., `7.7`).
|
IMPORTANT: The `-PsolrGuideDraft` system property is optional if you build drafts locally or as pre-publication DRAFTs (i.e., not for publication). By default the build system assumes this is a `DRAFT` build which will have a DRAFT watermark and other labels on the pages. Including the `-PsolrGuideDraft=false` property ensures the DRAFT watermark and labels are removed from the HTML files.
|
||||||
|
|
||||||
IMPORTANT: The `-PsolrGuideVersion` system property is optional if you build drafts locally or as pre-publication DRAFTs (i.e., not for publication). By default the build system uses the `build.gradle` file in the current branch to identify the version and assumes this is a `DRAFT` build which will have a DRAFT watermark and other labels on the pages. Including the `-PsolrGuideVersion` system property ensures the DRAFT watermark and labels are removed from the HTML files.
|
|
||||||
|
|
||||||
*Pull Production Repo and Upload New Files*
|
*Pull Production Repo and Upload New Files*
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue