This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch jira/solr-15556-antora
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/jira/solr-15556-antora by this
push:
new 4c69aa3 Auto-generate playbook for local/official
4c69aa3 is described below
commit 4c69aa3f2a1051308fa9e12ea3301601b27911ed
Author: Houston Putman <[email protected]>
AuthorDate: Tue Feb 1 15:01:23 2022 -0500
Auto-generate playbook for local/official
---
solr/solr-ref-guide/build.gradle | 183 +++++++++++++--------
.../{playbook.yml => playbook.template.yml} | 16 +-
2 files changed, 122 insertions(+), 77 deletions(-)
diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index db05468..7731bfa 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -47,6 +47,8 @@ repositories {
configurations {
depVer
refGuide
+ officialPlaybook
+ localPlaybook
}
dependencies {
@@ -80,8 +82,6 @@ dependencies {
gems 'rubygems:slim:4.1.0'
gems 'rubygems:concurrent-ruby:1.1.9'
gems 'rubygems:http_parser.rb:0.6.0'
-
-
}
sourceSets {
@@ -148,51 +148,6 @@ ext {
]
}
-task buildAntoraYaml(type: Copy) {
- description "Creates an antora.yaml with all variables populated"
-
- from "antora.yml.template"
- into projectDir
- rename("antora.yml.template", "antora.yml")
-
- def splitVersion = version.toString().split("\\p{Punct}")
- def props = [
- // NOTE: Only include values here that are distinct and unique to the
Official Dockerfiles
- //
- // Values identical in both Dockerfiles should use consistent names in
both templates and
- // be defined in the task creation
-
- 'solr_version' :
"${splitVersion[0]}.${splitVersion[1]}.${splitVersion[2]}",
- 'solr_version_major': splitVersion[0],
- 'solr_version_minor': splitVersion[1],
- 'solr_version_patch': splitVersion[2],
- ]
- doFirst {
- // Set these dependency versions as lazy gstrings so that they're
resolved after evaluation.
- // These variable names must use underscores, not dashes or periods
- props.putAll([
- ["dep_version_commons_codec", "commons-codec", "commons-codec"],
- ["dep_version_dropwizard", "io.dropwizard.metrics",
"metrics-core"],
- ["dep_version_hadoop", "org.apache.hadoop", "hadoop-auth"],
- ["dep_version_log4j", "org.apache.logging.log4j", "log4j-core"],
- ["dep_version_opennlp", "org.apache.opennlp", "opennlp-tools"],
- ["dep_version_tika", "org.apache.tika", "tika-core"],
- ["dep_version_zookeeper", "org.apache.zookeeper", "zookeeper"],
- ["dep_version_lucene", "org.apache.lucene", "lucene-core"],
- ].collectEntries { propKey, depGroup, depId -> [propKey, "${->
project.getVersion(depGroup, depId)}"] })
-
- props.putAll([
- solrGuideDraftStatus : propertyOrDefault('solrGuideDraft',
"true").toBoolean() ? "DRAFT" : "",
- solrRootPath : project(':solr').projectDir.toString() +
File.separator,
- buildDate : rootProject.ext['buildDate'],
- buildYear : rootProject.ext['buildYear'],
- 'lucene_version_docs': props.dep_version_lucene.replaceAll("\\.",
"_")
- ])
- }
-
- expand(props)
-}
-
// dynamically define the 2 variations of each target that we need...
[ htmlSiteDetails, linkCheckSiteDetails ].each{ details ->
final def contentDir = file("${buildDir}/${details.path}-content")
@@ -346,31 +301,129 @@ node {
version = "16.13.2" // LTS
}
+ext {
+ playbooksDir = "${buildDir}/playbooks"
+ playbookTemplate = "playbook.template.yml"
+ localPlaybook = "local-playbook.yml"
+ officialPlaybook = "official-playbook.yml"
+ playbooksDir = "${buildDir}/playbooks"
+}
+
+task buildAntoraYaml {
+ description "Creates an antora.yml with all variables populated"
+
+ def templateYaml = "antora.yml.template"
+ def outputYaml = "antora.yml"
+
+ inputs.file(templateYaml)
+ outputs.file(outputYaml)
+
+ doLast {
+ def splitVersion = version.toString().split("\\p{Punct}")
+ def props = [
+ 'solr_version' :
"${splitVersion[0]}.${splitVersion[1]}.${splitVersion[2]}",
+ 'solr_version_major': splitVersion[0],
+ 'solr_version_minor': splitVersion[1],
+ 'solr_version_patch': splitVersion[2],
+ ]
+ // Set these dependency versions as lazy gstrings so that they're
resolved after evaluation.
+ // These variable names must use underscores, not dashes or periods
+ props.putAll([
+ ["dep_version_commons_codec", "commons-codec", "commons-codec"],
+ ["dep_version_dropwizard", "io.dropwizard.metrics",
"metrics-core"],
+ ["dep_version_hadoop", "org.apache.hadoop", "hadoop-auth"],
+ ["dep_version_log4j", "org.apache.logging.log4j", "log4j-core"],
+ ["dep_version_opennlp", "org.apache.opennlp", "opennlp-tools"],
+ ["dep_version_tika", "org.apache.tika", "tika-core"],
+ ["dep_version_zookeeper", "org.apache.zookeeper", "zookeeper"],
+ ["dep_version_lucene", "org.apache.lucene", "lucene-core"],
+ ].collectEntries { propKey, depGroup, depId -> [propKey, "${->
project.getVersion(depGroup, depId)}"] })
+
+ props.putAll([
+ solrRootPath : project(':solr').projectDir.toString() +
File.separator,
+ buildDate : rootProject.ext['buildDate'],
+ buildYear : rootProject.ext['buildYear'],
+ lucene_version_docs : props.dep_version_lucene.replaceAll("\\.",
"_")
+ ])
+
+ copy {
+ from(templateYaml) {
+ rename {
+ outputYaml
+ }
+ }
+ into projectDir
+
+ expand(props)
+ }
+ }
+}
+
+task buildLocalAntoraPlaybookYaml(type: Copy) {
+ description "Creates ${project.ext.localPlaybook} to build and test the
site locally"
+
+ from(project.ext.playbookTemplate) {
+ rename {
+ project.ext.localPlaybook
+ }
+ }
+ into project.ext.playbooksDir
+
+ expand([
+ 'source_url' : projectDir.parentFile.parentFile.path,
+ 'source_branches' : "HEAD",
+ 'ui_bundle_url' :
"https://nightlies.apache.org/solr/draft-guides/ui-bundle.zip",
+ ])
+}
+
+task buildOfficialAntoraPlaybookYaml(type: Copy) {
+ description "Creates ${project.ext.officialPlaybook} to build the official
Solr ref-guide"
+
+ from(project.ext.playbookTemplate) {
+ rename {
+ project.ext.officialPlaybook
+ }
+ }
+ into project.ext.playbooksDir
+
+ expand([
+ 'source_url' : "https://github.com/apache/solr.git",
+ 'source_branches' : ["jira/solr-15556-antora"],
+ 'ui_bundle_url' :
"https://nightlies.apache.org/solr/draft-guides/ui-bundle.zip",
+ ])
+}
+
+dependencies {
+ localPlaybook
files("${project.ext.playbooksDir}/${project.ext.localPlaybook}") {
+ builtBy tasks.buildLocalAntoraPlaybookYaml
+ }
+ officialPlaybook
files("${project.ext.playbooksDir}/${project.ext.officialPlaybook}") {
+ builtBy tasks.buildOfficialAntoraPlaybookYaml
+ }
+}
+
+def isLocalGuide = propertyOrEnvOrDefault("refguide.local", "REFGUIDE_LOCAL",
"true").contains("t")
// Documentation for Antora-Gradle plugin at
// https://gitlab.com/antora/antora-gradle-plugin
antora {
// TODO document these properties in help
- playbookFile = file(propertyOrEnvOrDefault("refguide.playbook",
"REFGUIDE_PLAYBOOK", "playbook.yml"))
- antoraVersion = "3.0.1"
+ playbookFile = file("${project.ext.playbooksDir}/${isLocalGuide ?
project.ext.localPlaybook : project.ext.officialPlaybook}")
+ antoraVersion = "3.0.1"
// TODO this is duplicated but I think the other instance of this is going
away because it's specific to jekyll?
// Set these dependency versions as lazy gstrings so that they're resolved
after evaluation.
arguments = [
- // [ asciidoctor-attribute-key, "maven.groupId", "maven.artifactId" ]
- ["ivy-commons-codec-version", "commons-codec", "commons-codec"],
- ["ivy-dropwizard-version", "io.dropwizard.metrics",
"metrics-core"],
- ["ivy-hadoop-version", "org.apache.hadoop", "hadoop-auth"],
- ["ivy-log4j-version", "org.apache.logging.log4j", "log4j-core"],
- ["ivy-opennlp-version", "org.apache.opennlp", "opennlp-tools"],
- ["ivy-tika-version", "org.apache.tika", "tika-core"],
- ["ivy-zookeeper-version", "org.apache.zookeeper", "zookeeper"],
- ].collectEntries {
- propKey, depGroup, depId -> [propKey, "${ ->
project.getVersion(depGroup, depId) }"]
- }.collect { k,v -> ['--attribute', "$k=$v"]}.flatten() + '--fetch'
-
- // TODO figure out if we can fail the build when this task outputs errors
about broken links
- // TODO declare inputs and outputs so that we can cache the results
-}
+ "--fetch",
+ "--to-dir=${buildDir}/site",
+ ]
+ // TODO figure out if we can fail the build when this task outputs errors
about broken links
+ // TODO declare inputs and outputs so that we can cache the results
+}
-tasks.antora.dependsOn tasks.buildAntoraYaml
\ No newline at end of file
+tasks.antora.dependsOn tasks.buildAntoraYaml
+if (isLocalGuide) {
+ tasks.antora.dependsOn configurations.localPlaybook
+} else {
+ tasks.antora.dependsOn configurations.officialPlaybook
+}
\ No newline at end of file
diff --git a/solr/solr-ref-guide/playbook.yml
b/solr/solr-ref-guide/playbook.template.yml
similarity index 56%
rename from solr/solr-ref-guide/playbook.yml
rename to solr/solr-ref-guide/playbook.template.yml
index 65b4d5f..f3f5e9d 100644
--- a/solr/solr-ref-guide/playbook.yml
+++ b/solr/solr-ref-guide/playbook.template.yml
@@ -12,24 +12,16 @@ urls:
# See https://docs.antora.org/antora/latest/playbook/urls-redirect-facility/
# redirect_facility: httpd
content:
-# The URL for "Edit this page" links will always go to 'main' in Github
+ # The URL for "Edit this page" links will always go to 'main' in Github
edit_url: '{web_url}/tree/main/{path}'
sources:
-# TODO: this section needs to be edited before merging
- - url: https://github.com/apache/solr.git
- branches: jira/solr-15556-antora
+ - url: "${source_url}"
+ branches: ${source_branches}
start_path: solr/solr-ref-guide
-# Uncomment these sections for local development but DO NOT COMMIT IT
-# - url: ../..
-# branches: HEAD
-# start_path: solr/solr-ref-guide
ui:
bundle:
-# Uncomment next line when developing UI to see local changes before pushing
-# url: ./ui/build/ui-bundle.zip
-# Uncomment next line when pulling stable UI build from nightlies
- url: https://nightlies.apache.org/solr/draft-guides/ui-bundle.zip
+ url: "${ui_bundle_url}"
snapshot: true
output:
clean: true