-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
167 lines (144 loc) · 6.73 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" ?>
<project name="matterhorn-engage-streaming" basedir="." default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- project properties -->
<property environment="env"/>
<!-- user overides for project properties -->
<property file="${user.home}/build.properties"/>
<!-- base project properties -->
<property file="build.properties"/>
<property name="java.home" value="${env.JDK_HOME}"/>
<property name="src.dir" value="src"/>
<property name="lib.dir" value="www/WEB-INF/lib"/>
<property name="classes.dir" value="www/WEB-INF/classes"/>
<property name="dist.dir" value="dist"/>
<path id="project.classpath">
<fileset dir="${red5.root}/lib"/>
<pathelement location="${red5.root}/red5.jar"/>
<pathelement location="${red5.root}/lib/red5.jar"/>
<!-- project specific libs -->
<fileset dir="${lib.dir}"/>
</path>
<target name="prepare">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="clean">
<delete dir="${classes.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="retrieve" description="Retrieves the libraries if needed">
<taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml"
classpath="${basedir}/lib/ivy-trunk.jar"/>
<property name="ivy.lib.dir" value="${basedir}/lib"/>
<ivy:settings file="ivysettings.xml"/>
<ivy:resolve file="ivy.xml" />
<ivy:retrieve />
</target>
<target name="compile" depends="prepare, retrieve">
<condition property="java.target_version" value="1.5">
<not>
<isset property="java.target_version"/>
</not>
</condition>
<echo>java.home is ${java.home} and the target version is ${java.target_version}</echo>
<echo>red5.root is ${red5.root}</echo>
<echo>javac version: ${java.version}</echo>
<property name="dest.dir" value="${classes.dir}"/>
<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="modern"
source="${java.target_version}" target="${java.target_version}" listfiles="false"/>
<copy file="${src.dir}/logback-${ant.project.name}.xml" todir="${dest.dir}" />
<copy file="${src.dir}/*.properties" todir="${dest.dir}" failonerror="false" />
</target>
<target name="jar" depends="compile">
<tstamp prefix="build">
<format property="TODAY" pattern="d-MMMM-yyyy" locale="en"/>
</tstamp>
<jar destfile="${dist.dir}/${ant.project.name}.jar">
<fileset dir="${classes.dir}">
<include name="**"/>
</fileset>
<manifest>
<attribute name="Built" value="${build.TODAY} by ${user.name}"/>
<attribute name="Build-OS" value="${os.name} ${os.version}"/>
<attribute name="Build-Java" value="Java ${java.version}"/>
</manifest>
</jar>
</target>
<target name="war" depends="compile">
<tstamp prefix="build">
<format property="TODAY" pattern="d-MMMM-yyyy" locale="en"/>
</tstamp>
<war destfile="${dist.dir}/${ant.project.name}.war" webxml="www/WEB-INF/web.xml">
<fileset dir="www">
<exclude name="**/src/**"/>
<exclude name="**/*.jar"/>
</fileset>
<lib dir="${lib.dir}"/>
<manifest>
<attribute name="Built" value="${build.TODAY} by ${user.name}"/>
<attribute name="Build-OS" value="${os.name} ${os.version}"/>
<attribute name="Build-Java" value="Java ${java.version}"/>
</manifest>
</war>
</target>
<!-- checks out the source tree -->
<target name="checkout">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<svn username="${svn.login}" password="${svn.password}">
<checkout url="${svn.url}java/example/trunk/oflaDemo" revision="HEAD" destPath="."/>
<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}"/>
</target>
<!-- Updates snapshot repository -->
<target name="upload-snapshot" depends="war">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar" />
<condition property="java.version.name" value="java5" else="java6">
<not>
<available classname="javax.script.Bindings"/>
</not>
</condition>
<svn username="${svn.login}" password="${svn.password}">
<update dir="${basedir}"/>
<checkout url="${svn.url}snapshots" revision="HEAD" destPath="${snapshot.path}"/>
<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="${ant.project.name}-r${svn.info.rev}-${java.version.name}.war"/>
<echo message="Destination: ${snapshot.path}${snapshot.name}"/>
<!-- make a copy of the red5.jar with a versioned name + the java version -->
<move file="dist/${ant.project.name}.war" 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>
<svn username="${svn.login}" password="${svn.password}">
<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}">
<!--
<update dir="${snapshot.path}"/>
-->
<add file="${file.path}" force="true"/>
</svn>
</target>
<target name="all" depends="clean, prepare, compile, jar, war"/>
<target name="usage">
<echo>Type ant -p for available targets"</echo>
</target>
</project>