No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <project name="buildJswordTweakedJar" default="copyJarsToMinimalBible"
  2. basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
  3. <!-- Much of this code taken lovingly from https://github.com/mjdenham/and-bible/blob/master/jsword-tweaks/build.xml -->
  4. <property name="jsword.project" location="jsword" />
  5. <property name="jsword.src" location="${jsword.project}/src/main/java" />
  6. <property name="jsword.resources" location="${jsword.project}/src/main/resources" />
  7. <property name="minbible.jsword.src" location="src/main/java/jsword" />
  8. <property name="build.src" location="build/src" />
  9. <property name="build.class" location="build/class" />
  10. <property name="distribution" location="distribution" />
  11. <property name="MinimalBible" location="../MinimalBible" />
  12. <dirname property="core.basedir" file="${ant.file.core}" />
  13. <property name="jsword-tweaks.home" location="${core.basedir}" />
  14. <property name="jsword-dependencydir" location="${jsword-tweaks.home}/lib/jars" />
  15. <path id="classpath">
  16. <!-- First set of jars is given us by ivy -->
  17. <fileset dir="${jsword-dependencydir}" includes="*.jar" />
  18. <fileset dir="./libs" includes="*.jar" />
  19. </path>
  20. <target name="clean">
  21. <delete dir="${build.src}" />
  22. <delete dir="${build.class}" />
  23. <delete dir="${distribution}" />
  24. <delete dir="${jsword-dependencydir}" />
  25. </target>
  26. <target name="init" depends="clean">
  27. <tstamp />
  28. <mkdir dir="${build.src}" />
  29. <mkdir dir="${build.class}" />
  30. <mkdir dir="${distribution}" />
  31. <mkdir dir="${jsword-dependencydir}" />
  32. </target>
  33. <target name="mergeCode" depends="init">
  34. <copy todir="${build.src}">
  35. <fileset dir="${jsword.src}" />
  36. <fileset dir="${jsword.resources}">
  37. <exclude name="org/crosswire/jsword/versification/**" />
  38. </fileset>
  39. </copy>
  40. <copy todir="${build.src}" filtering="yes">
  41. <fileset dir="${jsword.resources}">
  42. <include name="org/crosswire/jsword/versification/**" />
  43. </fileset>
  44. <!-- zerosUnmapped causes exceptions and does not map verse 0 so comment
  45. it out -->
  46. <filterchain>
  47. <tokenfilter>
  48. <replaceregex pattern="!zerosUnmapped"
  49. replace="#!zerosUnmapped // commented out" />
  50. </tokenfilter>
  51. </filterchain>
  52. </copy>
  53. <!-- switch the Chinese localisation defaults around so default CN is simplified
  54. and TW is Traditional -->
  55. <copy file="${jsword.resources}/BibleNames_zh.properties" tofile="${build.src}/BibleNames_zh_TW.properties" />
  56. <copy file="${jsword.resources}/BibleNames_zh_CN.properties"
  57. tofile="${build.src}/BibleNames_zh.properties" overwrite="true" />
  58. <copy todir="${build.src}" overwrite="true">
  59. <fileset dir="${minbible.jsword.src}" />
  60. </copy>
  61. </target>
  62. <target name="compile" depends="mergeCode, ivy">
  63. <javac srcdir="${build.src}" destdir="${build.class}"
  64. classpathref="classpath" debug="true" source="1.6" target="1.6" />
  65. </target>
  66. <target name="jar" depends="compile">
  67. <!-- And use JarJar to shade the HttpClient -->
  68. <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
  69. classpath="${jsword-dependencydir}/jarjar-1.3.jar" />
  70. <jarjar jarfile="${distribution}/jsword.jar">
  71. <fileset dir="${build.class}" />
  72. <!-- need to include the .properties and .plugin files -->
  73. <fileset dir="${build.src}">
  74. <exclude name="**/*.java" />
  75. <exclude name="**/*.html" />
  76. </fileset>
  77. <zipgroupfileset dir="${jsword-dependencydir}" includes="*.jar" excludes="junit-*.jar, hamcrest-*.jar, jarjar-*.jar, icu4j-*.jar" />
  78. <rule pattern="org.apache.http.**" result="org.apache.shaded.http.@1" />
  79. </jarjar>
  80. <!-- We can use regular jar to build the src -->
  81. <jar jarfile="${distribution}/jsword-src.jar" basedir="${build.src}" />
  82. </target>
  83. <target name="copyJarsToMinimalBible" depends="jar"
  84. description="Copy generated jars to And Bible for use">
  85. <copy todir="${MinimalBible}/libs">
  86. <fileset dir="${distribution}" includes="*.jar" excludes="*-src.jar" />
  87. <!-- We only need to include jsword.jar, the jarjar already included dependencies. -->
  88. </copy>
  89. <copy todir="${MinimalBible}/libs-src">
  90. <fileset dir="${distribution}" includes="*-src.jar" />
  91. </copy>
  92. </target>
  93. <!--=======================================================================
  94. == Use ivy to manage external jars. == These are properties related to ivy.
  95. ========================================================================= -->
  96. <property name="ivy.version" value="2.3.0" />
  97. <property name="tools.home" location="${jsword-tweaks.home}/tools" />
  98. <property name="ivy.home" location="${tools.home}/ivy" />
  99. <property name="ivy.url"
  100. value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
  101. <property name="ivy.jar.file" location="${ivy.home}/ivy-${ivy.version}.jar" />
  102. <property name="ivy.quiet" value="default" /> <!-- default or quiet -->
  103. <property name="ivy.sync" value="false" /> <!-- true or false -->
  104. <property name="ivy.project.dir" location="${jsword-tweaks.home}" />
  105. <property name="ivy.lib.dir" location="${ivy.project.dir}/lib" />
  106. <property name="ivy.dep.file" location="${ivy.project.dir}/ivy.xml" />
  107. <property name="ivy.default.ivy.user.dir" location="${ivy.project.dir}/ivy" />
  108. <!-- Ivy.sync controls whether only the current version of jar is allowed.
  109. == This is good when updating the project, but not from day-to-day == since
  110. we build extra stuff into the same location. Having sync="true" == causes
  111. that to be deleted and need to be restored. -->
  112. <target name="ivy" description="Retrieve dependencies with ivy"
  113. depends="ivy.task">
  114. <ivy:retrieve sync="${ivy.sync}"
  115. pattern="${ivy.lib.dir}/[type]s/[artifact]-[revision].[ext]" log="${ivy.quiet}" />
  116. <ivy:cachepath pathid="default.path" />
  117. </target>
  118. <target name="ivy.clean" description="Remove the ivy installation">
  119. <delete dir="${ivy.home}" />
  120. </target>
  121. <target name="ivy.clean-cache" description="Remove dependent jars that ivy manages"
  122. depends="ivy.task">
  123. <ivy:cleancache />
  124. </target>
  125. <!-- Make ivy visible to Ant -->
  126. <target name="ivy.task" depends="ivy.download">
  127. <path id="ivy.lib.path">
  128. <fileset dir="${ivy.home}" includes="*.jar" />
  129. </path>
  130. <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
  131. classpathref="ivy.lib.path" />
  132. </target>
  133. <!-- Download ivy -->
  134. <target name="ivy.download" depends="ivy.check" unless="ivy.present">
  135. <mkdir dir="${ivy.home}" />
  136. <!-- download Ivy from web site so that it can be used even without any
  137. special installation -->
  138. <get src="${ivy.url}" dest="${ivy.jar.file}" usetimestamp="true" />
  139. </target>
  140. <!-- See if Ivy is installed -->
  141. <target name="ivy.check">
  142. <available file="${ivy.jar.file}" type="file" property="ivy.present" />
  143. </target>
  144. </project>