From efe8ecb216b0e2f2f1dceb26c4f21dcec1fb497c Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Fri, 11 Nov 2011 17:59:15 -0500 Subject: [PATCH] Revised user access checks to account for repository ownership. --- build.xml | 344 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 317 insertions(+), 27 deletions(-) diff --git a/build.xml b/build.xml index 2ff6264..8ba2b5a 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,11 @@ <project name="gitblit" default="compile" basedir="."> <!-- Google Code upload task --> - <taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="${basedir}/tools/ant-googlecode-0.0.3.jar" name="gcupload"/> + <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" /> @@ -12,9 +16,19 @@ <property name="project.war.dir" value="${basedir}/war" /> <property name="project.site.dir" value="${basedir}/site" /> <property name="project.resources.dir" value="${basedir}/resources" /> + <available property="hasBuildProps" file="${basedir}/build.properties"/> - <!-- Load publication servers, paths, and credentials --> - <loadproperties srcfile="${basedir}/build.properties" /> + <!-- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Load build.properties, if available + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --> + <target name="buildprops" if="hasBuildProps"> + <!-- Load publication servers, paths, and credentials --> + <loadproperties> + <file file="${basedir}/build.properties" /> + </loadproperties> + </target> <!-- @@ -22,7 +36,7 @@ Scrape the version info from code and setup the build properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <target name="buildinfo"> + <target name="buildinfo" depends="buildprops"> <!-- extract Gitblit version number from source code --> <loadfile property="gb.version" srcfile="${basedir}/src/com/gitblit/Constants.java"> @@ -70,6 +84,9 @@ </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" /> + <property name="gbapi.zipfile" value="gbapi-${gb.version}.zip" /> </target> @@ -88,12 +105,17 @@ </fileset> </copy> + <!-- copy gitblit.properties to the WEB-INF folder. + this file is only used for parsing setting descriptions. --> + <copy tofile="${basedir}/src/WEB-INF/reference.properties" 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" /> @@ -105,8 +127,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> @@ -133,6 +156,11 @@ <copy todir="${project.deploy.dir}"> <fileset dir="${basedir}/distrib"> <include name="**/*" /> + <exclude name="federation.properties" /> + </fileset> + <fileset dir="${basedir}"> + <include name="LICENSE" /> + <include name="NOTICE" /> </fileset> </copy> @@ -140,6 +168,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" /> @@ -175,10 +204,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" /> @@ -187,6 +216,8 @@ <include name="bug_16x16.png" /> <include name="book_16x16.png" /> <include name="blank.png" /> + <include name="federated_16x16.png" /> + <include name="arrow_page.png" /> </fileset> <!-- Copy Doc images --> @@ -228,7 +259,7 @@ <arg value="index=overview" /> <arg value="--alias" /> - <arg value="properties=gitblit.properties" /> + <arg value="properties=settings" /> <arg value="--substitute" /> <arg value="%VERSION%=${gb.version}" /> @@ -240,14 +271,35 @@ <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="%API%=${gbapi.zipfile}" /> + + <arg value="--substitute" /> <arg value="%BUILDDATE%=${gb.versionDate}" /> <arg value="--substitute" /> <arg value="%JGIT%=${jgit.version}" /> - <arg value="--load" /> + <arg value="--properties" /> <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" /> + <arg value="--nomarkdown" /> + <arg value="%BEGINCODE%:%ENDCODE%" /> + + <arg value="--substitute" /> + <arg value=""%BEGINCODE%=<pre class='prettyprint lang-java'>"" /> + + <arg value="--substitute" /> + <arg value="%ENDCODE%=</pre>" /> + + <arg value="--regex" /> + <arg value=""\b(issue)(\s*[#]?|-){0,1}(\d+)\b!!!<a href='http://code.google.com/p/gitblit/issues/detail?id=$3'>issue $3</a>"" /> + </java> </target> @@ -271,7 +323,15 @@ <fileset dir="${basedir}/src/WEB-INF"> <include name="web.xml" /> </fileset> + <fileset dir="${basedir}"> + <include name="LICENSE" /> + <include name="NOTICE" /> + </fileset> </copy> + + <!-- Copy gitblit.properties as reference.properties --> + <copy tofile="${project.war.dir}/WEB-INF/reference.properties" + file="${basedir}/distrib/gitblit.properties"/> <!-- Build the docs for the WAR build --> <antcall target="buildDocs" inheritall="true" inheritrefs="true"> @@ -319,9 +379,10 @@ <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" /> + <exclude name="com/gitblit/MakeCertificate*.class" /> </fileset> </copy> @@ -330,6 +391,176 @@ </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" /> + <include name="LICENSE" /> + <include name="NOTICE" /> + </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="maanager-${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/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/health_16x16.png" /> + <resource file="${basedir}/resources/feed_16x16.png" /> + <resource file="${basedir}/resources/bullet_feed.png" /> + <resource file="${basedir}/resources/search-icon.png" /> + <resource file="${basedir}/resources/commit_changes_16x16.png" /> + <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." /> + <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 Manager Zip file --> + <zip destfile="${manager.zipfile}"> + <fileset dir="${basedir}"> + <include name="manager-${gb.version}.jar" /> + <include name="LICENSE" /> + <include name="NOTICE" /> + </fileset> + </zip> + </target> + + <!-- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Build the Gitblit API client library + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --> + <target name="buildApiLibrary" depends="compile" description="Builds the Gitblit RPC client library"> + <echo>Building Gitblit API Library ${gb.version}</echo> + + <!-- Build API Library jar --> + <genjar jarfile="gbapi-${gb.version}.jar"> + <class name="com.gitblit.Keys" /> + <class name="com.gitblit.client.GitblitClient" /> + <classpath refid="master-classpath" /> + <classfilter> + <exclude name="com.google.gson." /> + <exclude name="com.sun.syndication." /> + </classfilter> + <manifest> + <attribute name="Specification-Version" value="${gb.version}" /> + <attribute name="Release-Date" value="${gb.versionDate}" /> + </manifest> + </genjar> + + <!-- Build API sources jar --> + <zip destfile="gbapi-${gb.version}-sources.jar"> + <fileset dir="${basedir}/src" defaultexcludes="yes"> + <include name="com/gitblit/Constants.java"/> + <include name="com/gitblit/GitBlitException.java"/> + <include name="com/gitblit/Keys.java"/> + <include name="com/gitblit/client/**/*.java"/> + <include name="com/gitblit/models/**/*.java"/> + <include name="com/gitblit/utils/**/*.java"/> + </fileset> + </zip> + + <!-- Build API JavaDoc jar --> + <javadoc destdir="${basedir}/javadoc"> + <fileset dir="${basedir}/src" defaultexcludes="yes"> + <include name="com/gitblit/Constants.java"/> + <include name="com/gitblit/GitBlitException.java"/> + <include name="com/gitblit/Keys.java"/> + <include name="com/gitblit/client/**/*.java"/> + <include name="com/gitblit/models/**/*.java"/> + <include name="com/gitblit/utils/**/*.java"/> + </fileset> + </javadoc> + <zip destfile="gbapi-${gb.version}-javadoc.jar"> + <fileset dir="${basedir}/javadoc" /> + </zip> + + <!-- Build the API library zip file --> + <zip destfile="${gbapi.zipfile}"> + <fileset dir="${basedir}"> + <include name="gbapi-${gb.version}.jar" /> + <include name="gbapi-${gb.version}-sources.jar" /> + <include name="gbapi-${gb.version}-javadoc.jar" /> + <include name="LICENSE" /> + <include name="NOTICE" /> + </fileset> + <fileset dir="${basedir}/ext"> + <include name="gson*.jar" /> + <exclude name="gson*-sources.jar" /> + <exclude name="gson*-javadoc.jar" /> + <include name="rome*.jar" /> + <exclude name="rome*-sources.jar" /> + <exclude name="rome*-javadoc.jar" /> + </fileset> + </zip> + </target> + + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Build the Gitblit Website @@ -345,10 +576,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" /> @@ -357,6 +588,8 @@ <include name="bug_16x16.png" /> <include name="book_16x16.png" /> <include name="blank.png" /> + <include name="federated_16x16.png" /> + <include name="arrow_page.png" /> </fileset> <!-- Copy Doc images --> @@ -415,15 +648,21 @@ <arg value="--pageHeader" /> <arg value="${basedir}/docs/site_header.html" /> - + <arg value="--pageFooter" /> <arg value="${basedir}/docs/site_footer.html" /> + + <arg value="--analyticsSnippet" /> + <arg value="${basedir}/docs/site_analytics.html" /> + + <arg value="--adSnippet" /> + <arg value="${basedir}/docs/site_ads.html" /> <arg value="--alias" /> <arg value="index=overview" /> <arg value="--alias" /> - <arg value="properties=gitblit.properties" /> + <arg value="properties=settings" /> <arg value="--substitute" /> <arg value="%VERSION%=${gb.version}" /> @@ -435,15 +674,36 @@ <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="%API%=${gbapi.zipfile}" /> + + <arg value="--substitute" /> <arg value="%BUILDDATE%=${gb.versionDate}" /> <arg value="--substitute" /> <arg value="%JGIT%=${jgit.version}" /> - <arg value="--load" /> + <arg value="--properties" /> <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" /> + + <arg value="--nomarkdown" /> + <arg value="%BEGINCODE%:%ENDCODE%" /> - </java> + <arg value="--substitute" /> + <arg value=""%BEGINCODE%=<pre class='prettyprint lang-java'>"" /> + + <arg value="--substitute" /> + <arg value="%ENDCODE%=</pre>" /> + + <arg value="--regex" /> + <arg value=""\b(issue)(\s*[#]?|-){0,1}(\d+)\b!!!<a href='http://code.google.com/p/gitblit/issues/detail?id=$3'>issue $3</a>"" /> + + </java> </target> @@ -452,7 +712,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,buildApiLibrary,buildSite"> <!-- Cleanup --> <delete dir="${project.build.dir}" /> <delete dir="${project.war.dir}" /> @@ -465,29 +725,59 @@ 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> - <!-- Upload ZIP file --> + <!-- Upload Gitblit GO ZIP file --> <gcupload username="${googlecode.user}" password="${googlecode.password}" projectname="gitblit" filename="${distribution.zipfile}" targetfilename="gitblit-${gb.version}.zip" - summary="Standalone, integrated Gitblit server v${gb.version}" + summary="Gitblit GO v${gb.version} (standalone, integrated Gitblit server)" labels="Featured, Type-Package, OpSys-All" /> - <!-- Upload WAR file --> + <!-- Upload Gitblit WAR file --> <gcupload username="${googlecode.user}" password="${googlecode.password}" projectname="gitblit" filename="${distribution.warfile}" targetfilename="gitblit-${gb.version}.war" - summary="Gitblit WAR v${gb.version} for your servlet container" + 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}" + 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 Gitblit 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" /> + + <!-- Upload Gitblit API Library --> + <gcupload + username="${googlecode.user}" + password="${googlecode.password}" + projectname="gitblit" + filename="${gbapi.zipfile}" + 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" /> </target> @@ -517,10 +807,10 @@ Compile from source, publish binaries, and build & deploy site ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <target name="publishAll" depends="publishBinaries,publishSite"> + <target name="publishAll" depends="publishBinaries,publishSite"> <!-- Cleanup --> <delete dir="${project.build.dir}" /> <delete dir="${project.war.dir}" /> <delete dir="${project.deploy.dir}" /> </target> -</project> \ No newline at end of file +</project> -- Gitblit v1.9.1