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