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,62 +126,40 @@ ext {
|
|||
buildContentDir = file("${buildDir}/content")
|
||||
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")
|
||||
solrDocsVersionPath = "${solrDocsVersion}".replaceAll(/^(\d+)\.(\d+)$/, "\$1_\$2_0")
|
||||
|
||||
solrGuideVersion = propertyOrDefault("solrGuideVersion", "${solrDocsVersion}-DRAFT")
|
||||
|
||||
solrRootPath = '../../../../solr/'
|
||||
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/"
|
||||
|
||||
// the "MAJOR_MINOR" version as a path for publishing the guide
|
||||
// So on 'branch_9_9' where solrDocsVersion = 9.9; solrGuideVersionPath => 9_9
|
||||
solrGuideVersionPath = "${solrDocsVersion}".replaceAll(/^(\d+)\.(\d+)$/, "\$1_\$2")
|
||||
|
||||
if (project.hasProperty("local.javadocs")) {
|
||||
htmlSolrJavadocs = "link:../../docs/"
|
||||
htmlLuceneJavadocs = "link:../../../../lucene/build/docs/"
|
||||
} else {
|
||||
htmlSolrJavadocs = "https://lucene.apache.org/solr/${solrDocsVersionPath}/"
|
||||
htmlLuceneJavadocs = "https://lucene.apache.org/core/${solrDocsVersionPath}/"
|
||||
// when linking to javadocs of code releases, which always use paths like "MAJOR_MINOR_BUGFIX"
|
||||
// (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")
|
||||
|
||||
// Some additional version properties are lazily computed
|
||||
// in setupLazyProps (because they need to be computed after evaluation is complete).
|
||||
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 = [
|
||||
'common': [
|
||||
'attribute-missing' : 'warn',
|
||||
'icons' : 'font',
|
||||
'icon-set' : 'fa',
|
||||
'figure-caption!' : '',
|
||||
'idprefix' : '',
|
||||
'idseparator' : '-',
|
||||
'source-highlighter': 'coderay',
|
||||
'solr-root-path' : solrRootPath,
|
||||
],
|
||||
'html' : [
|
||||
'imagesdir': buildContentDir.toString()
|
||||
]
|
||||
]
|
||||
// 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/",
|
||||
|
||||
solrGuideDraftStatus: propertyOrDefault("solrGuideDraft", "true").toBoolean() ? "DRAFT" : "",
|
||||
solrRootPath: project(':solr').projectDir.toString() + File.separator,
|
||||
|
||||
solrDocsVersion: solrDocsVersion,
|
||||
solrGuideVersionPath: solrGuideVersionPath,
|
||||
htmlSolrJavadocs: htmlSolrJavadocs,
|
||||
htmlLuceneJavadocs: htmlLuceneJavadocs,
|
||||
buildDate: buildDate,
|
||||
buildYear: buildYear,
|
||||
]
|
||||
}
|
||||
|
||||
task setupLazyProps {
|
||||
|
@ -189,25 +167,18 @@ task setupLazyProps {
|
|||
// 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.
|
||||
[
|
||||
["ivyversions./commons-codec/commons-codec", "commons-codec", "commons-codec"],
|
||||
["ivyversions.io.dropwizard.metrics.version", "io.dropwizard.metrics", "metrics-core"],
|
||||
["ivyversions.org.apache.logging.log4j.version", "org.apache.logging.log4j", "log4j-core"],
|
||||
["ivyversions./org.apache.opennlp/opennlp-tools", "org.apache.opennlp", "opennlp-tools"],
|
||||
["ivyversions.org.apache.tika.version", "org.apache.tika", "tika-core"],
|
||||
["ivyversions.org.apache.zookeeper.version", "org.apache.zookeeper", "zookeeper"],
|
||||
|
||||
["ivy-zookeeper-version", "org.apache.zookeeper", "zookeeper"],
|
||||
["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)
|
||||
["ivyCommonsCodec", "commons-codec", "commons-codec"],
|
||||
["ivyDropwizardMetrics", "io.dropwizard.metrics", "metrics-core"],
|
||||
["ivyLog4j", "org.apache.logging.log4j", "log4j-core"],
|
||||
["ivyOpennlpTools", "org.apache.opennlp", "opennlp-tools"],
|
||||
["ivyTika", "org.apache.tika", "tika-core"],
|
||||
["ivyZookeeper", "org.apache.zookeeper", "zookeeper"],
|
||||
].each { p, depGroup, depId ->
|
||||
templateProps[p] = getVersion(depGroup, depId, configurations.depVer)
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// If replaceable properties change, we have to rerun the task.
|
||||
inputs.properties props
|
||||
|
||||
def dummyAntProject = new org.apache.tools.ant.Project()
|
||||
inputs.properties templateProps
|
||||
|
||||
from(file("src"), {
|
||||
exclude '**/*.template'
|
||||
|
@ -227,15 +196,9 @@ task prepareSources(type: Sync) {
|
|||
include '**/*.template'
|
||||
rename '(.+)\\.template', '$1'
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
dependsOn buildNavDataFiles
|
||||
|
||||
|
@ -347,7 +256,7 @@ task buildSite(type: JavaExec) {
|
|||
}
|
||||
|
||||
// Hook up custom tasks with standard tasks.
|
||||
check.dependsOn bareBonesHtmlValidation
|
||||
check.dependsOn buildSite
|
||||
|
||||
// Do not hook site building to assemble, at least for now.
|
||||
// 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
|
||||
# them to the <asciidoctor:convert/> ant task for precommit validation as well.
|
||||
solr-attributes: &solr-attributes-ref
|
||||
solr-root-path: "../../../"
|
||||
solr-guide-draft-status: "${solr-guide-draft-status}"
|
||||
solr-guide-version: "${solr-guide-version}"
|
||||
solr-guide-version-path: "${solr-guide-version-path}"
|
||||
solr-docs-version: "${solr-docs-version}"
|
||||
java-javadocs: "${javadoc.link}"
|
||||
solr-javadocs: "${html-solr-javadocs}"
|
||||
lucene-javadocs: "${html-lucene-javadocs}"
|
||||
build-date: "${DSTAMP}"
|
||||
build-year: "${current.year}"
|
||||
ivy-commons-codec-version: "${ivyversions./commons-codec/commons-codec}"
|
||||
ivy-dropwizard-version: "${ivyversions.io.dropwizard.metrics.version}"
|
||||
ivy-log4j-version: "${ivyversions.org.apache.logging.log4j.version}"
|
||||
ivy-opennlp-version: "${ivyversions./org.apache.opennlp/opennlp-tools}"
|
||||
ivy-tika-version: "${ivyversions.org.apache.tika.version}"
|
||||
ivy-zookeeper-version: "${ivyversions.org.apache.zookeeper.version}"
|
||||
solr-root-path: "${solrRootPath}"
|
||||
solr-guide-draft-status: "${solrGuideDraftStatus}"
|
||||
solr-guide-version-path: "${solrGuideVersionPath}"
|
||||
solr-docs-version: "${solrDocsVersion}"
|
||||
java-javadocs: "${javadocLink}"
|
||||
solr-javadocs: "${htmlSolrJavadocs}"
|
||||
lucene-javadocs: "${htmlLuceneJavadocs}"
|
||||
build-date: "${buildDate}"
|
||||
build-year: "${buildYear}"
|
||||
ivy-commons-codec-version: "${ivyCommonsCodec}"
|
||||
ivy-dropwizard-version: "${ivyDropwizardMetrics}"
|
||||
ivy-log4j-version: "${ivyLog4j}"
|
||||
ivy-opennlp-version: "${ivyOpennlpTools}"
|
||||
ivy-tika-version: "${ivyTika}"
|
||||
ivy-zookeeper-version: "${ivyZookeeper}"
|
||||
|
||||
asciidoctor:
|
||||
safe: 0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12 footer">
|
||||
©{{ 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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
<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="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-guide-version}}</title>
|
||||
<title>{% if page_id != "index" %}{{ page.title }} | {% endif %}{{ site.site_title }} {{ site.solr-attributes.solr-docs-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" 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 */
|
||||
|
||||
/* 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 */
|
||||
|
||||
.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:
|
||||
|
||||
[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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
[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 `-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.
|
||||
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.
|
||||
|
||||
*Pull Production Repo and Upload New Files*
|
||||
|
||||
|
|
Loading…
Reference in New Issue