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