1
<?xml version="1.0" encoding="UTF-8"?>
56
<project name="langtools" default="build" basedir="../..">
64
<property file="make/langtools/build.properties"/>
67
<property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
70
<property file="${user.home}/.openjdk/build.properties"/>
73
<property name="src.dir" location="src"/>
74
<property name="test.dir" location="test"/>
75
<property name="make.dir" location="make/langtools"/>
76
<property name="make.idea.dir" location="make/ide/idea/langtools"/>
77
<property name="make.conf.dir" location="${make.dir}/conf"/>
78
<property name="make.tools.dir" location="${make.dir}/tools"/>
79
<property name="build.dir" location="build/langtools"/>
80
<property name="build.modules" location="${build.dir}/modules"/>
81
<property name="build.gensrc" location="${build.dir}/gensrc"/>
82
<property name="build.tools" location="${build.dir}/toolclasses"/>
83
<property name="build.bin" location="${build.dir}/bin"/>
84
<property name="build.jtreg" location="${build.dir}/jtreg"/>
85
<property name="build.prevsrc" location="${build.dir}/prevsrc"/>
87
<dirset id="src.module.dirset" dir="${src.dir}" includes="${module.names}"/>
89
<pathconvert pathsep="," property="src.module.dirs" refid="src.module.dirset"/>
91
<pathconvert property="xpatch.rest" pathsep=" --patch-module=" refid="src.module.dirset">
92
<regexpmapper from="^.*(/|\\)([^/\\]*)$" to='\2="${build.modules}\1\2"' />
95
<pathconvert property="xpatch.noquotes.rest" pathsep=" --patch-module=" refid="src.module.dirset">
96
<regexpmapper from="^([^/\\]*)(/|\\).*" to="\1=${build.modules}\2\1" />
99
<property name="xpatch.cmd" value="--patch-module=${xpatch.rest}"/>
100
<property name="xpatch.noquotes.cmd" value="--patch-module=${xpatch.noquotes.rest}"/>
105
<condition property="java.marker" value="bin/java">
108
<condition property="java.marker" value="bin/java.exe">
109
<os family="windows"/>
113
<property file="${make.dir}/build.properties"/>
115
<condition property="langtools.jdk.home" value="${jdk.home}">
116
<isset property="jdk.home" />
123
<condition property="launcher.java"
124
value="${langtools.jdk.home}/bin/java" else="java">
125
<isset property="langtools.jdk.home"/>
132
<target name="-def-check">
133
<macrodef name="check">
134
<attribute name="name"/>
135
<attribute name="property"/>
136
<attribute name="marker" default=""/>
138
<fail message="Cannot locate @{name}: please set @{property} to its location">
141
<isset property="@{property}"/>
145
<fail message="@{name} is not installed in ${@{property}}">
149
<equals arg1="@{marker}" arg2=""/>
152
<available file="${@{property}}/@{marker}"/>
161
<target name="-check-langtools.jdk.home" depends="-def-check">
162
<check name="target java" property="langtools.jdk.home" marker="${java.marker}"/>
165
<target name="-check-jtreg.home" depends="-def-check">
166
<check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
173
<target name="clean" description="Delete all generated files">
174
<delete dir="${build.dir}"/>
177
<target name="build" depends="build-all-tools"/>
179
<target name="-prepare-build" depends="-check-langtools.jdk.home">
180
<mkdir dir="${build.modules}"/>
181
<mkdir dir="${build.tools}"/>
182
<mkdir dir="${build.gensrc}"/>
183
<mkdir dir="${build.bin}"/>
184
<mkdir dir="${build.prevsrc}"/>
187
<target name="generate-sources-internal">
188
<basename property="module.name" file="${basedir}"/>
189
<mkdir dir="${build.gensrc}/${module.name}"/>
190
<pparse destdir="${build.gensrc}/${module.name}" includes="${langtools.resource.includes}">
191
<src path="./share/classes"/>
193
<pcompile destdir="${build.gensrc}/${module.name}" includes="**/*.properties">
194
<src path="./share/classes"/>
198
<target name="generate-sources" depends="-prepare-build,-def-pparse,-def-pcompile">
199
<subant inheritall="true" target="generate-sources-internal" genericantfile="${make.dir}/build.xml">
200
<dirset refid="src.module.dirset"/>
204
<target name="build-all-classes" depends="generate-sources">
205
<pathconvert property="xpatch.src.rest" pathsep=" --patch-module=" refid="src.module.dirset">
206
<regexpmapper from="^.*(/|\\)([^/\\]*)$" to="\2=${src.dir}\1\2/share/classes${path.separator}${build.gensrc}\1\2" />
208
<property name="xpatch.src.cmd" value="--patch-module=${xpatch.src.rest}"/>
209
<pathconvert pathsep="," property="gensrc.module.dirs">
210
<dirset dir="${build.gensrc}" includes="${module.names}"/>
212
<multirootfileset id="source.fileset" basedirs="${src.module.dirs},${gensrc.module.dirs}">
213
<include name="**/*.java"/>
214
<different targetdir="${build.prevsrc}" ignoreFileTimes="true"/>
216
<pathconvert pathsep=" " property="source.files" refid="source.fileset"/>
217
<echo file="${build.dir}/sources.txt">${source.files}</echo>
218
<exec executable="${langtools.jdk.home}/bin/javac" failonerror="true">
220
<arg value="${build.modules}" />
221
<arg line="${javac.opts}" />
222
<arg line="${xpatch.src.cmd}" />
223
<arg line="--module-source-path ." />
224
<arg line="@${build.dir}/sources.txt" />
226
<delete file="${build.dir}/sources.txt"/>
228
<fileset dir="${build.modules}" includes="**/module-info.class"/>
231
<copy todir="${build.prevsrc}" >
232
<multirootfileset refid="source.fileset"/>
236
<target name="build-all-tools" depends="build-all-classes, -def-build-tool">
237
<build-tool name="javac"/>
238
<build-tool name="javadoc"/>
239
<build-tool name="javap"/>
240
<build-tool name="jdeps"/>
241
<build-tool name="jshell"/>
244
<target name="jtreg" depends="build-all-tools,-def-jtreg">
245
<jtreg-tool name="all" tests="${jtreg.tests}"/>
252
<target name="idea" depends="-check-langtools.jdk.home">
254
<copy todir=".idea" >
255
<fileset dir="${make.idea.dir}/template">
256
<exclude name="**/src/**"/>
257
<exclude name="**/utils/**"/>
260
<condition property="idea.jtreg.home" value="${jtreg.home}" else = "[jtreg.home]">
261
<isset property="jtreg.home"/>
263
<condition property="idea.target.jdk" value="${langtools.jdk.home}" else = "$JDKPath$">
264
<isset property="langtools.jdk.home"/>
266
<replace file=".idea/ant.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
267
<replace dir=".idea/runConfigurations" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
268
<replace dir=".idea/runConfigurations" token="@XPATCH@" value="${xpatch.cmd}"/>
269
<replace file=".idea/misc.xml" token="@IDEA_JTREG_HOME@" value="${idea.jtreg.home}"/>
270
<replace file=".idea/misc.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
271
<replace file=".idea/misc.xml" token="@XPATCH@" value="${xpatch.cmd}"/>
272
<mkdir dir=".idea/classes"/>
273
<javac source="${javac.build.source}"
274
target="${javac.build.target}"
275
srcdir="${make.idea.dir}/template/src"
276
destdir=".idea/classes"/>
283
<target name="-def-pparse">
284
<copy todir="${build.tools}/propertiesparser" >
285
<fileset dir="${make.tools.dir}/propertiesparser" includes="**/resources/**"/>
287
<javac source="${javac.build.source}"
288
target="${javac.build.target}"
289
srcdir="${make.tools.dir}"
290
includes="propertiesparser/* anttasks/PropertiesParser* anttasks/PathFileSet*"
291
destdir="${build.tools}"
292
classpath="${ant.core.lib}"
293
bootclasspath="${langtools.jdk.home}/jre/lib/rt.jar"
294
includeantruntime="false">
295
<compilerarg line="${javac.build.opts} -XDstringConcat=inline"/>
297
<taskdef name="pparse"
298
classname="anttasks.PropertiesParserTask"
299
classpath="${build.tools}"/>
302
<target name="-def-pcompile">
304
source="${javac.build.source}"
305
target="${javac.build.target}"
306
srcdir="${make.tools.dir}"
307
includes="compileproperties/* anttasks/CompileProperties* anttasks/PathFileSet*"
308
destdir="${build.dir}/toolclasses/"
309
classpath="${ant.core.lib}"
310
includeantruntime="false">
311
<compilerarg line="${javac.build.opts} -XDstringConcat=inline"/>
313
<taskdef name="pcompile"
314
classname="anttasks.CompilePropertiesTask"
315
classpath="${build.tools}"/>
318
<target name="-def-build-tool">
319
<macrodef name="build-tool">
320
<attribute name="name"/>
321
<attribute name="compilation.kind" default=""/>
322
<attribute name="bin.dir" default="${build.bin}"/>
323
<attribute name="java" default="${launcher.java}"/>
324
<attribute name="main.class" default="${tool.@{name}.main.class}"/>
325
<attribute name="xpatch" default="${xpatch.cmd}"/>
327
<mkdir dir="@{bin.dir}"/>
328
<copy file="${make.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
329
<filterset begintoken="#" endtoken="#">
330
<filter token="PROGRAM" value="@{main.class}"/>
331
<filter token="TARGET_JAVA" value="@{java}"/>
332
<filter token="PS" value="${path.separator}"/>
333
<filter token="XPATCH" value="${xpatch.cmd}"/>
336
<chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
341
<target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-langtools.jdk.home">
342
<taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
344
<pathelement location="${jtreg.home}/lib/jtreg.jar"/>
345
<pathelement location="${jtreg.home}/lib/javatest.jar"/>
348
<macrodef name="jtreg-tool">
349
<attribute name="name"/>
350
<attribute name="tests"/>
351
<attribute name="jdk" default="${langtools.jdk.home}"/>
352
<attribute name="agentvm" default="true"/>
353
<attribute name="verbose" default="${default.jtreg.verbose}"/>
354
<attribute name="options" default="${other.jtreg.options}"/>
355
<attribute name="ignore" default="-keywords:!ignore -exclude:${test.dir}/ProblemList.txt"/>
356
<attribute name="jpda.jvmargs" default=""/>
357
<attribute name="extra.jvmargs" default=""/>
358
<attribute name="build.modules" default="${build.modules}"/>
360
<property name="coverage.options" value=""/>
361
<property name="coverage.classpath" value=""/>
362
<property name="default.jtreg.verbose" value="summary"/>
363
<property name="other.jtreg.options" value=""/>
364
<property name="jtreg.classfiles.to.modules" value="@{agentvm}"/>
367
workDir="${build.jtreg}/@{name}/work"
368
reportDir="${build.jtreg}/@{name}/report"
370
agentvm="@{agentvm}" verbose="@{verbose}"
371
failonerror="false" resultproperty="jtreg.@{name}.result"
372
vmoptions="${coverage.options} @{extra.jvmargs} ${xpatch.noquotes.cmd}">
373
<arg value="-debug:@{jpda.jvmargs}"/>
374
<arg line="@{ignore}"/>
375
<arg line="@{options}"/>
376
<arg line="@{tests}"/>
380
<condition property="jtreg.passed">
381
<equals arg1="${jtreg.@{name}.result}" arg2="0"/>
383
<property name="jtreg.report" value="${build.jtreg}/@{name}/report"/>
386
<property name="jtreg.defined" value="true"/>