diff options
Diffstat (limited to 'build.xml')
-rw-r--r-- | build.xml | 210 |
1 files changed, 155 insertions, 55 deletions
@@ -12,10 +12,11 @@ <property name="project.jar" value="gitblit.jar" />
<property name="project.mainclass" value="com.gitblit.Launcher" />
<property name="project.build.dir" value="${basedir}/build" />
- <property name="project.deploy.dir" value="${basedir}/deploy" />
+ <property name="project.deploy.dir" value="${basedir}/deploy" />
<property name="project.war.dir" value="${basedir}/war" />
<property name="project.jar.dir" value="${basedir}/jar" />
- <property name="project.site.dir" value="${basedir}/site" />
+ <property name="project.site.dir" value="${basedir}/target/site" />
+ <property name="project.target.dir" value="${basedir}/target" />
<property name="project.resources.dir" value="${basedir}/resources" />
<property name="project.express.dir" value="${basedir}/express" />
<property name="project.maven.repo.url" value="enter here your Maven repo URL" />
@@ -106,22 +107,66 @@ -->
<target name="compile" depends="buildinfo" description="Retrieves dependencies and compiles Gitblit from source">
- <!-- copy required distribution files to project folder -->
- <copy todir="${basedir}" overwrite="false">
+ <!-- cleanup old builds -->
+ <delete dir="${project.target.dir}" />
+ <mkdir dir="${project.target.dir}" />
+
+ <!-- cleanup old builds -->
+ <delete>
+ <fileset dir="${basedir}">
+ <include name="*.zip" />
+ <include name="*.war" />
+ <include name="*.jar" />
+ </fileset>
+ </delete>
+
+ <!-- copy required distribution files to data folder -->
+ <mkdir dir="${basedir}/data" />
+ <copy todir="${basedir}/data" overwrite="false">
<fileset dir="${basedir}/distrib">
<include name="gitblit.properties" />
<include name="users.conf" />
+ <include name="projects.conf" />
</fileset>
</copy>
<!-- copy required distribution files to project folder -->
- <mkdir dir="${basedir}/certs" />
- <copy todir="${basedir}/certs" overwrite="false">
+ <mkdir dir="${basedir}/data/certs" />
+ <copy todir="${basedir}/data/certs" overwrite="false">
<fileset dir="${basedir}/distrib">
<include name="authority.conf" />
<include name="*.tmpl" />
</fileset>
</copy>
+
+ <!-- copy required distribution files to project folder -->
+ <mkdir dir="${basedir}/data/groovy" />
+ <copy todir="${basedir}/data/groovy" overwrite="false">
+ <fileset dir="${basedir}/distrib/groovy" />
+ </copy>
+
+ <!-- upgrade existing workspace to data folder -->
+ <move todir="${basedir}/data" overwrite="true" failonerror="false">
+ <fileset dir="${basedir}">
+ <include name="users.conf" />
+ <include name="projects.conf" />
+ <include name="gitblit.properties" />
+ <include name="serverKeyStore.jks" />
+ <include name="serverTrustStore.jks" />
+ </fileset>
+ </move>
+ <move todir="${basedir}/data/certs" overwrite="true" failonerror="false">
+ <fileset dir="${basedir}/certs" />
+ </move>
+ <move todir="${basedir}/data/git" overwrite="true" failonerror="false">
+ <fileset dir="${basedir}/git" />
+ </move>
+ <move todir="${basedir}/data/proposals" overwrite="true" failonerror="false">
+ <fileset dir="${basedir}/proposals" />
+ </move>
+ <delete dir="${basedir}/javadoc" failonerror="false" />
+ <delete dir="${basedir}/site" failonerror="false" />
+ <delete dir="${basedir}/temp" failonerror="false" />
<!-- copy gitblit.properties to the WEB-INF folder.
this file is only used for parsing setting descriptions. -->
@@ -186,18 +231,45 @@ <exclude name="federation.properties" />
<exclude name="openshift.mkd" />
<exclude name="authority.conf" />
+ <exclude name="users.conf" />
+ <exclude name="projects.conf" />
+ <exclude name="gitblit.properties" />
<exclude name="*.tmpl" />
+ <exclude name="groovy/**" />
</fileset>
<fileset dir="${basedir}">
<include name="LICENSE" />
<include name="NOTICE" />
</fileset>
</copy>
- <copy tofile="${project.deploy.dir}/authority.jar" file="${basedir}/authority-${gb.version}.jar" />
+ <!-- Copy the supported Groovy hook scripts -->
+ <mkdir dir="${project.deploy.dir}/data/groovy" />
+ <copy todir="${project.deploy.dir}/data/groovy">
+ <fileset dir="${basedir}/distrib/groovy">
+ <include name="sendmail.groovy" />
+ <include name="sendmail-html.groovy" />
+ <include name="jenkins.groovy" />
+ <include name="protect-refs.groovy" />
+ </fileset>
+ </copy>
+
+ <copy tofile="${project.deploy.dir}/authority.jar" file="${project.target.dir}/authority-${gb.version}.jar" />
+
+ <!-- Prepare the data folder -->
+ <mkdir dir="${project.deploy.dir}/data"/>
+ <copy todir="${project.deploy.dir}/data">
+ <fileset dir="${basedir}/distrib">
+ <include name="users.conf" />
+ <include name="projects.conf" />
+ <include name="gitblit.properties" />
+ </fileset>
+ </copy>
+
<!-- Certificate templates -->
- <mkdir dir="${project.deploy.dir}/certs"/>
- <copy todir="${project.deploy.dir}/certs">
+ <mkdir dir="${project.deploy.dir}/data/certs"/>
+ <mkdir dir="${project.deploy.dir}/data/certs"/>
+ <copy todir="${project.deploy.dir}/data/certs">
<fileset dir="${basedir}/distrib">
<include name="*.tmpl" />
<include name="authority.conf" />
@@ -234,20 +306,8 @@ <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="sendmail-html.groovy" />
- <include name="jenkins.groovy" />
- <include name="protect-refs.groovy" />
- <include name="localclone.groovy" />
- </fileset>
- </copy>
-
<!-- Create Zip deployment -->
- <zip destfile="${distribution.zipfile}">
+ <zip destfile="${project.target.dir}/${distribution.zipfile}">
<fileset dir="${project.deploy.dir}">
<include name="**/*" />
</fileset>
@@ -383,9 +443,6 @@ <!-- Copy web.xml and users.conf to WEB-INF -->
<copy todir="${project.war.dir}/WEB-INF">
- <fileset dir="${basedir}/distrib">
- <include name="users.conf" />
- </fileset>
<fileset dir="${basedir}/src/WEB-INF">
<include name="web.xml" />
</fileset>
@@ -404,19 +461,28 @@ <param name="docs.output.dir" value="${project.war.dir}/WEB-INF/docs" />
</antcall>
+ <!-- Copy users.conf to WEB-INF/data -->
+ <mkdir dir="${project.war.dir}/WEB-INF/data" />
+ <copy todir="${project.war.dir}/WEB-INF/data">
+ <fileset dir="${basedir}/distrib">
+ <include name="users.conf" />
+ <include name="projects.conf" />
+ <include name="gitblit.properties" />
+ </fileset>
+ </copy>
+
<!-- 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">
+ <mkdir dir="${project.war.dir}/WEB-INF/data/groovy" />
+ <copy todir="${project.war.dir}/WEB-INF/data/groovy">
+ <fileset dir="${basedir}/distrib/groovy">
<include name="sendmail.groovy" />
<include name="sendmail-html.groovy" />
<include name="jenkins.groovy" />
<include name="protect-refs.groovy" />
- <include name="localclone.groovy" />
</fileset>
</copy>
- <!-- Build the WAR web.xml from the prototype web.xml and gitblit.properties -->
+ <!-- Build the WAR web.xml from the prototype web.xml -->
<java classpath="${project.build.dir}" classname="com.gitblit.build.BuildWebXml">
<classpath refid="master-classpath" />
@@ -426,8 +492,6 @@ <arg value="--destinationFile" />
<arg value="${project.war.dir}/WEB-INF/web.xml" />
- <arg value="--propertiesFile" />
- <arg value="${basedir}/distrib/gitblit.properties" />
</java>
<!-- Gitblit resources -->
@@ -467,7 +531,7 @@ </copy>
<!-- Build the WAR file -->
- <jar basedir="${project.war.dir}" destfile="${distribution.warfile}" compress="true" />
+ <jar basedir="${project.war.dir}" destfile="${project.target.dir}/${distribution.warfile}" compress="true" />
</target>
@@ -554,7 +618,7 @@ <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">
+ <genjar jarfile="${project.target.dir}/fedclient.jar">
<class name="com.gitblit.FederationClientLauncher" />
<resource file="${project.build.dir}/log4j.properties" />
<classfilter>
@@ -575,16 +639,21 @@ </genjar>
<!-- Build the federation client zip file -->
- <zip destfile="${fedclient.zipfile}">
+ <zip destfile="${project.target.dir}/${fedclient.zipfile}">
<fileset dir="${basedir}">
- <include name="fedclient.jar" />
<include name="LICENSE" />
<include name="NOTICE" />
</fileset>
+ <fileset dir="${project.target.dir}">
+ <include name="fedclient.jar" />
+ </fileset>
<fileset dir="${basedir}/distrib">
<include name="federation.properties" />
</fileset>
</zip>
+
+ <!-- Cleanup -->
+ <delete file="${project.target.dir}/fedclient.jar" />
</target>
@@ -619,10 +688,20 @@ <copy tofile="${deployments.root}/WEB-INF/reference.properties"
file="${basedir}/distrib/gitblit.properties"/>
+ <!-- Copy users.conf and gitblit.properties -->
+ <mkdir dir="${deployments.root}/WEB-INF/data" />
+ <copy todir="${deployments.root}/WEB-INF/data">
+ <fileset dir="${basedir}/distrib">
+ <include name="users.conf" />
+ <include name="projects.conf" />
+ <include name="gitblit.properties" />
+ </fileset>
+ </copy>
+
<!-- Copy the supported Groovy hook scripts -->
- <mkdir dir="${deployments.root}/WEB-INF/groovy" />
- <copy todir="${deployments.root}/WEB-INF/groovy">
- <fileset dir="${basedir}/groovy">
+ <mkdir dir="${deployments.root}/WEB-INF/data/groovy" />
+ <copy todir="${deployments.root}/WEB-INF/data/groovy">
+ <fileset dir="${basedir}/distrib/groovy">
<include name="sendmail.groovy" />
<include name="sendmail-html.groovy" />
<include name="jenkins.groovy" />
@@ -663,6 +742,8 @@ <exclude name="hamcrest*.jar" />
<exclude name="servlet*.jar" />
<exclude name="javax.servlet*.jar" />
+ <exclude name="jsslutils*.jar" />
+ <exclude name="jcalendar*.jar" />
</fileset>
</copy>
@@ -680,7 +761,7 @@ </jar>
<!-- Build Express Zip file -->
- <zip destfile="${express.zipfile}">
+ <zip destfile="${project.target.dir}/${express.zipfile}">
<fileset dir="${project.express.dir}" />
</zip>
@@ -695,7 +776,7 @@ <target name="buildManager" depends="compile" description="Builds the stand-alone Gitblit Manager">
<echo>Building Gitblit Manager ${gb.version}</echo>
- <genjar jarfile="manager-${gb.version}.jar">
+ <genjar jarfile="${project.target.dir}/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" />
@@ -747,13 +828,18 @@ </genjar>
<!-- Build Manager Zip file -->
- <zip destfile="${manager.zipfile}">
+ <zip destfile="${project.target.dir}/${manager.zipfile}">
<fileset dir="${basedir}">
- <include name="manager-${gb.version}.jar" />
<include name="LICENSE" />
<include name="NOTICE" />
</fileset>
+ <fileset dir="${project.target.dir}">
+ <include name="manager-${gb.version}.jar" />
+ </fileset>
</zip>
+
+ <!-- Cleanup -->
+ <delete file="${project.target.dir}/manager-${gb.version}.jar" />
</target>
@@ -765,7 +851,7 @@ <target name="buildAuthority" depends="compile" description="Builds the stand-alone Gitblit Authority">
<echo>Building Gitblit Authority ${gb.version}</echo>
- <genjar jarfile="authority-${gb.version}.jar">
+ <genjar jarfile="${project.target.dir}/authority-${gb.version}.jar">
<resource file="${basedir}/src/com/gitblit/client/splash.png" />
<resource file="${basedir}/resources/gitblt-favicon.png" />
<resource file="${basedir}/resources/user_16x16.png" />
@@ -812,13 +898,15 @@ </genjar>
<!-- Build Authority Zip file -->
- <zip destfile="${authority.zipfile}">
+ <zip destfile="${project.target.dir}/${authority.zipfile}">
<fileset dir="${basedir}">
- <include name="authority-${gb.version}.jar" />
<include name="LICENSE" />
<include name="NOTICE" />
</fileset>
- <zipfileset dir="${basedir}/distrib" prefix="certs">
+ <fileset dir="${project.target.dir}">
+ <include name="authority-${gb.version}.jar" />
+ </fileset>
+ <zipfileset dir="${basedir}/distrib" prefix="data/certs">
<include name="authority.conf" />
<include name="mail.tmpl" />
<include name="instructions.tmpl" />
@@ -835,7 +923,7 @@ <echo>Building Gitblit API Library ${gb.version}</echo>
<!-- Build API Library jar -->
- <genjar jarfile="gbapi-${gb.version}.jar">
+ <genjar jarfile="${project.target.dir}/gbapi-${gb.version}.jar">
<class name="com.gitblit.Keys" />
<class name="com.gitblit.client.GitblitClient" />
<classpath refid="master-classpath" />
@@ -850,7 +938,7 @@ </genjar>
<!-- Build API sources jar -->
- <zip destfile="gbapi-${gb.version}-sources.jar">
+ <zip destfile="${project.target.dir}/gbapi-${gb.version}-sources.jar">
<fileset dir="${basedir}/src" defaultexcludes="yes">
<include name="com/gitblit/Constants.java"/>
<include name="com/gitblit/GitBlitException.java"/>
@@ -862,7 +950,7 @@ </zip>
<!-- Build API JavaDoc jar -->
- <javadoc destdir="${basedir}/javadoc">
+ <javadoc destdir="${project.target.dir}/javadoc">
<fileset dir="${basedir}/src" defaultexcludes="yes">
<include name="com/gitblit/Constants.java"/>
<include name="com/gitblit/GitBlitException.java"/>
@@ -872,18 +960,20 @@ <include name="com/gitblit/utils/**/*.java"/>
</fileset>
</javadoc>
- <zip destfile="gbapi-${gb.version}-javadoc.jar">
- <fileset dir="${basedir}/javadoc" />
+ <zip destfile="${project.target.dir}/gbapi-${gb.version}-javadoc.jar">
+ <fileset dir="${project.target.dir}/javadoc" />
</zip>
<!-- Build the API library zip file -->
- <zip destfile="${gbapi.zipfile}">
+ <zip destfile="${project.target.dir}/${gbapi.zipfile}">
<fileset dir="${basedir}">
+ <include name="LICENSE" />
+ <include name="NOTICE" />
+ </fileset>
+ <fileset dir="${project.target.dir}">
<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">
<exclude name="src/**" />
@@ -892,6 +982,16 @@ <include name="jdom*.jar" />
</fileset>
</zip>
+
+ <!-- Cleanup -->
+ <delete>
+ <fileset dir="${project.target.dir}">
+ <include name="javadoc/**" />
+ <include name="gbapi-${gb.version}.jar" />
+ <include name="gbapi-${gb.version}-sources.jar" />
+ <include name="gbapi-${gb.version}-javadoc.jar" />
+ </fileset>
+ </delete>
</target>
|