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
|
<!--
Copyright (C) 2020 The Project Lombok Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project name="lombok.tests" default="test" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" basedir="..">
<description>
This buildfile is part of projectlombok.org. It takes care of compiling and running tests.
</description>
<target name="test.compile" depends="deps, compile" description="compiles the tests" unless="skip.tests">
<mkdir dir="build/tests" />
<ivy:compile destdir="build/teststubs" source="1.6" target="1.6" ecj="true" nowarn="true">
<src path="test/stubs" />
</ivy:compile>
<ivy:compile destdir="build/tests" source="1.5" target="1.5" ecj="true" nowarn="true">
<bootclasspath path="${jdk6-rt.loc}" />
<classpath refid="cp.test" />
<classpath refid="cp.eclipse-oxygen" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<src path="test/core/src" />
<src path="test/transform/src" />
<src path="test/bytecode/src" />
<src path="test/configuration/src" />
</ivy:compile>
<mkdir dir="build/teststubs" />
<ivy:compile destdir="build/teststubs" source="1.6" target="1.6" ecj="true" nowarn="true">
<src path="test/stubs" />
</ivy:compile>
</target>
<target name="test.ecj11" depends="deps, dist" description="Runs a few ecj-specific tests" unless="skip.tests">
<java jar="lib/ecj11/org.eclipse.jdt-ecj.jar" fork="true" failonerror="true">
<jvmarg value="-javaagent:dist/lombok.jar=ecj" />
<arg line="-source 1.6 -target 1.6 -cp dist/lombok.jar test/ecj/SimpleTest.java" />
</java>
<echo>run ecj11 with a test file to confirm agent injection works: OK</echo>
</target>
<property name="test.addopens.raw">
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
</property>
<property name="test.limitmodules">--limit-modules java.base,jdk.unsupported</property>
<loadresource property="test.addopens">
<propertyresource name="test.addopens.raw" />
<filterchain><tokenfilter>
<filetokenizer />
<replaceregex pattern="\s+" replace=" " flags="g" />
</tokenfilter></filterchain>
</loadresource>
<target name="test.javac6" depends="test.compile" description="runs the tests on your default VM, using javac6 as underlying compiler">
<echo>Running TestJavac on JVM${ant.java.version}, with lowest supported javac: 1.6.</echo>
<junit haltonfailure="yes" fork="true" forkmode="once">
<jvmarg value="-Xbootclasspath/a:${jdk6-rt.loc}" />
<jvmarg line="${test.limitmodules}" />
<jvmarg value="-Ddelombok.bootclasspath=${jdk6-rt.loc}" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="cp.test" />
<classpath refid="cp.stripe" />
<classpath refid="cp.javac6" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<test name="lombok.TestJavac" />
</junit>
</target>
<target name="test.javac8" depends="test.compile, deps.jdk8-runtime" description="runs the tests on your default VM, using javac8 as underlying compiler">
<echo>Running TestJavac on JVM${ant.java.version}, with javac: 1.8.</echo>
<junit haltonfailure="yes" fork="true" forkmode="once">
<jvmarg value="-Xbootclasspath/a:${jdk8-rt.loc}" />
<jvmarg line="${test.limitmodules}" />
<jvmarg value="-Ddelombok.bootclasspath=${jdk8-rt.loc}" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="cp.test" />
<classpath refid="cp.stripe" />
<classpath refid="cp.javac8" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<test name="lombok.TestJavac" />
</junit>
</target>
<macrodef name="test.javacX">
<attribute name="version" />
<sequential>
<find-vm version="@{version}" />
<echo>Running TestJavac with JVM ${jvm.loc.@{version}}.</echo>
<junit haltonfailure="yes" fork="true" forkmode="once" jvm="${jvm.loc.@{version}}/bin/${exe.java}">
<jvmarg line="${test.addopens}" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="cp.test" />
<classpath refid="cp.stripe" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<test name="lombok.TestJavac" />
</junit>
</sequential>
</macrodef>
<target name="test.javac11" depends="test.compile" description="runs the tests on your default VM, using javac11 as underlying compiler">
<test.javacX version="11" />
</target>
<target name="test.javac14" depends="test.compile" description="runs the tests on your default VM, using javac14 as underlying compiler">
<test.javacX version="14" />
</target>
<target name="test.javacCurrent" depends="test.compile" description="runs the tests on your default VM, using its javac as underlying compiler">
<echo>Running TestJavac on JVM${ant.java.version}, with the javac built into your VM distributon.</echo>
<junit haltonfailure="yes" fork="true" forkmode="once">
<jvmarg line="${test.addopens}" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="cp.test" />
<classpath refid="cp.stripe" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<test name="lombok.TestJavac" />
</junit>
</target>
<macrodef name="test.eclipse-X">
<attribute name="version" />
<sequential>
<echo>Running TestEclipse on eclipse-@{version} on JVM${ant.java.version}.</echo>
<junit haltonfailure="yes" fork="true" forkmode="once">
<jvmarg value="-Xbootclasspath/a:${jdk8-rt.loc}" />
<jvmarg value="-javaagent:dist/lombok.jar" />
<jvmarg line="${test.addopens}" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="cp.test" />
<classpath refid="cp.stripe" />
<classpath refid="cp.eclipse-@{version}" />
<classpath location="build/lombok" />
<classpath location="build/tests" />
<test name="lombok.TestEclipse" />
</junit>
</sequential>
</macrodef>
<target name="test.eclipse-oxygen" depends="test.compile" description="runs the tests on your default VM, testing the oxygen release of eclipse">
<test.eclipse-X version="oxygen" />
</target>
<target name="test.eclipse-202006" depends="test.compile" description="runs the tests on your default VM, testing the 2020-03 release of eclipse">
<test.eclipse-X version="202006" />
</target>
<target name="test" depends="test.javacCurrent, test.eclipse-202006" description="runs the tests against the default JVM, javac, and eclipse" />
<target name="test.broad" depends="test.javac8, test.javac14, test.eclipse-oxygen, test.eclipse-202006" description="runs the tests against the default JVM, javac, and eclipse" />
</project>
|