James Moger
2012-01-24 06ff61c04db32abc7ba4bbaeee604482c343152e
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" />
04627e 581             <resource file="${basedir}/resources/users_16x16.png" />
ee25c8 582             <resource file="${basedir}/resources/settings_16x16.png" />
841651 583             <resource file="${basedir}/resources/lock_go_16x16.png" />
JM 584             <resource file="${basedir}/resources/lock_pull_16x16.png" />
585             <resource file="${basedir}/resources/shield_16x16.png" />
586             <resource file="${basedir}/resources/federated_16x16.png" />
587             <resource file="${basedir}/resources/cold_16x16.png" />
588             <resource file="${basedir}/resources/book_16x16.png" />
589             <resource file="${basedir}/resources/bug_16x16.png" />
a70b43 590             <resource file="${basedir}/resources/health_16x16.png" />
4cac0d 591             <resource file="${basedir}/resources/feed_16x16.png" />
JM 592             <resource file="${basedir}/resources/bullet_feed.png" />
9119cf 593             <resource file="${basedir}/resources/search-icon.png" />
ee458f 594             <resource file="${basedir}/resources/commit_changes_16x16.png" />
c7e7e9 595             <resource file="${basedir}/resources/commit_merge_16x16.png" />
841651 596             <resource file="${basedir}/resources/blank.png" />
b7f591 597             <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
b774de 598
a7a9f7 599             <class name="com.gitblit.client.GitblitManagerLauncher" />
841651 600             <classfilter>
JM 601                 <exclude name="org.apache." />
602                 <exclude name="org.bouncycastle." />
603                 <exclude name="org.eclipse." />
604                 <exclude name="org.slf4j." />
605                 <exclude name="com.beust." />
606                 <exclude name="com.google." />
607             </classfilter>
608             <classpath refid="master-classpath" />
609             <manifest>
a7a9f7 610                 <attribute name="Main-Class" value="com.gitblit.client.GitblitManagerLauncher" />
841651 611                 <attribute name="SplashScreen-Image" value="splash.png" />
773bb6 612                 <attribute name="Specification-Version" value="${gb.version}" />
841651 613                 <attribute name="Release-Date" value="${gb.versionDate}" />
JM 614             </manifest>
615         </genjar>
b774de 616
d65f71 617         <!-- Build Manager Zip file -->
JM 618         <zip destfile="${manager.zipfile}">
619             <fileset dir="${basedir}">
620                 <include name="manager-${gb.version}.jar" />
621                 <include name="LICENSE" />
622                 <include name="NOTICE" />
623             </fileset>
624         </zip>
841651 625     </target>
773bb6 626     
JM 627     <!-- 
628             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
629             Build the Gitblit API client library
630             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
631         -->
632         <target name="buildApiLibrary" depends="compile" description="Builds the Gitblit RPC client library">
633             <echo>Building Gitblit API Library ${gb.version}</echo>
634         
d65f71 635             <!-- Build API Library jar -->
JM 636             <genjar jarfile="gbapi-${gb.version}.jar">
637                 <class name="com.gitblit.Keys" />
773bb6 638                 <class name="com.gitblit.client.GitblitClient" />
JM 639                 <classpath refid="master-classpath" />
640                 <classfilter>
641                     <exclude name="com.google.gson." />
9119cf 642                     <exclude name="com.sun.syndication." />
773bb6 643                 </classfilter>
JM 644                 <manifest>
645                     <attribute name="Specification-Version" value="${gb.version}" />
646                     <attribute name="Release-Date" value="${gb.versionDate}" />
647                 </manifest>
648             </genjar>
649             
d65f71 650             <!-- Build API sources jar -->
JM 651             <zip destfile="gbapi-${gb.version}-sources.jar">
652                 <fileset dir="${basedir}/src" defaultexcludes="yes">
653                     <include name="com/gitblit/Constants.java"/>
654                     <include name="com/gitblit/GitBlitException.java"/>
655                     <include name="com/gitblit/Keys.java"/>
656                       <include name="com/gitblit/client/**/*.java"/>
657                       <include name="com/gitblit/models/**/*.java"/>
658                       <include name="com/gitblit/utils/**/*.java"/>                      
659                 </fileset>
660             </zip>
661             
662             <!-- Build API JavaDoc jar -->
663             <javadoc destdir="${basedir}/javadoc">
664                 <fileset dir="${basedir}/src" defaultexcludes="yes">
665                     <include name="com/gitblit/Constants.java"/>
666                     <include name="com/gitblit/GitBlitException.java"/>
667                     <include name="com/gitblit/Keys.java"/>
668                       <include name="com/gitblit/client/**/*.java"/>
669                       <include name="com/gitblit/models/**/*.java"/>
670                       <include name="com/gitblit/utils/**/*.java"/>                      
671                 </fileset>
672             </javadoc>
673             <zip destfile="gbapi-${gb.version}-javadoc.jar">
674                 <fileset dir="${basedir}/javadoc" />
675             </zip>
676             
773bb6 677             <!-- Build the API library zip file -->
JM 678             <zip destfile="${gbapi.zipfile}">
679                 <fileset dir="${basedir}">
d65f71 680                     <include name="gbapi-${gb.version}.jar" />
JM 681                     <include name="gbapi-${gb.version}-sources.jar" />
682                     <include name="gbapi-${gb.version}-javadoc.jar" />
683                     <include name="LICENSE" />
684                     <include name="NOTICE" />
773bb6 685                 </fileset>
JM 686                 <fileset dir="${basedir}/ext">
687                     <include name="gson*.jar" />
688                     <exclude name="gson*-sources.jar" />
689                     <exclude name="gson*-javadoc.jar" />
9119cf 690                     <include name="rome*.jar" />
JM 691                     <exclude name="rome*-sources.jar" />
692                     <exclude name="rome*-javadoc.jar" />
773bb6 693                 </fileset>
JM 694             </zip>
695         </target>
841651 696         
f6740d 697         
85c2e6 698     <!-- 
JM 699         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
700         Build the Gitblit Website
701         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
702     -->
703     <target name="buildSite" depends="compile" description="Build the Gitblit website">
704         
705         <echo>Building Gitblit Website ${gb.version}</echo>
706
dd7961 707         <!-- Build Site -->
85c2e6 708         <delete dir="${project.site.dir}" />
JM 709         <mkdir dir="${project.site.dir}" />
710         <copy todir="${project.site.dir}">
f13c4c 711             <!-- Copy selected Gitblit resources -->
5450d0 712             <fileset dir="${project.resources.dir}">
493ab0 713                 <include name="bootstrap.140.css" />
8c5d72 714                 <include name="bootstrap.gb.css" />
dd7961 715                 <include name="markdown.css" />
8c5d72 716                 <include name="gitblt_25_white.png" />
dd7961 717                 <include name="gitblt-favicon.png" />
f90dc6 718                 <include name="lock_go_16x16.png" />
JM 719                 <include name="lock_pull_16x16.png" />
720                 <include name="shield_16x16.png" />
721                 <include name="cold_16x16.png" />
722                 <include name="bug_16x16.png" />
723                 <include name="book_16x16.png" />
724                 <include name="blank.png" />
831469 725                 <include name="federated_16x16.png" />
0aa6ec 726                 <include name="arrow_page.png" />
dd7961 727             </fileset>
a4d249 728
f90dc6 729             <!-- Copy Doc images -->
dd7961 730             <fileset dir="${basedir}/docs">
f90dc6 731                 <include name="*.png" />
f35a98 732                 <include name="*.gif" />
f90dc6 733                 <include name="*.js" />
JM 734             </fileset>
735         </copy>
a4d249 736
f90dc6 737         <!-- Copy Fancybox -->
85c2e6 738         <mkdir dir="${project.site.dir}/fancybox" />
JM 739         <copy todir="${project.site.dir}/fancybox">
a4d249 740             <fileset dir="${basedir}/docs/fancybox">
f90dc6 741                 <exclude name="thumbs.db" />
JM 742             </fileset>
743         </copy>
a4d249 744
230632 745         <!-- Copy google-code-prettify -->
JM 746         <mkdir dir="${basedir}/src/com/gitblit/wicket/pages/prettify" />
747         <copy todir="${project.site.dir}/prettify">
748             <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
749                 <exclude name="thumbs.db" />
750             </fileset>
751         </copy>
752
24d08f 753         <!-- Generate thumbnails of screenshots -->
22fc5e 754         <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildThumbnails">
24d08f 755             <classpath refid="master-classpath" />
JM 756                 
757             <arg value="--sourceFolder" />
758             <arg value="${basedir}/docs/screenshots" />
759         
760             <arg value="--destinationFolder" />
85c2e6 761             <arg value="${project.site.dir}/thumbs" />
24d08f 762             
JM 763             <arg value="--maximumDimension" />
764             <arg value="250" />
765         </java>
a4d249 766
f90dc6 767         <!-- Copy screenshots -->
85c2e6 768         <mkdir dir="${project.site.dir}/screenshots" />
JM 769         <copy todir="${project.site.dir}/screenshots">
f90dc6 770             <fileset dir="${basedir}/docs/screenshots">
JM 771                 <include name="*.png" />
772             </fileset>
773         </copy>
774
a4d249 775         <!-- Build site pages -->
22fc5e 776         <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildSite">
dd7961 777             <classpath refid="master-classpath" />
JM 778             <arg value="--sourceFolder" />
779             <arg value="${basedir}/docs" />
a4d249 780
dd7961 781             <arg value="--outputFolder" />
85c2e6 782             <arg value="${project.site.dir}" />
dd7961 783
JM 784             <arg value="--pageHeader" />
81f881 785             <arg value="${basedir}/docs/site_header.html" />
e7a153 786             
dd7961 787             <arg value="--pageFooter" />
81f881 788             <arg value="${basedir}/docs/site_footer.html" />
a4d249 789
e7a153 790             <arg value="--analyticsSnippet" />
JM 791             <arg value="${basedir}/docs/site_analytics.html" />
792                 
793             <arg value="--adSnippet" />
794             <arg value="${basedir}/docs/site_ads.html" />
795
e0054b 796             <arg value="--alias" />
JM 797             <arg value="index=overview" />
424fe1 798
1f9dae 799             <arg value="--alias" />
4c835e 800             <arg value="properties=settings" />
a4d249 801
JM 802             <arg value="--substitute" />
803             <arg value="%VERSION%=${gb.version}" />
804
805             <arg value="--substitute" />
85c2e6 806             <arg value="%GO%=${distribution.zipfile}" />
JM 807
808             <arg value="--substitute" />
809             <arg value="%WAR%=${distribution.warfile}" />
a4d249 810
JM 811             <arg value="--substitute" />
f6740d 812             <arg value="%FEDCLIENT%=${fedclient.zipfile}" />
JM 813
814             <arg value="--substitute" />
d65f71 815             <arg value="%MANAGER%=${manager.zipfile}" />
773bb6 816
JM 817             <arg value="--substitute" />
818             <arg value="%API%=${gbapi.zipfile}" />
841651 819
JM 820             <arg value="--substitute" />
b774de 821             <arg value="%EXPRESS%=${express.zipfile}" />
JM 822
823             <arg value="--substitute" />
d39680 824             <arg value="%BUILDDATE%=${gb.versionDate}" />
a4d249 825
JM 826             <arg value="--substitute" />
827             <arg value="%JGIT%=${jgit.version}" />
1f9dae 828
a3f474 829             <arg value="--properties" />
1f9dae 830             <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
230632 831             
JM 832             <arg value="--nomarkdown" />
833             <arg value="%BEGINCODE%:%ENDCODE%" />
834
835             <arg value="--substitute" />
836             <arg value="&quot;%BEGINCODE%=&lt;pre class='prettyprint lang-java'&gt;&quot;" />
837
838             <arg value="--substitute" />
839             <arg value="%ENDCODE%=&lt;/pre&gt;" />
1f9dae 840
5c563c 841             <arg value="--regex" />
JM 842             <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;" />
843
a3f474 844         </java>    
85c2e6 845     </target>
b774de 846
424fe1 847
85c2e6 848     <!--
JM 849         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
850         Compile from source, publish binaries, and build & deploy site
851         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
852     -->
9be337 853     <target name="buildAll" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary,buildSite">        
1f9dae 854         <!-- Cleanup -->
2a7306 855         <delete dir="${project.build.dir}" />
85c2e6 856         <delete dir="${project.war.dir}" />
JM 857         <delete dir="${project.deploy.dir}" />
b774de 858         <delete dir="${project.express.dir}" />
5fe7df 859     </target>
b774de 860
746aaf 861     
JM 862     <!--
863         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
864         Update the gh-pages branch with the current site
865         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
866     -->
867     <target name="updateGhPages" depends="buildSite">
868         <!-- Build gh-pages branch -->
869         <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildGhPages">
870             <classpath refid="master-classpath" />
871             <arg value="--sourceFolder" />
872             <arg value="${basedir}/site" />
873
874             <arg value="--repository" />
875             <arg value="${basedir}" />
876             
877             <arg value="--obliterate" />
878         </java>
879     </target>
880     
b774de 881
85c2e6 882     <!-- 
JM 883         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
884         Publish binaries to Google Code
885         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
886     -->
a48c33 887     <target name="publishBinaries" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary" description="Publish the Gitblit binaries to Google Code">
b774de 888
85c2e6 889         <echo>Uploading Gitblit ${gb.version} binaries</echo>
b774de 890
773bb6 891         <!-- Upload Gitblit GO ZIP file -->
85c2e6 892         <gcupload 
JM 893              username="${googlecode.user}" 
894              password="${googlecode.password}" 
895              projectname="gitblit" 
896              filename="${distribution.zipfile}" 
897              targetfilename="gitblit-${gb.version}.zip"
ed21d2 898              summary="Gitblit GO v${gb.version} (standalone, integrated Gitblit server)"
85c2e6 899              labels="Featured, Type-Package, OpSys-All" />
b774de 900
773bb6 901         <!-- Upload Gitblit WAR file -->
85c2e6 902         <gcupload 
JM 903              username="${googlecode.user}" 
904              password="${googlecode.password}" 
905              projectname="gitblit" 
906              filename="${distribution.warfile}" 
907              targetfilename="gitblit-${gb.version}.war"
ed21d2 908              summary="Gitblit WAR v${gb.version} (standard WAR webapp for servlet containers)"
85c2e6 909              labels="Featured, Type-Package, OpSys-All" />
b774de 910
773bb6 911         <!-- Upload Gitblit FedClient -->
f6740d 912         <gcupload 
JM 913             username="${googlecode.user}" 
914             password="${googlecode.password}" 
915             projectname="gitblit" 
916             filename="${fedclient.zipfile}" 
917             targetfilename="fedclient-${gb.version}.zip"
918             summary="Gitblit Federation Client v${gb.version} (command-line tool to clone data from federated Gitblit instances)"
919             labels="Featured, Type-Package, OpSys-All" />
841651 920
773bb6 921         <!-- Upload Gitblit Manager -->
841651 922         <gcupload 
JM 923             username="${googlecode.user}" 
924             password="${googlecode.password}" 
925             projectname="gitblit" 
d65f71 926             filename="${manager.zipfile}" 
JM 927             targetfilename="manager-${gb.version}.zip"
a7a9f7 928             summary="Gitblit Manager v${gb.version} (Swing tool to remotely administer a Gitblit server)"
773bb6 929             labels="Featured, Type-Package, OpSys-All" />
b774de 930
773bb6 931         <!-- Upload Gitblit API Library -->
JM 932         <gcupload 
933             username="${googlecode.user}" 
934             password="${googlecode.password}" 
935             projectname="gitblit" 
936             filename="${gbapi.zipfile}" 
937             targetfilename="gbapi-${gb.version}.zip"
938             summary="Gitblit API Library v${gb.version} (JSON RPC library to integrate with your software)"
841651 939             labels="Featured, Type-Package, OpSys-All" />
b774de 940
JM 941         <!-- Upload Gitblit Express for RedHat OpenShift -->
942         <gcupload 
943             username="${googlecode.user}" 
944             password="${googlecode.password}" 
945             projectname="gitblit" 
946             filename="${express.zipfile}" 
947             targetfilename="express-${gb.version}.zip"
948             summary="Gitblit Express v${gb.version} (run Gitblit on RedHat's OpenShift cloud)"
949             labels="Featured, Type-Package, OpSys-All" />
950
5450d0 951     </target>
JM 952
b774de 953
85c2e6 954     <!--
JM 955         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
b774de 956         Publish site to site hosting service
85c2e6 957         You must add ext/commons-net-1.4.0.jar to your ANT classpath.
JM 958         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
959     -->
746aaf 960     <target name="publishSite" depends="buildSite,updateGhPages" description="Publish the Gitblit site to a webserver (requires ext/commons-net-1.4.0.jar)" >
b774de 961
85c2e6 962         <echo>Uploading Gitblit ${gb.version} website</echo>
b774de 963
81f881 964         <ftp server="${ftp.server}"
JM 965             userid="${ftp.user}"
966             password="${ftp.password}"
967             remotedir="${ftp.dir}"
968             passive="true"
969             verbose="yes">
85c2e6 970         <fileset dir="${project.site.dir}" />
81f881 971         </ftp>
JM 972     </target>
85c2e6 973
b774de 974
85c2e6 975     <!--
JM 976         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
977         Compile from source, publish binaries, and build & deploy site
978         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
979     -->
773bb6 980     <target name="publishAll" depends="publishBinaries,publishSite">
85c2e6 981         <!-- Cleanup -->
JM 982         <delete dir="${project.build.dir}" />
983         <delete dir="${project.war.dir}" />
984         <delete dir="${project.deploy.dir}" />
985     </target>
59ee92 986 </project>