RandomSec/build.xml

265 lines
10 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!--+
|
| Gridworks Build File
|
+-->
<!--+
| NOTE: this script expects the 'build.dir' and 'dist.dir' properties to be set
| when invoking it. This is done like this
|
| ant -f build.xml -Dbuild.dir="/path/to/build/dir" -Ddist.dir="/path/to/dist/dir" -Drevision="r3934"
|
| Basically, this build file is designed to be invoked by the 'gridworks' shell
| script (this makes it easy to integrate into nightly-build and continuous
| integration systems).
+-->
<project name="gridworks" default="build" basedir=".">
<property environment="env"/>
<property name="src.dir" value="${basedir}/src/main/java" />
<property name="server.src.dir" value="${basedir}/src/server/java" />
<property name="graphics.dir" value="${basedir}/src/graphics" />
<property name="conf.dir" value="${basedir}/src/conf" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="tests.dir" value="${basedir}/tests" />
<property name="tools.dir" value="${basedir}/tools" />
<property name="server_classes.dir" value="${build.dir}/classes" />
<property name="webapp_classes.dir" value="${basedir}/src/main/webapp/WEB-INF/classes" />
<property name="tests_classes.dir" value="${tests.dir}/classes" />
<property name="webapp.name" value="webapp" />
<property name="webapp.dir" value="${build.dir}/${webapp.name}" />
<property name="mac.dir" value="${build.dir}/mac" />
<property name="windows.dir" value="${build.dir}/windows" />
<property name="linux.name" value="gridworks-${version}" />
<property name="linux.dir" value="${build.dir}/linux/${linux.name}" />
<path id="class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="tests.class.path">
<path refid="class.path"/>
<fileset dir="${tests.dir}/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- NOTE(SM): this is needed to support autoreloading, don't remove! -->
<target name="build_server">
<mkdir dir="${server_classes.dir}" />
<javac srcdir="${server.src.dir}" destdir="${server_classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="class.path" />
</javac>
</target>
<target name="build" depends="build_server">
<mkdir dir="${webapp_classes.dir}" />
<javac destdir="${webapp_classes.dir}" debug="true" includeAntRuntime="no">
<src path="${server.src.dir}"/>
<src path="${src.dir}"/>
<classpath refid="class.path" />
</javac>
</target>
<target name="build_tests" depends="build">
<mkdir dir="${tests_classes.dir}" />
<javac srcdir="${tests.dir}/src" destdir="${tests_classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="tests.class.path" />
</javac>
</target>
<target name="jar" depends="build">
<jar destfile="${build.dir}/gridworks.jar" basedir="${webapp_classes.dir}"/>
</target>
<target name="prepare_webapp">
<mkdir dir="${webapp.dir}" />
<copy todir="${webapp.dir}">
<fileset dir="${basedir}/src/main/webapp">
<include name="**/*"/>
<exclude name="WEB-INF/classes/**"/>
</fileset>
</copy>
<replace file="${webapp.dir}/scripts/version.js">
<replacefilter token="$VERSION" value="${version}"/>
<replacefilter token="$REVISION" value="${revision}"/>
</replace>
</target>
<target name="mac" depends="jar, prepare_webapp">
<taskdef
name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler"
classpath="${jarbundler.dir}/jarbundler-2.1.0.jar"
/>
<mkdir dir="${mac.dir}"/>
<jarbundler
dir="${mac.dir}"
name="Gridworks"
mainclass="com.metaweb.gridworks.Gridworks"
icon="${graphics.dir}/icon/gridworks.icns"
version="${version}"
infostring="Gridworks ${version}"
aboutmenuname="Gridworks"
workingdirectory="$APP_PACKAGE/Contents/Resources"
jvmversion="1.6+"
bundleid="com.metaweb.gridworks.Gridworks"
vmoptions="-Dgridworks.version=${revision} ${java.options}"
antialiasedgraphics="true"
antialiasedtext="true"
liveresize="true"
growboxintrudes="true"
screenmenu="true">
<jarfileset dir="${lib.dir}">
<exclude name="**/.svn" />
<include name="**/*.jar" />
</jarfileset>
<jarfilelist dir="${build.dir}" files="gridworks.jar" />
<resourcefileset dir="${webapp.dir}/..">
<include name="${webapp.name}/**" />
</resourcefileset>
</jarbundler>
</target>
<target name="windows" depends="jar, prepare_webapp">
<mkdir dir="${windows.dir}"/>
<taskdef
name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar"
/>
<launch4j>
<config
headerType="console"
outfile="${windows.dir}/Gridworks.exe"
jarPath="lib/gridworks-${version}-${revision}.jar"
dontWrapJar="true"
icon="${graphics.dir}/icon/gridworks.ico">
<classPath mainClass="com.metaweb.gridworks.Gridworks">
<cp>lib/*.jar</cp>
</classPath>
<jre minVersion="1.6.0" jdkPreference="preferJre" initialHeapSize="256" maxHeapSize="1024">
<opt>-Djava.library.path=lib/native/windows -Dgridworks.version=${revision}</opt>
</jre>
<versionInfo
fileVersion="${num_version}.0.0"
txtFileVersion="${version}"
fileDescription="gridworks"
copyright="Copyright (c) 2010, Metaweb Technologies, Inc."
productVersion="${num_version}.0.0"
txtProductVersion="${num_version}.0.0"
productName="Gridworks"
companyName="Metaweb Technologies, Inc."
internalName="gridworks"
originalFilename="gridworks.exe"
/>
</config>
</launch4j>
<copy todir="${windows.dir}/lib">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${windows.dir}/lib/native/windows">
<fileset dir="${lib.dir}/native/windows">
<include name="*.dll"/>
</fileset>
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${windows.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy todir="${windows.dir}/webapp">
<fileset dir="${webapp.dir}">
<include name="**"/>
</fileset>
</copy>
<copy todir="${linux.dir}/licenses">
<fileset dir="${basedir}/licenses">
<include name="**"/>
</fileset>
</copy>
<copy file="${conf.dir}/gridworks.l4j.ini" tofile="${windows.dir}/gridworks.l4j.ini"/>
<copy file="${basedir}/gridworks.bat" tofile="${windows.dir}/gridworks.bat"/>
<copy file="${basedir}/README.txt" tofile="${windows.dir}/README.txt"/>
<copy file="${basedir}/LICENSE.txt" tofile="${windows.dir}/LICENSE.txt"/>
<zip destfile="${dist.dir}/gridworks-${version}-${revision}.zip" basedir="${windows.dir}"/>
</target>
<target name="linux" depends="jar, prepare_webapp">
<mkdir dir="${linux.dir}"/>
<copy todir="${linux.dir}/lib">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${linux.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy todir="${linux.dir}/src/main/webapp">
<fileset dir="${webapp.dir}">
<include name="**"/>
</fileset>
</copy>
<copy todir="${linux.dir}/licenses">
<fileset dir="${basedir}/licenses">
<include name="**"/>
</fileset>
</copy>
<copy file="${basedir}/gridworks.ini" tofile="${linux.dir}/gridworks.ini"/>
<copy file="${basedir}/LICENSE.txt" tofile="${linux.dir}/LICENSE.txt"/>
<copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
<copy file="${basedir}/gridworks" tofile="${linux.dir}/gridworks"/>
<tar longfile="gnu" compression="gzip" destfile="${dist.dir}/gridworks-${version}-${revision}.tar.gz">
<tarfileset dir="${linux.dir}/.." filemode="755">
<include name="${linux.name}/gridworks"/>
</tarfileset>
<tarfileset dir="${linux.dir}/..">
<include name="${linux.name}/**"/>
<exclude name="${linux.name}/gridworks"/>
</tarfileset>
</tar>
</target>
<target name="findbugs" depends="build">
<taskdef
name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.dir}/lib/findbugs-ant.jar"
/>
<findbugs jvmargs="-Xmx1024m" home="${findbugs.dir}" output="html" outputFile="${build.dir}/gridworks-findbugs.html" >
<auxClasspath refid="class.path" />
<sourcePath path="${src.dir}" />
<class location="${webapp_classes.dir}" />
</findbugs>
</target>
<target name="clean">
<delete file="${build.dir}/gridworks.jar" />
<delete dir="${server_classes.dir}" />
<delete dir="${webapp_classes.dir}" />
<delete dir="${tests_classes.dir}" />
</target>
<target name="distclean" depends="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${tools.dir}" />
</target>
</project>