summaryrefslogtreecommitdiff
path: root/src/installer/resources/build.xml
blob: 32bfbd7e8255999280b3cfba13bdea4b32cd0eb5 (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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Shibboleth Discovery Service" basedir="../../.." default="install">

    <property name="installer.dir" value="${basedir}/src/installer"/>
    <property name="resources.dir" value="${installer.dir}/resources"/>
    <property name="webapp.dir" value="${basedir}/src/main/webapp"/>
    <property name="war.name" value="discovery"/>
        
    <!-- Installation specific property file -->
    <property file="${resources.dir}/install.properties"/>
    
    <!-- Load ant-contrib tasks -->
    <taskdef resource="net/sf/antcontrib/antlib.xml"/>
    
    <!-- Load Internet2 ant extensions -->
    <taskdef resource="edu/internet2/middleware/ant/antlib.xml"/>

    <!-- install - for deployment -->
    <target name="install" description="Creates the discovery service home directory, install configuration files, and create the service's WAR.">

        <input message="Where should the Shibboleth Discovery Service software be installed?" addproperty="ds.home.input" defaultvalue="${ds.home}"/>
        <var name="ds.home" value="${ds.home.input}"/>
            
        <pathToAbsolutePath path="${ds.home}" addproperty="ds.home.path"/>
        <pathToUrl path="${ds.home}" addproperty="ds.home.url"/>
        
        <if>
            <available file="${ds.home.path}" property="ds.home.exists"/>
            <then>
                <input message="The directory '${ds.home.path}' already exists.  Would you like to overwrite your existing configuration?" addproperty="install.config" validargs="yes,no" defaultvalue="no"/>
            </then>
            <else>
                <var name="install.config" value="yes"/>
            </else>
        </if>

        <if>
            <equals arg1="${install.config}" arg2="yes"/>
            <then>
                <propertyfile file="${resources.dir}/install.properties">
                    <entry key="ds.home" value="${ds.home}"/>
                </propertyfile>

                <mkdir dir="${ds.home}"/>
                <mkdir dir="${ds.home}/conf"/>
                <mkdir dir="${ds.home}/logs"/>
                <mkdir dir="${ds.home}/metadata"/>
                <mkdir dir="${ds.home}/war"/>

                <copy todir="${ds.home}/conf" preservelastmodified="true" overwrite="true">
                    <fileset dir="${resources.dir}" includes="wayfconfig.xml,logging.xml"/>
                    <filterset begintoken="$" endtoken="$">
                        <filter token="DS_HOME" value="${ds.home}"/>
                    </filterset>
                </copy>
            </then>
        </if>

        <!-- create - always - the web.xml -->
        <copy file="${webapp.dir}/WEB-INF/web.xml" todir="${installer.dir}" preservelastmodified="true" overwrite="true">
            <filterset begintoken="$" endtoken="$">
                <filter token="DS_HOME" value="${ds.home}"/>
            </filterset>
        </copy>

        <!-- build the war file -->
        <war warfile="${ds.home}/war/${war.name}.war" webxml="${installer.dir}/web.xml">
            <lib dir="${basedir}/lib"/>
            <webinf dir="${webapp.dir}/WEB-INF" excludes="web.xml"/>
            <fileset dir="${webapp.dir}" excludes="WEB-INF/**"/>
        </war>
        
        <!-- Remove generated web.xml -->
        <delete file="${installer.dir}/web.xml"/>
                
    </target>

</project>