Subversion Repositories DevTools

Rev

Rev 1820 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1820 Rev 1824
Line 15... Line 15...
15
	<using name="ant-windows" version="REPLACE_ANT_WINDOWS"/>
15
	<using name="ant-windows" version="REPLACE_ANT_WINDOWS"/>
16
 
16
 
17
 
17
 
18
	<!-- Invoke another copy of Ant and run the specified target.
18
	<!-- Invoke another copy of Ant and run the specified target.
19
		 This allows modification of the environment by:
19
		 This allows modification of the environment by:
-
 
20
		  - "<env>" elements as per the standard "<exec>" Ant task.  It's best not to use
-
 
21
		    this for modifying Path or PATH.
20
		  - attribute "pathadditions=" - append the given string to the Path/PATH
22
		  - attribute "pathreplacement=" - replace the Path/PATH environment variable
21
		    environment variable.  String can contain multiple extra paths
23
		    with the given string.  String can contain multiple extra paths
22
		    separated by either ";" or ":".
24
		    separated by either ";" or ":".
-
 
25
		  - attributes "pathinsertions=" & "pathadditions=" - prepend / append the given
-
 
26
		    string to the Path/PATH environment variable.  String can contain multiple
23
		  - "<env>" elements as per the standard "<exec>" Ant task.
27
		    extra paths separated by either ";" or ":".
24
 
28
 
25
		 This is used for e.g. ensuring the Borland compiler can find the Borland
29
		 This is used for e.g. ensuring the Borland compiler can find the Borland
26
		 linker (ilink32).
30
		 linker (ilink32).
27
 
31
 
28
		 Note "using.nocache=true" is set on the new Ant to flag that all ant-using
32
		 Note "using.nocache=true" is set on the new Ant to flag that all ant-using
29
		 caching has already been done on the first Ant, so no need to do it all again.
33
		 caching has already been done on the first Ant, so no need to do it all again.
30
	 -->
34
	 -->
31
	<macrodef name="envchange">
35
	<macrodef name="envchange">
32
		<attribute name="target"/>
36
		<attribute name="target"/>
-
 
37
		<attribute name="pathreplacement" default="NOT_SUPPLIED"/>
-
 
38
		<attribute name="pathinsertions" default="NOT_SUPPLIED"/>
33
		<attribute name="pathadditions" default="NO_ADDITIONS"/>
39
		<attribute name="pathadditions" default="NOT_SUPPLIED"/>
34
 
40
 
35
		<!-- Any elements inside <envchange> implicitly are part of <envchange-elements>.
41
		<!-- Any elements inside <envchange> implicitly are part of <envchange-elements>.
36
			 This is to pick up <env> elements for <exec>. -->
42
			 This is to pick up <env> elements for <exec>. -->
37
		<element name="envchange-elements" implicit="yes" optional="yes"/>
43
		<element name="envchange-elements" implicit="yes" optional="yes"/>
38
		<sequential>
44
		<sequential>
39
			<!-- Get existing Path/PATH env var -->
45
			<!-- Replacing the path completely? -->
40
			<if>
46
			<if>
41
				<isset property="windows"/>
-
 
42
				<then>
-
 
43
					<property name="envchange.oldpath" value="${env.Path}"/>
-
 
44
				</then>
-
 
45
				<else>
-
 
46
					<property name="envchange.oldpath" value="${env.PATH}"/>
-
 
47
				</else>
-
 
48
			</if>
-
 
49
 
-
 
50
			<!-- Add specified additions to old path, or just use old path as is
-
 
51
				 if no additions were specified -->
-
 
52
			<if>
-
 
53
				<equals arg1="@{pathadditions}" arg2="NO_ADDITIONS"/>
47
				<not><equals arg1="@{pathreplacement}" arg2="NOT_SUPPLIED"/></not>
54
				<then>
48
				<then>
55
					<property name="envchange.newpath" value="${envchange.oldpath}"/>
49
					<property name="envchange.newpath" value="@{pathreplacement}"/>
56
				</then>
50
				</then>
57
				<else>
51
				<else>
-
 
52
					<!-- Changing existing path - Get existing Path/PATH env var -->
-
 
53
					<if>
-
 
54
						<isset property="windows"/>
-
 
55
						<then>
-
 
56
							<property name="envchange.oldpath" value="${env.Path}"/>
-
 
57
						</then>
-
 
58
						<else>
-
 
59
							<property name="envchange.oldpath" value="${env.PATH}"/>
-
 
60
						</else>
-
 
61
					</if>
-
 
62
 
-
 
63
					<!-- Add specified additions to old path, or just use old path
-
 
64
						 if no additions were specified -->
-
 
65
					<if>
-
 
66
						<equals arg1="@{pathinsertions}" arg2="NOT_SUPPLIED"/>
-
 
67
						<then>
-
 
68
							<property name="tmppath" value="${envchange.oldpath}"/>
-
 
69
						</then>
-
 
70
						<else>
-
 
71
							<property name="tmppath" value="@{pathinsertions};${envchange.oldpath}"/>
-
 
72
						</else>
-
 
73
					</if>
-
 
74
					<if>
-
 
75
						<equals arg1="@{pathadditions}" arg2="NOT_SUPPLIED"/>
-
 
76
						<then>
-
 
77
							<property name="envchange.newpath" value="${tmppath}"/>
-
 
78
						</then>
-
 
79
						<else>
58
					<property name="envchange.newpath" value="${envchange.oldpath};@{pathadditions}"/>
80
							<property name="envchange.newpath" value="${tmppath};@{pathadditions}"/>
-
 
81
						</else>
-
 
82
					</if>
59
				</else>
83
				</else>
60
			</if>
84
			</if>
61
			<if>
85
			<if>
62
				<isset property="windows"/>
86
				<isset property="windows"/>
63
				<then>
87
				<then>