From fe326255202dcfac8b0991ca9d28e3cf4bcc4fe6 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 23 Oct 2011 12:28:48 -0400
Subject: [PATCH] Per-repository setting to skip summary metrics

---
 build.xml |  163 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 151 insertions(+), 12 deletions(-)

diff --git a/build.xml b/build.xml
index 1025943..107fac3 100644
--- a/build.xml
+++ b/build.xml
@@ -5,6 +5,9 @@
 	<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" 
 		classpath="${basedir}/tools/ant-googlecode-0.0.3.jar" name="gcupload"/>
 
+	<!-- GenJar task -->
+	<taskdef resource="genjar.properties" classpath="${basedir}/tools/GenJar.jar" />
+
 	<!-- Project Properties -->
 	<property name="project.jar" value="gitblit.jar" />
 	<property name="project.mainclass" value="com.gitblit.Launcher" />
@@ -81,6 +84,8 @@
 		</loadfile>	
 		<property name="distribution.zipfile" value="gitblit-${gb.version}.zip" />
 		<property name="distribution.warfile" value="gitblit-${gb.version}.war" />
+		<property name="fedclient.zipfile" value="fedclient-${gb.version}.zip" />
+		<property name="manager.zipfile" value="manager-${gb.version}.zip" />
 	</target>
 	
 	
@@ -99,12 +104,17 @@
 			</fileset>
 		</copy>
 
+		<!-- copy gitblit.properties to the WEB-INF folder.
+		     this file is only used for parsing setting descriptions. -->
+		<copy todir="${basedir}/src/WEB-INF" overwrite="true"
+			file="${basedir}/distrib/gitblit.properties" />
+
 		<!-- Compile the build tool and execute it.
 			 This downloads missing compile-time dependencies from Maven. -->
 
 		<delete dir="${project.build.dir}" />
 		<mkdir dir="${project.build.dir}" />
-		<javac srcdir="${basedir}/src" destdir="${project.build.dir}">
+		<javac debug="true" srcdir="${basedir}/src" destdir="${project.build.dir}">
 			<include name="com/gitblit/build/Build.java" />			
 			<include name="com/gitblit/Constants.java" />
 			<include name="com/gitblit/utils/StringUtils.java" />			
@@ -116,8 +126,9 @@
 			<fileset dir="${basedir}/ext">
 				<include name="*.jar" />
 			</fileset>
+			<pathelement path="${project.build.dir}" />				
 		</path>
-		<javac destdir="${project.build.dir}" failonerror="false">
+		<javac debug="true" destdir="${project.build.dir}" failonerror="false">
 			<src path="${basedir}/src" />
 			<classpath refid="master-classpath" />
 		</javac>
@@ -144,6 +155,7 @@
 		<copy todir="${project.deploy.dir}">
 			<fileset dir="${basedir}/distrib">
 				<include name="**/*" />
+				<exclude name="federation.properties" />
 			</fileset>
 			<fileset dir="${basedir}">
 				<include name="LICENSE" />
@@ -155,6 +167,7 @@
 		<jar jarfile="${project.deploy.dir}/${project.jar}">
 			<fileset dir="${project.build.dir}">
 				<include name="**/*" />
+				<exclude name="com/gitblit/client/**" />
 			</fileset>
 			<fileset dir="${project.resources.dir}">
 				<exclude name="thumbs.db" />
@@ -190,10 +203,10 @@
 			<copy todir="${docs.output.dir}">
 				<!-- Copy selected Gitblit resources -->
 				<fileset dir="${project.resources.dir}">
-					<include name="background.png" />
-					<include name="gitblit.css" />
+					<include name="bootstrap.130.css" />
+					<include name="bootstrap.gb.css" />
 					<include name="markdown.css" />
-					<include name="gitblt_25.png" />
+					<include name="gitblt_25_white.png" />
 					<include name="gitblt-favicon.png" />
 					<include name="lock_go_16x16.png" />
 					<include name="lock_pull_16x16.png" />
@@ -203,6 +216,7 @@
 					<include name="book_16x16.png" />
 					<include name="blank.png" />
 					<include name="federated_16x16.png" />
+					<include name="arrow_page.png" />
 				</fileset>
 
 				<!-- Copy Doc images -->
@@ -256,6 +270,12 @@
 				<arg value="%WAR%=${distribution.warfile}" />
 
 				<arg value="--substitute" />
+				<arg value="%FEDCLIENT%=${fedclient.zipfile}" />
+
+				<arg value="--substitute" />
+				<arg value="%MANAGER%=${manager.zipfile}" />
+
+				<arg value="--substitute" />
 				<arg value="%BUILDDATE%=${gb.versionDate}" />
 
 				<arg value="--substitute" />
@@ -291,10 +311,11 @@
 		
 		<delete dir="${project.war.dir}" />		
 
-		<!-- Copy web.xml and users.properties to WEB-INF -->
+		<!-- Copy web.xml, users.properties, and gitblit.properties to WEB-INF -->
 		<copy todir="${project.war.dir}/WEB-INF">
 			<fileset dir="${basedir}/distrib">
 			 	<include name="users.properties" />
+				<include name="gitblit.properties" />
 			</fileset>
 			<fileset dir="${basedir}/src/WEB-INF">
 			 	<include name="web.xml" />
@@ -351,6 +372,7 @@
 				<exclude name="WEB-INF/web.xml" />
 				<exclude name="com/gitblit/tests/" />
 				<exclude name="com/gitblit/build/**" />
+				<exclude name="com/gitblit/client/**" />
 				<exclude name="com/gitblit/GitBlitServer*.class" />
 				<exclude name="com/gitblit/Launcher*.class" />
 				<exclude name="com/gitblit/MakeCertificate*.class" />				
@@ -362,6 +384,96 @@
 	</target>
 
 	
+	<!-- 
+		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+		Build the stand-alone, command-line Gitblit Federation Client
+		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	-->
+	<target name="buildFederationClient" depends="compile" description="Builds the stand-alone Gitblit federation client">
+		<echo>Building Gitblit Federation Client ${gb.version}</echo>
+	
+		<genjar jarfile="fedclient.jar">
+			<class name="com.gitblit.FederationClientLauncher" />
+			<resource file="${project.build.dir}/log4j.properties" />
+			<classfilter>
+				<exclude name="org.apache." />
+				<exclude name="org.bouncycastle." />
+				<exclude name="org.eclipse." />
+				<exclude name="org.slf4j." />
+				<exclude name="com.beust." />
+				<exclude name="com.google." />
+			</classfilter>
+			<classpath refid="master-classpath" />
+			<manifest>
+				<attribute name="Main-Class" value="com.gitblit.FederationClientLauncher" />
+				<attribute name="Specification-Version" value="${gb.version}" />				
+				<attribute name="Release-Date" value="${gb.versionDate}" />
+			</manifest>
+		</genjar>
+		
+		<!-- Build the federation client zip file -->
+		<zip destfile="${fedclient.zipfile}">
+			<fileset dir="${basedir}">
+				<include name="fedclient.jar" />				
+			</fileset>
+			<fileset dir="${basedir}/distrib">
+				<include name="federation.properties" />				
+			</fileset>
+		</zip>
+	</target>
+
+
+	<!-- 
+		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+		Build the stand-alone, Gitblit Manager
+		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	-->
+	<target name="buildManager" depends="compile" description="Builds the stand-alone Gitblit Manager">
+		<echo>Building Gitblit Manager ${gb.version}</echo>
+	
+		<genjar jarfile="manager.jar">
+			<resource file="${basedir}/src/com/gitblit/client/splash.png" />
+			<resource file="${basedir}/resources/gitblt-favicon.png" />
+			<resource file="${basedir}/resources/gitweb-favicon.png" />
+			<resource file="${basedir}/resources/user_16x16.png" />
+			<resource file="${basedir}/resources/settings_16x16.png" />
+			<resource file="${basedir}/resources/lock_go_16x16.png" />
+			<resource file="${basedir}/resources/lock_pull_16x16.png" />
+			<resource file="${basedir}/resources/shield_16x16.png" />
+			<resource file="${basedir}/resources/federated_16x16.png" />
+			<resource file="${basedir}/resources/cold_16x16.png" />
+			<resource file="${basedir}/resources/book_16x16.png" />
+			<resource file="${basedir}/resources/bug_16x16.png" />
+			<resource file="${basedir}/resources/blank.png" />
+			<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
+				
+			<class name="com.gitblit.client.GitblitManagerLauncher" />
+			<classfilter>
+				<exclude name="org.apache." />
+				<exclude name="org.bouncycastle." />
+				<exclude name="org.eclipse." />
+				<exclude name="org.slf4j." />
+				<exclude name="com.beust." />
+				<exclude name="com.google." />
+			</classfilter>
+			<classpath refid="master-classpath" />
+			<manifest>
+				<attribute name="Main-Class" value="com.gitblit.client.GitblitManagerLauncher" />
+				<attribute name="SplashScreen-Image" value="splash.png" />
+				<attribute name="Specification-Version" value="${gb.version}" />				
+				<attribute name="Release-Date" value="${gb.versionDate}" />
+			</manifest>
+		</genjar>
+		
+		<!-- Build the Manager zip file -->
+		<zip destfile="${manager.zipfile}">
+			<fileset dir="${basedir}">
+				<include name="manager.jar" />				
+			</fileset>			
+		</zip>
+	</target>
+		
+		
 	<!-- 
 		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 		Build the Gitblit Website
@@ -377,10 +489,10 @@
 		<copy todir="${project.site.dir}">
 			<!-- Copy selected Gitblit resources -->
 			<fileset dir="${project.resources.dir}">
-				<include name="background.png" />
-				<include name="gitblit.css" />
+				<include name="bootstrap.130.css" />
+				<include name="bootstrap.gb.css" />
 				<include name="markdown.css" />
-				<include name="gitblt_25.png" />
+				<include name="gitblt_25_white.png" />
 				<include name="gitblt-favicon.png" />
 				<include name="lock_go_16x16.png" />
 				<include name="lock_pull_16x16.png" />
@@ -390,6 +502,7 @@
 				<include name="book_16x16.png" />
 				<include name="blank.png" />
 				<include name="federated_16x16.png" />
+				<include name="arrow_page.png" />
 			</fileset>
 
 			<!-- Copy Doc images -->
@@ -474,6 +587,12 @@
 			<arg value="%WAR%=${distribution.warfile}" />
 
 			<arg value="--substitute" />
+			<arg value="%FEDCLIENT%=${fedclient.zipfile}" />
+
+			<arg value="--substitute" />
+			<arg value="%MANAGER%=${manager.zipfile}" />
+
+			<arg value="--substitute" />
 			<arg value="%BUILDDATE%=${gb.versionDate}" />
 
 			<arg value="--substitute" />
@@ -503,7 +622,7 @@
 		Compile from source, publish binaries, and build & deploy site
 		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 	-->
-	<target name="buildAll" depends="buildGO,buildWAR,buildSite">		
+	<target name="buildAll" depends="buildGO,buildWAR,buildFederationClient,buildManager,buildSite">		
 		<!-- Cleanup -->
 		<delete dir="${project.build.dir}" />
 		<delete dir="${project.war.dir}" />
@@ -516,7 +635,7 @@
 		Publish binaries to Google Code
 		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 	-->
-	<target name="publishBinaries" depends="buildGO,buildWAR" description="Publish the Gitblit binaries to Google Code">
+	<target name="publishBinaries" depends="buildGO,buildWAR,buildFederationClient,buildManager" description="Publish the Gitblit binaries to Google Code">
 		
 		<echo>Uploading Gitblit ${gb.version} binaries</echo>
 		
@@ -539,6 +658,26 @@
 		     targetfilename="gitblit-${gb.version}.war"
 		     summary="Gitblit WAR v${gb.version} (standard WAR webapp for servlet containers)"
 		     labels="Featured, Type-Package, OpSys-All" />
+		
+		<!-- Upload FedClient -->
+		<gcupload 
+			username="${googlecode.user}" 
+			password="${googlecode.password}" 
+			projectname="gitblit" 
+			filename="${fedclient.zipfile}" 
+			targetfilename="fedclient-${gb.version}.zip"
+			summary="Gitblit Federation Client v${gb.version} (command-line tool to clone data from federated Gitblit instances)"
+			labels="Featured, Type-Package, OpSys-All" />
+
+		<!-- Upload Manager -->
+		<gcupload 
+			username="${googlecode.user}" 
+			password="${googlecode.password}" 
+			projectname="gitblit" 
+			filename="${manager.zipfile}" 
+			targetfilename="manager-${gb.version}.zip"
+			summary="Gitblit Manager v${gb.version} (Swing tool to remotely administer a Gitblit server)"
+			labels="Featured, Type-Package, OpSys-All" />
 	</target>
 
 	
@@ -574,4 +713,4 @@
 		<delete dir="${project.war.dir}" />
 		<delete dir="${project.deploy.dir}" />
 	</target>
-</project>
\ No newline at end of file
+</project>

--
Gitblit v1.9.1