Working build of jSword using the tweaks.

Lots of code taken from
https://github.com/mjdenham/and-bible/blob/master/jsword-tweaks/build.xml
and some re-written to make life easier.
This commit is contained in:
Bradlee Speice 2014-04-18 22:19:53 -04:00
parent 40b7ffd5fb
commit 63123a1a31
3 changed files with 173 additions and 0 deletions

View File

@ -1 +1,7 @@
/bin /bin
/build
/distribution
/ivy
/libs
/tools
/ivy.xml

View File

@ -0,0 +1,164 @@
<project name="buildJswordTweakedJar" default="copyJarsToMinimalBible"
basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Much of this code taken lovingly from https://github.com/mjdenham/and-bible/blob/master/jsword-tweaks/build.xml -->
<property name="jsword.project" location="../jsword" />
<property name="jsword.src" location="${jsword.project}/src/main/java" />
<property name="jsword.resources" location="${jsword.project}/src/main/resources" />
<property name="minbible.jsword.src" location="src/main/java/jsword" />
<property name="build.src" location="build/src" />
<property name="build.class" location="build/class" />
<property name="distribution" location="distribution" />
<property name="MinimalBible" location="../MinimalBible" />
<dirname property="core.basedir" file="${ant.file.core}" />
<property name="jsword-tweaks.home" location="${core.basedir}" />
<property name="jsword-dependencydir" location="${jsword-tweaks.home}/lib/jars" />
<path id="classpath">
<!-- First set of jars is given us by ivy -->
<fileset dir="${jsword-dependencydir}" includes="*.jar" />
<fileset dir="./libs" includes="*.jar" />
</path>
<target name="clean">
<delete dir="${build.src}" />
<delete dir="${build.class}" />
<delete dir="${distribution}" />
<!-- Forces us to redownload dependencies, but I'm OK with that -->
<delete dir="${jsword-dependencydir}" />
</target>
<target name="init" depends="clean">
<tstamp />
<mkdir dir="${build.src}" />
<mkdir dir="${build.class}" />
<mkdir dir="${distribution}" />
<mkdir dir="${jsword-dependencydir}" />
<copy todir="${jsword-tweaks.home}">
<fileset file="${jsword.project}/ivy.xml" />
</copy>
</target>
<target name="mergeCode" depends="init">
<copy todir="${build.src}">
<fileset dir="${jsword.src}" />
<fileset dir="${jsword.resources}">
<exclude name="org/crosswire/jsword/versification/**" />
</fileset>
</copy>
<copy todir="${build.src}" filtering="yes">
<fileset dir="${jsword.resources}">
<include name="org/crosswire/jsword/versification/**" />
</fileset>
<!-- zerosUnmapped causes exceptions and does not map verse 0 so comment
it out -->
<filterchain>
<tokenfilter>
<replaceregex pattern="!zerosUnmapped"
replace="#!zerosUnmapped // commented out" />
</tokenfilter>
</filterchain>
</copy>
<!-- switch the Chinese localisation defaults around so default CN is simplified
and TW is Traditional -->
<copy file="${jsword.resources}/BibleNames_zh.properties" tofile="${build.src}/BibleNames_zh_TW.properties" />
<copy file="${jsword.resources}/BibleNames_zh_CN.properties"
tofile="${build.src}/BibleNames_zh.properties" overwrite="true" />
<!--
<copy todir="${build.src}" overwrite="true">
<fileset dir="${minbible.jsword.src}" />
</copy>
-->
</target>
<target name="compile" depends="mergeCode, ivy">
<javac srcdir="${build.src}" destdir="${build.class}"
classpathref="classpath" debug="true" source="1.6" target="1.6" />
</target>
<target name="jar" depends="compile">
<jar jarfile="${distribution}/jsword.jar">
<fileset dir="${build.class}" />
<!-- need to include the .properties and .plugin files -->
<fileset dir="${build.src}">
<exclude name="**/*.java" />
<exclude name="**/*.html" />
</fileset>
</jar>
<jar jarfile="${distribution}/jsword-src.jar" basedir="${build.src}" />
</target>
<target name="copyJarsToMinimalBible" depends="jar"
description="Copy generated jars to And Bible for use">
<copy todir="${MinimalBible}/libs">
<fileset dir="${distribution}" includes="*.jar" excludes="*-src.jar" />
<fileset dir="${jsword-dependencydir}" includes="*.jar" />
</copy>
<copy todir="${MinimalBible}/libs-src">
<fileset dir="${distribution}" includes="*-src.jar" />
</copy>
</target>
<!--=======================================================================
== Use ivy to manage external jars. == These are properties related to ivy.
========================================================================= -->
<property name="ivy.version" value="2.3.0" />
<property name="tools.home" location="${jsword-tweaks.home}/tools" />
<property name="ivy.home" location="${tools.home}/ivy" />
<property name="ivy.url"
value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="ivy.jar.file" location="${ivy.home}/ivy-${ivy.version}.jar" />
<property name="ivy.quiet" value="default" /> <!-- default or quiet -->
<property name="ivy.sync" value="false" /> <!-- true or false -->
<property name="ivy.project.dir" location="${jsword-tweaks.home}" />
<property name="ivy.lib.dir" location="${ivy.project.dir}/lib" />
<property name="ivy.dep.file" location="${ivy.project.dir}/ivy.xml" />
<property name="ivy.default.ivy.user.dir" location="${ivy.project.dir}/ivy" />
<!-- Ivy.sync controls whether only the current version of jar is allowed.
== This is good when updating the project, but not from day-to-day == since
we build extra stuff into the same location. Having sync="true" == causes
that to be deleted and need to be restored. -->
<target name="ivy" description="Retrieve dependencies with ivy"
depends="ivy.task">
<ivy:retrieve sync="${ivy.sync}"
pattern="${ivy.lib.dir}/[type]s/[artifact]-[revision].[ext]" log="${ivy.quiet}" />
<ivy:cachepath pathid="default.path" />
</target>
<target name="ivy.clean" description="Remove the ivy installation">
<delete dir="${ivy.home}" />
</target>
<target name="ivy.clean-cache" description="Remove dependent jars that ivy manages"
depends="ivy.task">
<ivy:cleancache />
</target>
<!-- Make ivy visible to Ant -->
<target name="ivy.task" depends="ivy.download">
<path id="ivy.lib.path">
<fileset dir="${ivy.home}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path" />
</target>
<!-- Download ivy -->
<target name="ivy.download" depends="ivy.check" unless="ivy.present">
<mkdir dir="${ivy.home}" />
<!-- download Ivy from web site so that it can be used even without any
special installation -->
<get src="${ivy.url}" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!-- See if Ivy is installed -->
<target name="ivy.check">
<available file="${ivy.jar.file}" type="file" property="ivy.present" />
</target>
</project>

3
jsword-minimalbible/lib/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/javadocs
/sources
/jars