From 1c30dad2115fc513791d8a5b292ad0f7d7b85749 Mon Sep 17 00:00:00 2001 From: lemval <mvanleeuwen@xebia.com> Date: Tue, 31 Jan 2012 09:25:02 -0500 Subject: [PATCH] Do not traverse unaccessible subdirectories (issue 51) --- build.xml | 224 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 197 insertions(+), 27 deletions(-) diff --git a/build.xml b/build.xml index 8ba2b5a..d286288 100644 --- a/build.xml +++ b/build.xml @@ -16,6 +16,7 @@ <property name="project.war.dir" value="${basedir}/war" /> <property name="project.site.dir" value="${basedir}/site" /> <property name="project.resources.dir" value="${basedir}/resources" /> + <property name="project.express.dir" value="${basedir}/express" /> <available property="hasBuildProps" file="${basedir}/build.properties"/> <!-- @@ -87,6 +88,7 @@ <property name="fedclient.zipfile" value="fedclient-${gb.version}.zip" /> <property name="manager.zipfile" value="manager-${gb.version}.zip" /> <property name="gbapi.zipfile" value="gbapi-${gb.version}.zip" /> + <property name="express.zipfile" value="express-${gb.version}.zip" /> </target> @@ -101,7 +103,7 @@ <copy todir="${basedir}" overwrite="false"> <fileset dir="${basedir}/distrib"> <include name="gitblit.properties" /> - <include name="users.properties" /> + <include name="users.conf" /> </fileset> </copy> @@ -157,6 +159,7 @@ <fileset dir="${basedir}/distrib"> <include name="**/*" /> <exclude name="federation.properties" /> + <exclude name="openshift.mkd" /> </fileset> <fileset dir="${basedir}"> <include name="LICENSE" /> @@ -178,11 +181,31 @@ </manifest> </jar> + <!-- Gitblit library dependencies --> + <mkdir dir="${project.deploy.dir}/ext"/> + <copy todir="${project.deploy.dir}/ext"> + <fileset dir="${basedir}/ext"> + <exclude name="junit*.jar" /> + <exclude name="commons-net*.jar" /> + <exclude name="*-sources.jar" /> + <exclude name="*-javadoc.jar" /> + </fileset> + </copy> + <!-- Build the docs for the deploy --> <antcall target="buildDocs" inheritall="true" inheritrefs="true"> <param name="docs.output.dir" value="${project.deploy.dir}/docs" /> </antcall> + <!-- Copy the supported Groovy hook scripts --> + <mkdir dir="${project.deploy.dir}/groovy" /> + <copy todir="${project.deploy.dir}/groovy"> + <fileset dir="${basedir}/groovy"> + <include name="sendmail.groovy" /> + <include name="jenkins.groovy" /> + </fileset> + </copy> + <!-- Create Zip deployment --> <zip destfile="${distribution.zipfile}"> <fileset dir="${project.deploy.dir}"> @@ -204,7 +227,7 @@ <copy todir="${docs.output.dir}"> <!-- Copy selected Gitblit resources --> <fileset dir="${project.resources.dir}"> - <include name="bootstrap.130.css" /> + <include name="bootstrap.140.css" /> <include name="bootstrap.gb.css" /> <include name="markdown.css" /> <include name="gitblt_25_white.png" /> @@ -223,6 +246,7 @@ <!-- Copy Doc images --> <fileset dir="${basedir}/docs"> <include name="*.png" /> + <include name="*.gif" /> </fileset> </copy> @@ -280,6 +304,9 @@ <arg value="%API%=${gbapi.zipfile}" /> <arg value="--substitute" /> + <arg value="%EXPRESS%=${express.zipfile}" /> + + <arg value="--substitute" /> <arg value="%BUILDDATE%=${gb.versionDate}" /> <arg value="--substitute" /> @@ -313,12 +340,12 @@ <echo>Building Gitblit WAR ${gb.version}</echo> - <delete dir="${project.war.dir}" /> + <delete dir="${project.war.dir}" /> - <!-- Copy web.xml and users.properties to WEB-INF --> + <!-- Copy web.xml and users.conf to WEB-INF --> <copy todir="${project.war.dir}/WEB-INF"> <fileset dir="${basedir}/distrib"> - <include name="users.properties" /> + <include name="users.conf" /> </fileset> <fileset dir="${basedir}/src/WEB-INF"> <include name="web.xml" /> @@ -337,7 +364,16 @@ <antcall target="buildDocs" inheritall="true" inheritrefs="true"> <param name="docs.output.dir" value="${project.war.dir}/WEB-INF/docs" /> </antcall> - + + <!-- Copy the supported Groovy hook scripts --> + <mkdir dir="${project.war.dir}/WEB-INF/groovy" /> + <copy todir="${project.war.dir}/WEB-INF/groovy"> + <fileset dir="${basedir}/groovy"> + <include name="sendmail.groovy" /> + <include name="jenkins.groovy" /> + </fileset> + </copy> + <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties --> <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml"> <classpath refid="master-classpath" /> @@ -376,7 +412,7 @@ <mkdir dir="${project.war.dir}/WEB-INF/classes"/> <copy todir="${project.war.dir}/WEB-INF/classes"> <fileset dir="${project.build.dir}"> - <exclude name="WEB-INF/web.xml" /> + <exclude name="WEB-INF/" /> <exclude name="com/gitblit/tests/" /> <exclude name="com/gitblit/build/**" /> <exclude name="com/gitblit/client/**" /> @@ -434,17 +470,115 @@ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Build a Gitblit filesystem for deployment to RedHat OpenShif Expresst + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --> + <target name="buildExpress" depends="compile" description="Build exploded WAR file suitable for deployment to OpenShift Express"> + <echo>Building Gitblit Express for RedHat OpenShift ${gb.version}</echo> + + <delete dir="${project.express.dir}" /> + + <!-- Create the OpenShift filesystem --> + <property name="deployments.root" value="${project.express.dir}/deployments/ROOT.war"/> + <mkdir dir="${deployments.root}" /> + <touch file="${project.express.dir}/deployments/ROOT.war.dodeploy" /> + + <!-- Copy the Gitblit OpenShift readme file --> + <copy tofile="${project.express.dir}/README.gitblit" + file="${basedir}/distrib/openshift.mkd"/> + + <!-- Copy LICENSE and NOTICE to WEB-INF --> + <copy todir="${deployments.root}/WEB-INF"> + <fileset dir="${basedir}"> + <include name="LICENSE" /> + <include name="NOTICE" /> + </fileset> + </copy> + + <!-- Copy gitblit.properties as reference.properties --> + <copy tofile="${deployments.root}/WEB-INF/reference.properties" + file="${basedir}/distrib/gitblit.properties"/> + + <!-- Copy the supported Groovy hook scripts --> + <mkdir dir="${deployments.root}/WEB-INF/groovy" /> + <copy todir="${deployments.root}/WEB-INF/groovy"> + <fileset dir="${basedir}/groovy"> + <include name="sendmail.groovy" /> + <include name="jenkins.groovy" /> + </fileset> + </copy> + + <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties --> + <!-- THIS FILE IS NOT OVERRIDDEN ONCE IT IS BUILT!!! --> + <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml"> + <classpath refid="master-classpath" /> + + <arg value="--sourceFile" /> + <arg value="${basedir}/src/WEB-INF/web.xml" /> + + <arg value="--destinationFile" /> + <arg value="${deployments.root}/WEB-INF/web.xml" /> + + <arg value="--propertiesFile" /> + <arg value="${basedir}/distrib/gitblit.properties" /> + </java> + + <!-- Gitblit resources --> + <copy todir="${deployments.root}"> + <fileset dir="${project.resources.dir}"> + <exclude name="thumbs.db" /> + </fileset> + </copy> + + <!-- Gitblit library dependencies --> + <mkdir dir="${deployments.root}/WEB-INF/lib"/> + <copy todir="${deployments.root}/WEB-INF/lib"> + <fileset dir="${basedir}/ext"> + <exclude name="*-sources.jar" /> + <exclude name="*-javadoc.jar" /> + <exclude name="jcommander*.jar" /> + <exclude name="jetty*.jar" /> + <exclude name="junit*.jar" /> + <exclude name="servlet*.jar" /> + </fileset> + </copy> + + <!-- Gitblit classes --> + <mkdir dir="${deployments.root}/WEB-INF/classes"/> + <copy todir="${deployments.root}/WEB-INF/classes"> + <fileset dir="${project.build.dir}"> + <exclude name="WEB-INF/" /> + <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" /> + </fileset> + </copy> + + <!-- Build Express Zip file --> + <zip destfile="${express.zipfile}"> + <fileset dir="${project.express.dir}" /> + </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="maanager-${gb.version}.jar"> + + <genjar jarfile="manager-${gb.version}.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/users_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" /> @@ -461,7 +595,7 @@ <resource file="${basedir}/resources/commit_merge_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." /> @@ -479,7 +613,7 @@ <attribute name="Release-Date" value="${gb.versionDate}" /> </manifest> </genjar> - + <!-- Build Manager Zip file --> <zip destfile="${manager.zipfile}"> <fileset dir="${basedir}"> @@ -576,7 +710,7 @@ <copy todir="${project.site.dir}"> <!-- Copy selected Gitblit resources --> <fileset dir="${project.resources.dir}"> - <include name="bootstrap.130.css" /> + <include name="bootstrap.140.css" /> <include name="bootstrap.gb.css" /> <include name="markdown.css" /> <include name="gitblt_25_white.png" /> @@ -595,6 +729,7 @@ <!-- Copy Doc images --> <fileset dir="${basedir}/docs"> <include name="*.png" /> + <include name="*.gif" /> <include name="*.js" /> </fileset> </copy> @@ -683,6 +818,9 @@ <arg value="%API%=${gbapi.zipfile}" /> <arg value="--substitute" /> + <arg value="%EXPRESS%=${express.zipfile}" /> + + <arg value="--substitute" /> <arg value="%BUILDDATE%=${gb.versionDate}" /> <arg value="--substitute" /> @@ -705,30 +843,51 @@ </java> </target> - + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compile from source, publish binaries, and build & deploy site ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <target name="buildAll" depends="buildGO,buildWAR,buildFederationClient,buildManager,buildApiLibrary,buildSite"> + <target name="buildAll" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary,buildSite"> <!-- Cleanup --> <delete dir="${project.build.dir}" /> <delete dir="${project.war.dir}" /> <delete dir="${project.deploy.dir}" /> + <delete dir="${project.express.dir}" /> </target> - + + <!-- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Update the gh-pages branch with the current site + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --> + <target name="updateGhPages" depends="buildSite"> + <!-- Build gh-pages branch --> + <java classpath="${project.build.dir}" classname="com.gitblit.build.BuildGhPages"> + <classpath refid="master-classpath" /> + <arg value="--sourceFolder" /> + <arg value="${basedir}/site" /> + + <arg value="--repository" /> + <arg value="${basedir}" /> + + <arg value="--obliterate" /> + </java> + </target> + + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Publish binaries to Google Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <target name="publishBinaries" depends="buildGO,buildWAR,buildFederationClient,buildManager" description="Publish the Gitblit binaries to Google Code"> - + <target name="publishBinaries" depends="buildGO,buildWAR,buildExpress,buildFederationClient,buildManager,buildApiLibrary" description="Publish the Gitblit binaries to Google Code"> + <echo>Uploading Gitblit ${gb.version} binaries</echo> - + <!-- Upload Gitblit GO ZIP file --> <gcupload username="${googlecode.user}" @@ -738,7 +897,7 @@ targetfilename="gitblit-${gb.version}.zip" summary="Gitblit GO v${gb.version} (standalone, integrated Gitblit server)" labels="Featured, Type-Package, OpSys-All" /> - + <!-- Upload Gitblit WAR file --> <gcupload username="${googlecode.user}" @@ -748,7 +907,7 @@ targetfilename="gitblit-${gb.version}.war" summary="Gitblit WAR v${gb.version} (standard WAR webapp for servlet containers)" labels="Featured, Type-Package, OpSys-All" /> - + <!-- Upload Gitblit FedClient --> <gcupload username="${googlecode.user}" @@ -768,7 +927,7 @@ 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" /> - + <!-- Upload Gitblit API Library --> <gcupload username="${googlecode.user}" @@ -778,19 +937,30 @@ targetfilename="gbapi-${gb.version}.zip" summary="Gitblit API Library v${gb.version} (JSON RPC library to integrate with your software)" labels="Featured, Type-Package, OpSys-All" /> + + <!-- Upload Gitblit Express for RedHat OpenShift --> + <gcupload + username="${googlecode.user}" + password="${googlecode.password}" + projectname="gitblit" + filename="${express.zipfile}" + targetfilename="express-${gb.version}.zip" + summary="Gitblit Express v${gb.version} (run Gitblit on RedHat's OpenShift cloud)" + labels="Featured, Type-Package, OpSys-All" /> + </target> - + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Publish site to hosting service + Publish site to site hosting service You must add ext/commons-net-1.4.0.jar to your ANT classpath. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <target name="publishSite" depends="buildSite" description="Publish the Gitblit site to a webserver (requires ext/commons-net-1.4.0.jar)" > - + <target name="publishSite" depends="buildSite,updateGhPages" description="Publish the Gitblit site to a webserver (requires ext/commons-net-1.4.0.jar)" > + <echo>Uploading Gitblit ${gb.version} website</echo> - + <ftp server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}" @@ -801,7 +971,7 @@ </ftp> </target> - + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compile from source, publish binaries, and build & deploy site -- Gitblit v1.9.1