Files
i2p.syndie/build.xml

348 lines
15 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<project name="syndie" default="run" basedir=".">
<description>Builds, tests and runs the project syndie.</description>
<!--
Include property files so that values can be easily overridden.
Users should create an override.properties file to make changes.
-->
<property file="override.properties"/>
<property file="build.properties"/>
<!-- Set some global properties up -->
<property name="src.dir" value="src" />
<property name="data.dir" value="data" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="lib.dir" value="lib" />
<property name="dist.lib.jar" value="${dist.dir}/syndie.jar" />
<!-- allow lib locations to be overridden -->
<property name="hsqldb.jar" value="${lib.dir}/hsqldb.jar" />
<property name="i2p.jar" value="${lib.dir}/i2p.jar" />
<property name="swt.jar" value="${lib.dir}/swt.jar" />
<!-- Set some classpaths up -->
<path id="classpath.build">
<pathelement location="${hsqldb.jar}" />
<pathelement location="${i2p.jar}" />
<pathelement location="${swt.jar}" />
</path>
<path id="classpath.run">
<pathelement location="${dist.lib.jar}" />
<path refid="classpath.build" />
</path>
<!-- Set up a fileset for the resources -->
<path id="resources.path">
<fileset dir="${data.dir}" />
</path>
<target name="init" depends="buildProperties">
<tstamp>
<format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC" locale="en" />
</tstamp>
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
</target>
<target name="compile" depends="init" description="compile the source">
2011-06-01 15:36:04 +00:00
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="true" source="1.5" target="1.5"
deprecation="on" includeAntRuntime="false" >
<classpath>
<path refid="classpath.build" />
</classpath>
</javac>
<copy todir="${build.dir}">
<path refid="resources.path" />
</copy>
</target>
<target name="jar" depends="compile" description="generate the jar file">
<jar jarfile="${dist.lib.jar}" basedir="${build.dir}" />
</target>
<target name="dist" depends="jar" description="Combine all jars">
2013-01-04 22:05:13 +00:00
<copy file="${swt.jar}" todir="lib" />
<copy file="${i2p.jar}" todir="lib" />
<jar jarfile="syndie.jar" index="true">
<manifest>
<attribute name="Main-Class" value="syndie.gui.SWTUI"/>
</manifest>
<zipfileset src="${dist.lib.jar}" includes="**" />
<zipgroupfileset dir="lib" includes="*.jar"/>
</jar>
</target>
<target name="run" depends="jar" description="run syndie">
<condition property="run.args" value="">
<not>
<isset property="run.args" />
</not>
</condition>
<java classname="syndie.gui.SWTUI" fork="true" failonerror="false">
<arg line="${run.args}" />
<classpath>
<path refid="classpath.run" />
</classpath>
</java>
</target>
<target name="plugin" depends="getReleaseNumber, jar">
2010-03-02 00:09:09 +00:00
<mkdir dir="plugin/lib" />
<buildnumber file="scripts/build.number" />
<!-- make the update linux xpi2p, this is for both 32 and 64 bit -->
2010-03-03 00:20:57 +00:00
<delete file="plugin/lib/hsqldb.jar.pack" />
<delete file="plugin/lib/swt.jar.pack" />
2010-03-02 00:09:09 +00:00
<copy file="LICENSE" todir="plugin" />
<copy file="src/com/LICENSE.txt" tofile="plugin/LICENSE-jazzy.txt" />
<copy file="LICENSE-EPL-v1.0.html" tofile="plugin/LICENSE-icons.html" />
2010-03-03 00:20:57 +00:00
<copy file="scripts/plugin-linux.config" tofile="plugin/plugin.config" overwrite="true" />
<copy file="scripts/clients-linux.config" tofile="plugin/clients.config" overwrite="true" />
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-02 00:09:09 +00:00
<arg value="version=${release.number}-b${build.number}" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-02 00:09:09 +00:00
<arg value="update-only=true" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="pack200" failonerror="true">
2010-03-02 00:09:09 +00:00
<arg value="-g" />
<arg value="plugin/lib/syndie.jar.pack" />
<arg value="${dist.dir}/syndie.jar" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="scripts/makeplugin.sh" failonerror="true">
2010-03-02 00:09:09 +00:00
<arg value="plugin" />
</exec>
2010-03-03 00:20:57 +00:00
<move file="syndie.xpi2p" tofile="syndie-linux-i386-update.xpi2p" />
<!-- make the windows update xpi2p -->
<copy file="scripts/plugin-windows.config" tofile="plugin/plugin.config" overwrite="true" />
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-03 00:20:57 +00:00
<arg value="version=${release.number}-b${build.number}" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-03 00:20:57 +00:00
<arg value="update-only=true" />
</exec>
<copy file="scripts/clients-windows.config" tofile="plugin/clients.config" overwrite="true" />
2010-03-21 15:47:11 +00:00
<exec executable="scripts/makeplugin.sh" failonerror="true">
2010-03-03 00:20:57 +00:00
<arg value="plugin" />
</exec>
<move file="syndie.xpi2p" tofile="syndie-win32-update.xpi2p" />
2010-03-02 00:09:09 +00:00
<!-- make the install xpi2p -->
<copy file="lib/hsqldb_lic.txt" todir="plugin" />
2010-03-05 18:39:14 +00:00
<copy file="scripts/LICENSE-swt.txt" todir="plugin" />
2010-03-03 00:20:57 +00:00
<copy file="scripts/plugin-linux.config" tofile="plugin/plugin.config" overwrite="true" />
<copy file="scripts/clients-linux.config" tofile="plugin/clients.config" overwrite="true" />
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-02 00:09:09 +00:00
<arg value="version=${release.number}-b${build.number}" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="pack200" failonerror="true">
2010-03-02 00:09:09 +00:00
<arg value="-g" />
<arg value="plugin/lib/hsqldb.jar.pack" />
<arg value="${lib.dir}/hsqldb.jar" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="pack200" failonerror="true">
2010-03-02 00:09:09 +00:00
<arg value="-g" />
<arg value="plugin/lib/swt.jar.pack" />
<arg value="${lib.dir}/swt.jar" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="scripts/makeplugin.sh" failonerror="true">
2010-03-02 00:09:09 +00:00
<arg value="plugin" />
</exec>
2010-03-03 00:20:57 +00:00
<move file="syndie.xpi2p" tofile="syndie-linux-i386.xpi2p" />
2010-03-08 01:31:12 +00:00
<!-- make the 64 bit linux install xpi2p -->
2010-03-21 15:47:11 +00:00
<exec executable="pack200" failonerror="true">
2010-03-08 01:31:12 +00:00
<arg value="-g" />
<arg value="plugin/lib/swt.jar.pack" />
<arg value="${lib.dir}/swt-linux-x86-64.jar" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="scripts/makeplugin.sh" failonerror="true">
2010-03-08 01:31:12 +00:00
<arg value="plugin" />
</exec>
<move file="syndie.xpi2p" tofile="syndie-linux-x86-64.xpi2p" />
2010-03-03 00:20:57 +00:00
<!-- make the windows install xpi2p -->
<copy file="scripts/plugin-windows.config" tofile="plugin/plugin.config" overwrite="true" />
<copy file="scripts/clients-windows.config" tofile="plugin/clients.config" overwrite="true" />
2010-03-21 15:47:11 +00:00
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
2010-03-03 00:20:57 +00:00
<arg value="version=${release.number}-b${build.number}" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="pack200" failonerror="true">
2010-03-03 00:20:57 +00:00
<arg value="-g" />
<arg value="plugin/lib/swt.jar.pack" />
<arg value="${lib.dir}/swt-win32.jar" />
</exec>
2010-03-21 15:47:11 +00:00
<exec executable="scripts/makeplugin.sh" failonerror="true">
2010-03-03 00:20:57 +00:00
<arg value="plugin" />
</exec>
<move file="syndie.xpi2p" tofile="syndie-win32.xpi2p" />
2010-03-02 00:09:09 +00:00
</target>
<target name="clean" description="clean up">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete file="sloccount.sc" />
<delete file="syndie.jar" />
2010-03-05 18:39:14 +00:00
<delete dir="plugin" />
2013-01-06 21:31:30 +00:00
<delete file="${ant.project.name}.fba" />
2010-03-02 00:09:09 +00:00
<delete file="syndie.xpi2p" />
<delete file="syndie-update.xpi2p" />
2010-03-21 15:47:11 +00:00
<delete file="syndie-win32.xpi2p" />
<delete file="syndie-win32-update.xpi2p" />
<delete file="syndie-linux-i386.xpi2p" />
<delete file="syndie-linux-i386-update.xpi2p" />
2010-03-21 15:47:11 +00:00
<delete file="syndie-linux-x86-64.xpi2p" />
</target>
<target name="checkForMtn" >
<available property="mtn.available" file="_MTN" type="dir" />
</target>
<target name="getMtnRev" depends="checkForMtn" if="mtn.available" >
<exec executable="mtn" outputproperty="workspace.version" errorproperty="mtn.error1" failifexecutionfails="false" >
<arg value="automate" />
<arg value="get_base_revision_id" />
</exec>
</target>
<target name="buildProperties" depends="getMtnRev, getReleaseNumber" >
<!-- default if not set above -->
<property name="workspace.version" value="unknown" />
<property name="full.version" value="${release.number}" />
<echo message="Building version ${full.version} (mtn rev ${workspace.version})" />
</target>
<target name="getReleaseNumber">
<loadfile srcfile="src/syndie/Version.java" property="release.number">
<filterchain>
<linecontains>
<contains value="public static final String VERSION"/>
</linecontains>
<tokenfilter>
<replaceregex pattern=".*&quot;([^&quot;]+)&quot;;" replace="\1" flags="gi" />
</tokenfilter>
<striplinebreaks/>
<trim/>
<ignoreblank/>
</filterchain>
</loadfile>
<property name="release.number" value="unknown" />
<echo message="Release number is ${release.number}" />
</target>
<target name="sloccount.report">
<echo message="Generating sloccount report (this will take awhile)" />
<exec executable="sloccount" failonerror="true">
<arg value="--details"/>
<arg value="--wide"/>
<arg value="${basedir}"/>
<redirector output="sloccount.sc">
<outputfilterchain>
<linecontainsregexp negate="true">
<regexp pattern="(WARNING|Warning:|sloccount\.sc)" />
</linecontainsregexp>
</outputfilterchain>
</redirector>
</exec>
<echo message="sloccount report saved to the file sloccount.sc" />
</target>
<target name="getExtendedVersion" depends="buildProperties, trimMtnRev">
<property name="MtnShortHash" value="unknown" />
<condition property="Extended.Version" value="${full.version}-${MtnShortHash}">
<not>
<or>
<equals arg1="${MtnShortHash}" arg2="" />
<equals arg1="${MtnShortHash}" arg2="unknown" />
</or>
</not>
</condition>
<!-- if not set above we'll set it here -->
<property name="Extended.Version" value="${full.version}" />
</target>
<target name="trimMtnRev" depends="getMtnRev" unless="withoutRev">
<script language="javascript">
<![CDATA[
var MtnRev = project.getProperty("workspace.version");
if (MtnRev != 'unknown' && MtnRev != null) {
echo = project.createTask("echo");
var MtnShortHash = MtnRev.substring(0,8);
project.setProperty("MtnShortHash", MtnShortHash);
echo.setMessage("Trimmed hash: " + MtnShortHash);
echo.perform();
} else {
project.setProperty("MtnShortHash", 'unknown');
}
]]>
</script>
</target>
<target name="source-tarball" depends="getExtendedVersion">
<!-- will this use the monotonerc file in the current workspace? -->
<fail message="This target cannot be used without Monotone!">
<condition>
<not>
<isset property="mtn.available" />
</not>
</condition>
</fail>
<property name="tarball.name" value="${ant.project.name}_${Extended.Version}.orig.tar.bz2" />
<echo message="Checking out fresh copy into ../${ant.project.name}-${Extended.Version} for tarballing:" />
<delete dir="../${ant.project.name}-${Extended.Version}" />
<exec executable="mtn" failonerror="true">
<arg value="co" />
<arg value="-b" />
<arg value="i2p.${ant.project.name}" />
<!-- w: is the revision of the current workspace -->
<arg value="-r" />
<arg value="w:" />
<arg value="../${ant.project.name}-${Extended.Version}" />
</exec>
<delete includeemptydirs="true" quiet="false">
<fileset dir="../${ant.project.name}-${Extended.Version}/_MTN" />
</delete>
<tar longfile="gnu" destfile="../${tarball.name}" compression="bzip2">
<tarfileset dir="../${ant.project.name}-${Extended.Version}" prefix="/${ant.project.name}-${Extended.Version}">
<include name="**/**" />
<exclude name="debian/**"/>
<exclude name="**/*.sh"/>
</tarfileset>
<tarfileset dir="../${ant.project.name}-${Extended.Version}" prefix="/${ant.project.name}-${Extended.Version}" filemode="755">
<exclude name="debian/**" />
<include name="**/*.sh" />
</tarfileset>
</tar>
</target>
2013-01-06 21:31:30 +00:00
<target name="findbugs" depends="jar">
<echo message="Starting findbugs, this will take a while..." />
<exec executable="nice" failonerror="true">
<arg value="findbugs"/>
<arg value="-textui"/>
<arg value="-projectName"/>
<arg value="${ant.project.name}"/>
<arg value="-sortByClass"/>
<arg value="-xml"/>
<arg value="-output"/>
<arg value="${ant.project.name}.fba"/>
<arg value="-auxclasspath"/>
<arg value="${swt.jar}:${hsqldb.jar}:${i2p.jar}" />
<arg value="-sourcepath"/>
<arg value="src" />
<!-- start of the files to be analyzed -->
<arg value="dist/syndie.jar"/>
</exec>
<echo message="Findbugs output stored in ${ant.project.name}.fba" />
<echo message="Now run: findbugs ${ant.project.name}.fba" />
</target>
</project>
<!-- vim: set ft=xml ts=4 sw=4 et: -->