Apache Solr open-source search software
SOLR-10675: differentiate DRAFT builds of the html/pdf ref-guides vs the official releases
Chris Hostetterb552127ea36b
diff --git a/solr/solr-ref-guide/build.xml b/solr/solr-ref-guide/build.xmlindex a23bac85740..74e6deedf67 100644--- a/solr/solr-ref-guide/build.xml+++ b/solr/solr-ref-guide/build.xml@@ -20,10 +20,12 @@<project name="solr-ref-guide" default="default" xmlns:asciidoctor="antlib:org.asciidoctor.ant" ><import file="../common-build.xml"/>-<!-- properties to use in our docs --><loadresource property="solr-docs-version">- <propertyresource name="version.base"/>+ <!-- NOTE: this is specifically only the "major.minor", it does not include the ".bugfix"+ This is because we (currently) only release the guide for minor versions.+ -->+ <propertyresource name="version"/><filterchain><tokenfilter><filetokenizer/>@@ -32,6 +34,7 @@</filterchain></loadresource><loadresource property="solr-docs-version-path">+ <!-- NOTE: This is the ${solr-docs-version} as a path suitbale for linking to javadocs --><propertyresource name="solr-docs-version"/><filterchain><tokenfilter>@@ -40,12 +43,41 @@</tokenfilter></filterchain></loadresource>+ <!-- NOTE: ${solr-guide-version} is the version of this ref-guide.++ By default, we assume this is the same as ${solr-docs-version} with a "-DRAFT" suffix+ When releasing, specify an explicit value of this property on the command line.++ NOTE: the ${solr-guide-version} used *may* be different from the version of Solr the guide+ covers if we decide to do a bug-fix release of the ref-guide++ Examples: (assume branch_6_1 where version=6.1.SOMETHING)++ Basic nightly/local build of the 6.1 guide...++ => ant build-pdf++ Official release build of the 6.1 guide...++ => ant build-pdf -Dsolr-guide-version=6.1++ Release of a "6.1.1" ref guide, correcting some serious error in the docs+ (even if there is no 6.1.1 version - or if we've alreayd released up to 6.1.5 - of Solr itself)++ => ant build-pdf -Dsolr-guide-version=6.1.1++ -->+ <property name="solr-guide-version" value="${solr-docs-version}-DRAFT" />+ <condition property="solr-guide-draft-status" value="" else="DRAFT">+ <matches pattern="^\d+\.\d+(|\.\d+)$" string="${solr-guide-version}" />+ </condition>+<property name="solr-javadocs" value="https://lucene.apache.org/solr/${solr-docs-version-path}/" /><property name="lucene-javadocs" value="https://lucene.apache.org/core/${solr-docs-version-path}/" /><property name="build.content.dir" location="${build.dir}/content" /><property name="main-page" value="index" />- <property name="pdf-filename" value="apache-solr-ref-guide-${solr-docs-version}.pdf" />+ <property name="pdf-filename" value="apache-solr-ref-guide-${solr-guide-version}.pdf" /><!-- ====== TOOLS FOR GENERATING/VALIDATING BITS OF THE SITE / PDF ======= --><property name="tools-jar-name" value="solr-ref-guide-tools.jar" />@@ -157,6 +189,8 @@<!-- NOTE: If you add any attributes here for use in adoc files, you almost certainly need to also addthem to the _config.yml.template file for building the jekyll site as well-->+ <attribute key="solr-guide-draft-status" value="${solr-guide-draft-status}" />+ <attribute key="solr-guide-version" value="${solr-guide-version}" /><attribute key="solr-docs-version" value="${solr-docs-version}" /><attribute key="solr-javadocs" value="${solr-javadocs}" /><attribute key="lucene-javadocs" value="${lucene-javadocs}" />diff --git a/solr/solr-ref-guide/meta-docs/pdf.adoc b/solr/solr-ref-guide/meta-docs/pdf.adocindex 74921be91a6..1520d5c251e 100644--- a/solr/solr-ref-guide/meta-docs/pdf.adoc+++ b/solr/solr-ref-guide/meta-docs/pdf.adoc@@ -86,11 +86,7 @@ Our Ant target (`build-pdf`) uses the following settings:<!-- NOTE: If you add any attributes here for use in adoc files, you almost certainly need to also addthem to the _config.yml.template file for building the jekyll site as well-->- <attribute key="solr-docs-version" value="${solr-docs-version}" />- <attribute key="solr-javadocs" value="${solr-javadocs}" />- <attribute key="lucene-javadocs" value="${lucene-javadocs}" />- <attribute key="build-date" value="${DSTAMP}" />- <attribute key="build-year" value="${current.year}" />+ <!-- ... --></asciidoctor:convert>----@@ -124,7 +120,9 @@ There are a lot of options here. Note that some include the `<attribute>` tag anThese attributes use variables that are inserted by Ant during the PDF creation process. This allows us to pull from standard Lucene/Solr build files, and not have to update several places for any release. The Ant build process updates the `_config.yml` file from the `_config.yml.template`, then these attributes pull the proper value from that file.-`<attribute key="solr-docs-version" value="${solr-docs-version}" />`:: Sets the version to the current release version.+`<attribute key="solr-guide-draft-status" value="${solr-guide-draft-status}" />`:: Indicates if this is a `DRAFT` PDF or not.+`<attribute key="solr-guide-version" value="${solr-guide-version}" />`:: The version of the Guide itself.+`<attribute key="solr-docs-version" value="${solr-docs-version}" />`:: The version of Solr covered by this guide.`<attribute key="solr-javadocs" value="${solr-javadocs}" />`:: Sets the path for Solr javadoc links to include the right path for the current release version.`<attribute key="lucene-javadocs" value="${lucene-javadocs}" />`:: Sets the path for Lucene javadoc links to the right path for the current release version.`<attribute key="build-date" value="${DSTAMP}" />`:: Sets the date of the build to add the date to the footer of each page of the PDF.diff --git a/solr/solr-ref-guide/meta-docs/publish.adoc b/solr/solr-ref-guide/meta-docs/publish.adocindex 5a8fccb1cba..a2a6d4175b3 100644--- a/solr/solr-ref-guide/meta-docs/publish.adoc+++ b/solr/solr-ref-guide/meta-docs/publish.adoc@@ -22,9 +22,14 @@ The build process generates the PDF, including the page hierarchy, and then runsTo build the PDF:-. Run `ant build-pdf`+. Run `ant build-pdf -Dsolr-guide-version=X.Y`. The resulting PDF will be in `solr/build/solr-ref-guide`.+Important::+++The `-Dsolr-guide-version` system property is optional. By default the build system uses the `version.properties` of the current branch and assumes this is a `DRAFT` build.+++=== Prerequisites* You have checked out the Lucene/Solr source code on the machine you will be doing the release from. You will need scripts in the `dev-tools` directory.@@ -134,10 +139,13 @@ The steps to publish the Guide differ depending on if it is the first time the G=== Building the HTML Version-If you have the required dependencies on your local machine, you can build the HTML version with `ant build-site`. The dependencies are listed in `solr-ref-guide/README.adoc`.+If you have the required dependencies on your local machine, you can build the HTML version with `ant build-site -Dsolr-guide-version=X.Y`. The dependencies are listed in `solr-ref-guide/README.adoc`.+Tip::++//TODO update Jenkins link-If you do not have the required dependencies, and don't choose to install them, you can download the files from the Jenkins (https://builds.apache.org/job/Solr-reference-guide-jira-SOLR-10290/lastSuccessfulBuild/artifact/solr/build/solr-ref-guide/html-site/[Solr Reference Guide job]).+If you do not have the required dependencies, and don't choose to install them, you can download the files from the Jenkins (https://builds.apache.org/job/Solr-reference-guide-jira-SOLR-10290/lastSuccessfulBuild/artifact/solr/build/solr-ref-guide/html-site/[Solr Reference Guide job]). But these HTML pages will have the `DRAFT` status noted in them and will not be suitable for publishing.++=== Publish a New Guide// A lot of this was copied from https://wiki.apache.org/lucene-java/ReleaseTodo#Website_.2B-.3D_javadocs. See that section for explanations for why some steps are required.@@ -151,7 +159,7 @@ svn co --depth=immediates https://svn.apache.org/repos/asf/lucene/cms/trunk/cont+* If you already have this repo checked out, you can simply `svn up website-source` to update to the latest revision.. `cd website-source`-. Add Guide branch dir: `echo solr/guide/X_Y_Z >> extpaths.txt`+. Add Guide branch dir: `echo solr/guide/X_Y >> extpaths.txt`. Commit changes:+[source,bash]@@ -159,7 +167,7 @@ svn commit -m "Update CMS production sync exceptions for X_Y_Z Guide" extpaths.t==== Step 2: Push Guide to Website Production-Go to the checkout directory where you have built the Guide and push the documentation via subversion import. You must push it to the path you just added to `extpaths.txt`, so if the path you added was `solr/guide/6.5`, you'll use the path as shown in the below example:+Go to the checkout directory where you have built the Guide and push the documentation via subversion import. You must push it to the path you just added to `extpaths.txt`, so if the path you added was `solr/guide/6_5`, you'll use the path as shown in the below example:[source,bash]svn -m "Add Ref Guide for Solr 6.5" import <checkoutroot>/solr/build/solr-ref-guide/html-site https://svn.apache.org/repos/infra/websites/production/lucene/content/solr/guide/6_5diff --git a/solr/solr-ref-guide/src/_config.yml.template b/solr/solr-ref-guide/src/_config.yml.templateindex c1e92717693..dd7173cfb9f 100755--- a/solr/solr-ref-guide/src/_config.yml.template+++ b/solr/solr-ref-guide/src/_config.yml.template@@ -85,6 +85,8 @@ 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 building the PDF as well.solr-attributes: &solr-attributes-ref+ solr-guide-draft-status: "${solr-guide-draft-status}"+ solr-guide-version: "${solr-guide-version}"solr-docs-version: "${solr-docs-version}"solr-javadocs: "${solr-javadocs}"lucene-javadocs: "${lucene-javadocs}"diff --git a/solr/solr-ref-guide/src/_includes/footer.html b/solr/solr-ref-guide/src/_includes/footer.htmlindex c22f239545e..ab96ec7da77 100755--- a/solr/solr-ref-guide/src/_includes/footer.html+++ b/solr/solr-ref-guide/src/_includes/footer.html@@ -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 last generated: {{ site.solr-attributes.build-date }} <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 /><p><img src="{{ "solr-sunOnly-small.png" }}" alt="Apache Solr"/></p></div></div>diff --git a/solr/solr-ref-guide/src/_includes/head.html b/solr/solr-ref-guide/src/_includes/head.htmlindex 03b0db8c299..4e665930010 100755--- a/solr/solr-ref-guide/src/_includes/head.html+++ b/solr/solr-ref-guide/src/_includes/head.html@@ -3,7 +3,8 @@<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}}">-<title>{{ page.title }} | {{ site.site_title }}</title>+{% comment %}NOTE: explicitly using the GUIDE version here (not solr) {% endcomment %}+<title>{{ page.title }} | {{ site.site_title }} {{ site.solr-attributes.solr-guide-version}}</title><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="css/bootstrap.min.css">-->diff --git a/solr/solr-ref-guide/src/_includes/sidebar.html b/solr/solr-ref-guide/src/_includes/sidebar.htmlindex 4b4124c8f9b..56be9bcb844 100755--- a/solr/solr-ref-guide/src/_includes/sidebar.html+++ b/solr/solr-ref-guide/src/_includes/sidebar.html@@ -1,7 +1,13 @@{% assign sidebar = site.data.sidebar %}<ul id="mysidebar" class="nav">- <li class="sidebarTitle">{{sidebar.title}} <!-- TODO: version from site.data --></li>+ <li class="sidebarTitle">{{sidebar.title}}</li>+ {% if "" != site.solr-attributes.solr-guide-draft-status %}+ <li class="draft-notice">+ This is an unofficial DRAFT of the Guide for {{ site.solr-attributes.solr-docs-version }}.+ <a href="https://lucene.apache.org/solr/guide/">Official releases of this Guide are available from the Solr website</a>.+ </li>+ {% endif %}{% for level1item in sidebar.kids %}<li class="sb-level1"><a href="{{level1item.url | remove: "/"}}">{{ level1item.title }}</a>diff --git a/solr/solr-ref-guide/src/_includes/topnav.html b/solr/solr-ref-guide/src/_includes/topnav.htmlindex 677f850fb49..7ed1f685d5c 100755--- a/solr/solr-ref-guide/src/_includes/topnav.html+++ b/solr/solr-ref-guide/src/_includes/topnav.html@@ -8,6 +8,7 @@<span class="icon-bar"></span><span class="icon-bar"></span></button>+ {% comment %} NOTE: Explicitly using *SOLR* version here (not guide){% endcomment %}<a class="fa fa-home fa-lg navbar-brand" href="index.html"> <span class="projectTitle"> {{site.topnav_title}} {{ site.solr-attributes.solr-docs-version }}</span></a></div><div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">diff --git a/solr/solr-ref-guide/src/_layouts/default.html b/solr/solr-ref-guide/src/_layouts/default.htmlindex aa4601f1fa1..357dacf5e13 100755--- a/solr/solr-ref-guide/src/_layouts/default.html+++ b/solr/solr-ref-guide/src/_layouts/default.html@@ -31,7 +31,7 @@</script></head>-<body id="{{ page.shortname }}">+<body class="{{ site.solr-attributes.solr-guide-draft-status }}" id="{{ page.shortname }}">{% include topnav.html %}<!-- Page Content --><div class="container">diff --git a/solr/solr-ref-guide/src/css/customstyles.css b/solr/solr-ref-guide/src/css/customstyles.cssindex 057cd86e3dd..4499a0fb3bf 100755--- a/solr/solr-ref-guide/src/css/customstyles.css+++ b/solr/solr-ref-guide/src/css/customstyles.css@@ -211,6 +211,20 @@ background-color: #347DBE;padding: 2px 10px;background-color: #f1f1f1;}+.nav li.draft-notice {+ /* we don't want the draft water mark to make this hard to notice */+ background-color: rgb(255, 255, 255);+}+.nav li.draft-notice a, .nav li.draft-notice a:hover, .nav li.draft-notice a:active .nav li.draft-notice a:focus {+ display: inline;+ color: #2156a5;+ text-decoration: underline;++ position: inherit;+ line-height: inherit;+ padding: inherit;+ background-color: inherit;+}.nav > li > a {line-height: 20px;diff --git a/solr/solr-ref-guide/src/css/ref-guide.css b/solr/solr-ref-guide/src/css/ref-guide.cssindex 100266b7c65..2087abf8d0f 100644--- a/solr/solr-ref-guide/src/css/ref-guide.css+++ b/solr/solr-ref-guide/src/css/ref-guide.css@@ -76,6 +76,10 @@ bodymargin: 0;}+body.DRAFT {+ background-image: url("../draft-background.png");+}+a{background: transparent;diff --git a/solr/solr-ref-guide/src/draft-background.png b/solr/solr-ref-guide/src/draft-background.pngnew file mode 100644index 00000000000..b6aac825e45Binary files /dev/null and b/solr/solr-ref-guide/src/draft-background.png differdiff --git a/solr/solr-ref-guide/src/pdf/themes/refguide-theme.yml b/solr/solr-ref-guide/src/pdf/themes/refguide-theme.ymlindex 5e272ced49b..eb798855967 100644--- a/solr/solr-ref-guide/src/pdf/themes/refguide-theme.yml+++ b/solr/solr-ref-guide/src/pdf/themes/refguide-theme.yml@@ -250,10 +250,10 @@ footer:# * {section-or-chapter-title}# We have added some custom variables from the build, see _config.yml.templaterecto_content:- right: 'Published: {build-date}'+ right: 'Guide Version {solr-guide-version} - Published: {build-date}'left: '(C) {build-year}, Apache Software Foundation'verso_content:- left: 'Published: {build-date}'+ left: 'Guide Version {solr-guide-version} - Published: {build-date}'right: '(C) {build-year}, Apache Software Foundation'colophon:font_size: $base_font_size_small