summaryrefslogtreecommitdiff
path: root/broker/build-old.xml
blob: 52a30f53ae0b9a429c2a183e07c1e042696b4871 (plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?xml version="1.0"?>
<!--
 -
 - Licensed to the Apache Software Foundation (ASF) under one
 - or more contributor license agreements.  See the NOTICE file
 - distributed with this work for additional information
 - regarding copyright ownership.  The ASF licenses this file
 - to you under the Apache License, Version 2.0 (the
 - "License"); you may not use this file except in compliance
 - with the License.  You may obtain a copy of the License at
 - 
 -   http://www.apache.org/licenses/LICENSE-2.0
 - 
 - Unless required by applicable law or agreed to in writing,
 - software distributed under the License is distributed on an
 - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - KIND, either express or implied.  See the License for the
 - specific language governing permissions and limitations
 - under the License.
 -
 -->

<!-- AMQPd build file -->

<project name="qpid-broker" default="jar" basedir=".">

    <!-- Global task properties -->
    <property name="common.root" value="${basedir}/../common"/>
    <property name="common.lib" value="${common.root}/lib"/>
    <property name="common.src" value="${common.root}/src"/>
    <property name="common.resources" value="${common.root}/resources"/>

    <property name="common.generated.java.src" value="${common.root}/generated/java"/>

    <property name="client.classes" value="${basedir}/../client/classes"/>
    <property name="client.testclasses" value="${basedir}/../client/testclasses"/>

    <property name="broker.root" value="${basedir}"/>
    <property name="broker.lib" value="${basedir}/lib"/>
    <property name="broker.src" value="${broker.root}/src"/>
    <property name="broker.tests" value="${broker.root}/test"/>
    <property name="broker.classes" value="${broker.root}/classes"/>
    <property name="broker.testclasses" value="${broker.root}/testclasses"/>

    <property name="broker.dist" value="${basedir}/dist"/>
    <property name="dam.dist" value="${basedir}/damPackage"/>

    <!-- Path structures used by several tasks -->
    <path id="amqp.classpath">
        <fileset dir="${broker.lib}">
            <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${common.lib}">
            <include name="**/*.jar"/>
        </fileset>
        <pathelement path="${client.classes}"/>
        <pathelement path="${client.testclasses}"/>
        <pathelement path="${broker.classes}"/>
        <pathelement path="${broker.testclasses}"/>
    </path>

    <!-- Task definitions -->

    <target name="init" description="Initialise the build process">
        <tstamp>
            <format property="release" pattern="-dMMMyy" locale="en" timezone="GMT"/>
        </tstamp>

        <mkdir dir="${broker.classes}"/>
        <mkdir dir="${broker.testclasses}"/>
        <mkdir dir="${broker.dist}"/>
    </target>

    <!-- Remove all built files -->
    <target name="clean" depends="init" description="Remove all built and generated files">
        <delete dir="${broker.dist}"/>
        <!--<delete dir="${generated.java.src}"/>-->
        <delete dir="${broker.classes}"/>
        <delete dir="${broker.testclasses}"/>
    </target>

    <!-- Generate framing source code from protocol specification -->
    <target name="generate" description="Generates framing source code from protocol specification">
         <ant dir="../common" target="generate"/>
    </target>

    <!-- Compile Java -->
    <target name="compile" depends="init, generate" description="Compile all source files excluding tests">
        <javac destdir="${broker.classes}" target="1.5" source="1.5" classpathref="amqp.classpath" debug="on">
            <compilerarg value="-Xlint:unchecked" />
            <compilerarg value="-Xlint:deprecation" />
            <src path="${common.src}"/>
            <src path="${broker.src}"/>
            <src path="${common.generated.java.src}"/>
        </javac>

        <copy todir="${broker.classes}">
            <!-- copy any non java src files into the build tree, e.g. log4j.properties -->
            <fileset dir="${broker.src}">
                <exclude name="**/*.java"/>
                <exclude name="**/package.html"/>
            </fileset>
            <fileset dir="${common.src}">
                <exclude name="**/*.java"/>
                <exclude name="**/package.html"/>
            </fileset>
            <fileset dir="${common.resources}">
                <exclude name="**/*.java"/>
                <exclude name="**/package.html"/>
            </fileset>
        </copy>
    </target>

    <target name="compiletests" depends="compile" description="Compile all tests">
        <javac destdir="${broker.testclasses}" target="1.5" source="1.5" classpathref="amqp.classpath" debug="on">
            <compilerarg value="-Xlint:unchecked"/>
            <compilerarg value="-Xlint:deprecation"/>
            <src path="${broker.tests}"/>
        </javac>

        <copy todir="${broker.testclasses}">
            <!-- copy any non java src files into the build tree, e.g. log4j.properties -->
            <fileset dir="${broker.tests}">
                <exclude name="**/*.java"/>
                <exclude name="**/package.html"/>
            </fileset>
        </copy>
    </target>

    <target name="test" depends="compiletests">
        <junit fork="yes" showoutput="true" haltonfailure="yes">
            <test name="org.apache.qpid.server.UnitTests"/>
            <formatter type="plain"/>
            <classpath refid="amqp.classpath"/>
        </junit>
    </target>

    <!-- Build jar archive -->
    <target name="jar" depends="compile, compiletests" description="Create Jar files as the distribution">
        <mkdir dir="${broker.dist}"/>
        <jar basedir="${broker.classes}" jarfile="${broker.dist}/amqpd.jar"/>
        <jar basedir="${broker.testclasses}" jarfile="${broker.dist}/amqpd-tests.jar"/>
    </target>

    <target name="release" depends="jar" description="Create a release package">
        <!-- create a jar file that will contain classpath entries for all required jars -->
        <jar jarfile="${broker.dist}/broker-launch.jar">
            <manifest>
                <attribute name="Main-Class" value="org.apache.qpid.server.Main"/>
                <attribute name="Class-Path" value="lib/je-3.0.35.jar lib/slf4j-simple.jar lib/log4j-1.2.13.jar lib/mina-core-0.9.5-SNAPSHOT.jar lib/mina-filter-ssl-0.9.5-SNAPSHOT.jar lib/commons-cli-1.0.jar lib/commons-configuration-1.2.jar lib/commons-collections-3.1.jar lib/commons-logging-api.jar lib/commons-logging.jar lib/commons-lang-2.1.jar lib/amqpd.jar lib/amqp-common.jar"/>
            </manifest>
        </jar>
        <!-- create a zip for releasing -->
        <zip destfile="${broker.dist}/broker.zip">
            <fileset dir="bin" includes="*.sh,*.bat"/>
            <fileset file="${broker.dist}/broker-launch.jar" />
            <zipfileset prefix="etc" dir="etc" includes="*"/>
            <zipfileset prefix="lib" file="${broker.lib}/bdb/je-3.0.35.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/slf4j/slf4j-simple.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/logging-log4j/log4j-1.2.13.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/mina/mina-core-0.9.5-SNAPSHOT.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-cli/commons-cli-1.0.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-configuration/commons-configuration-1.2.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-collections/commons-collections-3.1.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging-api.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging.jar"/>
            <zipfileset prefix="lib" file="${common.lib}/commons-lang/commons-lang-2.1.jar"/>
            <zipfileset prefix="lib" file="${broker.dist}/amqpd.jar"/>
            <zipfileset prefix="lib" file="${broker.dist}/amqp-common.jar"/>
        </zip>

        <tar destfile="${broker.dist}/broker.tar.gz" compression="gzip">
            <tarfileset dir="bin" includes="*.sh,*.bat"/>
            <tarfileset file="${broker.dist}/broker-launch.jar" />
            <tarfileset prefix="etc" dir="etc" includes="*"/>
            <tarfileset prefix="lib" file="${broker.lib}/bdb/je-3.0.35.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/slf4j/slf4j-simple.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/logging-log4j/log4j-1.2.13.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/mina/mina-core-0.9.5-SNAPSHOT.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-cli/commons-cli-1.0.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-configuration/commons-configuration-1.2.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-collections/commons-collections-3.1.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging-api.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging.jar"/>
            <tarfileset prefix="lib" file="${common.lib}/commons-lang/commons-lang-2.1.jar"/>
            <tarfileset prefix="lib" file="${broker.dist}/amqpd.jar"/>
            <tarfileset prefix="lib" file="${broker.dist}/amqp-common.jar"/>
        </tar>
    </target>

    <!-- @TODO finish this target MM !! -->
    <target name="damit">

		<property name="tarFileName" value="ams_amq.tar"/>
		<delete failonerror="false" file="${tarFileName}"/>
		<delete includeEmptyDirs="true" failonerror="false">
			<fileset dir="${dam.dist}"/>
		</delete>
		<mkdir dir="${dam.dist}"/>
		<copy todir="${dam.dist}">
			<fileset dir="${basedir}/damPackage">
				<exclude name="config/gps_domain/applications/gps.ear"/>
			</fileset>
		</copy>
		<!-- Remove CR and EOF characters from shell scripts within the DAM package -->
		<fixcrlf srcdir="${dam.dist}" eol="lf" eof="remove">
			<include name="**/*.sh"/>
			<include name="**/*.startup"/>
		</fixcrlf>

        <tar tarfile="${tarFileName}">
			<!-- add everything _except_ shell scripts: rw_r__r__ -->
			<tarfileset dir="${dam.dist}" mode="644">
				<exclude name="**/*.sh"/>
				<exclude name="**/*.startup"/>
			</tarfileset>
			<!-- add all shell scripts as executable: rwxr_xr_x -->
			<tarfileset dir="${dam.dist}" mode="755">
				<include name="**/*.sh"/>
				<include name="**/*.startup"/>
			</tarfileset>
		</tar>

	</target>

    <target name="javadoc" depends="compile, compiletests" description="Generate javadoc for all broker classes">
        <mkdir dir="${broker.dist}/docs/api"/>
        <javadoc sourcepath="${broker.src}" destdir="${broker.dist}/docs/api"
                 packagenames="org.apache.qpid.*" classpathref="amqp.classpath" author="true"
                 version="true" windowTitle="AMQPd (Project Qpid) API" doctitle="AMQP Broker API"
                 footer="See &lt;a href=&quot;http://www.amqp.org&quot;&gt;www.amqp.org&lt;/a&gt; for more information."
                 use="true" verbose="false"/>
    </target>

    <target name="RunBroker" depends="compile" description="Run broker">
        <java classpathref="amqp.classpath" fork="yes" classname="org.apache.qpid.server.Main">
            <sysproperty key="amqj.logging.level" value="INFO"/>
            <jvmarg value="-server"/>
        </java>
    </target>

    <target name="profile" depends="compile" description="Run broker in Netbeans profiler">
        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
        <nbprofiledirect>
          <classpath refid="amqp.classpath"/>
        </nbprofiledirect>

        <java classpathref="amqp.classpath" fork="yes" classname="org.apache.qpid.server.Main"
              dir="${profiler.session.working.dir}"
              jvm="${profiler.info.jvm}">
            <sysproperty key="amqj.logging.level" value="INFO"/>
            <jvmarg value="${profiler.info.jvmargs.agent}"/>
            <jvmarg line="${profiler.info.jvmargs}"/>
            <jvmarg value="-server"/>
            <jvmarg value="-Xmx512m"/>
            <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
        </java>
    </target>

    <target name="profile-single" depends="compile" description="Profile File">
        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
        <nbprofile classname="${profile.class}">
            <classpath refid="amqp.classpath"/>
        </nbprofile>
    </target>
</project>