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>
2
 
1976 jgill 3
    <!--
1974 jgill 4
	    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
5
		macrodef: initivy
6
		~~~~~~~~~~~~~~~~~~~~~
7
		This macrodef takes an ivy dependency template file, and creates 
8
		a new ivy.xml file that has all the revisions updated with the version 
9
		numbers from the depends.xml file.         
10
		= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
1976 jgill 11
	 -->
1974 jgill 12
	<macrodef name="initivy">
13
		<sequential>
14
			<available property="ivy.xml.exists" filepath="${basedir}" file="${basedir}/ivy-template.xml" />
15
			<available property="depends.xml.exists" filepath="${basedir}" file="${basedir}/${ant.project.name}depends.xml" />
16
			<available property="auto.xml.exists" filepath="${basedir}" file="${basedir}/auto.xml" />
17
			<if>
18
				<and>
19
					<isset property="ivy.xml.exists"/>
20
					<isset property="depends.xml.exists"/>
21
				</and>
22
				<then>
23
					<if>
24
						<isset property="auto.xml.exists"/>
25
						<then>
26
							<property name="dependencies.xml" location="${basedir}/auto.xml"/>
27
						</then>
28
						<else>
29
							<property name="dependencies.xml" location="${basedir}/${ant.project.name}depends.xml"/>
30
						</else>
31
					</if>
32
 
33
					<loadproperties srcFile="${dependencies.xml}">
34
						<filterchain>
35
							<tokenfilter>
1976 jgill 36
									<replaceregex 
37
										pattern='&lt;project.*&gt;'
38
					                    replace=''
39
					                    flags="gi" />
40
					                <replaceregex 
41
					                    pattern='&lt;property\s+name="packagename"\s+value="(.*)"\s*/&gt;'
42
			                            replace=''
43
			                            flags="true" />
44
	                           		<replaceregex 
45
			                           pattern='&lt;property\s+name="(.*)"\s+value="(.*)"\s*/&gt;'
46
			                           replace='\1.rev=\2${line.separator}\1.branch=\2'
47
			                           flags="gi" />
48
								</tokenfilter>
1974 jgill 49
							<expandproperties/>
50
							<tokenfilter>
51
		                        <replaceregex 
52
                           			pattern='(.*).rev=(.*?)\.?+[a-zA-Z]*$'
53
                           			replace='\1.rev=\2'
54
                           			flags="gi" />
55
                           		<replaceregex 
56
                           			pattern='(.*).branch=.*?([a-zA-Z]*$)'
57
                           			replace='\1.branch=\2'
58
                           			flags="gi" />
59
							</tokenfilter>
60
						</filterchain>
61
					</loadproperties>
62
 
63
					<loadfile property="ivy-template-file" srcFile="${basedir}/ivy-template.xml">
64
						<filterchain>
65
							<expandproperties />
66
						</filterchain>
67
					</loadfile>
68
					<echo file="${basedir}/ivy.xml">${ivy-template-file}</echo>
69
				</then>
70
			</if>
71
		</sequential>
72
	</macrodef>
73
 
74
</project>