You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ct...@apache.org on 2017/03/16 16:53:18 UTC

[2/2] lucene-solr:jira/solr-10290: SOLR-10290: Add ivy and build files, etc.

SOLR-10290: Add ivy and build files, etc.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ec324b29
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ec324b29
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ec324b29

Branch: refs/heads/jira/solr-10290
Commit: ec324b294ce858733dd014399a27ccb2cb513def
Parents: 8736246
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Mar 16 11:51:06 2017 -0500
Committer: Cassandra Targett <ct...@apache.org>
Committed: Thu Mar 16 11:51:06 2017 -0500

----------------------------------------------------------------------
 solr/solr-ref-guide/.gitignore  |   1 +
 solr/solr-ref-guide/README.adoc |  23 +++++
 solr/solr-ref-guide/build.xml   | 188 +++++++++++++++++++++++++++++++++++
 solr/solr-ref-guide/ivy.xml     |  10 ++
 4 files changed, 222 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ec324b29/solr/solr-ref-guide/.gitignore
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/.gitignore b/solr/solr-ref-guide/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/solr/solr-ref-guide/.gitignore
@@ -0,0 +1 @@
+build/

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ec324b29/solr/solr-ref-guide/README.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/README.adoc b/solr/solr-ref-guide/README.adoc
new file mode 100644
index 0000000..dcca883
--- /dev/null
+++ b/solr/solr-ref-guide/README.adoc
@@ -0,0 +1,23 @@
+= Solr Ref Guide
+
+This is the source for the Solr Reference Guide.
+
+Raw content is stored in Asciidoc (`.adoc`) formated files in the `src/` directory.
+
+These files are processed with AsciiDoctor in 2 different ways:
+
+* Via 'Jekyll' to build an HTML browsable version of the Ref Guide
+** NOTE: This currently requires that you have already installed `ruby`, `jekyll`, and the `jekyll-asciidoc` plugin locally
+* Via `asciidoctor-ant` to build the officially released PDF version of the Ref Guide
+
+For details on building the ref guide, see `ant -p`.
+
+Key directories to be aware of:
+
+* `src` - where all human edited `*.adoc` files realted to the Guide live, as well as various configuration, theme, and template files.
+* `tools` - custom Java code for parsing metadata in our `src/*.adoc` files to produce some `_data/` files for site & pdf navigation purposes.
+* `build/content` - a copy of the `src` dir generated by ant where:
+** `*.template` files are processed to replace ant properties with their runtime values
+** some `build/content/_data` files are generated by our java tools based header attributes from each of the `*.adoc` files
+* `build/html-site` - HTML generated version of the ref guide
+* `build/apache-solr-ref-guide-X.Y.pdf` - PDF generated version of the ref guide

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ec324b29/solr/solr-ref-guide/build.xml
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/build.xml b/solr/solr-ref-guide/build.xml
new file mode 100644
index 0000000..444db44
--- /dev/null
+++ b/solr/solr-ref-guide/build.xml
@@ -0,0 +1,188 @@
+<project xmlns:asciidoctor="antlib:org.asciidoctor.ant" xmlns:ivy="antlib:org.apache.ivy.ant" >
+
+  <!-- TODO: once we're part of the lucene-solr git repo,
+       remove these lines and replace them with an import of common-build.xml -->
+  <property name="version.base" value="6.2.42" />
+  <tstamp>
+    <format property="current.year" pattern="yyyy"/>
+    <format property="DSTAMP" pattern="yyyy-MM-dd"/>
+  </tstamp>
+  <property name="ivy.sync" value="true"/>
+    <condition property="ivy.symlink">
+    <os family="unix"/>
+  </condition>
+  <!-- <import file="....../common-build.xml"/> -->
+
+
+
+
+  <!-- properties to use in our docs -->
+  <loadresource property="solr-docs-version">
+    <propertyresource name="version.base"/>
+    <filterchain>
+      <tokenfilter>
+        <filetokenizer/>
+        <replaceregex pattern="^(\d+\.\d+)(|\..*)$" replace="\1" flags="s"/>
+      </tokenfilter>
+    </filterchain>
+  </loadresource>
+  <loadresource property="solr-docs-version-path">
+    <propertyresource name="solr-docs-version"/>
+    <filterchain>
+      <tokenfilter>
+        <filetokenizer/>
+        <replaceregex pattern="^(\d+)\.(\d+)(|\..*)$" replace="\1_\2_0" flags="s"/>
+      </tokenfilter>
+    </filterchain>
+  </loadresource>
+  <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}/" />
+
+  <target name="resolve">
+    <mkdir dir="build/lib"/>
+    <ivy:retrieve type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"
+                  pattern="build/lib/[artifact]-[revision].[ext]" />
+  </target>
+
+  <property name="build.content.dir" location="build/content" />
+  <property name="main-page" value="apache-solr-reference-guide" />
+  <property name="pdf-filename" value="apache-solr-ref-guide-${solr-docs-version}.pdf" />
+
+  <!-- ====== TOOLS FOR GENERATING/VALIDATING BITS OF THE SITE / PDF ======= -->
+  <property name="tools-jar-name" value="solr-ref-guide-tools.jar" />
+  <path id="tools-compile-classpath">
+    <fileset dir="build/lib">
+      <include name="**/*.jar"/>
+      <exclude name="**/${tools-jar-name}" />
+    </fileset>
+  </path>
+  <path id="tools-run-classpath">
+    <fileset dir="build/lib">
+      <include name="**/*.jar"/>
+    </fileset>
+  </path>
+
+  <target name="clean">
+    <delete dir="build"/>
+  </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/classes"/>
+    <javac debug="yes"
+           debuglevel="source,lines,vars"
+           destdir="build/classes"
+           includeantruntime="false">
+      <compilerarg value="-Xlint:all"/>
+      <classpath refid="tools-compile-classpath"/>
+      <src path="tools/"/>
+    </javac>
+    <jar destfile="build/lib/${tools-jar-name}">
+      <fileset dir="build/classes"
+               includes="**/*.class"/>
+    </jar>
+  </target>
+
+  <target name="build-init" description="Prepares the build/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 needed by both the html and pdf artifacts">
+    <mkdir dir="${build.content.dir}/_data"/>
+    <java classname="BuildNavAndPDFBody"
+          failonerror="true"
+          fork="true">
+      <classpath refid="tools-run-classpath"/>
+      <arg value="${build.content.dir}"/>
+      <arg value="${main-page}"/>
+    </java>
+  </target>
+
+  <target name="check-links-and-anchors" depends="build-init,build-tools-jar" description="Parse the HTML site files to check for problematic links or anchors">
+    <java classname="CheckLinksAndAnchors"
+          failonerror="true"
+          fork="true">
+      <classpath refid="tools-run-classpath"/>
+      <arg value="${basedir}/build/html-site"/>
+    </java>
+  </target>
+  
+  <!-- ====== PDF Build ======= -->
+  <target name="build-pdf"
+          depends="build-nav-data-files,resolve"
+          description="Builds a PDF">
+    <taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml"
+             classpathref="tools-run-classpath"/>
+    <asciidoctor:convert
+                 sourceDirectory="${build.content.dir}/pdf"
+                 sourceDocumentName="SolrRefGuide-all.adoc"
+                 baseDir="${build.content.dir}"
+                 outputDirectory="build"
+                 backend="pdf"
+                 extensions="adoc"
+                 sourceHighlighter="coderay"
+                 embedAssets="true"
+                 imagesDir="${build.content.dir}"
+                 doctype="book"
+                 safemode="unsafe">
+      <attribute key="icons" value="font" />
+      <attribute key="icon-set" value="fa" />
+      <attribute key="docinfo!" value='' />
+      <attribute key="pdf-stylesDir" value="./pdf/themes"/>
+      <attribute key="pdf-style" value="refguide"/>
+      <attribute key="pdf-fontsDir" value="./pdf/fonts"/>
+      <attribute key="pagenums" value='' />
+      <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-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>
+    <move file="build/SolrRefGuide-all.pdf" tofile="build/${pdf-filename}" />
+    <echo>Finished Building ${basedir}/build/${pdf-filename}</echo>
+  </target>
+
+  <!-- ======= 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-init,build-nav-data-files"
+          description="Builds an HTML Site w/Jekyll">
+    <echo>Running Jekyll...</echo>
+    <exec executable="jekyll" dir="${build.content.dir}">
+      <arg value="build"/>
+    </exec>
+    <echo>Ready to browse site: ${basedir}/build/html-site/${main-page}.html</echo>
+  </target>
+
+  <target name="build"
+          description="Builds both a PDF and HTML versions of the ref guide"
+          depends="build-pdf,build-site">
+    <echo>PDF: ${basedir}/build/${pdf-filename}</echo>
+    <echo>SITE: ${basedir}/build/html-site/${main-page}.html</echo>
+  </target>
+
+</project>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ec324b29/solr/solr-ref-guide/ivy.xml
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/ivy.xml b/solr/solr-ref-guide/ivy.xml
new file mode 100644
index 0000000..f625aed
--- /dev/null
+++ b/solr/solr-ref-guide/ivy.xml
@@ -0,0 +1,10 @@
+<ivy-module version="2.0">
+  <info organisation="org.apache.solr" module="ref-guide-tools"/>
+  <dependencies>
+    <!-- v1.5.3 of asciidoctor-ant includes asciidoctorj-pdf 1.5.0-alpha.11,
+         which is the same as asciidoctor-pdf 1.5.0-alpha.11  -->
+    <dependency org="org.asciidoctor" name="asciidoctor-ant" rev="1.5.3" />
+    <dependency org="org.json" name="json" rev="20160810" />
+    <dependency org="org.jsoup" name="jsoup" rev="1.8.2" />
+  </dependencies>
+</ivy-module>