Subversion Repositories DevTools

Rev

Rev 1974 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1974 jgill 1
<project name="load-using-macrodef"
2
         xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
1972 jgill 3
 
4
	<!--	C O P Y R I G H T   N O T I C E
5
			This material is confidential to ERG and may not be disclosed in whole
6
			or in part to any third party nor used in any manner whatsoever other
7
			than for the purposes expressly consented to by ERG in writing.
8
 
9
			This material is also copyright and may not be reproduced, stored in a
10
			retrieval system or transmitted in any form or by any means in whole or
11
			in part without the express written consent of ERG.
12
	-->
13
 
14
 
15
	<!-- 
16
	  - REPLACE_ANT_USING will get replaced with the release version of ant-using on release. 
17
	  -->
18
	<property name="ant-using-version" value="REPLACE_ANT_USING"/>
19
 
20
 
21
	<fail message="An existing ANT using macro has been declared with a different version" status="2">
22
		<condition>
23
			<and>
24
				<isset	property="using.ant-using.version"/>
25
				<not><equals arg1="${using.ant-using.version}" arg2="${ant-using-version}"/></not>
26
			</and>
27
		</condition>
28
	</fail>
29
 
30
	<property name="using.ant-using.version" value="${ant-using-version}"/>
31
 
32
	<fail message="The mandatory environment variable GBE_DPKG is missing" status="1">
33
		<condition>
34
			<and>
35
				<not><isset property="env.GBE_DPKG"/></not>
36
			</and>
37
		</condition>
38
	</fail>
39
 
40
	<dirname property="dirname.load-using-macrodef" file="${ant.file.load-using-macrodef}"/>
1974 jgill 41
	<property name="using.ant-using.basedir" location="${dirname.load-using-macrodef}"/>
1972 jgill 42
 
43
	<taskdef resource="net/sf/antcontrib/antlib.xml">
44
		 <classpath>
45
		     <pathelement location="${dirname.load-using-macrodef}/jar/ant-contrib.jar"/>
46
		 </classpath>
47
	</taskdef>
48
 
1974 jgill 49
	<path id="ivy.lib.path">
50
		<fileset dir="${dirname.load-using-macrodef}/jar" includes="ivy*.jar"/>
51
	</path>
52
 
53
	<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
54
			uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
55
 
56
	<available property="ivy.xml.exists" filepath="${basedir}" file="ivy.xml"/>
57
	<available property="ivy-template.xml.exists" filepath="${basedir}" file="ivy-template.xml"/>
58
	<if>
59
		<or>
60
			<isset property="ivy.xml.exists"/>
61
			<isset property="ivy-template.xml.exists"/>
62
		</or>
63
		<then>
1978 jgill 64
			<if>
65
				<!-- if we are building using the auto build tool, or we are not, and GBE_DPKG_CACHE isn't set,
66
					then use ${basedir}/build/.ivy/cache as the ivy cache.
67
					else use the GBE_DPKG_CACHE location.
68
				-->
69
				<or>
70
					<and>
71
						<isset property="env.GBE_ABT"/>
72
						<not><equals arg1="${env.GBE_ABT}" arg2=""/></not>
73
					</and>
74
					<not>
75
                        <and>
76
                            <isset property="env.GBE_DPKG_CACHE"/>
77
                            <length string="${env.GBE_DPKG_CACHE}" trim="true" when="greater" length="0"/>
78
                        </and>
79
                    </not>
80
				</or>
81
				<then>
82
					<property name="ivy.cache.home" value="${basedir}/build/.ivy/cache"/>
83
				</then>
84
				<else>
85
					<property name="ivy.cache.home" value="${env.GBE_DPKG_CACHE}/.ivy/cache"/>
86
				</else>
87
			</if>
88
 
89
			<echo taskname="ivy:cache">${ivy.cache.home}</echo>
90
 
1974 jgill 91
			<ivy:configure file="${dirname.load-using-macrodef}/ivyconf.xml" />
92
		</then>
93
	</if>
94
 
1972 jgill 95
	<!-- 
96
	  - Do we have an environment variable for GBE_DPKG_CACHE?
97
	  - If so, use it as the build location.
98
	  - If not, look for a properties file : ant-build-properties (if one exists)
1978 jgill 99
	  - If the properties are not found, default to ${basedir}/build/.dpkg/cache
1972 jgill 100
	  -->
101
	<if>
1978 jgill 102
        <and>
103
        	<isset property="env.GBE_DPKG_CACHE"/>
104
            <length string="${env.GBE_DPKG_CACHE}" trim="true" when="greater" length="0"/>
105
        </and>
1972 jgill 106
		<then>
107
			<property name="build.repository" value="${env.GBE_DPKG_CACHE}"/>
108
			<echo taskname="ant-using">Using environment variable 'GBE_DPKG_CACHE' as build.repository from : ${build.repository}</echo>
109
		</then>
110
		<else>
111
			<available property="ant-build-properties_available" filepath="${user.home}" file="ant-build-properties"/>
112
			<if>
113
				<isset property="ant-build-properties_available"/>
114
				<then>
115
					<property file="${user.home}/ant-build-properties"/>
116
					<echo taskname="ant-using">Using 'ant-build-properties' file for build.repository as : ${build.repository}</echo>
117
				</then>
118
				<else>
1978 jgill 119
					<property name="build.repository" value="${basedir}/build/.dpkg/cache"/>
1972 jgill 120
				</else>
121
			</if>
122
		</else>
123
	</if>
124
 
125
 
126
	<!-- 
127
	  - Pick up ant-using-macro.xml from same directory as this file was imported. 
128
	  -->
129
	<import file="${dirname.load-using-macrodef}/ant-using-macro.xml" optional="false"/>
130
    <import file="${dirname.load-using-macrodef}/ant-clean.xml" optional="false"/>
131
    <import file="${dirname.load-using-macrodef}/ant-manifest.xml" optional="false"/>
132
    <import file="${dirname.load-using-macrodef}/ant-release.xml" optional="false"/>
133
    <import file="${dirname.load-using-macrodef}/ant-javadoc.xml" optional="false"/>
134
    <import file="${dirname.load-using-macrodef}/ant-jants.xml" optional="false"/>
1974 jgill 135
	<import file="${dirname.load-using-macrodef}/ant-ivy.xml" optional="false"/>
1972 jgill 136
 
137
	<!-- 
138
	  - Import the auto.xml file (if it exists), and if it does not then import the depends.xml.
139
	  - The name of the depends.xml it will look for (in this order) is ${ant.project.name}-depends.xml or
140
	  - ${ant.project.name}depends.xml.
141
	  -->
142
	<available property="auto.xml.exists" filepath="${basedir}" file="auto.xml"/>
143
	<if>
144
	    <isset property="auto.xml.exists"/>
145
		<then>
146
			<import file="${basedir}/auto.xml" optional="true"/>
147
		</then>
148
		<else>
149
			<available property="depends.xml.exists" filepath="${basedir}" file="${ant.project.name}-depends.xml"/>
150
			<if>
151
				<isset property="depends.xml.exists"/>
152
				<then>
153
					<import file="${basedir}/${ant.project.name}-depends.xml" optional="true"/>
154
				</then>
155
				<else>
156
					<import file="${basedir}/${ant.project.name}depends.xml" optional="true"/>
157
				</else>
158
			</if>
159
		</else>
160
	</if>
161
 
162
</project>