build.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="writelatex-git-bridge" default="all">
  3. <!-- Compiler options -->
  4. <property name="compiler.debug" value="on"/>
  5. <property name="compiler.generate.no.warnings" value="off"/>
  6. <property name="compiler.args" value=""/>
  7. <property name="compiler.max.memory" value="700m"/>
  8. <patternset id="ignored.files">
  9. <exclude name="**/CVS/**"/>
  10. <exclude name="**/SCCS/**"/>
  11. <exclude name="**/RCS/**"/>
  12. <exclude name="**/rcs/**"/>
  13. <exclude name="**/.DS_Store/**"/>
  14. <exclude name="**/.svn/**"/>
  15. <exclude name="**/.pyc/**"/>
  16. <exclude name="**/.pyo/**"/>
  17. <exclude name="**/*.pyc/**"/>
  18. <exclude name="**/*.pyo/**"/>
  19. <exclude name="**/.git/**"/>
  20. <exclude name="**/*.hprof/**"/>
  21. <exclude name="**/_svn/**"/>
  22. <exclude name="**/.hg/**"/>
  23. <exclude name="**/*.lib/**"/>
  24. <exclude name="**/*~/**"/>
  25. <exclude name="**/__pycache__/**"/>
  26. <exclude name="**/.bundle/**"/>
  27. <exclude name="**/*.rbc/**"/>
  28. </patternset>
  29. <patternset id="library.patterns">
  30. <include name="*.zip"/>
  31. <include name="*.apk"/>
  32. <include name="*.war"/>
  33. <include name="*.egg"/>
  34. <include name="*.ear"/>
  35. <include name="*.ane"/>
  36. <include name="*.swc"/>
  37. <include name="*.jar"/>
  38. </patternset>
  39. <patternset id="compiler.resources">
  40. <exclude name="**/?*.java"/>
  41. <exclude name="**/?*.form"/>
  42. <exclude name="**/?*.class"/>
  43. <exclude name="**/?*.groovy"/>
  44. <exclude name="**/?*.scala"/>
  45. <exclude name="**/?*.flex"/>
  46. <exclude name="**/?*.kt"/>
  47. <exclude name="**/?*.clj"/>
  48. </patternset>
  49. <!-- Project Libraries -->
  50. <path id="library.hamcrest-core-1.3.classpath">
  51. <pathelement location="${basedir}/libs/hamcrest-core-1.3.jar"/>
  52. </path>
  53. <path id="library.hamcrest-library-1.3.classpath">
  54. <pathelement location="${basedir}/libs/hamcrest-library-1.3.jar"/>
  55. </path>
  56. <path id="library.javax.servlet-api-3.1.0.classpath">
  57. <pathelement location="${basedir}/libs/javax.servlet-api-3.1.0.jar"/>
  58. </path>
  59. <path id="library.jetty-all-9.2.3.v20140905.classpath">
  60. <pathelement location="${basedir}/libs/jetty-all-9.2.3.v20140905.jar"/>
  61. </path>
  62. <path id="library.junit-4.11.classpath">
  63. <pathelement location="${basedir}/libs/junit-4.11.jar"/>
  64. </path>
  65. <path id="library.org.eclipse.jgit-3.5.1.201410131835-r.classpath">
  66. <pathelement location="${basedir}/libs/org.eclipse.jgit-3.5.1.201410131835-r.jar"/>
  67. </path>
  68. <path id="library.org.eclipse.jgit.http.server-3.5.1.201410131835-r.classpath">
  69. <pathelement location="${basedir}/libs/org.eclipse.jgit.http.server-3.5.1.201410131835-r.jar"/>
  70. </path>
  71. <!-- Modules -->
  72. <!-- Module writelatex-git-bridge -->
  73. <dirname property="module.writelatex-git-bridge.basedir" file="${ant.file}"/>
  74. <property name="compiler.args.writelatex-git-bridge" value="-encoding UTF-8 -source 1.6 ${compiler.args}"/>
  75. <property name="writelatex-git-bridge.output.dir" value="${module.writelatex-git-bridge.basedir}/out/production/writelatex-git-bridge"/>
  76. <property name="writelatex-git-bridge.testoutput.dir" value="${module.writelatex-git-bridge.basedir}/out/test/writelatex-git-bridge"/>
  77. <path id="writelatex-git-bridge.module.bootclasspath">
  78. <!-- Paths to be included in compilation bootclasspath -->
  79. </path>
  80. <path id="writelatex-git-bridge.module.production.classpath">
  81. <path refid="library.org.eclipse.jgit-3.5.1.201410131835-r.classpath"/>
  82. <path refid="library.org.eclipse.jgit.http.server-3.5.1.201410131835-r.classpath"/>
  83. <path refid="library.javax.servlet-api-3.1.0.classpath"/>
  84. <path refid="library.jetty-all-9.2.3.v20140905.classpath"/>
  85. <path refid="library.hamcrest-core-1.3.classpath"/>
  86. <path refid="library.hamcrest-library-1.3.classpath"/>
  87. <path refid="library.junit-4.11.classpath"/>
  88. </path>
  89. <path id="writelatex-git-bridge.runtime.production.module.classpath">
  90. <pathelement location="${writelatex-git-bridge.output.dir}"/>
  91. <path refid="library.org.eclipse.jgit-3.5.1.201410131835-r.classpath"/>
  92. <path refid="library.org.eclipse.jgit.http.server-3.5.1.201410131835-r.classpath"/>
  93. <path refid="library.javax.servlet-api-3.1.0.classpath"/>
  94. <path refid="library.jetty-all-9.2.3.v20140905.classpath"/>
  95. <path refid="library.hamcrest-core-1.3.classpath"/>
  96. <path refid="library.hamcrest-library-1.3.classpath"/>
  97. <path refid="library.junit-4.11.classpath"/>
  98. </path>
  99. <path id="writelatex-git-bridge.module.classpath">
  100. <pathelement location="${writelatex-git-bridge.output.dir}"/>
  101. <path refid="library.org.eclipse.jgit-3.5.1.201410131835-r.classpath"/>
  102. <path refid="library.org.eclipse.jgit.http.server-3.5.1.201410131835-r.classpath"/>
  103. <path refid="library.javax.servlet-api-3.1.0.classpath"/>
  104. <path refid="library.jetty-all-9.2.3.v20140905.classpath"/>
  105. <path refid="library.hamcrest-core-1.3.classpath"/>
  106. <path refid="library.hamcrest-library-1.3.classpath"/>
  107. <path refid="library.junit-4.11.classpath"/>
  108. </path>
  109. <path id="writelatex-git-bridge.runtime.module.classpath">
  110. <pathelement location="${writelatex-git-bridge.testoutput.dir}"/>
  111. <pathelement location="${writelatex-git-bridge.output.dir}"/>
  112. <path refid="library.org.eclipse.jgit-3.5.1.201410131835-r.classpath"/>
  113. <path refid="library.org.eclipse.jgit.http.server-3.5.1.201410131835-r.classpath"/>
  114. <path refid="library.javax.servlet-api-3.1.0.classpath"/>
  115. <path refid="library.jetty-all-9.2.3.v20140905.classpath"/>
  116. <path refid="library.hamcrest-core-1.3.classpath"/>
  117. <path refid="library.hamcrest-library-1.3.classpath"/>
  118. <path refid="library.junit-4.11.classpath"/>
  119. </path>
  120. <patternset id="excluded.from.module.writelatex-git-bridge">
  121. <patternset refid="ignored.files"/>
  122. </patternset>
  123. <patternset id="excluded.from.compilation.writelatex-git-bridge">
  124. <patternset refid="excluded.from.module.writelatex-git-bridge"/>
  125. </patternset>
  126. <path id="writelatex-git-bridge.module.sourcepath">
  127. <dirset dir="${module.writelatex-git-bridge.basedir}">
  128. <include name="src"/>
  129. </dirset>
  130. </path>
  131. <path id="writelatex-git-bridge.module.test.sourcepath">
  132. <dirset dir="${module.writelatex-git-bridge.basedir}">
  133. <include name="test"/>
  134. </dirset>
  135. </path>
  136. <target name="compile.module.writelatex-git-bridge" depends="compile.module.writelatex-git-bridge.production,compile.module.writelatex-git-bridge.tests" description="Compile module writelatex-git-bridge"/>
  137. <target name="compile.module.writelatex-git-bridge.production" description="Compile module writelatex-git-bridge; production classes">
  138. <mkdir dir="${writelatex-git-bridge.output.dir}"/>
  139. <javac destdir="${writelatex-git-bridge.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
  140. <compilerarg line="${compiler.args.writelatex-git-bridge}"/>
  141. <bootclasspath refid="writelatex-git-bridge.module.bootclasspath"/>
  142. <classpath refid="writelatex-git-bridge.module.production.classpath"/>
  143. <src refid="writelatex-git-bridge.module.sourcepath"/>
  144. <patternset refid="excluded.from.compilation.writelatex-git-bridge"/>
  145. </javac>
  146. <copy todir="${writelatex-git-bridge.output.dir}">
  147. <fileset dir="${module.writelatex-git-bridge.basedir}/src">
  148. <patternset refid="compiler.resources"/>
  149. <type type="file"/>
  150. </fileset>
  151. </copy>
  152. </target>
  153. <target name="compile.module.writelatex-git-bridge.tests" depends="compile.module.writelatex-git-bridge.production" description="compile module writelatex-git-bridge; test classes" unless="skip.tests">
  154. <mkdir dir="${writelatex-git-bridge.testoutput.dir}"/>
  155. <javac destdir="${writelatex-git-bridge.testoutput.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
  156. <compilerarg line="${compiler.args.writelatex-git-bridge}"/>
  157. <bootclasspath refid="writelatex-git-bridge.module.bootclasspath"/>
  158. <classpath refid="writelatex-git-bridge.module.classpath"/>
  159. <src refid="writelatex-git-bridge.module.test.sourcepath"/>
  160. <patternset refid="excluded.from.compilation.writelatex-git-bridge"/>
  161. </javac>
  162. <copy todir="${writelatex-git-bridge.testoutput.dir}">
  163. <fileset dir="${module.writelatex-git-bridge.basedir}/test">
  164. <patternset refid="compiler.resources"/>
  165. <type type="file"/>
  166. </fileset>
  167. </copy>
  168. </target>
  169. <target name="clean.module.writelatex-git-bridge" description="cleanup module">
  170. <delete dir="${writelatex-git-bridge.output.dir}"/>
  171. <delete dir="${writelatex-git-bridge.testoutput.dir}"/>
  172. </target>
  173. <target name="clean.modules" depends="clean.module.writelatex-git-bridge">
  174. <delete dir="${module.writelatex-git-bridge.basedir}/out" />
  175. </target>
  176. <target name="init" description="Build initialization">
  177. <!-- Perform any build initialization in this target -->
  178. </target>
  179. <target name="clean" depends="clean.modules" description="cleanup all">
  180. <delete dir="${module.writelatex-git-bridge.basedir}/bin" />
  181. </target>
  182. <target name="build.modules" depends="init, clean, compile.module.writelatex-git-bridge" description="build all modules"/>
  183. <target name="init.artifacts">
  184. <property name="artifacts.temp.dir" value="${basedir}/__artifacts_temp"/>
  185. <property name="artifact.output.writelatex-git-bridge:jar" value="${basedir}/out/artifacts/writelatex_git_bridge_jar"/>
  186. <mkdir dir="${artifacts.temp.dir}"/>
  187. <property name="temp.jar.path.writelatex-git-bridge.jar" value="${artifacts.temp.dir}/writelatex-git-bridge.jar"/>
  188. </target>
  189. <target name="artifact.writelatex-git-bridge:jar" depends="init.artifacts, compile.module.writelatex-git-bridge, compile.module.writelatex-git-bridge" description="Build &#39;writelatex-git-bridge:jar&#39; artifact">
  190. <property name="artifact.temp.output.writelatex-git-bridge:jar" value="${artifacts.temp.dir}/writelatex_git_bridge_jar"/>
  191. <mkdir dir="${artifact.temp.output.writelatex-git-bridge:jar}"/>
  192. <jar destfile="${temp.jar.path.writelatex-git-bridge.jar}" duplicate="preserve" filesetmanifest="mergewithoutmain">
  193. <zipfileset dir="${writelatex-git-bridge.output.dir}"/>
  194. <zipfileset dir="${writelatex-git-bridge.testoutput.dir}"/>
  195. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/org.eclipse.jgit.http.server-3.5.1.201410131835-r.jar"/>
  196. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/junit-4.11.jar"/>
  197. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/javax.servlet-api-3.1.0.jar"/>
  198. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/hamcrest-core-1.3.jar"/>
  199. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/org.eclipse.jgit-3.5.1.201410131835-r.jar"/>
  200. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/jetty-all-9.2.3.v20140905.jar"/>
  201. <zipfileset excludes="META-INF/**/*" src="${basedir}/libs/hamcrest-library-1.3.jar"/>
  202. </jar>
  203. <copy file="${temp.jar.path.writelatex-git-bridge.jar}" tofile="${artifact.temp.output.writelatex-git-bridge:jar}/writelatex-git-bridge.jar"/>
  204. </target>
  205. <target name="build.all.artifacts" depends="artifact.writelatex-git-bridge:jar" description="Build all artifacts">
  206. <mkdir dir="${artifact.output.writelatex-git-bridge:jar}"/>
  207. <copy todir="${artifact.output.writelatex-git-bridge:jar}">
  208. <fileset dir="${artifact.temp.output.writelatex-git-bridge:jar}"/>
  209. </copy>
  210. <!-- Delete temporary files -->
  211. <delete dir="${artifacts.temp.dir}"/>
  212. </target>
  213. <target name="test.unit" depends="compile.module.writelatex-git-bridge.tests">
  214. <junit>
  215. <classpath>
  216. <path refid="writelatex-git-bridge.module.classpath"/>
  217. <pathelement location="${writelatex-git-bridge.testoutput.dir}"/>
  218. </classpath>
  219. <batchtest>
  220. <fileset dir="${writelatex-git-bridge.testoutput.dir}">
  221. </fileset>
  222. </batchtest>
  223. <formatter type="brief" usefile="false"/>
  224. </junit>
  225. </target>
  226. <target name="test.system" depends="package">
  227. <property name="executable-full-path"
  228. location="${module.writelatex-git-bridge.basedir}/test/system"/>
  229. <exec executable="${executable-full-path}/main.sh" />
  230. </target>
  231. <target name="test" depends="test.unit, test.system, clean" />
  232. <target name="package" depends="build.all.artifacts">
  233. <mkdir dir="${module.writelatex-git-bridge.basedir}/bin" />
  234. <copy file="${artifact.output.writelatex-git-bridge:jar}/writelatex-git-bridge.jar" tofile="${module.writelatex-git-bridge.basedir}/bin/writelatex-git-bridge.jar" />
  235. </target>
  236. <target name="all" depends="build.modules, test.unit, package, clean.modules, test.system" description="build all"/>
  237. </project>