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

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