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