summaryrefslogtreecommitdiff
path: root/qpid/java/broker-web/build.xml
blob: fb747f50e3dc267c5d769f887a9026f32956fc0d (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
<!--
 - 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.
 -->
<project name="broker-web" xmlns:ivy="antlib:org.apache.ivy.ant" default="build">

    <condition property="bdbstore" value="bdbstore" else="">
        <contains string="${modules.opt}" substring="bdbstore"/>
    </condition>

    <import file="../common.xml"/>
    <findSubProjects name="broker-plugins" dir="../broker-plugins"/>
    <property name="module.depends" value="common management/common amqp-1-0-common broker ${bdbstore} ${broker-plugins}" />
    <property name="module.test.depends" value="test client common/test broker/test management/common systests" />
    <property name="module.genpom" value="true"/>

    <import file="../module.xml"/>

    <scriptdef name="string-replace" language="javascript">
         <attribute name="string" />
         <attribute name="token" />
         <attribute name="value" />
         <attribute name="property" />
         <![CDATA[
           var string = attributes.get("string");
           var token = attributes.get("token");
           var value = attributes.get("value");
           project.setProperty(attributes.get("property"), string.replace(token, value));
         ]]>
      </scriptdef>

    <!-- war is built as part of build task and stored in module release folder -->
    <target name="postbuild" description="Create war" >

        <property name="war.dir" value="../build/war"/>
        <mkdir dir="${war.dir}/WEB-INF/lib"/>

        <!-- copy third-party dependencies into WEB-INF/lib -->
        <copy todir="${war.dir}/WEB-INF/lib" flatten="true">
            <fileset dir="${project.root}" includes="${module.depends.libs}"
                excludes="**/jetty-* **/*servlet*"/>
        </copy>

        <!-- copy qpid dependencies into WEB-INF/lib -->
        <foreach property="dependency" list="${module.depends}">
            <string-replace string="qpid-${dependency}" token="/" value="-" property="dependency.path"/>
            <copy todir="${war.dir}/WEB-INF/lib">
              <fileset dir="${project.root}/build/lib" includes="**/${dependency.path}*.jar"
                  excludes="*-tests-*.jar *-sources.jar *.osgi.jar"/>
            </copy>
        </foreach>

        <!-- copy management jar into WEB-INF/lib in order to use servlets from it-->
        <copy todir="${war.dir}/WEB-INF/lib">
          <fileset dir="${project.root}/build/lib/plugins" includes="qpid-broker-plugins-management*.jar"/>
        </copy>

        <mkdir dir="${war.dir}/WEB-INF/etc"/>
        <mkdir dir="${war.dir}/WEB-INF/work/log"/>

        <!-- copy default broker configuration into /WEB-INF/etc-->
        <copy todir="${war.dir}/WEB-INF/etc">
            <fileset dir="${project.root}/broker/etc" excludes="config.xml virtualhosts.xml"/>
        </copy>

        <copy todir="${war.dir}/WEB-INF/etc">
            <fileset dir="src/main/resources/WEB-INF/etc/"/>
        </copy>

        <!-- copy management.html into index.html -->
        <copy tofile="${war.dir}/index.html"
            file="../broker-plugins/management/src/main/java/resources/management.html"/>

        <!-- extract dojo -->
        <unwar src="${project.root}/${dojo}" dest="${war.dir}/dojo">
          <patternset>
              <exclude name="META-INF/**"/>
              <exclude name="WEB-INF/**"/>
              <exclude name="**/*.uncompressed.js"/>
          </patternset>
        </unwar>

        <!-- build war -->
        <war destfile="release/qpid.war" webxml="src/main/resources/WEB-INF/web.xml">
          <lib file="${module.jar}"/>
          <fileset dir="../broker-plugins/management/src/main/java/resources"/>
          <fileset dir="${war.dir}"/>
        </war>

        <copy file="release/qpid.war" tofile="release/qpid-${project.version}.war"/>
    </target>

</project>