Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
1062 lines (1056 sloc) 44.9 KB
<?xml version="1.0" ?>
<project name="Red5" basedir="." default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- This build file requires Apache Ant >= 1.7 -->
<condition property="ant-at-least-7">
<antversion atleast="1.7.0"/>
</condition>
<!-- project properties -->
<property environment="env"/>
<property name="java.home" value="${env.JDK_HOME}"/>
<property name="src.dir" value="src"/>
<property name="dist.dir" value="dist"/>
<property name="log.dir" value="log"/>
<property name="lib.dir" value="lib"/>
<property name="plugins.dir" value="plugins"/>
<property name="classes.dir" value="bin"/>
<property name="webapps.dir" value="webapps"/>
<property name="webapps.build.dir" value="${dist.dir}/webapps"/>
<property name="config.dir" value="src/conf"/>
<property name="javadoc.dir" value="doc/api"/>
<property name="debug.state" value="true"/>
<!-- Documentation properties -->
<property name="doc.ref.dir" value="../../../doc/trunk/reference"/>
<property name="doc.ref.lib" value="${doc.ref.dir}/lib"/>
<property name="javadoc.style" value="${doc.ref.dir}/styles/javadoc.css"/>
<!-- unit testing -->
<property name="test.dir" value="test"/>
<property name="testclass.dir" value="bin/testcases/classes"/>
<property name="testreports.dir" value="bin/testcases/testreports"/>
<property name="testdoc.dir" value="doc/test"/>
<!-- user overides for project properties -->
<property file="${user.home}/build.properties"/>
<!-- base project properties -->
<property file="build.properties"/>
<!-- Hudson auto-builds and release properties -->
<!-- Hudson will set BUILD_TAG when running -->
<condition property="archive.version" value="${red5.version}-build-${env.BUILD_TAG}">
<isset property="env.BUILD_TAG"/>
</condition>
<!-- And if we're not in Hudson, just use the red5.version property -->
<condition property="archive.version" value="${red5.version}">
<not>
<isset property="archive.version"/>
</not>
</condition>
<property name="red5.zip" value="${red5.filename}-${archive.version}.zip"/>
<property name="red5.archive" value="${red5.filename}-${archive.version}.tar.gz"/>
<tstamp prefix="build">
<format property="TODAY" pattern="d-MMMM-yyyy" locale="en"/>
</tstamp>
<!-- Special directory destination for WAR build - unused in normal server build -->
<property name="tmp.war.dir" value=""/>
<!--
Ivy tasks and lib directory
http://ant.apache.org/ivy
http://testearly.com/2007/06/24/ivy-in-42-steps
-->
<taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml" classpath="${lib.dir}/${ivy.version}.jar"/>
<!-- Latest ivy 9/2008 seems to want absolute path -->
<property name="ivy.lib.dir" value="${basedir}/lib"/>
<path id="project.classpath">
<fileset dir="${lib.dir}"/>
</path>
<path id="script.classpath">
<fileset dir="${lib.dir}"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="full.classpath">
<fileset dir="${lib.dir}"/>
<fileset dir="./">
<filename name="${red5.filename}.jar"/>
<filename name="boot.jar"/>
</fileset>
</path>
<path id="runtime.classpath">
<fileset dir="${lib.dir}">
<exclude name="Grobo*.jar"/>
<exclude name="grobo*.jar"/>
<exclude name="junit*.jar"/>
<exclude name="ivy*.jar"/>
</fileset>
</path>
<!-- Build Targets -->
<target name="-java6.check">
<condition property="java6.installed" value="true">
<and>
<or>
<equals arg1="${java.target_version}" arg2="1.6"/>
<equals arg1="${java.target_version}" arg2="1.7"/>
</or>
<available property="java6.installed" classname="javax.script.Bindings"/>
</and>
</condition>
<condition property="java6.using" value="1.6" else="${java.target_version}">
<isset property="java6.installed"/>
</condition>
<echo message="Using Java ${java6.using} specification: ${java.specification.version}"/>
<fail message="Unsupported Java version - detected: ${java.version} selected: ${java.target_version}. Only Java compiler version 1.6 or later are supported.">
<condition>
<not>
<or>
<equals arg1="${java.target_version}" arg2="1.6"/>
<equals arg1="${java.target_version}" arg2="1.7"/>
</or>
</not>
</condition>
</fail>
</target>
<!-- Check for the main libraries -->
<target name="-library.check">
<echo message="Java: java.home is ${java.home} and the target version is ${java.target_version}"/>
<echo message="Ant: ant.home is ${ant.home} and the target version is ${ant.version}"/>
<!-- May want to add repository availability checking
<condition property="repository.offline.googlecode" value="true">
<isreachable host="red5.googlecode.com" timeout="30" />
</condition>
<echo message='Repository access: googlecode=${repository.offline.googlecode}'/>
-->
<condition property="library.installed" value="true">
<and>
<available property="spring.installed" classpathref="project.classpath" classname="org.springframework.core.SpringVersion"/>
<available property="logging.installed" classpathref="project.classpath" classname="org.slf4j.Logger"/>
<available property="catalina.installed" classpathref="project.classpath" classname="org.apache.catalina.Server"/>
<available property="mina.installed" classpathref="project.classpath" classname="org.apache.mina.filter.codec.ProtocolEncoder"/>
<isset property="ivy.conf.name"/>
</and>
</condition>
</target>
<target name="prepare" description="Setup the directories for building">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${log.dir}"/>
<mkdir dir="${dist.dir}/${log.dir}"/>
<mkdir dir="${testclass.dir}"/>
<mkdir dir="${testreports.dir}"/>
</target>
<target name="clean" description="Clean the directories for building">
<delete file="${red5.filename}.jar"/>
<delete file="boot.jar"/>
<delete file="ivy.log"/>
<delete dir="${classes.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${javadoc.dir}"/>
<delete dir="${testdoc.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${webapps.dir}/" includes="**/*.class"/>
</delete>
<delete includeemptydirs="true">
<fileset dir="${webapps.dir}/" includes="**/*.jar"/>
</delete>
<delete>
<fileset dir="${basedir}">
<include name="*.tar.gz"/>
<include name="*.zip"/>
<exclude name="project.zip"/>
</fileset>
</delete>
</target>
<target name="retrieve" unless="library.installed" description="Retrieves the libraries if needed">
<!-- Ivy configuration - http://ant.apache.org/ivy/history/trunk/ant.html -->
<ivy:settings file="ivysettings.xml"/>
<condition property="ivy.conf.name" value="java6">
<not>
<isset property="ivy.conf.name"/>
</not>
</condition>
<echo message="Ivy conf name: ${ivy.conf.name}"/>
<ivy:resolve file="ivy.xml" conf="${ivy.conf.name}" checkIfChanged="false" transitive="false" />
<ivy:retrieve conf="${ivy.conf.name}"/>
</target>
<target name="ivyclear" description="Clears out the Ivy cache">
<delete dir="${user.home}/.ivy2/cache/red5"/>
<delete includeemptydirs="true">
<fileset dir="${lib.dir}" excludes="**/ivy*.jar"/>
</delete>
<ivy:cleancache/>
</target>
<target name="compile" depends="-library.check, -java6.check, prepare" description="Compiles the server">
<!-- token replacement filers -->
<property name="filter.file" value="${config.dir}/build_standalone.properties"/>
<condition property="java.target_version" value="1.6">
<not>
<isset property="java.target_version"/>
</not>
</condition>
<echo message="javac version: ${java.target_version}"/>
<condition property="eclipse.using" value="Using" else="Not using">
<isset property="eclipse.running"/>
</condition>
<echo message="${eclipse.using} the Eclipse IDE"/>
<condition property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter">
<isset property="eclipse.running"/>
</condition>
<condition property="compiler" value="${build.compiler}${java.target_version}">
<equals arg1="${build.compiler}" arg2="javac"/>
</condition>
<property name="compiler" value="${build.compiler}"/>
<echo message="Compiler adapter name: ${compiler}"/>
<!-- destination for compiled classes -->
<property name="dest.dir" value="${classes.dir}"/>
<!-- standard excludes for compile -->
<property name="std_excludes" value="**/*.jsp,org/red5/server/script/**"/>
<antcall target="compile-core" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-core-compatibility" inheritAll="true" inheritRefs="true"/>
<!-- libraries and classes needed for building the demos -->
<path id="webapps.classpath">
<fileset dir="${lib.dir}">
<filename name="*.jar"/>
</fileset>
<pathelement location="${classes.dir}"/>
</path>
<antcall target="compile-demos" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-script" inheritAll="true" inheritRefs="true"/>
</target>
<!-- Core -->
<target name="compile-core" if="java6.installed" description="Build server core">
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="java6"/>
</antcall>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="project.classpath" optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}" deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}" source="${java.target_version}" target="${java.target_version}" memoryInitialSize="${memory.minimum}" memoryMaximumSize="${memory.maximum}" excludes="${std_excludes}" listfiles="false" includeantruntime="false"/>
<!-- touch this source file so that the revision number will be updated upon svn commit -->
<touch file="${src.dir}/org/red5/server/api/Red5.java"/>
</target>
<target name="compile-core-compatibility" unless="java6.installed">
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="java5"/>
</antcall>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="project.classpath"
optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}"
deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}"
source="${java.target_version}" target="${java.target_version}" memoryInitialSize="${memory.minimum}" memoryMaximumSize="${memory.maximum}"
excludes="${std_excludes}" listfiles="false" includeantruntime="false"/>
</target>
<macrodef name="build-demo">
<attribute name="name"/>
<element name="copy-assets" optional="yes"/>
<sequential>
<mkdir dir="${webapps.build.dir}/@{name}/WEB-INF/classes"/>
<mkdir dir="${webapps.build.dir}/@{name}/WEB-INF/lib"/>
<javac sourcepath="" srcdir="${webapps.dir}/@{name}/WEB-INF/src" destdir="${webapps.build.dir}/@{name}/WEB-INF/classes"
classpathref="webapps.classpath" optimize="${build.optimize}" verbose="${build.verbose}"
fork="${build.fork}" nowarn="${build.nowarn}" deprecation="${build.deprecation}"
debug="${debug.state}" compiler="${compiler}" source="${java.target_version}" target="${java.target_version}" includeantruntime="false"/>
<copy todir="${webapps.build.dir}/@{name}" filtering="true">
<fileset dir="webapps/@{name}">
<exclude name="**/src/**"/>
<exclude name="**/*.flv"/>
<exclude name="**/*.meta"/>
</fileset>
</copy>
<!-- copy other demo files (optional) -->
<copy-assets/>
</sequential>
</macrodef>
<macrodef name="logback">
<attribute name="webapp"/>
<sequential>
<!-- copy the logback config per webapp and associated jars -->
<copy todir="${webapps.build.dir}/@{webapp}/WEB-INF/classes" file="webapps/@{webapp}/WEB-INF/src/logback-@{webapp}.xml"
overwrite="true"/>
</sequential>
</macrodef>
<!-- Demos -->
<target name="compile-demos" description="Build demo apps">
<echo message="Webapps dir: ${webapps.dir}"/>
<echo message="Webapps build dir: ${webapps.build.dir}"/>
<!-- load token replacement filters -->
<filter filtersfile="${filter.file}"/>
<copy todir="${webapps.build.dir}/root" filtering="true">
<fileset dir="webapps/root">
<exclude name="**/src/**"/>
<exclude name="**/*.swf"/>
<exclude name="**/*.png"/>
<exclude name="**/*.jpg"/>
<!--
<exclude name="demos"/>
-->
</fileset>
</copy>
<!-- copy SWF without filtering as it causes corruption -->
<copy todir="${webapps.build.dir}/root">
<fileset dir="webapps/root">
<include name="**/*.swf"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<!--
<exclude name="demos"/>
-->
</fileset>
</copy>
<!-- vod -->
<copy todir="${webapps.build.dir}/vod">
<fileset dir="webapps/vod">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
<include name="**/*.sw*"/>
<include name="**/*.flv"/>
<include name="**/*.html"/>
<include name="**/*.js"/>
</fileset>
</copy>
<!-- live -->
<copy todir="${webapps.build.dir}/live">
<fileset dir="webapps/live">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
<include name="**/*.sw*"/>
<include name="**/*.html"/>
<include name="**/*.js"/>
</fileset>
</copy>
<!-- installer -->
<!-- load token replacement filters -->
<filter filtersfile="${filter.file}"/>
<copy todir="${webapps.build.dir}/installer" filtering="true">
<fileset dir="webapps/installer">
<exclude name="**/src/**"/>
<exclude name="**/*.swf"/>
</fileset>
</copy>
<!-- copy SWF without filtering to prevent file corruption -->
<copy todir="${webapps.build.dir}/installer">
<fileset dir="webapps/installer">
<include name="**/*.swf"/>
</fileset>
</copy>
<!-- copy the demos if they dont exist in the tree -->
<copy todir="${webapps.build.dir}/root/demos" failonerror="false">
<fileset dir="../../../flash/trunk/deploy">
<include name="**/*.*"/>
<exclude name=".svn"/>
</fileset>
</copy>
</target>
<!-- Scripting -->
<target name="compile-script" depends="prepare">
<available property="scripting_compatibility" classpathref="project.classpath" classname="javax.script.ScriptEngineManager"/>
<condition property="scripting.using" value="Scripting compatibility is available." else="No compatibility for scripting available">
<istrue value="${scripting_compatibility}"/>
</condition>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="script.classpath"
optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}"
deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}"
source="${java.target_version}" target="${java.target_version}" memoryMaximumSize="${memory.maximum}"
includes="org/red5/server/script/**" listfiles="false" includeantruntime="false"/>
<echo message="${scripting.using}"/>
</target>
<target name="compile-war" depends="-library.check, -java6.check, clean, prepare">
<!-- token replacement filers -->
<property name="filter.file" value="${config.dir}/war/build_war.properties"/>
<condition property="java.target_version" value="1.6">
<not>
<isset property="java.target_version"/>
</not>
</condition>
<echo message="javac version: ${java.target_version}"/>
<condition property="compiler" value="${build.compiler}${java.target_version}">
<equals arg1="${build.compiler}" arg2="javac"/>
</condition>
<property name="compiler" value="${build.compiler}"/>
<echo message="Compiler adapter name: ${compiler}"/>
<mkdir dir="${classes.dir}/WEB-INF/classes"/>
<property name="dest.dir" value="${classes.dir}/WEB-INF/classes"/>
<property name="std_excludes" value="${server.war.excludes}"/>
<antcall target="compile-core" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-core-compatibility" inheritAll="true" inheritRefs="true"/>
<!-- libraries and classes needed for building the demos -->
<path id="webapps.classpath">
<fileset dir="${lib.dir}">
<filename name="*.jar"/>
</fileset>
<pathelement location="${dest.dir}"/>
</path>
<antcall target="compile-demos" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-script" inheritAll="true" inheritRefs="true">
<param name="dest.dir" value="${classes.dir}/WEB-INF/classes"/>
</antcall>
</target>
<macrodef name="compile-wardemo">
<attribute name="name"/>
<sequential>
<war destfile="${dist.dir}/@{name}.war" webxml="${webapps.build.dir}/@{name}/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/@{name}">
<exclude name="WEB-INF"/>
<exclude name="**/src/**"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
</sequential>
</macrodef>
<target name="war-demos" description="Build wars for demo apps" depends="compile-demos">
<!-- copy installer swf etc under root/installer -->
<mkdir dir="${webapps.build.dir}/root/installer"/>
<copy todir="${webapps.build.dir}/root/installer">
<fileset dir="${webapps.build.dir}/installer"/>
</copy>
<!-- war up root -->
<war destfile="${dist.dir}/ROOT.war" webxml="${webapps.build.dir}/root/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/root"/>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
</target>
<target name="javadoc" depends="-java6.check" description="Generate JavaDoc">
<condition property="available.envpath" value="Path: ${env.Path}" else="Not using env.Path">
<isset property="env.Path"/>
</condition>
<echo message="${available.envpath}"/>
<!-- Determine the location of Sun's API docs -->
<condition property="javadoc.loc" value="javase/6">
<equals arg1="${java6.installed}" arg2="true"/>
</condition>
<delete>
<fileset dir="${lib.dir}" includes="**/*sources*.jar"/>
</delete>
<javadoc useexternalfile="true" failonerror="false" verbose="false" classpathref="full.classpath"
destdir="${javadoc.dir}" author="true" version="true" use="true" splitindex="true"
windowtitle="${documentation.title}" stylesheetfile="${javadoc.style}">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/red5/**"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.xsd"/>
</fileset>
<doctitle><![CDATA[<h1>${documentation.title}</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; ${red5.age} <a href="${red5.url}" target="_blank">${red5.name}</a></i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Public API" packages="org.red5.server.api:org.red5.server.api.*"/>
<group title="Network Protocols" packages="org.red5.server.net:org.red5.server.net.*"/>
<group title="Streaming" packages="org.red5.server.stream:org.red5.server.stream.*"/>
<group title="IO Packages" packages="org.red5.io:org.red5.io.*"/>
<group title="Scripting" packages="org.red5.server.script:org.red5.server.script.*"/>
<link href="http://download.oracle.com/${javadoc.loc}/docs/api"/>
<link href="http://jetty.codehaus.org/jetty/jetty-6/apidocs"/>
<link href="http://mina.apache.org/report/trunk/apidocs"/>
<link href="http://static.springsource.org/spring/docs/2.5.x/api"/>
<!-- <link href="http://www.quartz-scheduler.org/docs/api"/> -->
<link href="http://www.slf4j.org/api"/>
<link href="http://logging.apache.org/log4j/1.2/apidocs"/>
<link href="http://groovy.codehaus.org/api"/>
<link href="http://tomcat.apache.org/tomcat-6.0-doc/api"/>
<link href="http://ehcache.org/apidocs"/>
</javadoc>
<echo message="Javadoc API stub: ${javadoc.loc}"/>
<echo message="Javadoc CSS: ${doc.ref.dir} ${javadoc.style}"/>
</target>
<macrodef name="compile-jardemo">
<attribute name="name"/>
<element name="copy-assets" optional="yes"/>
<sequential>
<jar destfile="${webapps.build.dir}/@{name}/WEB-INF/lib/@{name}.jar">
<fileset dir="${webapps.build.dir}/@{name}/WEB-INF/classes">
<include name="**"/>
</fileset>
</jar>
<!-- copy files (optional) -->
<copy-assets/>
</sequential>
</macrodef>
<!-- Determine classpath for jar file -->
<target name="jar-determine-classpath" depends="compile" unless="jar.classpath">
<manifestclasspath property="jar.classpath" jarfile="${red5.filename}.jar">
<classpath refid="runtime.classpath"/>
</manifestclasspath>
</target>
<target name="jar" description="Make Archive" depends="jar-determine-classpath">
<jar destfile="${red5.filename}.jar">
<fileset dir="${classes.dir}">
<exclude name="**/org/red5/server/Bootstrap.class"/>
<exclude name="**/org/red5/server/Shutdown.class"/>
<exclude name="**/ShutdownMXBean.class"/>
<exclude name="**/org/red5/classloading/**"/>
<include name="**/org/**"/>
<include name="**/META-INF**"/>
</fileset>
<manifest>
<attribute name="Red5-Version" value="${red5.version}"/>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
<metainf dir="${src.dir}/META-INF">
<include name="**"/>
</metainf>
</jar>
<!-- Bootstrap, Shutdown, and classloaders -->
<jar destfile="boot.jar">
<fileset dir="${classes.dir}">
<include name="**/org/red5/server/Bootstrap.class"/>
<include name="**/org/red5/server/Shutdown.class"/>
<include name="**/ShutdownMXBean.class"/>
<include name="**/org/red5/classloading/**"/>
<include name="**/META-INF**"/>
</fileset>
<manifest>
<attribute name="Red5-Version" value="${red5.version}"/>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
<attribute name="Main-Class" value="org.red5.server.Bootstrap"/>
</manifest>
<metainf dir="${src.dir}/META-INF">
<include name="**"/>
</metainf>
</jar>
</target>
<target name="dist" description="Create binary distribution" depends="jar">
<copy todir="${dist.dir}/lib">
<fileset dir="${lib.dir}">
<exclude name="ivy*.jar"/>
<exclude name="junit*.jar"/>
<exclude name="grobo*.jar"/>
<exclude name="*-sources*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${config.dir}">
<!-- exclude war config files -->
<exclude name="**/war/**"/>
<exclude name="**/jboss/**"/>
</fileset>
</copy>
<copy todir="${dist.dir}/plugins">
<fileset dir="${plugins.dir}"/>
</copy>
<copy todir="${dist.dir}/webapps" file="webapps\red5-default.xml"/>
<copy todir="${dist.dir}">
<fileset dir="./">
<include name="${red5.filename}.jar"/>
<include name="boot.jar"/>
<include name="red5.bat"/>
<include name="red5-shutdown.bat"/>
<include name="red5.sh"/>
<include name="red5-shutdown.sh"/>
<include name="red5-debug.sh"/>
<include name="red5-debug.bat"/>
<include name="red5-highperf.sh"/>
<include name="red5-highperf.bat"/>
<include name="license.txt"/>
</fileset>
</copy>
<chmod file="${dist.dir}/red5.sh" perm="755"/>
<chmod file="${dist.dir}/red5-shutdown.sh" perm="755"/>
<chmod file="${dist.dir}/red5-debug.sh" perm="755"/>
<chmod file="${dist.dir}/red5-highperf.sh" perm="755"/>
</target>
<target name="dist-installer" description="Create installer distribution" depends="clean, ivyclear, dist, javadoc">
<copy todir="${dist.dir}/doc">
<fileset dir="doc"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir="./">
<include name=".classpath"/>
<include name=".project"/>
<include name=".springBeans"/>
<include name="build.xml"/>
<include name="build.properties"/>
<include name="Makefile"/>
<include name="red5-debug.bat"/>
<include name="red5-debug.sh"/>
</fileset>
</copy>
<chmod file="${dist.dir}/red5-debug.sh" perm="755"/>
<!-- include war config files -->
<copy todir="${dist.dir}/conf">
<fileset dir="${config.dir}">
<include name="**/war/**"/>
<include name="**/jboss/**"/>
</fileset>
</copy>
<!--
<copy todir="${dist.dir}/src">
<fileset dir="src"/>
</copy>
-->
<copy todir="${webapps.build.dir}">
<fileset dir="webapps">
<include name="**/src/**"/>
</fileset>
</copy>
<copy todir="${webapps.build.dir}/root/demos" failonerror="false">
<fileset dir="../../../flash/trunk/deploy"/>
</copy>
<!-- zip the source instead of copying verbatim -->
<zip destfile="${dist.dir}/src.zip" basedir="${src.dir}" level="9"/>
<!-- move to the expected directory for windows installer -->
<move todir="${dist.dir}.java6">
<fileset dir="${dist.dir}"/>
</move>
</target>
<target name="dist-archive" depends="dist-installer" description="Create archive file for distribution">
<touch>
<fileset dir="${dist.dir}"/>
</touch>
<!--
We use exec instead of tar here because Ant's tar
can't preserve file permissions.
-->
<!-- Create a directory with the right subname -->
<exec dir="." executable="rm" osfamily="unix">
<arg line="-rf ${red5.filename}-${archive.version}"/>
</exec>
<exec dir="." executable="cp" osfamily="unix">
<arg line="-rf ${dist.dir} ${red5.filename}-${archive.version}"/>
</exec>
<!-- tar that directory -->
<exec dir="." executable="tar" osfamily="unix">
<!-- p: perserve permissions
c: compress
z: gzip
v: list files processed
f: archive -->
<arg value="-pczvf"/>
<arg value="${red5.archive}"/>
<arg value="${red5.filename}-${archive.version}"/>
</exec>
<!-- and remove the tmp directory -->
<exec dir="." executable="rm" osfamily="unix">
<arg line="-rf ${red5.filename}-${archive.version}"/>
</exec>
<!-- Now we create a zip file for our windows friends;
file permissions won't be preserved and it'll unzip into
the directory it's in, but that's standard windows fare -->
<zip destfile="${red5.zip}" basedir="${dist.dir}" level="9">
<zipfileset prefix="${archive.version}/" dir="${dist.dir}">
<include name="${dist.dir}/**"/>
<exclude name="${dist.dir}/*.sh"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="${archive.version}/" filemode="755">
<include name="${dist.dir}/*.sh"/>
</zipfileset>
</zip>
</target>
<target name="dist-macosx" description="Create Mac OSX installer">
<ant antfile="install/macosx/build.xml" inheritAll="false"/>
</target>
<target name="dist-windows" description="Create Windows installer">
<ant antfile="install/windows/build.xml" inheritAll="false"/>
</target>
<target name="dist-debian" description="Create Debian package" depends="dist-installer">
<!-- 1. update "debian/changelog" and add an entry for the new version you are
building. Note that the syntax must match the previous entries!
2. Update the filename in "debian/files" to match the version you are
building.
3. Run this task from the Red5 root -->
<mkdir name="${dist.dir}/debian"/>
<!-- Copies debian files to dist -->
<copy todir="${dist.dir}/debian/">
<fileset dir="${basedir}/install/debian"/>
</copy>
<exec executable="dpkg-buildpackage" dir="${dist.dir}" failonerror="true">
<arg line="-uc -b -rfakeroot"/>
</exec>
</target>
<target name="dist-redhat" description="Create Redhat installer" depends="dist-installer">
<exec executable="rpm" failonerror="true">
<arg line="-ba install/redhat/red5.spec"/>
</exec>
</target>
<target name="server" depends="dist" description="Compile and start the server">
<echo message="Using ${dist.dir} for Red5 root"/>
<mkdir dir="${dist.dir}/${log.dir}"/>
<java classname="org.red5.server.Bootstrap" fork="true">
<classpath>
<pathelement location="${dist.dir}/conf"/>
<pathelement location="${dist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${dist.dir}/conf/red5.policy"/>
-->
<jvmarg value="-Dpython.home=${dist.dir}/lib"/>
<jvmarg value="-Dred5.root=${dist.dir}"/>
</java>
</target>
<target name="shutdown">
<java classname="org.red5.server.Shutdown" fork="true">
<classpath>
<pathelement location="${dist.dir}/conf"/>
<pathelement location="${dist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${dist.dir}/conf/red5.policy"/>
-->
<!-- enable the following 2 lines if your using JMX with SSL and auth -->
<!--
<jvmarg value="-Djavax.net.ssl.trustStore=${dist.dir}/conf/truststore.jmx"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=trustword"/>
-->
<jvmarg value="-Dred5.root=${dist.dir}"/>
<arg value="9999"/>
<arg value="red5user"/>
<arg value="changeme"/>
</java>
</target>
<target name="udp-server" depends="compile" description="Compile and start experimental UDP server">
<java classname="org.red5.server.net.udp.Standalone" fork="true">
<classpath>
<pathelement location="${config.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="full.classpath"/>
</classpath>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${config.dir}/red5.policy"/>
</java>
</target>
<target name="run-tests" depends="compile-tests" description="Run unit tests and generate HTML reports">
<!-- copy config contents to test conf dir -->
<mkdir dir="${testdist.dir}/../bin/conf"/>
<copy todir="${testdist.dir}/../bin/conf">
<fileset dir="${src.dir}/conf">
<include name="**/*.properties"/>
</fileset>
</copy>
<junit fork="true" haltonfailure="no" printsummary="yes" showoutput="no" failureproperty="test.failure.property"
dir="${testreports.dir}">
<classpath>
<pathelement location="${testclass.dir}"/>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
<pathelement location="${testdist.dir}/red5.jar"/>
<path refid="full.classpath"/>
</classpath>
<formatter type="xml"/>
<batchtest todir="${testreports.dir}">
<fileset dir="${testclass.dir}">
<include name="**/*Test.class"/>
<exclude name="**/Abstract*Test.class"/>
<exclude name="**/*AbstractTest.class"/>
</fileset>
</batchtest>
</junit>
<condition property="test.allPassed" else="yes" value=" !!!!!! NO !!!!!">
<isset property="test.failure.property"/>
</condition>
<mkdir dir="${testdoc.dir}"/>
<junitreport todir="${testdoc.dir}">
<fileset dir="${testreports.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${testdoc.dir}"/>
</junitreport>
<echo message="Did all tests pass: ${test.allPassed}"/>
</target>
<target name="run-tests-systemtest" depends="compile-tests" description="Runs some end-to-end system tests against a test server using a Flash client">
<!-- Copy over all self-run scripts -->
<!-- Note we use cp, and not <copy> to preserve permission
semantics. This means this target will NOT run directly
on Windows without Cygwin, which is fine because
all the shell scripts are .sh scripts. It is left
as an exercise for the reader to develop a .bat version
that can actually run processes in the background. -->
<!-- Finally, don't use fully qualified paths here; that
can screw up Cygwin -->
<exec executable="cp">
<arg line="-rf"/>
<arg line="${test.dir}/scripts"/>
<arg line="${testdist.dir}/"/>
</exec>
<exec executable="bash" dir="${testreports.dir}/fixtures" failonerror="true">
<arg line="${testdist.dir}/scripts/red5-flash-player-headless"/>
<arg line="red5-selftest.swf"/>
<env key="PATH" path="${env.PATH}:${testdist.dir}/scripts"/>
<env key="RED5_HOME" path="${testdist.dir}"/>
</exec>
</target>
<target name="run-tests-server" depends="compile-tests" description="Run the selftest server">
<echo message="Using ${testdist.dir} for Red5 root"/>
<mkdir dir="${testdist.dir}/${log.dir}"/>
<java classname="org.red5.server.Bootstrap" fork="true" dir="${testdist.dir}">
<classpath>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${testdist.dir}/conf/red5.policy"/>
-->
<jvmarg value="-Dpython.home=${testdist.dir}/lib"/>
<jvmarg value="-Dred5.root=${testdist.dir}"/>
</java>
</target>
<target name="compile-tests" depends="dist" description="Compiles unit test classes">
<property name="testdist.dir" location="${testreports.dir}/dist"/>
<echo>Making dist for testing</echo>
<mkdir dir="${testdist.dir}"/>
<mkdir dir="${testreports.dir}/fixtures"/>
<mkdir dir="${testreports.dir}/log"/>
<!-- Give the tests their own dist installation to work with -->
<antcall target="dist" inheritAll="false" inheritRefs="false">
<param name="dist.dir" value="${testdist.dir}"/>
</antcall>
<!-- Copy all test config files into the dist/conf of the
test distribution. The JUnit task below will add this
directory to the classpath -->
<copy todir="${testdist.dir}/conf" overwrite="true">
<fileset dir="${test.dir}" includes="**/*.xml" excludes="www/**/*"/>
<fileset dir="${test.dir}" includes="**/*.properties" excludes="www/**/*"/>
</copy>
<!-- Install the self-test application that tests depend on -->
<copy todir="${testdist.dir}/webapps/selftest" overwrite="true">
<fileset dir="${test.dir}/www/" includes="**/*"/>
</copy>
<copy todir="${testreports.dir}/fixtures" overwrite="true">
<fileset dir="${test.dir}/fixtures" includes="**/*"/>
</copy>
<echo>Libraries checked: ${library.installed}</echo>
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="utest"/>
</antcall>
<available property="junit.installed" classname="junit.framework.TestCase"/>
<mkdir dir="${testclass.dir}"/>
<javac srcdir="${test.dir}" destdir="${testclass.dir}" optimize="${build.optimize}" verbose="${build.verbose}"
fork="${build.fork}" nowarn="${build.nowarn}" deprecation="${build.deprecation}"
debug="${debug.state}" compiler="${build.compiler}">
<classpath>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
<pathelement location="${testdist.dir}/red5.jar"/>
<path refid="full.classpath"/>
</classpath>
</javac>
<mkdir dir="${testdist.dir}/webapps/selftest/WEB-INF/classes"/>
<copy todir="${testdist.dir}/webapps/selftest/WEB-INF/classes" overwrite="true">
<fileset dir="${testclass.dir}" includes="**/*.class"/>
</copy>
</target>
<target name="webwar" description="Make Web Archive" depends="compile-war">
<!-- token replacement filers -->
<filter filtersfile="${config.dir}/war/build_war.properties"/>
<copy todir="${classes.dir}">
<fileset dir=".">
<include name="license.txt"/>
</fileset>
</copy>
<!-- remove directories we dont want -->
<delete dir="${classes.dir}/testcases"/>
<!-- cleanup "standalone" red5-web files -->
<delete>
<fileset dir="${webapps.build.dir}" includes="**/red5-web.*"/>
</delete>
<!-- add the configs to the root war -->
<filter token="display.name" value=""/>
<filter token="webapp.root.key" value="/"/>
<filter token="context.path" value="/"/>
<copy tofile="${webapps.build.dir}/root/META-INF/context.xml" overwrite="true" filtering="true"
file="${config.dir}/war/root-context.xml"/>
<copy todir="${webapps.build.dir}/root/WEB-INF" overwrite="true" filtering="true">
<fileset dir="${config.dir}/war">
<include name="web.xml"/>
</fileset>
</copy>
<copy todir="${webapps.build.dir}/root/WEB-INF/classes" overwrite="true" filtering="true">
<fileset dir="${config.dir}">
<include name="*.jmx"/>
<include name="access.properties"/>
<include name="password.properties"/>
</fileset>
<fileset dir="${config.dir}/war">
<include name="logback.xml"/>
<include name="beanRefContext.xml"/>
<include name="defaultContext.xml"/>
<include name="red5-common.xml"/>
<include name="red5-core.xml"/>
<include name="*-web.xml"/>
</fileset>
</copy>
<!-- copy installer swf etc under root/installer -->
<mkdir dir="${webapps.build.dir}/root/installer"/>
<copy todir="${webapps.build.dir}/root/installer">
<fileset dir="${webapps.build.dir}/installer"/>
</copy>
<delete dir="${webapps.build.dir}/root/installer/WEB-INF"/>
<!-- war up root -->
<war destfile="${dist.dir}/ROOT.war" webxml="${webapps.build.dir}/root/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/root"/>
<fileset dir="${classes.dir}">
<exclude name="**/logback.xml"/>
</fileset>
<lib dir="${lib.dir}">
<exclude name="*.properties"/>
<exclude name="jsp*.jar"/>
<exclude name="servlet*.jar"/>
<exclude name="catalina*.jar"/>
<exclude name="tomcat*.jar"/>
<exclude name="annotations-api*.jar"/>
<exclude name="el-api*.jar"/>
<exclude name="jetty*.jar"/>
<exclude name="jasper*.jar"/>
<exclude name="whirly*.jar"/>
<exclude name="*robo*.jar"/>
<exclude name="junit*.jar"/>
<exclude name="ivy*.jar"/>
<exclude name="javaee*.jar"/>
<exclude name="*-sources-*.jar"/>
<exclude name="com.springsource.slf4j.juli*.jar"/>
<exclude name="com.springsource.slf4j.log4j*.jar"/>
<exclude name="com.springsource.slf4j.org.apache*.jar"/>
</lib>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
<!-- cleanup -->
<delete dir="${dist.dir}/webapps"/>
</target>
<target name="remote-jar" description="Creates a jar that may be deployed with remote applications"
depends="compile">
<mkdir dir="${classes.dir}/conf"/>
<copy todir="${classes.dir}/conf">
<fileset dir="${config.dir}">
<exclude name="**/war/**"/>
<exclude name="**/jboss/**"/>
</fileset>
</copy>
<jar destfile="${dist.dir}/red5-remoting.jar">
<fileset dir="${classes.dir}">
<include name="**/AMFTunnelServlet.class"/>
<include name="**/ServletUtils.class"/>
<include name="**/red5/compatibility/**"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</jar>
</target>
<target name="rtmps-keystore" description="RTMPS Keystore Generator">
<input message="Keystore Pass" addproperty="keystore.storepass" defaultvalue="password"/>
<input message="Certificate Validity" addproperty="keystore.validity" defaultvalue="365"/>
<input message="Common Name" addproperty="keystore.dname.cn" defaultvalue="localhost"/>
<input message="Organisation Unit" addproperty="keystore.dname.ou" defaultvalue="${red5.name}"/>
<input message="Organisation" addproperty="keystore.dname.o" defaultvalue="${red5.name}"/>
<input message="Location" addproperty="keystore.dname.l" defaultvalue="Henderson"/>
<input message="State" addproperty="keystore.dname.st" defaultvalue="NV"/>
<input message="Country" addproperty="keystore.dname.c" defaultvalue="US"/>
<delete file="${config.dir}/keystore"/>
<genkey alias="red5" keysize="512" keyalg="RSA" storepass="${keystore.storepass}" keypass="${keystore.storepass}"
keystore="${config.dir}/keystore" validity="${keystore.validity}">
<dname>
<param name="CN" value="${keystore.dname.cn}"/>
<param name="OU" value="${keystore.dname.ou}"/>
<param name="O" value="${keystore.dname.o}"/>
<param name="L" value="${keystore.dname.l}"/>
<param name="ST" value="${keystore.dname.st}"/>
<param name="C" value="${keystore.dname.c}"/>
</dname>
</genkey>
</target>
<target name="truststore" depends="rtmps-keystore" description="JConsole Client Truststore">
<copy file="${config.dir}/keystore" tofile="${config.dir}/keystore.jmx" overwrite="true"/>
<copy file="${config.dir}/keystore.jmx" tofile="${config.dir}/truststore.jmx" overwrite="true"/>
<echo>Verifying Keystore ${keystore.storepass}</echo>
<exec dir="." executable="keytool">
<arg line="-list -v -keystore ${config.dir}/keystore.jmx -storepass ${keystore.storepass}"/>
</exec>
<echo>Export Server Certificate</echo>
<exec dir="." executable="keytool">
<arg line="-export -alias red5 -keystore ${config.dir}/keystore.jmx -file ${config.dir}/red5server.cer -storepass ${keystore.storepass}"/>
</exec>
<echo>Import Server Certificate into TrustStore</echo>
<exec dir="." executable="keytool">
<arg line="-import -file conf/red5server.cer -keystore ${config.dir}/truststore.jmx -storepass ${keystore.storepass} -noprompt"/>
</exec>
<echo>Verifying Truststore</echo>
<exec dir="." executable="keytool">
<arg line="-list -v -keystore ${config.dir}/truststore.jmx -storepass ${keystore.storepass}"/>
</exec>
</target>
<!-- JConsole -->
<target name="console">
<exec dir="." executable="jconsole">
<arg line="-J-Djava.util.logging.config.file=${config.dir}/management.logging.properties -J-Djava.security.manager -J-Djava.security.policy=${config.dir}/red5.policy -J-Djavax.net.ssl.trustStore=${config.dir}/truststore.jmx -J-Djavax.net.ssl.trustStorePassword=password -J-Dssl.debug=true -J-Djava.security.debug=ssl service:jmx:rmi:///jndi/rmi://localhost:9999/red5"/>
</exec>
</target>
<!-- JConsole with SSL -->
<target name="console-ssl">
<exec dir="." executable="jconsole">
<arg line="-J-Djava.util.logging.config.file=${config.dir}/management.logging.properties -J-Djava.security.manager -J-Djava.security.policy=${config.dir}/red5.policy -J-Djavax.net.ssl.trustStore=${config.dir}/truststore.jmx -J-Djavax.net.ssl.trustStorePassword=password -J-Djavax.net.ssl.keyStore=${config.dir}/keystore.jmx -J-Djavax.net.ssl.keyStorePassword=password -J-Dssl.debug=true -J-Djava.security.debug=ssl service:jmx:rmi:///jndi/rmi://localhost:9999/red5"/>
</exec>
</target>
<!--
Requirements:
1. Go here: http://subclipse.tigris.org/svnant.html
2. Download SvnAnt
ex: http://subclipse.tigris.org/files/documents/906/43359/svnant-1.2.1.zip
3. Unzip the archive and place the jar files in your Ant lib directory
ex: C:\dev\ant\lib
-->
<!-- checks out the source tree -->
<target name="checkout">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<svn>
<checkout url="${svn.url}java/server/trunk/" revision="HEAD" destPath="."/>
</svn>
</target>
<!-- checks out the source tree from the top-most level -->
<target name="checkout-all">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<svn>
<!-- we are three levels down -->
<checkout url="${svn.url}" revision="HEAD" destPath="../../../"/>
</svn>
</target>
<!-- Updates snapshot repository -->
<target name="upload-snapshot" depends="jar">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<condition property="java.version.name" value="java5" else="java6">
<not>
<isset property="java6.installed"/>
</not>
</condition>
<svn username="${svn.login}" password="${svn.password}" failonerror="true">
<update dir="${basedir}"/>
<status path="build.xml" textStatusProperty="svn.info.status" lastChangedRevisionProperty="svn.info.lastrev"
revisionProperty="svn.info.rev"/>
</svn>
<echo message="Svn info - status: ${svn.info.status} last rev: ${svn.info.lastrev} rev: ${svn.info.rev}"/>
<property name="snapshot.name" value="red5-${red5.version}-r${svn.info.rev}-${java.version.name}.jar"/>
<property name="snapshot.path" value="../../../snapshots/"/>
<echo message="Destination: ${snapshot.path}${snapshot.name}"/>
<!-- make a copy of the red5.jar with a versioned name + the java version -->
<move file="red5.jar" tofile="${snapshot.path}${snapshot.name}"/>
<!-- check if the file is already versioned -->
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<status path="${svn.url}/snapshots/${snapshot.name}" textStatusProperty="svn.info.status"/>
</svn>
<echo message="Svn info - status: ${svn.info.status}"/>
<condition property="add-file" value="true" else="false">
<equals arg1="${svn.info.status}" arg2="unversioned"/>
</condition>
<echo message="File does not exist in repository: ${add-file}"/>
<antcall target="svn-add" inheritAll="true" inheritRefs="true">
<param name="file.path" value="${snapshot.path}${snapshot.name}"/>
</antcall>
<!--
may need to add options depending upon svn client install
javahl="true|false" svnkit="true|false"
-->
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<commit message="Added snapshot" file="${snapshot.path}${snapshot.name}"/>
</svn>
</target>
<target name="svn-add" if="add-file">
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<add file="${file.path}" force="true"/>
</svn>
</target>
<target name="all" depends="clean, prepare, compile, jar, javadoc" description="Run all server tasks"/>
<target name="usage">
<echo message="Type ant -p for available targets"/>
</target>
</project>