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

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