| <?xml version="1.0"?> |
| <!-- |
| 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. |
| --> |
| <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"> |
| <!-- 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/> |
| <replaceregex pattern="^(\d+\.\d+)(|\..*)$" replace="\1" flags="s"/> |
| </tokenfilter> |
| </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> |
| <filetokenizer/> |
| <replaceregex pattern="^(\d+)\.(\d+)(|\..*)$" replace="\1_\2_0" flags="s"/> |
| </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-site |
| |
| Official build of the 6.1 guide... |
| |
| => ant build-site -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 already released up to 6.1.5 - of Solr itself) |
| |
| => ant build-site -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> |
| |
| <loadresource property="solr-guide-version-path"> |
| <!-- NOTE: This is the ${solr-guide-version} as a path suitable for use publishing the HTML --> |
| <propertyresource name="solr-guide-version"/> |
| <filterchain> |
| <tokenfilter> |
| <filetokenizer/> |
| <replaceregex pattern="^(\d+)\.(\d+)(-DRAFT)?.*" replace="\1_\2\3" flags="s"/> |
| </tokenfilter> |
| </filterchain> |
| </loadresource> |
| |
| <!-- where we link to javadocs from the html guide, and if we validate them, is all dependent |
| on the 'local.javadocs' sysprop --> |
| <condition property="check-all-relative-links" value="-check-all-relative-links" else=""> |
| <isset property="local.javadocs" /> |
| </condition> |
| <condition property="html-solr-javadocs" |
| value="link:../../docs/" |
| else="https://lucene.apache.org/solr/${solr-docs-version-path}/"> |
| <isset property="local.javadocs" /> |
| </condition> |
| <condition property="html-lucene-javadocs" |
| value="link:../../../../lucene/build/docs/" |
| else="https://lucene.apache.org/core/${solr-docs-version-path}/"> |
| <isset property="local.javadocs" /> |
| </condition> |
| |
| <property name="build.content.dir" location="${build.dir}/content" /> |
| <property name="main-page" value="index" /> |
| <!-- for pulling in versions of major deps --> |
| <property prefix="ivyversions" file="${common.dir}/ivy-versions.properties"/> |
| |
| <!-- ====== TOOLS FOR GENERATING/VALIDATING BITS OF THE SITE ======= --> |
| <property name="tools-jar-name" value="solr-ref-guide-tools.jar" /> |
| <path id="tools-compile-classpath"> |
| <fileset dir="lib"> |
| <include name="**/*.jar"/> |
| <exclude name="**/${tools-jar-name}" /> |
| </fileset> |
| </path> |
| <path id="tools-run-classpath"> |
| <fileset dir="lib"> |
| <include name="**/*.jar"/> |
| </fileset> |
| <fileset dir="${build.dir}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <target name="clean"> |
| <delete dir="${build.dir}"/> |
| </target> |
| |
| <target name="build-tools-jar" depends="resolve" description="Builds the custom java tools use use for generating some data files from page metdata"> |
| <mkdir dir="${build.dir}/classes"/> |
| <!-- NOTE: we include the ant runtime so we can compile our customized version of the asciidoctor ant task --> |
| <javac debug="yes" |
| debuglevel="source,lines,vars" |
| destdir="${build.dir}/classes" |
| includeantruntime="true"> |
| <compilerarg value="-Xlint:all"/> |
| <classpath refid="tools-compile-classpath"/> |
| <src path="tools/"/> |
| </javac> |
| <copy todir="${build.dir}/classes" file="tools/asciidoctor-antlib.xml" /> |
| <jar destfile="${build.dir}/${tools-jar-name}"> |
| <fileset dir="${build.dir}/classes" |
| includes="**/*.class,**/*.xml"/> |
| </jar> |
| </target> |
| |
| <target name="build-init" description="Prepares the build's 'content' dir, copying over src files and transforming *.template files in the process"> |
| <delete dir="${build.content.dir}" /> |
| <mkdir dir="${build.content.dir}" /> |
| |
| <echo>Copying all non template files from src ...</echo> |
| <copy todir="${build.content.dir}"> |
| <fileset dir="src"> |
| <exclude name="**/*.template"/> |
| </fileset> |
| </copy> |
| <echo>Copy (w/prop replacement) any template files from src...</echo> |
| <copy todir="${build.content.dir}"> |
| <fileset dir="src"> |
| <include name="**/*.template"/> |
| </fileset> |
| <mapper type="glob" from="*.template" to="*"/> |
| <filterchain> |
| <expandproperties/> |
| </filterchain> |
| </copy> |
| </target> |
| |
| <target name="build-nav-data-files" depends="build-init,build-tools-jar" description="creates nav based data files"> |
| <mkdir dir="${build.content.dir}/_data"/> |
| <java classname="BuildNavDataFiles" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="tools-run-classpath"/> |
| <arg value="${build.content.dir}"/> |
| <arg value="${main-page}"/> |
| </java> |
| </target> |
| |
| <macrodef name="asciidoctor-convert"> |
| <!-- custom macro that fills in all the defaults we care about when running asciidoctor-ant |
| The primary purpose for this is to build a bare-bones HTML version for validating the |
| document structure (ie: duplicate anchors, links all point to valid anchors, |
| etc...) that we want to be able to validate even if the current user doesn't have jekyll installed |
| --> |
| <attribute name="sourceDirectory"/> |
| <attribute name="sourceDocumentName"/> |
| <attribute name="outputDirectory"/> |
| <attribute name="backend"/> |
| <attribute name="solr-javadocs" default="${html-solr-javadocs}" /> |
| <attribute name="lucene-javadocs" default="${html-lucene-javadocs}" /> |
| <attribute name="headerFooter" default="true" /> |
| <sequential> |
| <!-- NOTE: we have our own variant on the asciidoctor-ant task, so that sourceDocumentName="" |
| is treated the same as if it's unset (ie: null) |
| --> |
| <taskdef uri="antlib:org.asciidoctor.ant" resource="asciidoctor-antlib.xml" |
| classpathref="tools-run-classpath"/> |
| <asciidoctor:convert |
| sourceDirectory="@{sourceDirectory}" |
| sourceDocumentName="@{sourceDocumentName}" |
| baseDir="${build.content.dir}" |
| outputDirectory="@{outputDirectory}" |
| preserveDirectories="true" |
| backend="@{backend}" |
| headerFooter="@{headerFooter}" |
| extensions="adoc" |
| sourceHighlighter="coderay" |
| imagesDir="${build.content.dir}" |
| doctype="book" |
| safemode="unsafe"> |
| <attribute key="attribute-missing" value="warn" /> |
| <attribute key="icons" value="font" /> |
| <attribute key="icon-set" value="fa" /> |
| <attribute key="figure-caption!" value='' /> |
| <attribute key="idprefix" value='' /> |
| <attribute key="idseparator" value='-' /> |
| <!-- attributes used in adoc files --> |
| <!-- NOTE: If you add any attributes here for use in adoc files, you almost certainly need to also add |
| them to the _config.yml.template file for building the jekyll site as well |
| --> |
| <attribute key="solr-root-path" value="../../../" /> |
| <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="java-javadocs" value="${javadoc.link}" /> |
| <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}" /> |
| <attribute key="ivy-commons-codec-version" value="${ivyversions./commons-codec/commons-codec}" /> |
| <attribute key="ivy-dropwizard-version" value="${ivyversions.io.dropwizard.metrics.version}" /> |
| <attribute key="ivy-log4j-version" value="${ivyversions.org.log4j.major.version}" /> |
| <attribute key="ivy-opennlp-version" value="${ivyversions./org.apache.opennlp/opennlp-tools}" /> |
| <attribute key="ivy-tika-version" value="${ivyversions.org.apache.tika.version}" /> |
| <attribute key="ivy-velocity-tools-version" value="${ivyversions.org.apache.velocity.tools.version}" /> |
| <attribute key="ivy-zookeeper-version" value="${ivyversions.org.apache.zookeeper.version}" /> |
| </asciidoctor:convert> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- ======= HTML Site Build ======= |
| Builds site with Jekyll. |
| This (for now) assumes that Jekyll (http://jekyllrb.com) is installed locally. --> |
| <target name="build-site" |
| depends="-build-site" |
| description="Builds an HTML Site w/Jekyll and verifies the anchors+links are valid" > |
| <java classname="CheckLinksAndAnchors" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="tools-run-classpath"/> |
| <arg value="${build.dir}/html-site"/> |
| <arg value="${check-all-relative-links}" /> |
| </java> |
| <echo>Ready to browse site: ${build.dir}/html-site/${main-page}.html</echo> |
| </target> |
| <target name="-build-site" |
| depends="build-init,build-nav-data-files" > |
| <echo>Running Jekyll...</echo> |
| <exec executable="jekyll" dir="${build.content.dir}" failonerror="true"> |
| <arg value="build" /> |
| <arg value="--verbose"/> |
| </exec> |
| </target> |
| |
| <!-- ======= HTML Bare Bones Conversion ======= |
| Does a very raw converstion of the adoc files to HTML for the purpose of link & anchor checking |
| |
| Unlike the "HTML Site Build" above, this does *NOT* require Jekyll, and can be done entirely |
| With ivy deps fetched automatically. |
| --> |
| <target name="bare-bones-html-validation" depends="build-init,build-nav-data-files" |
| description="Builds (w/o Jekyll) a very simple html version of the guide and runs link/anchor validation on it"> |
| |
| <delete dir="${build.dir}/bare-bones-html"/> |
| <mkdir dir="${build.dir}/bare-bones-html"/> |
| <asciidoctor-convert sourceDirectory="${build.content.dir}" |
| sourceDocumentName="" |
| outputDirectory="${build.dir}/bare-bones-html" |
| headerFooter="false" |
| backend="html5" |
| solr-javadocs="${html-solr-javadocs}" |
| lucene-javadocs="${html-lucene-javadocs}" |
| /> |
| |
| <java classname="CheckLinksAndAnchors" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="tools-run-classpath"/> |
| <arg value="${build.dir}/bare-bones-html"/> |
| <arg value="-bare-bones" /> |
| <arg value="${check-all-relative-links}" /> |
| </java> |
| <echo>Validated Links & Anchors via: ${build.dir}/bare-bones-html/</echo> |
| </target> |
| |
| <target name="default" |
| description="Builds an HTML versions of the ref guide" |
| depends="build-site"> |
| <echo>SITE: ${build.dir}/html-site/${main-page}.html</echo> |
| </target> |
| |
| |
| |
| </project> |