SOLR-9450: The docs/ folder in the binary distribution now contains a single index.html file linking to the online documentation, reducing the size of the download

This commit is contained in:
Uwe Schindler 2017-02-23 15:43:45 +01:00
parent 3ad6e41910
commit 894a43b259
5 changed files with 109 additions and 7 deletions

View File

@ -246,6 +246,9 @@ Other Changes
* SOLR-10020: Cannot reload a core if it fails initialization. (Mike Drob via Erick Erickson)
* SOLR-9450: The docs/ folder in the binary distribution now contains a single index.html file linking
to the online documentation, reducing the size of the download (janhoy, Shawn Heisey, Uwe Schindler)
================== 6.4.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
@ -697,7 +700,7 @@ Upgrade Notes
New Features
----------------------
* SOLR-5725: facet.method=enum can bypass exact counts calculation with facet.exists=true, it just returns 1 for
* SOLR-5725: facet.method=enum can bypass exact counts calculation with facet.exists=true, it just returns 1 for
terms which exists in result docset. (Alexey Kozhemiakin, Sebastian Koziel, Radoslaw Zielinski via Mikhail Khludnev)
* SOLR-9127: Excel workbook (.xlsx) response writer. use 'wt=xlsx' (Tony Moriarty, noble)
@ -974,7 +977,6 @@ Other Changes
* SOLR-9371: Fix bin/solr calculations for start/stop wait time and RMI_PORT.
(Shawn Heisey via Erick Erickson)
================== 6.2.1 ==================
Bug Fixes

View File

@ -118,7 +118,7 @@ dist/solr-<component>-XX.jar
for more information).
docs/index.html
The Apache Solr Javadoc API documentation and Tutorial
A link to the online version of Apache Solr Javadoc API documentation and Tutorial
Instructions for Building Apache Solr from Source

View File

@ -209,6 +209,21 @@
</filterchain>
</copy>
</target>
<target name="documentation-online" description="Generate a link to the online documentation"
depends="define-solr-javadoc-url">
<xslt in="${ant.file}" out="${javadoc-online.dir}/index.html" style="site/online-link.xsl" force="true">
<outputproperty name="method" value="html"/>
<outputproperty name="version" value="4.0"/>
<outputproperty name="encoding" value="UTF-8"/>
<outputproperty name="indent" value="yes"/>
<param name="version" expression="${version}"/>
<param name="solrJavadocUrl" expression="${solr.javadoc.url}"/>
</xslt>
<copy todir="${javadoc-online.dir}">
<fileset dir="site/assets" includes="**/solr.svg"/>
</copy>
</target>
<target name="process-webpages" depends="define-lucene-javadoc-url,resolve-pegdown">
<makeurl property="process-webpages.buildfiles" separator="|">
@ -455,7 +470,7 @@
<target name="prepare-release" depends="prepare-release-no-sign, sign-artifacts"/>
<!-- make a distribution -->
<target name="package" depends="package-src-tgz,create-package,-dist-changes,-dist-keys"/>
<target name="package" depends="package-src-tgz,create-package,documentation,-dist-changes,-dist-keys"/>
<!-- copy changes/ to the release folder -->
<target name="-dist-changes">
@ -545,7 +560,7 @@
<target name="init-dist"/>
<target name="dist"/>
<target name="server"/>
<target name="documentation"/>
<target name="documentation-online"/>
</antcall>
<mkdir dir="${dest}/${fullnamever}"/>
<delete includeemptydirs="true">
@ -586,7 +601,7 @@
dist/solrj-lib/*
dist/test-framework/**"
excludes="**/*.tgz **/*.zip **/*.md5 **/*src*.jar **/*docs*.jar **/*.sha1" />
<tarfileset dir="${javadoc.dir}"
<tarfileset dir="${javadoc-online.dir}"
prefix="${fullnamever}/docs" />
</tar>
<make-checksums file="${package.dir}/${fullnamever}.tgz"/>

View File

@ -42,6 +42,7 @@
<property name="server.dir" location="${common-solr.dir}/server" />
<property name="example" location="${common-solr.dir}/example" />
<property name="javadoc.dir" location="${dest}/docs"/>
<property name="javadoc-online.dir" location="${dest}/docs-online"/>
<property name="tests.cleanthreads.sysprop" value="perClass"/>
<property name="changes.target.dir" location="${dest}/docs/changes"/>
@ -339,7 +340,7 @@
<groovy><![CDATA[
String url, version = properties['version'];
String useLocalJavadocUrl = properties['useLocalJavadocUrl'];
if (version.contains('-SNAPSHOT') || Boolean.parseBoolean(useLocalJavadocUrl)) {
if (version != properties['version.base'] || Boolean.parseBoolean(useLocalJavadocUrl)) {
url = new File(properties['common.dir'], 'build' + File.separator + 'docs').toURI().toASCIIString();
if (!(url =~ /\/$/)) url += '/';
} else {
@ -351,6 +352,21 @@
]]></groovy>
</target>
<target name="define-solr-javadoc-url" depends="resolve-groovy" unless="solr.javadoc.url">
<groovy><![CDATA[
String url, version = properties['version'];
if (version != properties['version.base']) {
url = '';
task.log('Disabled Solr Javadocs online URL for packaging (custom build / SNAPSHOT version).');
} else {
version = version.replace('.', '_');
url = 'http://lucene.apache.org/solr/' + version + '/';
task.log('Using the following URL to refer to Solr Javadocs: ' + url);
}
properties['solr.javadoc.url'] = url;
]]></groovy>
</target>
<target name="jar-src">
<sequential>
<mkdir dir="${build.dir}"/>

69
solr/site/online-link.xsl Normal file
View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="version"/>
<xsl:param name="solrJavadocUrl"/>
<!--
NOTE: This template matches the root element of any given input XML document!
The XSL input file is ignored completely, but XSL expects one to be given,
so build.xml passes itself here. The list of module build.xmls is given via
string parameter, that must be splitted at '|'.
-->
<xsl:template match="/">
<html>
<head>
<title><xsl:text>Apache Solr </xsl:text><xsl:value-of select="$version"/><xsl:text> Documentation</xsl:text></title>
<link rel="icon" type="image/x-icon" href="images/favicon.ico"/>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"/>
</head>
<body>
<div>
<a href="http://lucene.apache.org/solr/">
<img src="images/solr.svg" style="width:210px; margin:22px 0px 7px 20px; border:none;" title="Apache Solr Logo" alt="Solr" />
</a>
<div style="z-index:100;position:absolute;top:25px;left:226px">
<span style="font-size: x-small">TM</span>
</div>
</div>
<h1>
<xsl:text>Apache Solr</xsl:text>
<span style="vertical-align: top; font-size: x-small">
<xsl:text>TM</xsl:text>
</span>
<xsl:text> </xsl:text>
<xsl:value-of select="$version"/>
<xsl:text> Documentation</xsl:text>
</h1>
<p>
<xsl:choose>
<xsl:when test="$solrJavadocUrl">
<a href="{$solrJavadocUrl}">Follow this link to view online documentation for Solr <xsl:value-of select="$version"/>.</a>
</xsl:when>
<xsl:otherwise>
No online documentation available for custom builds or SNAPSHOT versions. Run <code>ant documentation</code> from <code>src.tgz</code> package to build docs locally.
</xsl:otherwise>
</xsl:choose>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>