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 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="gitblit" default="compile" basedir=".">
  3. <!-- Google Code upload task -->
  4. <taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
  5. classpath="${basedir}/tools/ant-googlecode-0.0.3.jar" name="gcupload"/>
  6. <!-- GenJar task -->
  7. <taskdef resource="genjar.properties" classpath="${basedir}/tools/GenJar.jar" />
  8. <!-- Project Properties -->
  9. <property name="project.jar" value="gitblit.jar" />
  10. <property name="project.mainclass" value="com.gitblit.Launcher" />
  11. <property name="project.build.dir" value="${basedir}/build" />
  12. <property name="project.deploy.dir" value="${basedir}/deploy" />
  13. <property name="project.war.dir" value="${basedir}/war" />
  14. <property name="project.site.dir" value="${basedir}/site" />
  15. <property name="project.resources.dir" value="${basedir}/resources" />
  16. <property name="project.express.dir" value="${basedir}/express" />
  17. <available property="hasBuildProps" file="${basedir}/build.properties"/>
  18. <!--
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. Load build.properties, if available
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. -->
  23. <target name="buildprops" if="hasBuildProps">
  24. <!-- Load publication servers, paths, and credentials -->
  25. <loadproperties>
  26. <file file="${basedir}/build.properties" />
  27. </loadproperties>
  28. </target>
  29. <!--
  30. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. Scrape the version info from code and setup the build properties
  32. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  33. -->
  34. <target name="buildinfo" depends="buildprops">
  35. <!-- extract Gitblit version number from source code -->
  36. <loadfile property="gb.version" srcfile="${basedir}/src/com/gitblit/Constants.java">
  37. <filterchain>
  38. <linecontains>
  39. <contains value="public static final String VERSION = " />
  40. </linecontains>
  41. <striplinebreaks />
  42. <tokenfilter>
  43. <replacestring from="public static final String VERSION = &quot;" to="" />
  44. <replacestring from="&quot;;" to="" />
  45. <trim />
  46. </tokenfilter>
  47. </filterchain>
  48. </loadfile>
  49. <!-- extract Gitblit version date from source code -->
  50. <loadfile property="gb.versionDate" srcfile="${basedir}/src/com/gitblit/Constants.java">
  51. <filterchain>
  52. <linecontains>
  53. <contains value="public static final String VERSION_DATE = " />
  54. </linecontains>
  55. <striplinebreaks />
  56. <tokenfilter>
  57. <replacestring from="public static final String VERSION_DATE = &quot;" to="" />
  58. <replacestring from="&quot;;" to="" />
  59. <trim />
  60. </tokenfilter>
  61. </filterchain>
  62. </loadfile>
  63. <!-- extract JGit version number from source code -->
  64. <loadfile property="jgit.version" srcfile="${basedir}/src/com/gitblit/Constants.java">
  65. <filterchain>
  66. <linecontains>
  67. <contains value="public static final String JGIT_VERSION = " />
  68. </linecontains>
  69. <striplinebreaks />
  70. <tokenfilter>
  71. <replacestring from="public static final String JGIT_VERSION = &quot;" to="" />
  72. <replacestring from="&quot;;" to="" />
  73. <trim />
  74. </tokenfilter>
  75. </filterchain>
  76. </loadfile>
  77. <property name="distribution.zipfile" value="gitblit-${gb.version}.zip" />
  78. <property name="distribution.warfile" value="gitblit-${gb.version}.war" />
  79. <property name="fedclient.zipfile" value="fedclient-${gb.version}.zip" />
  80. <property name="manager.zipfile" value="manager-${gb.version}.zip" />
  81. <property name="gbapi.zipfile" value="gbapi-${gb.version}.zip" />
  82. <property name="express.zipfile" value="express-${gb.version}.zip" />
  83. </target>
  84. <!--
  85. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. Compile
  87. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. -->
  89. <target name="compile" depends="buildinfo" description="Retrieves dependencies and compiles Gitblit from source">
  90. <!-- copy required distribution files to project folder -->
  91. <copy todir="${basedir}" overwrite="false">
  92. <fileset dir="${basedir}/distrib">
  93. <include name="gitblit.properties" />
  94. <include name="users.conf" />
  95. </fileset>
  96. </copy>
  97. <!-- copy gitblit.properties to the WEB-INF folder.
  98. this file is only used for parsing setting descriptions. -->
  99. <copy tofile="${basedir}/src/WEB-INF/reference.properties" overwrite="true"
  100. file="${basedir}/distrib/gitblit.properties" />
  101. <!-- Compile the build tool and execute it.
  102. This downloads missing compile-time dependencies from Maven. -->
  103. <delete dir="${project.build.dir}" />
  104. <mkdir dir="${project.build.dir}" />
  105. <javac debug="true" srcdir="${basedir}/src" destdir="${project.build.dir}" includeantruntime="false">
  106. <include name="com/gitblit/build/Build.java" />
  107. <include name="com/gitblit/Constants.java" />
  108. <include name="com/gitblit/utils/StringUtils.java" />
  109. </javac>
  110. <java classpath="${project.build.dir}" classname="com.gitblit.build.Build" />
  111. <!-- Compile Project -->
  112. <path id="master-classpath">
  113. <fileset dir="${basedir}/ext">
  114. <include name="*.jar" />
  115. </fileset>
  116. <pathelement path="${project.build.dir}" />
  117. </path>
  118. <javac debug="true" destdir="${project.build.dir}" failonerror="false" includeantruntime="false">
  119. <src path="${basedir}/src" />
  120. <classpath refid="master-classpath" />
  121. </javac>
  122. <copy todir="${project.build.dir}">
  123. <fileset dir="${basedir}/src" excludes="**/*.java,**/thumbs.db" />
  124. </copy>
  125. </target>
  126. <!--
  127. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  128. Build Gitblit GO
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. -->
  131. <target name="buildGO" depends="compile" description="Build Gitblit GO distribution">
  132. <echo>Building Gitblit GO ${gb.version}</echo>
  133. <!-- Delete the deploy folder -->
  134. <delete dir="${project.deploy.dir}" />
  135. <!-- Create deployment folder structure -->
  136. <mkdir dir="${project.deploy.dir}" />
  137. <copy todir="${project.deploy.dir}">
  138. <fileset dir="${basedir}/distrib">
  139. <include name="**/*" />
  140. <exclude name="federation.properties" />
  141. <exclude name="openshift.mkd" />
  142. </fileset>
  143. <fileset dir="${basedir}">
  144. <include name="LICENSE" />
  145. <include name="NOTICE" />
  146. </fileset>
  147. </copy>
  148. <!-- Build jar -->
  149. <jar jarfile="${project.deploy.dir}/${project.jar}">
  150. <fileset dir="${project.build.dir}">
  151. <include name="**/*" />
  152. <exclude name="com/gitblit/client/**" />
  153. </fileset>
  154. <fileset dir="${project.resources.dir}">
  155. <exclude name="thumbs.db" />
  156. </fileset>
  157. <manifest>
  158. <attribute name="Main-Class" value="${project.mainclass}" />
  159. </manifest>
  160. </jar>
  161. <!-- Gitblit library dependencies -->
  162. <mkdir dir="${project.deploy.dir}/ext"/>
  163. <copy todir="${project.deploy.dir}/ext">
  164. <fileset dir="${basedir}/ext">
  165. <exclude name="junit*.jar" />
  166. <exclude name="commons-net*.jar" />
  167. <exclude name="*-sources.jar" />
  168. <exclude name="*-javadoc.jar" />
  169. </fileset>
  170. </copy>
  171. <!-- Build the docs for the deploy -->
  172. <antcall target="buildDocs" inheritall="true" inheritrefs="true">
  173. <param name="docs.output.dir" value="${project.deploy.dir}/docs" />
  174. </antcall>
  175. <!-- Copy the supported Groovy hook scripts -->
  176. <mkdir dir="${project.deploy.dir}/groovy" />
  177. <copy todir="${project.deploy.dir}/groovy">
  178. <fileset dir="${basedir}/groovy">
  179. <include name="sendmail.groovy" />
  180. <include name="jenkins.groovy" />
  181. <include name="protect-refs.groovy" />
  182. </fileset>
  183. </copy>
  184. <!-- Create Zip deployment -->
  185. <zip destfile="${distribution.zipfile}">
  186. <fileset dir="${project.deploy.dir}">
  187. <include name="**/*" />
  188. </fileset>
  189. </zip>
  190. </target>
  191. <!--
  192. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193. Build Gitblit Docs which are bundled with GO and WAR downloads
  194. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  195. -->
  196. <target name="buildDocs">
  197. <!-- Build Docs -->
  198. <mkdir dir="${docs.output.dir}" />
  199. <copy todir="${docs.output.dir}">
  200. <!-- Copy selected Gitblit resources -->
  201. <fileset dir="${project.resources.dir}">
  202. <include name="bootstrap/**/*" />
  203. <include name="gitblit.css" />
  204. <include name="gitblt_25_white.png" />
  205. <include name="gitblt-favicon.png" />
  206. <include name="lock_go_16x16.png" />
  207. <include name="lock_pull_16x16.png" />
  208. <include name="shield_16x16.png" />
  209. <include name="cold_16x16.png" />
  210. <include name="bug_16x16.png" />
  211. <include name="book_16x16.png" />
  212. <include name="blank.png" />
  213. <include name="federated_16x16.png" />
  214. <include name="arrow_page.png" />
  215. </fileset>
  216. <!-- Copy Doc images -->
  217. <fileset dir="${basedir}/docs">
  218. <include name="*.png" />
  219. <include name="*.gif" />
  220. </fileset>
  221. </copy>
  222. <!-- Copy google-code-prettify -->
  223. <mkdir dir="${docs.output.dir}/prettify" />
  224. <copy todir="${docs.output.dir}/prettify">
  225. <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
  226. <exclude name="thumbs.db" />
  227. </fileset>
  228. </copy>
  229. <!-- Build deployment doc pages -->
  230. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildSite">
  231. <classpath refid="master-classpath" />
  232. <arg value="--sourceFolder" />
  233. <arg value="${basedir}/docs" />
  234. <arg value="--outputFolder" />
  235. <arg value="${docs.output.dir}" />
  236. <arg value="--pageHeader" />
  237. <arg value="${basedir}/docs/doc_header.html" />
  238. <arg value="--pageFooter" />
  239. <arg value="${basedir}/docs/doc_footer.html" />
  240. <arg value="--skip" />
  241. <arg value="screenshots" />
  242. <arg value="--skip" />
  243. <arg value="releases" />
  244. <arg value="--alias" />
  245. <arg value="index=overview" />
  246. <arg value="--alias" />
  247. <arg value="properties=settings" />
  248. <arg value="--substitute" />
  249. <arg value="%VERSION%=${gb.version}" />
  250. <arg value="--substitute" />
  251. <arg value="%GO%=${distribution.zipfile}" />
  252. <arg value="--substitute" />
  253. <arg value="%WAR%=${distribution.warfile}" />
  254. <arg value="--substitute" />
  255. <arg value="%FEDCLIENT%=${fedclient.zipfile}" />
  256. <arg value="--substitute" />
  257. <arg value="%MANAGER%=${manager.zipfile}" />
  258. <arg value="--substitute" />
  259. <arg value="%API%=${gbapi.zipfile}" />
  260. <arg value="--substitute" />
  261. <arg value="%EXPRESS%=${express.zipfile}" />
  262. <arg value="--substitute" />
  263. <arg value="%BUILDDATE%=${gb.versionDate}" />
  264. <arg value="--substitute" />
  265. <arg value="%JGIT%=${jgit.version}" />
  266. <arg value="--properties" />
  267. <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
  268. <arg value="--nomarkdown" />
  269. <arg value="%BEGINCODE%:%ENDCODE%" />
  270. <arg value="--substitute" />
  271. <arg value="&quot;%BEGINCODE%=&lt;pre class='prettyprint lang-java'&gt;&quot;" />
  272. <arg value="--substitute" />
  273. <arg value="%ENDCODE%=&lt;/pre&gt;" />
  274. <arg value="--regex" />
  275. <arg value="&quot;\b(issue)(\s*[#]?|-){0,1}(\d+)\b!!!&lt;a href='http://code.google.com/p/gitblit/issues/detail?id=$3'&gt;issue $3&lt;/a&gt;&quot;" />
  276. </java>
  277. </target>
  278. <!--
  279. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  280. Build Gitblit WAR
  281. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  282. -->
  283. <target name="buildWAR" depends="compile" description="Build Gitblit WAR">
  284. <echo>Building Gitblit WAR ${gb.version}</echo>
  285. <delete dir="${project.war.dir}" />
  286. <!-- Copy web.xml and users.conf to WEB-INF -->
  287. <copy todir="${project.war.dir}/WEB-INF">
  288. <fileset dir="${basedir}/distrib">
  289. <include name="users.conf" />
  290. </fileset>
  291. <fileset dir="${basedir}/src/WEB-INF">
  292. <include name="web.xml" />
  293. </fileset>
  294. <fileset dir="${basedir}">
  295. <include name="LICENSE" />
  296. <include name="NOTICE" />
  297. </fileset>
  298. </copy>
  299. <!-- Copy gitblit.properties as reference.properties -->
  300. <copy tofile="${project.war.dir}/WEB-INF/reference.properties"
  301. file="${basedir}/distrib/gitblit.properties"/>
  302. <!-- Build the docs for the WAR build -->
  303. <antcall target="buildDocs" inheritall="true" inheritrefs="true">
  304. <param name="docs.output.dir" value="${project.war.dir}/WEB-INF/docs" />
  305. </antcall>
  306. <!-- Copy the supported Groovy hook scripts -->
  307. <mkdir dir="${project.war.dir}/WEB-INF/groovy" />
  308. <copy todir="${project.war.dir}/WEB-INF/groovy">
  309. <fileset dir="${basedir}/groovy">
  310. <include name="sendmail.groovy" />
  311. <include name="jenkins.groovy" />
  312. <include name="protect-refs.groovy" />
  313. </fileset>
  314. </copy>
  315. <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties -->
  316. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml">
  317. <classpath refid="master-classpath" />
  318. <arg value="--sourceFile" />
  319. <arg value="${basedir}/src/WEB-INF/web.xml" />
  320. <arg value="--destinationFile" />
  321. <arg value="${project.war.dir}/WEB-INF/web.xml" />
  322. <arg value="--propertiesFile" />
  323. <arg value="${basedir}/distrib/gitblit.properties" />
  324. </java>
  325. <!-- Gitblit resources -->
  326. <copy todir="${project.war.dir}">
  327. <fileset dir="${project.resources.dir}">
  328. <exclude name="thumbs.db" />
  329. </fileset>
  330. </copy>
  331. <!-- Gitblit library dependencies -->
  332. <mkdir dir="${project.war.dir}/WEB-INF/lib"/>
  333. <copy todir="${project.war.dir}/WEB-INF/lib">
  334. <fileset dir="${basedir}/ext">
  335. <exclude name="*-sources.jar" />
  336. <exclude name="*-javadoc.jar" />
  337. <exclude name="jcommander*.jar" />
  338. <exclude name="jetty*.jar" />
  339. <exclude name="junit*.jar" />
  340. <exclude name="servlet*.jar" />
  341. <exclude name="javax.servlet*.jar" />
  342. </fileset>
  343. </copy>
  344. <!-- Gitblit classes -->
  345. <mkdir dir="${project.war.dir}/WEB-INF/classes"/>
  346. <copy todir="${project.war.dir}/WEB-INF/classes">
  347. <fileset dir="${project.build.dir}">
  348. <exclude name="WEB-INF/" />
  349. <exclude name="com/gitblit/tests/" />
  350. <exclude name="com/gitblit/build/**" />
  351. <exclude name="com/gitblit/client/**" />
  352. <exclude name="com/gitblit/AddIndexedBranch*.class" />
  353. <exclude name="com/gitblit/GitBlitServer*.class" />
  354. <exclude name="com/gitblit/Launcher*.class" />
  355. <exclude name="com/gitblit/MakeCertificate*.class" />
  356. </fileset>
  357. </copy>
  358. <!-- Build the WAR file -->
  359. <jar basedir="${project.war.dir}" destfile="${distribution.warfile}" compress="true" />
  360. </target>
  361. <!--
  362. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  363. Build the stand-alone, command-line Gitblit Federation Client
  364. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  365. -->
  366. <target name="buildFederationClient" depends="compile" description="Builds the stand-alone Gitblit federation client">
  367. <echo>Building Gitblit Federation Client ${gb.version}</echo>
  368. <genjar jarfile="fedclient.jar">
  369. <class name="com.gitblit.FederationClientLauncher" />
  370. <resource file="${project.build.dir}/log4j.properties" />
  371. <classfilter>
  372. <exclude name="org.apache." />
  373. <exclude name="org.bouncycastle." />
  374. <exclude name="org.eclipse." />
  375. <exclude name="org.slf4j." />
  376. <exclude name="com.beust." />
  377. <exclude name="com.google." />
  378. </classfilter>
  379. <classpath refid="master-classpath" />
  380. <manifest>
  381. <attribute name="Main-Class" value="com.gitblit.FederationClientLauncher" />
  382. <attribute name="Specification-Version" value="${gb.version}" />
  383. <attribute name="Release-Date" value="${gb.versionDate}" />
  384. </manifest>
  385. </genjar>
  386. <!-- Build the federation client zip file -->
  387. <zip destfile="${fedclient.zipfile}">
  388. <fileset dir="${basedir}">
  389. <include name="fedclient.jar" />
  390. <include name="LICENSE" />
  391. <include name="NOTICE" />
  392. </fileset>
  393. <fileset dir="${basedir}/distrib">
  394. <include name="federation.properties" />
  395. </fileset>
  396. </zip>
  397. </target>
  398. <!--
  399. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  400. Build a Gitblit filesystem for deployment to RedHat OpenShif Expresst
  401. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  402. -->
  403. <target name="buildExpress" depends="compile" description="Build exploded WAR file suitable for deployment to OpenShift Express">
  404. <echo>Building Gitblit Express for RedHat OpenShift ${gb.version}</echo>
  405. <delete dir="${project.express.dir}" />
  406. <!-- Create the OpenShift filesystem -->
  407. <property name="deployments.root" value="${project.express.dir}/deployments/ROOT.war"/>
  408. <mkdir dir="${deployments.root}" />
  409. <touch file="${project.express.dir}/deployments/ROOT.war.dodeploy" />
  410. <!-- Copy the Gitblit OpenShift readme file -->
  411. <copy tofile="${project.express.dir}/README.gitblit"
  412. file="${basedir}/distrib/openshift.mkd"/>
  413. <!-- Copy LICENSE and NOTICE to WEB-INF -->
  414. <copy todir="${deployments.root}/WEB-INF">
  415. <fileset dir="${basedir}">
  416. <include name="LICENSE" />
  417. <include name="NOTICE" />
  418. </fileset>
  419. </copy>
  420. <!-- Copy gitblit.properties as reference.properties -->
  421. <copy tofile="${deployments.root}/WEB-INF/reference.properties"
  422. file="${basedir}/distrib/gitblit.properties"/>
  423. <!-- Copy the supported Groovy hook scripts -->
  424. <mkdir dir="${deployments.root}/WEB-INF/groovy" />
  425. <copy todir="${deployments.root}/WEB-INF/groovy">
  426. <fileset dir="${basedir}/groovy">
  427. <include name="sendmail.groovy" />
  428. <include name="jenkins.groovy" />
  429. <include name="protect-refs.groovy" />
  430. </fileset>
  431. </copy>
  432. <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties -->
  433. <!-- THIS FILE IS NOT OVERRIDDEN ONCE IT IS BUILT!!! -->
  434. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml">
  435. <classpath refid="master-classpath" />
  436. <arg value="--sourceFile" />
  437. <arg value="${basedir}/src/WEB-INF/web.xml" />
  438. <arg value="--destinationFile" />
  439. <arg value="${deployments.root}/WEB-INF/web.xml" />
  440. <arg value="--propertiesFile" />
  441. <arg value="${basedir}/distrib/gitblit.properties" />
  442. </java>
  443. <!-- Gitblit resources -->
  444. <copy todir="${deployments.root}">
  445. <fileset dir="${project.resources.dir}">
  446. <exclude name="thumbs.db" />
  447. </fileset>
  448. </copy>
  449. <!-- Gitblit library dependencies -->
  450. <mkdir dir="${deployments.root}/WEB-INF/lib"/>
  451. <copy todir="${deployments.root}/WEB-INF/lib">
  452. <fileset dir="${basedir}/ext">
  453. <exclude name="*-sources.jar" />
  454. <exclude name="*-javadoc.jar" />
  455. <exclude name="jcommander*.jar" />
  456. <exclude name="jetty*.jar" />
  457. <exclude name="junit*.jar" />
  458. <exclude name="servlet*.jar" />
  459. <exclude name="javax.servlet*.jar" />
  460. </fileset>
  461. </copy>
  462. <!-- Gitblit classes -->
  463. <mkdir dir="${deployments.root}/WEB-INF/classes"/>
  464. <copy todir="${deployments.root}/WEB-INF/classes">
  465. <fileset dir="${project.build.dir}">
  466. <exclude name="WEB-INF/" />
  467. <exclude name="com/gitblit/tests/" />
  468. <exclude name="com/gitblit/build/**" />
  469. <exclude name="com/gitblit/client/**" />
  470. <exclude name="com/gitblit/GitBlitServer*.class" />
  471. <exclude name="com/gitblit/Launcher*.class" />
  472. <exclude name="com/gitblit/MakeCertificate*.class" />
  473. </fileset>
  474. </copy>
  475. <!-- Build Express Zip file -->
  476. <zip destfile="${express.zipfile}">
  477. <fileset dir="${project.express.dir}" />
  478. </zip>
  479. </target>
  480. <!--
  481. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  482. Build the stand-alone, Gitblit Manager
  483. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  484. -->
  485. <target name="buildManager" depends="compile" description="Builds the stand-alone Gitblit Manager">
  486. <echo>Building Gitblit Manager ${gb.version}</echo>
  487. <genjar jarfile="manager-${gb.version}.jar">
  488. <resource file="${basedir}/src/com/gitblit/client/splash.png" />
  489. <resource file="${basedir}/resources/gitblt-favicon.png" />
  490. <resource file="${basedir}/resources/gitweb-favicon.png" />
  491. <resource file="${basedir}/resources/user_16x16.png" />
  492. <resource file="${basedir}/resources/users_16x16.png" />
  493. <resource file="${basedir}/resources/settings_16x16.png" />
  494. <resource file="${basedir}/resources/lock_go_16x16.png" />
  495. <resource file="${basedir}/resources/lock_pull_16x16.png" />
  496. <resource file="${basedir}/resources/shield_16x16.png" />
  497. <resource file="${basedir}/resources/federated_16x16.png" />
  498. <resource file="${basedir}/resources/cold_16x16.png" />
  499. <resource file="${basedir}/resources/book_16x16.png" />
  500. <resource file="${basedir}/resources/bug_16x16.png" />
  501. <resource file="${basedir}/resources/health_16x16.png" />
  502. <resource file="${basedir}/resources/feed_16x16.png" />
  503. <resource file="${basedir}/resources/bullet_feed.png" />
  504. <resource file="${basedir}/resources/search-icon.png" />
  505. <resource file="${basedir}/resources/commit_changes_16x16.png" />
  506. <resource file="${basedir}/resources/commit_merge_16x16.png" />
  507. <resource file="${basedir}/resources/blank.png" />
  508. <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
  509. <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ja.properties" />
  510. <class name="com.gitblit.client.GitblitManagerLauncher" />
  511. <classfilter>
  512. <exclude name="org.apache." />
  513. <exclude name="org.bouncycastle." />
  514. <exclude name="org.eclipse." />
  515. <exclude name="org.slf4j." />
  516. <exclude name="com.beust." />
  517. <exclude name="com.google." />
  518. </classfilter>
  519. <classpath refid="master-classpath" />
  520. <manifest>
  521. <attribute name="Main-Class" value="com.gitblit.client.GitblitManagerLauncher" />
  522. <attribute name="SplashScreen-Image" value="splash.png" />
  523. <attribute name="Specification-Version" value="${gb.version}" />
  524. <attribute name="Release-Date" value="${gb.versionDate}" />
  525. </manifest>
  526. </genjar>
  527. <!-- Build Manager Zip file -->
  528. <zip destfile="${manager.zipfile}">
  529. <fileset dir="${basedir}">
  530. <include name="manager-${gb.version}.jar" />
  531. <include name="LICENSE" />
  532. <include name="NOTICE" />
  533. </fileset>
  534. </zip>
  535. </target>
  536. <!--
  537. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  538. Build the Gitblit API client library
  539. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  540. -->
  541. <target name="buildApiLibrary" depends="compile" description="Builds the Gitblit RPC client library">
  542. <echo>Building Gitblit API Library ${gb.version}</echo>
  543. <!-- Build API Library jar -->
  544. <genjar jarfile="gbapi-${gb.version}.jar">
  545. <class name="com.gitblit.Keys" />
  546. <class name="com.gitblit.client.GitblitClient" />
  547. <classpath refid="master-classpath" />
  548. <classfilter>
  549. <exclude name="com.google.gson." />
  550. <exclude name="com.sun.syndication." />
  551. </classfilter>
  552. <manifest>
  553. <attribute name="Specification-Version" value="${gb.version}" />
  554. <attribute name="Release-Date" value="${gb.versionDate}" />
  555. </manifest>
  556. </genjar>
  557. <!-- Build API sources jar -->
  558. <zip destfile="gbapi-${gb.version}-sources.jar">
  559. <fileset dir="${basedir}/src" defaultexcludes="yes">
  560. <include name="com/gitblit/Constants.java"/>
  561. <include name="com/gitblit/GitBlitException.java"/>
  562. <include name="com/gitblit/Keys.java"/>
  563. <include name="com/gitblit/client/**/*.java"/>
  564. <include name="com/gitblit/models/**/*.java"/>
  565. <include name="com/gitblit/utils/**/*.java"/>
  566. </fileset>
  567. </zip>
  568. <!-- Build API JavaDoc jar -->
  569. <javadoc destdir="${basedir}/javadoc">
  570. <fileset dir="${basedir}/src" defaultexcludes="yes">
  571. <include name="com/gitblit/Constants.java"/>
  572. <include name="com/gitblit/GitBlitException.java"/>
  573. <include name="com/gitblit/Keys.java"/>
  574. <include name="com/gitblit/client/**/*.java"/>
  575. <include name="com/gitblit/models/**/*.java"/>
  576. <include name="com/gitblit/utils/**/*.java"/>
  577. </fileset>
  578. </javadoc>
  579. <zip destfile="gbapi-${gb.version}-javadoc.jar">
  580. <fileset dir="${basedir}/javadoc" />
  581. </zip>
  582. <!-- Build the API library zip file -->
  583. <zip destfile="${gbapi.zipfile}">
  584. <fileset dir="${basedir}">
  585. <include name="gbapi-${gb.version}.jar" />
  586. <include name="gbapi-${gb.version}-sources.jar" />
  587. <include name="gbapi-${gb.version}-javadoc.jar" />
  588. <include name="LICENSE" />
  589. <include name="NOTICE" />
  590. </fileset>
  591. <fileset dir="${basedir}/ext">
  592. <include name="gson*.jar" />
  593. <exclude name="gson*-sources.jar" />
  594. <exclude name="gson*-javadoc.jar" />
  595. <include name="rome*.jar" />
  596. <exclude name="rome*-sources.jar" />
  597. <exclude name="rome*-javadoc.jar" />
  598. </fileset>
  599. </zip>
  600. </target>
  601. <!--
  602. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  603. Build the Gitblit Website
  604. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  605. -->
  606. <target name="buildSite" depends="compile" description="Build the Gitblit website">
  607. <echo>Building Gitblit Website ${gb.version}</echo>
  608. <!-- Build Site -->
  609. <delete dir="${project.site.dir}" />
  610. <mkdir dir="${project.site.dir}" />
  611. <copy todir="${project.site.dir}">
  612. <!-- Copy selected Gitblit resources -->
  613. <fileset dir="${project.resources.dir}">
  614. <include name="bootstrap/**/*" />
  615. <include name="gitblit.css" />
  616. <include name="gitblt_25_white.png" />
  617. <include name="gitblt-favicon.png" />
  618. <include name="lock_go_16x16.png" />
  619. <include name="lock_pull_16x16.png" />
  620. <include name="shield_16x16.png" />
  621. <include name="cold_16x16.png" />
  622. <include name="bug_16x16.png" />
  623. <include name="book_16x16.png" />
  624. <include name="blank.png" />
  625. <include name="federated_16x16.png" />
  626. <include name="arrow_page.png" />
  627. </fileset>
  628. <!-- Copy Doc images -->
  629. <fileset dir="${basedir}/docs">
  630. <include name="*.png" />
  631. <include name="*.gif" />
  632. <include name="*.js" />
  633. </fileset>
  634. </copy>
  635. <!-- Copy Fancybox -->
  636. <mkdir dir="${project.site.dir}/fancybox" />
  637. <copy todir="${project.site.dir}/fancybox">
  638. <fileset dir="${basedir}/docs/fancybox">
  639. <exclude name="thumbs.db" />
  640. </fileset>
  641. </copy>
  642. <!-- Copy google-code-prettify -->
  643. <mkdir dir="${basedir}/src/com/gitblit/wicket/pages/prettify" />
  644. <copy todir="${project.site.dir}/prettify">
  645. <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
  646. <exclude name="thumbs.db" />
  647. </fileset>
  648. </copy>
  649. <!-- Generate thumbnails of screenshots -->
  650. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildThumbnails">
  651. <classpath refid="master-classpath" />
  652. <arg value="--sourceFolder" />
  653. <arg value="${basedir}/docs/screenshots" />
  654. <arg value="--destinationFolder" />
  655. <arg value="${project.site.dir}/thumbs" />
  656. <arg value="--maximumDimension" />
  657. <arg value="250" />
  658. </java>
  659. <!-- Copy screenshots -->
  660. <mkdir dir="${project.site.dir}/screenshots" />
  661. <copy todir="${project.site.dir}/screenshots">
  662. <fileset dir="${basedir}/docs/screenshots">
  663. <include name="*.png" />
  664. </fileset>
  665. </copy>
  666. <!-- Build site pages -->
  667. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildSite">
  668. <classpath refid="master-classpath" />
  669. <arg value="--sourceFolder" />
  670. <arg value="${basedir}/docs" />
  671. <arg value="--outputFolder" />
  672. <arg value="${project.site.dir}" />
  673. <arg value="--pageHeader" />
  674. <arg value="${basedir}/docs/site_header.html" />
  675. <arg value="--pageFooter" />
  676. <arg value="${basedir}/docs/site_footer.html" />
  677. <arg value="--analyticsSnippet" />
  678. <arg value="${basedir}/docs/site_analytics.html" />
  679. <arg value="--adSnippet" />
  680. <arg value="${basedir}/docs/site_ads.html" />
  681. <arg value="--alias" />
  682. <arg value="index=overview" />
  683. <arg value="--alias" />
  684. <arg value="properties=settings" />
  685. <arg value="--substitute" />
  686. <arg value="%VERSION%=${gb.version}" />
  687. <arg value="--substitute" />
  688. <arg value="%GO%=${distribution.zipfile}" />
  689. <arg value="--substitute" />
  690. <arg value="%WAR%=${distribution.warfile}" />
  691. <arg value="--substitute" />
  692. <arg value="%FEDCLIENT%=${fedclient.zipfile}" />
  693. <arg value="--substitute" />
  694. <arg value="%MANAGER%=${manager.zipfile}" />
  695. <arg value="--substitute" />
  696. <arg value="%API%=${gbapi.zipfile}" />
  697. <arg value="--substitute" />
  698. <arg value="%EXPRESS%=${express.zipfile}" />
  699. <arg value="--substitute" />
  700. <arg value="%BUILDDATE%=${gb.versionDate}" />
  701. <arg value="--substitute" />
  702. <arg value="%JGIT%=${jgit.version}" />
  703. <arg value="--properties" />
  704. <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
  705. <arg value="--nomarkdown" />
  706. <arg value="%BEGINCODE%:%ENDCODE%" />
  707. <arg value="--substitute" />
  708. <arg value="&quot;%BEGINCODE%=&lt;pre class='prettyprint lang-java'&gt;&quot;" />
  709. <arg value="--substitute" />
  710. <arg value="%ENDCODE%=&lt;/pre&gt;" />
  711. <arg value="--regex" />
  712. <arg value="&quot;\b(issue)(\s*[#]?|-){0,1}(\d+)\b!!!&lt;a href='http://code.google.com/p/gitblit/issues/detail?id=$3'&gt;issue $3&lt;/a&gt;&quot;" />
  713. </java>
  714. </target>
  715. <!--
  716. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  717. Compile from source, publish binaries, and build & deploy site
  718. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  719. -->
  720. <target name="buildAll" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary,buildSite">
  721. <!-- Cleanup -->
  722. <delete dir="${project.build.dir}" />
  723. <delete dir="${project.war.dir}" />
  724. <delete dir="${project.deploy.dir}" />
  725. <delete dir="${project.express.dir}" />
  726. </target>
  727. <!--
  728. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  729. Update the gh-pages branch with the current site
  730. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  731. -->
  732. <target name="updateGhPages" depends="buildSite">
  733. <!-- Build gh-pages branch -->
  734. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildGhPages">
  735. <classpath refid="master-classpath" />
  736. <arg value="--sourceFolder" />
  737. <arg value="${basedir}/site" />
  738. <arg value="--repository" />
  739. <arg value="${basedir}" />
  740. <arg value="--obliterate" />
  741. </java>
  742. </target>
  743. <!--
  744. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  745. Publish binaries to Google Code
  746. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  747. -->
  748. <target name="publishBinaries" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary" description="Publish the Gitblit binaries to Google Code">
  749. <echo>Uploading Gitblit ${gb.version} binaries</echo>
  750. <!-- Upload Gitblit GO ZIP file -->
  751. <gcupload
  752. username="${googlecode.user}"
  753. password="${googlecode.password}"
  754. projectname="gitblit"
  755. filename="${distribution.zipfile}"
  756. targetfilename="gitblit-${gb.version}.zip"
  757. summary="Gitblit GO v${gb.version} (standalone, integrated Gitblit server)"
  758. labels="Featured, Type-Package, OpSys-All" />
  759. <!-- Upload Gitblit WAR file -->
  760. <gcupload
  761. username="${googlecode.user}"
  762. password="${googlecode.password}"
  763. projectname="gitblit"
  764. filename="${distribution.warfile}"
  765. targetfilename="gitblit-${gb.version}.war"
  766. summary="Gitblit WAR v${gb.version} (standard WAR webapp for servlet containers)"
  767. labels="Featured, Type-Package, OpSys-All" />
  768. <!-- Upload Gitblit FedClient -->
  769. <gcupload
  770. username="${googlecode.user}"
  771. password="${googlecode.password}"
  772. projectname="gitblit"
  773. filename="${fedclient.zipfile}"
  774. targetfilename="fedclient-${gb.version}.zip"
  775. summary="Gitblit Federation Client v${gb.version} (command-line tool to clone data from federated Gitblit instances)"
  776. labels="Featured, Type-Package, OpSys-All" />
  777. <!-- Upload Gitblit Manager -->
  778. <gcupload
  779. username="${googlecode.user}"
  780. password="${googlecode.password}"
  781. projectname="gitblit"
  782. filename="${manager.zipfile}"
  783. targetfilename="manager-${gb.version}.zip"
  784. summary="Gitblit Manager v${gb.version} (Swing tool to remotely administer a Gitblit server)"
  785. labels="Featured, Type-Package, OpSys-All" />
  786. <!-- Upload Gitblit API Library -->
  787. <gcupload
  788. username="${googlecode.user}"
  789. password="${googlecode.password}"
  790. projectname="gitblit"
  791. filename="${gbapi.zipfile}"
  792. targetfilename="gbapi-${gb.version}.zip"
  793. summary="Gitblit API Library v${gb.version} (JSON RPC library to integrate with your software)"
  794. labels="Featured, Type-Package, OpSys-All" />
  795. <!-- Upload Gitblit Express for RedHat OpenShift -->
  796. <gcupload
  797. username="${googlecode.user}"
  798. password="${googlecode.password}"
  799. projectname="gitblit"
  800. filename="${express.zipfile}"
  801. targetfilename="express-${gb.version}.zip"
  802. summary="Gitblit Express v${gb.version} (run Gitblit on RedHat's OpenShift cloud)"
  803. labels="Featured, Type-Package, OpSys-All" />
  804. </target>
  805. <!--
  806. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  807. Publish site to site hosting service
  808. You must add ext/commons-net-1.4.0.jar to your ANT classpath.
  809. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  810. -->
  811. <target name="publishSite" depends="buildSite,updateGhPages" description="Publish the Gitblit site to a webserver (requires ext/commons-net-1.4.0.jar)" >
  812. <echo>Uploading Gitblit ${gb.version} website</echo>
  813. <ftp server="${ftp.server}"
  814. userid="${ftp.user}"
  815. password="${ftp.password}"
  816. remotedir="${ftp.dir}"
  817. passive="true"
  818. verbose="yes">
  819. <fileset dir="${project.site.dir}" />
  820. </ftp>
  821. </target>
  822. <!--
  823. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  824. Compile from source, publish binaries, and build & deploy site
  825. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  826. -->
  827. <target name="publishAll" depends="publishBinaries,publishSite">
  828. <!-- Cleanup -->
  829. <delete dir="${project.build.dir}" />
  830. <delete dir="${project.war.dir}" />
  831. <delete dir="${project.deploy.dir}" />
  832. </target>
  833. </project>