aboutsummaryrefslogtreecommitdiffstats
path: root/build/release/build.xml
blob: c063788d792be55eb179a7a3fb6f843c1a6ae42b (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!-- ========================================================================= -->
<!-- Copyright (c) 2003-2005 Contributors.                                     -->
<!-- All rights reserved.                                                      -->
<!-- This program and the accompanying materials are made available            -->
<!-- under the terms of the Eclipse Public License v1.0                        -->
<!-- which accompanies this distribution and is available at                   -->
<!-- http://www.eclipse.org/legal/epl-v10.html                                 -->
<!--                                                                           -->
<!-- Contributors:                                                             -->
<!--     Wes Isberg     initial implementation                                 -->
<!-- ========================================================================= -->

<project name="build" default="all" basedir="..">

    <property name="aspectj.modules.dir" location="${basedir}/.."/>
    
    <import file="${aspectj.modules.dir}/build/build-properties.xml"/>
    <import file="${aspectj.modules.dir}/build/release/release-tests.xml"/>

	<target name="info">
	    <echo message="see build.readme.txt and readme.txt"/>
	</target>
	
    <target name="init" depends="init-release-properties">
	</target>
    
	<target name="init-release-properties" depends="init-properties,init-directories">
		<property name="do.cvs" value="false"/>
	    <property name="run.${min.vm}" value="true"/>
	    <property name="run.14" value="false"/>
	    <property name="run.${max.vm}" value="true"/>
		
		<property name="aspectj.build.props" value=""/>
		<property name="ant.verbose" value=""/>
		<property name="failonerror" value="false"/>
		<property name="harness.jvmline" value="-Dignore=me"/>

		<property name="aspectj.ant.home"
			location="${aspectj.modules.lib.dir}/ant"/>
		<property name="aspectj.ant.lib.dir"
			location="${aspectj.ant.home}/lib"/>

		<property name="harness.jar"
			location="${aj.jar.dir}/testing-drivers-test-all.jar"/>
		
		<property name="java.home.file"
			location="${aj.build.dir}/javahome.props.tmp"/>

		<property name="java13.command"
			location="${java13.home}/bin/java"/>

		<property name="java14.command"
			location="${java14.home}/bin/java"/>
		
		<property name="java15.command"
			location="${java15.home}/bin/java"/>

        <mkdir dir="${aj.logs.dir}"/>
	</target>
	
	<target name="all" depends="init">
	    <build-aspectj vm="${min.vm}" target="clean"/>
	    <save-build-id id="min-vm-${min.vm}"/>
	    <build-aspectj vm="${min.vm}" target="echo-properties"/>
	    <build-aspectj vm="${min.vm}" target="all"/>
	    <build-aspectj vm="${min.vm}" target="test-each-module"/>
		<build-aspectj vm="${max.vm}" target="junitreport"/>
		<build-aspectj vm="${max.vm}" target="save-result"/>
	    
	    <build-aspectj vm="${max.vm}" target="clean-keep-results"/>
	    <!-- can't use safety of build-aspectj since deleting output file -->
		<antcall target="clean-default-results"/>
		
	    <save-build-id id="max-vm-${max.vm}"/>
		<build-aspectj vm="${max.vm}" target="echo-properties"/>
	    <build-aspectj vm="${max.vm}" target="all"/>
	    <build-aspectj vm="${max.vm}" target="test-each-module"/>
		<build-aspectj vm="${max.vm}" target="junitreport"/>
		<antcall target="install"/>
		<antcall target="product-tests"/>
		<!-- TODO re-enable antcall target="harness-tests"/ --> 
		<!-- Temporary removal to see if build will work... -->
		<!--build-aspectj vm="13" target="compile-runtime-11"/-->
			
	    <build-aspectj vm="${max.vm}" target="save-result"/>
	    
		<antcall target="fail-if-allresults-allfailures"/>
	</target>
          
	<target name="install" depends="init-release-properties"
		description="install AspectJ distribution using Java min.vm=${min.vm}">
	    <antcall target="init-postBuild-properties"/>
		<require-available property="aspectj.jar"
			path="${aj.dist.dir}/aspectj-${build.version}.jar"/>
		<clean-dir dir="${aj.install.dir}"/>
		<setup-vm vm="${min.vm}"/>
		<property file="${java.home.file}"/>
		<fail unless="build.java.command" 
		     message="failed to read ${build.java.command} from ${java.home.file}"/>
	    <java 
		    fork="true" 
			jvm="${build.java.command}"
			jar="${aspectj.jar}" 
		    failonerror="true">
			<arg line="-to ${aj.install.dir}"/>
		</java>
	</target>
    
    <macrodef name="build-aspectj">
	    <attribute name="target"/>
	    <attribute name="vm"/>
	    <sequential>
	        <setup-vm vm="@{vm}"/>
	        <condition property="do.ant.props" value=" ">
	            <not><isset property="do.ant.props"/></not>
	        </condition>
	        	
			<antcall target="do-run-ant">
				<param name="ant.dir" location="${aspectj.modules.build.dir}"/>
				<param name="run.ant.file" value="build.xml"/>
				<param name="ant.target" value="@{target}"/>
				<param name="ant.output" 
					location="${aj.logs.dir}/build-@{target}"/>
				<param name="ant.properties" 
				    value="${do.ant.props} ${aspectj.build.props}"/>
			</antcall>
		</sequential>
    </macrodef>
    
	<target name="do-run-ant" depends="init-release-properties"
	 description="the ant we use to build">
		<!-- we could use normal ant, but we enforce using
		     our ant libraries and the specified java runtime
		 -->
		<fail unless="ant.target" message="define ant.target"/>
		<fail unless="run.ant.file" message="define run.ant.file"/>
		<!-- don't fail - set if not defined -->
		<property name="ant.properties" value=""/>

		<property file="${java.home.file}"/>
		<fail unless="build.java.home" 
		     message="failed to read ${build.java.home} from ${java.home.file}"/>
		<fail unless="build.java.version" 
		     message="failed to read ${build.java.version} from ${java.home.file}"/>
		<available property="aspectjrt.path" 
			value="${aj.install.dir}/lib/aspectjrt.jar"
			file="${aj.install.dir}/lib/aspectjrt.jar"/>
		<available property="aspectjrt.path"
			value="${lib.test.aspectjrt.jar}" 
			file="${lib.test.aspectjrt.jar}"/>
		<property name="ant.output.file" 
			location="${ant.output}-${build.java.version}.txt"/>
		<echo>
  do-run-ant dir ${ant.dir}
     file/target -f ${run.ant.file} ${ant.target}
         options ${ant.verbose} ${ant.properties}
          output ${ant.output.file}
     failonerror ${failonerror}
  aspectjrt.path ${aspectjrt.path}
</echo>

		<java 
			fork="true"
			resultproperty="do-run-ant.result"
			failonerror="${failonerror}"
			dir="${ant.dir}"
			jvm="${build.java.command}"
			classname="org.apache.tools.ant.Main"
			maxmemory="350m"
			newenvironment="true"
			output="${ant.output.file}">
			<classpath>
			    <!-- TODO use lib/ant-launcher.jar only? use jdk.tools.jar (version) -->
				<fileset dir="${aspectj.ant.lib.dir}">
					<include name="*.jar"/>
				</fileset>
				<pathelement location="${junit.jar}"/>
				<pathelement location="${build.java.home}/lib/tools.jar"/> 
			</classpath>

			<!-- urk - all properties for any client -->
			<!-- for any build -->
			<sysproperty key="JAVA_HOME" path="${build.java.home}"/>
			<sysproperty key="ANT_HOME" 
				path="${aspectj.ant.home}"/>

			<!-- for ajde -->
			<sysproperty key="aspectjrt.path" file="${aspectjrt.path}"/>

			<!-- for tests/product/build-aspectj/build.xml -->
			<sysproperty key="ASPECTJ_MODULES"
				file="${aspectj.modules.dir}"/>
			<sysproperty key="ASPECTJ_HOME"
				file="${aj.install.dir}"/>
			<arg line="-f ${run.ant.file} ${ant.target} ${ant.verbose} ${ant.properties}"/>
		</java>
		<condition property="do-run-ant.failed" value="true">
			<not><equals arg1="0" arg2="${do-run-ant.result}"/></not>			
		</condition>
		<echo message="dra: do-run-ant.failed=${do-run-ant.failed} do-run-ant.result=${do-run-ant.result}"/>
		<report-if-failed property="do-run-ant.failed"
			text="Build failed: ${ant.output.file}"/>
	</target>
    
    <macrodef name="do-vm-targets">
        <attribute name="target"/>
        <sequential>            
			<do-vm-target target="@{target}" vm="min" />
			<do-vm-target target="@{target}" vm="14" />
	 		<do-vm-target target="@{target}" vm="max" />
	    </sequential>
	</macrodef>
    <macrodef name="do-vm-target">
	    <attribute name="vm"/>
    	<attribute name="target"/>
	    <sequential>
	        <antcall target="do-@{vm}-target">
    			<param name="do.target" value="@{target}"/>
            </antcall>
	    </sequential>
	</macrodef>
    
	<target name="do-13-target"	if="run.13">
		<setup-vm vm="13"/>
		<antcall target="${do.target}"/>
	</target>

	<target name="do-14-target"	if="run.14">
		<setup-vm vm="14"/>
		<antcall target="${do.target}"/>
	</target>

    <target name="do-15-target"	if="run.15">
		<setup-vm vm="15"/>
		<antcall target="${do.target}"/>
	</target>
	
	<target name="do-min-target"	if="run.${min.vm}">
		<setup-vm vm="${min.vm}"/>
		<antcall target="${do.target}"/>
	</target>

	<target name="do-max-target"	if="run.${max.vm}">
		<setup-vm vm="${max.vm}"/>
		<antcall target="${do.target}"/>
	</target>
    <macrodef name="setup-vm">
        <attribute name="vm"/>
        <sequential>            
			<property name="wjf@{vm}.bjh" location="${java@{vm}.home}"/>
			<property name="wjf@{vm}.cmd" location="${wjf@{vm}.bjh}/bin/java"/>
            <delete file="${java.home.file}"/>
			<propertyfile file="${java.home.file}">
				<entry key="build.java.version" value="@{vm}"/>
				<entry key="build.java.home" value="${wjf@{vm}.bjh}"/>
				<entry key="build.java.command" value="${wjf@{vm}.cmd}"/>
			</propertyfile>
        </sequential>
	</macrodef>

</project>