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