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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  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}">
  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">
  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. </fileset>
  182. </copy>
  183. <!-- Create Zip deployment -->
  184. <zip destfile="${distribution.zipfile}">
  185. <fileset dir="${project.deploy.dir}">
  186. <include name="**/*" />
  187. </fileset>
  188. </zip>
  189. </target>
  190. <!--
  191. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  192. Build Gitblit Docs which are bundled with GO and WAR downloads
  193. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194. -->
  195. <target name="buildDocs">
  196. <!-- Build Docs -->
  197. <mkdir dir="${docs.output.dir}" />
  198. <copy todir="${docs.output.dir}">
  199. <!-- Copy selected Gitblit resources -->
  200. <fileset dir="${project.resources.dir}">
  201. <include name="bootstrap.140.css" />
  202. <include name="bootstrap.gb.css" />
  203. <include name="markdown.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. </fileset>
  313. </copy>
  314. <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties -->
  315. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml">
  316. <classpath refid="master-classpath" />
  317. <arg value="--sourceFile" />
  318. <arg value="${basedir}/src/WEB-INF/web.xml" />
  319. <arg value="--destinationFile" />
  320. <arg value="${project.war.dir}/WEB-INF/web.xml" />
  321. <arg value="--propertiesFile" />
  322. <arg value="${basedir}/distrib/gitblit.properties" />
  323. </java>
  324. <!-- Gitblit resources -->
  325. <copy todir="${project.war.dir}">
  326. <fileset dir="${project.resources.dir}">
  327. <exclude name="thumbs.db" />
  328. </fileset>
  329. </copy>
  330. <!-- Gitblit library dependencies -->
  331. <mkdir dir="${project.war.dir}/WEB-INF/lib"/>
  332. <copy todir="${project.war.dir}/WEB-INF/lib">
  333. <fileset dir="${basedir}/ext">
  334. <exclude name="*-sources.jar" />
  335. <exclude name="*-javadoc.jar" />
  336. <exclude name="jcommander*.jar" />
  337. <exclude name="jetty*.jar" />
  338. <exclude name="junit*.jar" />
  339. <exclude name="servlet*.jar" />
  340. </fileset>
  341. </copy>
  342. <!-- Gitblit classes -->
  343. <mkdir dir="${project.war.dir}/WEB-INF/classes"/>
  344. <copy todir="${project.war.dir}/WEB-INF/classes">
  345. <fileset dir="${project.build.dir}">
  346. <exclude name="WEB-INF/" />
  347. <exclude name="com/gitblit/tests/" />
  348. <exclude name="com/gitblit/build/**" />
  349. <exclude name="com/gitblit/client/**" />
  350. <exclude name="com/gitblit/GitBlitServer*.class" />
  351. <exclude name="com/gitblit/Launcher*.class" />
  352. <exclude name="com/gitblit/MakeCertificate*.class" />
  353. </fileset>
  354. </copy>
  355. <!-- Build the WAR file -->
  356. <jar basedir="${project.war.dir}" destfile="${distribution.warfile}" compress="true" />
  357. </target>
  358. <!--
  359. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  360. Build the stand-alone, command-line Gitblit Federation Client
  361. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362. -->
  363. <target name="buildFederationClient" depends="compile" description="Builds the stand-alone Gitblit federation client">
  364. <echo>Building Gitblit Federation Client ${gb.version}</echo>
  365. <genjar jarfile="fedclient.jar">
  366. <class name="com.gitblit.FederationClientLauncher" />
  367. <resource file="${project.build.dir}/log4j.properties" />
  368. <classfilter>
  369. <exclude name="org.apache." />
  370. <exclude name="org.bouncycastle." />
  371. <exclude name="org.eclipse." />
  372. <exclude name="org.slf4j." />
  373. <exclude name="com.beust." />
  374. <exclude name="com.google." />
  375. </classfilter>
  376. <classpath refid="master-classpath" />
  377. <manifest>
  378. <attribute name="Main-Class" value="com.gitblit.FederationClientLauncher" />
  379. <attribute name="Specification-Version" value="${gb.version}" />
  380. <attribute name="Release-Date" value="${gb.versionDate}" />
  381. </manifest>
  382. </genjar>
  383. <!-- Build the federation client zip file -->
  384. <zip destfile="${fedclient.zipfile}">
  385. <fileset dir="${basedir}">
  386. <include name="fedclient.jar" />
  387. <include name="LICENSE" />
  388. <include name="NOTICE" />
  389. </fileset>
  390. <fileset dir="${basedir}/distrib">
  391. <include name="federation.properties" />
  392. </fileset>
  393. </zip>
  394. </target>
  395. <!--
  396. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  397. Build a Gitblit filesystem for deployment to RedHat OpenShif Expresst
  398. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  399. -->
  400. <target name="buildExpress" depends="compile" description="Build exploded WAR file suitable for deployment to OpenShift Express">
  401. <echo>Building Gitblit Express for RedHat OpenShift ${gb.version}</echo>
  402. <delete dir="${project.express.dir}" />
  403. <!-- Create the OpenShift filesystem -->
  404. <property name="deployments.root" value="${project.express.dir}/deployments/ROOT.war"/>
  405. <mkdir dir="${deployments.root}" />
  406. <touch file="${project.express.dir}/deployments/ROOT.war.dodeploy" />
  407. <!-- Copy the Gitblit OpenShift readme file -->
  408. <copy tofile="${project.express.dir}/README.gitblit"
  409. file="${basedir}/distrib/openshift.mkd"/>
  410. <!-- Copy LICENSE and NOTICE to WEB-INF -->
  411. <copy todir="${deployments.root}/WEB-INF">
  412. <fileset dir="${basedir}">
  413. <include name="LICENSE" />
  414. <include name="NOTICE" />
  415. </fileset>
  416. </copy>
  417. <!-- Copy gitblit.properties as reference.properties -->
  418. <copy tofile="${deployments.root}/WEB-INF/reference.properties"
  419. file="${basedir}/distrib/gitblit.properties"/>
  420. <!-- Copy the supported Groovy hook scripts -->
  421. <mkdir dir="${deployments.root}/WEB-INF/groovy" />
  422. <copy todir="${deployments.root}/WEB-INF/groovy">
  423. <fileset dir="${basedir}/groovy">
  424. <include name="sendmail.groovy" />
  425. <include name="jenkins.groovy" />
  426. </fileset>
  427. </copy>
  428. <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties -->
  429. <!-- THIS FILE IS NOT OVERRIDDEN ONCE IT IS BUILT!!! -->
  430. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml">
  431. <classpath refid="master-classpath" />
  432. <arg value="--sourceFile" />
  433. <arg value="${basedir}/src/WEB-INF/web.xml" />
  434. <arg value="--destinationFile" />
  435. <arg value="${deployments.root}/WEB-INF/web.xml" />
  436. <arg value="--propertiesFile" />
  437. <arg value="${basedir}/distrib/gitblit.properties" />
  438. </java>
  439. <!-- Gitblit resources -->
  440. <copy todir="${deployments.root}">
  441. <fileset dir="${project.resources.dir}">
  442. <exclude name="thumbs.db" />
  443. </fileset>
  444. </copy>
  445. <!-- Gitblit library dependencies -->
  446. <mkdir dir="${deployments.root}/WEB-INF/lib"/>
  447. <copy todir="${deployments.root}/WEB-INF/lib">
  448. <fileset dir="${basedir}/ext">
  449. <exclude name="*-sources.jar" />
  450. <exclude name="*-javadoc.jar" />
  451. <exclude name="jcommander*.jar" />
  452. <exclude name="jetty*.jar" />
  453. <exclude name="junit*.jar" />
  454. <exclude name="servlet*.jar" />
  455. </fileset>
  456. </copy>
  457. <!-- Gitblit classes -->
  458. <mkdir dir="${deployments.root}/WEB-INF/classes"/>
  459. <copy todir="${deployments.root}/WEB-INF/classes">
  460. <fileset dir="${project.build.dir}">
  461. <exclude name="WEB-INF/" />
  462. <exclude name="com/gitblit/tests/" />
  463. <exclude name="com/gitblit/build/**" />
  464. <exclude name="com/gitblit/client/**" />
  465. <exclude name="com/gitblit/GitBlitServer*.class" />
  466. <exclude name="com/gitblit/Launcher*.class" />
  467. <exclude name="com/gitblit/MakeCertificate*.class" />
  468. </fileset>
  469. </copy>
  470. <!-- Build Express Zip file -->
  471. <zip destfile="${express.zipfile}">
  472. <fileset dir="${project.express.dir}" />
  473. </zip>
  474. </target>
  475. <!--
  476. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  477. Build the stand-alone, Gitblit Manager
  478. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  479. -->
  480. <target name="buildManager" depends="compile" description="Builds the stand-alone Gitblit Manager">
  481. <echo>Building Gitblit Manager ${gb.version}</echo>
  482. <genjar jarfile="manager-${gb.version}.jar">
  483. <resource file="${basedir}/src/com/gitblit/client/splash.png" />
  484. <resource file="${basedir}/resources/gitblt-favicon.png" />
  485. <resource file="${basedir}/resources/gitweb-favicon.png" />
  486. <resource file="${basedir}/resources/user_16x16.png" />
  487. <resource file="${basedir}/resources/settings_16x16.png" />
  488. <resource file="${basedir}/resources/lock_go_16x16.png" />
  489. <resource file="${basedir}/resources/lock_pull_16x16.png" />
  490. <resource file="${basedir}/resources/shield_16x16.png" />
  491. <resource file="${basedir}/resources/federated_16x16.png" />
  492. <resource file="${basedir}/resources/cold_16x16.png" />
  493. <resource file="${basedir}/resources/book_16x16.png" />
  494. <resource file="${basedir}/resources/bug_16x16.png" />
  495. <resource file="${basedir}/resources/health_16x16.png" />
  496. <resource file="${basedir}/resources/feed_16x16.png" />
  497. <resource file="${basedir}/resources/bullet_feed.png" />
  498. <resource file="${basedir}/resources/search-icon.png" />
  499. <resource file="${basedir}/resources/commit_changes_16x16.png" />
  500. <resource file="${basedir}/resources/commit_merge_16x16.png" />
  501. <resource file="${basedir}/resources/blank.png" />
  502. <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
  503. <class name="com.gitblit.client.GitblitManagerLauncher" />
  504. <classfilter>
  505. <exclude name="org.apache." />
  506. <exclude name="org.bouncycastle." />
  507. <exclude name="org.eclipse." />
  508. <exclude name="org.slf4j." />
  509. <exclude name="com.beust." />
  510. <exclude name="com.google." />
  511. </classfilter>
  512. <classpath refid="master-classpath" />
  513. <manifest>
  514. <attribute name="Main-Class" value="com.gitblit.client.GitblitManagerLauncher" />
  515. <attribute name="SplashScreen-Image" value="splash.png" />
  516. <attribute name="Specification-Version" value="${gb.version}" />
  517. <attribute name="Release-Date" value="${gb.versionDate}" />
  518. </manifest>
  519. </genjar>
  520. <!-- Build Manager Zip file -->
  521. <zip destfile="${manager.zipfile}">
  522. <fileset dir="${basedir}">
  523. <include name="manager-${gb.version}.jar" />
  524. <include name="LICENSE" />
  525. <include name="NOTICE" />
  526. </fileset>
  527. </zip>
  528. </target>
  529. <!--
  530. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  531. Build the Gitblit API client library
  532. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  533. -->
  534. <target name="buildApiLibrary" depends="compile" description="Builds the Gitblit RPC client library">
  535. <echo>Building Gitblit API Library ${gb.version}</echo>
  536. <!-- Build API Library jar -->
  537. <genjar jarfile="gbapi-${gb.version}.jar">
  538. <class name="com.gitblit.Keys" />
  539. <class name="com.gitblit.client.GitblitClient" />
  540. <classpath refid="master-classpath" />
  541. <classfilter>
  542. <exclude name="com.google.gson." />
  543. <exclude name="com.sun.syndication." />
  544. </classfilter>
  545. <manifest>
  546. <attribute name="Specification-Version" value="${gb.version}" />
  547. <attribute name="Release-Date" value="${gb.versionDate}" />
  548. </manifest>
  549. </genjar>
  550. <!-- Build API sources jar -->
  551. <zip destfile="gbapi-${gb.version}-sources.jar">
  552. <fileset dir="${basedir}/src" defaultexcludes="yes">
  553. <include name="com/gitblit/Constants.java"/>
  554. <include name="com/gitblit/GitBlitException.java"/>
  555. <include name="com/gitblit/Keys.java"/>
  556. <include name="com/gitblit/client/**/*.java"/>
  557. <include name="com/gitblit/models/**/*.java"/>
  558. <include name="com/gitblit/utils/**/*.java"/>
  559. </fileset>
  560. </zip>
  561. <!-- Build API JavaDoc jar -->
  562. <javadoc destdir="${basedir}/javadoc">
  563. <fileset dir="${basedir}/src" defaultexcludes="yes">
  564. <include name="com/gitblit/Constants.java"/>
  565. <include name="com/gitblit/GitBlitException.java"/>
  566. <include name="com/gitblit/Keys.java"/>
  567. <include name="com/gitblit/client/**/*.java"/>
  568. <include name="com/gitblit/models/**/*.java"/>
  569. <include name="com/gitblit/utils/**/*.java"/>
  570. </fileset>
  571. </javadoc>
  572. <zip destfile="gbapi-${gb.version}-javadoc.jar">
  573. <fileset dir="${basedir}/javadoc" />
  574. </zip>
  575. <!-- Build the API library zip file -->
  576. <zip destfile="${gbapi.zipfile}">
  577. <fileset dir="${basedir}">
  578. <include name="gbapi-${gb.version}.jar" />
  579. <include name="gbapi-${gb.version}-sources.jar" />
  580. <include name="gbapi-${gb.version}-javadoc.jar" />
  581. <include name="LICENSE" />
  582. <include name="NOTICE" />
  583. </fileset>
  584. <fileset dir="${basedir}/ext">
  585. <include name="gson*.jar" />
  586. <exclude name="gson*-sources.jar" />
  587. <exclude name="gson*-javadoc.jar" />
  588. <include name="rome*.jar" />
  589. <exclude name="rome*-sources.jar" />
  590. <exclude name="rome*-javadoc.jar" />
  591. </fileset>
  592. </zip>
  593. </target>
  594. <!--
  595. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  596. Build the Gitblit Website
  597. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  598. -->
  599. <target name="buildSite" depends="compile" description="Build the Gitblit website">
  600. <echo>Building Gitblit Website ${gb.version}</echo>
  601. <!-- Build Site -->
  602. <delete dir="${project.site.dir}" />
  603. <mkdir dir="${project.site.dir}" />
  604. <copy todir="${project.site.dir}">
  605. <!-- Copy selected Gitblit resources -->
  606. <fileset dir="${project.resources.dir}">
  607. <include name="bootstrap.140.css" />
  608. <include name="bootstrap.gb.css" />
  609. <include name="markdown.css" />
  610. <include name="gitblt_25_white.png" />
  611. <include name="gitblt-favicon.png" />
  612. <include name="lock_go_16x16.png" />
  613. <include name="lock_pull_16x16.png" />
  614. <include name="shield_16x16.png" />
  615. <include name="cold_16x16.png" />
  616. <include name="bug_16x16.png" />
  617. <include name="book_16x16.png" />
  618. <include name="blank.png" />
  619. <include name="federated_16x16.png" />
  620. <include name="arrow_page.png" />
  621. </fileset>
  622. <!-- Copy Doc images -->
  623. <fileset dir="${basedir}/docs">
  624. <include name="*.png" />
  625. <include name="*.gif" />
  626. <include name="*.js" />
  627. </fileset>
  628. </copy>
  629. <!-- Copy Fancybox -->
  630. <mkdir dir="${project.site.dir}/fancybox" />
  631. <copy todir="${project.site.dir}/fancybox">
  632. <fileset dir="${basedir}/docs/fancybox">
  633. <exclude name="thumbs.db" />
  634. </fileset>
  635. </copy>
  636. <!-- Copy google-code-prettify -->
  637. <mkdir dir="${basedir}/src/com/gitblit/wicket/pages/prettify" />
  638. <copy todir="${project.site.dir}/prettify">
  639. <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
  640. <exclude name="thumbs.db" />
  641. </fileset>
  642. </copy>
  643. <!-- Generate thumbnails of screenshots -->
  644. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildThumbnails">
  645. <classpath refid="master-classpath" />
  646. <arg value="--sourceFolder" />
  647. <arg value="${basedir}/docs/screenshots" />
  648. <arg value="--destinationFolder" />
  649. <arg value="${project.site.dir}/thumbs" />
  650. <arg value="--maximumDimension" />
  651. <arg value="250" />
  652. </java>
  653. <!-- Copy screenshots -->
  654. <mkdir dir="${project.site.dir}/screenshots" />
  655. <copy todir="${project.site.dir}/screenshots">
  656. <fileset dir="${basedir}/docs/screenshots">
  657. <include name="*.png" />
  658. </fileset>
  659. </copy>
  660. <!-- Build site pages -->
  661. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildSite">
  662. <classpath refid="master-classpath" />
  663. <arg value="--sourceFolder" />
  664. <arg value="${basedir}/docs" />
  665. <arg value="--outputFolder" />
  666. <arg value="${project.site.dir}" />
  667. <arg value="--pageHeader" />
  668. <arg value="${basedir}/docs/site_header.html" />
  669. <arg value="--pageFooter" />
  670. <arg value="${basedir}/docs/site_footer.html" />
  671. <arg value="--analyticsSnippet" />
  672. <arg value="${basedir}/docs/site_analytics.html" />
  673. <arg value="--adSnippet" />
  674. <arg value="${basedir}/docs/site_ads.html" />
  675. <arg value="--alias" />
  676. <arg value="index=overview" />
  677. <arg value="--alias" />
  678. <arg value="properties=settings" />
  679. <arg value="--substitute" />
  680. <arg value="%VERSION%=${gb.version}" />
  681. <arg value="--substitute" />
  682. <arg value="%GO%=${distribution.zipfile}" />
  683. <arg value="--substitute" />
  684. <arg value="%WAR%=${distribution.warfile}" />
  685. <arg value="--substitute" />
  686. <arg value="%FEDCLIENT%=${fedclient.zipfile}" />
  687. <arg value="--substitute" />
  688. <arg value="%MANAGER%=${manager.zipfile}" />
  689. <arg value="--substitute" />
  690. <arg value="%API%=${gbapi.zipfile}" />
  691. <arg value="--substitute" />
  692. <arg value="%EXPRESS%=${express.zipfile}" />
  693. <arg value="--substitute" />
  694. <arg value="%BUILDDATE%=${gb.versionDate}" />
  695. <arg value="--substitute" />
  696. <arg value="%JGIT%=${jgit.version}" />
  697. <arg value="--properties" />
  698. <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
  699. <arg value="--nomarkdown" />
  700. <arg value="%BEGINCODE%:%ENDCODE%" />
  701. <arg value="--substitute" />
  702. <arg value="&quot;%BEGINCODE%=&lt;pre class='prettyprint lang-java'&gt;&quot;" />
  703. <arg value="--substitute" />
  704. <arg value="%ENDCODE%=&lt;/pre&gt;" />
  705. <arg value="--regex" />
  706. <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;" />
  707. </java>
  708. </target>
  709. <!--
  710. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711. Compile from source, publish binaries, and build & deploy site
  712. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  713. -->
  714. <target name="buildAll" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary,buildSite">
  715. <!-- Cleanup -->
  716. <delete dir="${project.build.dir}" />
  717. <delete dir="${project.war.dir}" />
  718. <delete dir="${project.deploy.dir}" />
  719. <delete dir="${project.express.dir}" />
  720. </target>
  721. <!--
  722. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  723. Update the gh-pages branch with the current site
  724. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  725. -->
  726. <target name="updateGhPages" depends="buildSite">
  727. <!-- Build gh-pages branch -->
  728. <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildGhPages">
  729. <classpath refid="master-classpath" />
  730. <arg value="--sourceFolder" />
  731. <arg value="${basedir}/site" />
  732. <arg value="--repository" />
  733. <arg value="${basedir}" />
  734. <arg value="--obliterate" />
  735. </java>
  736. </target>
  737. <!--
  738. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  739. Publish binaries to Google Code
  740. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  741. -->
  742. <target name="publishBinaries" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager" description="Publish the Gitblit binaries to Google Code">
  743. <echo>Uploading Gitblit ${gb.version} binaries</echo>
  744. <!-- Upload Gitblit GO ZIP file -->
  745. <gcupload
  746. username="${googlecode.user}"
  747. password="${googlecode.password}"
  748. projectname="gitblit"
  749. filename="${distribution.zipfile}"
  750. targetfilename="gitblit-${gb.version}.zip"
  751. summary="Gitblit GO v${gb.version} (standalone, integrated Gitblit server)"
  752. labels="Featured, Type-Package, OpSys-All" />
  753. <!-- Upload Gitblit WAR file -->
  754. <gcupload
  755. username="${googlecode.user}"
  756. password="${googlecode.password}"
  757. projectname="gitblit"
  758. filename="${distribution.warfile}"
  759. targetfilename="gitblit-${gb.version}.war"
  760. summary="Gitblit WAR v${gb.version} (standard WAR webapp for servlet containers)"
  761. labels="Featured, Type-Package, OpSys-All" />
  762. <!-- Upload Gitblit FedClient -->
  763. <gcupload
  764. username="${googlecode.user}"
  765. password="${googlecode.password}"
  766. projectname="gitblit"
  767. filename="${fedclient.zipfile}"
  768. targetfilename="fedclient-${gb.version}.zip"
  769. summary="Gitblit Federation Client v${gb.version} (command-line tool to clone data from federated Gitblit instances)"
  770. labels="Featured, Type-Package, OpSys-All" />
  771. <!-- Upload Gitblit Manager -->
  772. <gcupload
  773. username="${googlecode.user}"
  774. password="${googlecode.password}"
  775. projectname="gitblit"
  776. filename="${manager.zipfile}"
  777. targetfilename="manager-${gb.version}.zip"
  778. summary="Gitblit Manager v${gb.version} (Swing tool to remotely administer a Gitblit server)"
  779. labels="Featured, Type-Package, OpSys-All" />
  780. <!-- Upload Gitblit API Library -->
  781. <gcupload
  782. username="${googlecode.user}"
  783. password="${googlecode.password}"
  784. projectname="gitblit"
  785. filename="${gbapi.zipfile}"
  786. targetfilename="gbapi-${gb.version}.zip"
  787. summary="Gitblit API Library v${gb.version} (JSON RPC library to integrate with your software)"
  788. labels="Featured, Type-Package, OpSys-All" />
  789. <!-- Upload Gitblit Express for RedHat OpenShift -->
  790. <gcupload
  791. username="${googlecode.user}"
  792. password="${googlecode.password}"
  793. projectname="gitblit"
  794. filename="${express.zipfile}"
  795. targetfilename="express-${gb.version}.zip"
  796. summary="Gitblit Express v${gb.version} (run Gitblit on RedHat's OpenShift cloud)"
  797. labels="Featured, Type-Package, OpSys-All" />
  798. </target>
  799. <!--
  800. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  801. Publish site to site hosting service
  802. You must add ext/commons-net-1.4.0.jar to your ANT classpath.
  803. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  804. -->
  805. <target name="publishSite" depends="buildSite,updateGhPages" description="Publish the Gitblit site to a webserver (requires ext/commons-net-1.4.0.jar)" >
  806. <echo>Uploading Gitblit ${gb.version} website</echo>
  807. <ftp server="${ftp.server}"
  808. userid="${ftp.user}"
  809. password="${ftp.password}"
  810. remotedir="${ftp.dir}"
  811. passive="true"
  812. verbose="yes">
  813. <fileset dir="${project.site.dir}" />
  814. </ftp>
  815. </target>
  816. <!--
  817. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  818. Compile from source, publish binaries, and build & deploy site
  819. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  820. -->
  821. <target name="publishAll" depends="publishBinaries,publishSite">
  822. <!-- Cleanup -->
  823. <delete dir="${project.build.dir}" />
  824. <delete dir="${project.war.dir}" />
  825. <delete dir="${project.deploy.dir}" />
  826. </target>
  827. </project>