aboutsummaryrefslogtreecommitdiff
path: root/buildScripts/setup.ant.xml
blob: 87a3593a49bd21425c97c3c95aa7b9928db8b591 (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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<!--
 Copyright (C) 2020-2021 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.setup" default="deps" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" basedir="..">
	<description>
This buildfile is part of projectlombok.org. It sets up the build itself.
	</description>
	
	<!-- increment this number to force a clean of the 'build' dir -->
	<property name="build.version" value="2021-03-18_001" />
	
	<property name="pattern.jdk11plus" value="^(\d\d\d+|1[1-9]|[2-9]\d)(\..*)?$" />
	<property name="ivy.retrieve.pattern" value="lib/[conf]/[organisation]-[artifact].[ext]" />
	<property environment="env" />
	<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
	
	<property name="jdk6-rt.loc" location="lib/openjdk6_rt.jar" />
	<property name="jdk8-rt.loc" location="lib/openjdk8_rt.jar" />
	<property name="rtstubs18.loc" location="lib/rtstubs18.jar" />
	<available file="${jdk6-rt.loc}" property="jdk6-rt.available" />
	<available file="${jdk8-rt.loc}" property="jdk8-rt.available" />
	<available file="${rtstubs18.loc}" property="rtstubs18.available" />
	<property name="ssh.configuration.file" location="ssh.configuration" />
	
	<target name="-setup.ssh.ask">
		<property file="${ssh.configuration.file}" />
		<fail>
			Your ssh.configuration file is corrupted; delete it and rerun this script.
			<condition>
				<or>
					<and>
						<isset property="ssh.username" />
						<equals arg1="" arg2="${ssh.username}" />
					</and>
					<and>
						<isset property="ssh.keyfile" />
						<equals arg1="" arg2="${ssh.keyfile}" />
					</and>
				</or>
			</condition>
		</fail>
		<fail>
			The keyfile configured in your ${ssh.configuration.file} file does not exist.
			<condition>
				<and>
					<isset property="ssh.keyfile" />
					<not><available file="${ssh.keyfile}" /></not>
				</and>
			</condition>
		</fail>
		
		<condition property="ssh.configuration.write">
			<or>
				<not><isset property="ssh.username" /></not>
				<not><isset property="ssh.keyfile" /></not>
			</or>
		</condition>
		<input message="What is your SSH username on the projectlombok.org server? (Enter to abort)." addproperty="ssh.username" />
		<fail>Aborted<condition><equals arg1="" arg2="${ssh.username}" /></condition></fail>
		<input message="Where is your ssh keyfile located? (Enter to abort)." addproperty="ssh.keyfile" defaultvalue="${user.home}/.ssh/id_rsa" />
		<fail>File ${ssh.keyfile} does not exist<condition><not><available file="${ssh.keyfile}" /></not></condition></fail>
	</target>
	
	<target name="-setup.ssh.save" if="ssh.configuration.write">
		<propertyfile file="${ssh.configuration.file}" comment="SSH connect info for projectlombok.org.">
			<entry key="ssh.username" value="${ssh.username}" />
			<entry key="ssh.keyfile" value="${ssh.keyfile}" />
		</propertyfile>
		<echo>Your connection info has been written to ${ssh.configuration.file} and will be remembered for future invocations.</echo>
	</target>
	
	<target name="setup.ssh" depends="-setup.ssh.ask, -setup.ssh.save" />
	
	<target name="-autoclean.check">
		<available type="dir" file="build" property="existingbuild.present" />
		<loadresource property="existingbuild.ver">
			<first count="1">
				<resources>
					<restrict>
						<fileset dir="." includes="build/build-ver.txt" />
						<exists />
					</restrict>
					<string>0</string>
				</resources>
			</first>
		</loadresource>
		<condition property="existingbuild.mismatch">
			<and>
				<isset property="existingbuild.present" />
				<not><equals arg1="${existingbuild.ver}" arg2="${build.version}" trim="true" /></not>
			</and>
		</condition>
	</target>
	
	<target name="autoclean" depends="-autoclean.check" if="existingbuild.mismatch" description="Checks if a change in the build or deplist neccessitates a clean">
		<echo>build ver has been incremented, neccessitating a clean...</echo>
		<delete dir="build" />
	</target>
	
	<target name="-setup.build" depends="autoclean">
		<mkdir dir="build" />
		<echo file="build/build-ver.txt">${build.version}</echo>
	</target>
	
	<target name="clean" description="Removes all generated files.">
		<delete dir="build" quiet="true" />
	</target>
	
	<target name="clean.dist" depends="clean" description="Deletes everything that this build script has ever generated.">
		<delete dir="lib" quiet="true" />
		<delete dir="dist" quiet="true" />
		<delete file=".project" quiet="true" />
		<delete file=".classpath" quiet="true" />
		<delete dir=".settings" quiet="true" />
		<delete dir=".idea" quiet="true" />
		<delete file="lombok.iml" quiet="true" />
		<delete dir="ivyCache" quiet="true" />
	</target>
	
	<target name="-ipp.download" unless="ivyplusplus.available">
		<mkdir dir="lib" />
		<get src="https://projectlombok.org/downloads/ivyplusplus.jar" dest="lib/ivyplusplus.jar" usetimestamp="true" />
	</target>
	
	<target name="-ipp.load" depends="-ipp.download">
		<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
		<ivy:ensureippversion version="1.40" property="ivyplusplus.minimumAvailable" />
	</target>
	
	<target name="-ipp.redownload" unless="ivyplusplus.minimumAvailable">
		<get src="https://projectlombok.org/downloads/ivyplusplus.jar" dest="lib/ivyplusplus.jar" />
		<fail>A new version of ivyplusplus was required and has been downloaded. Rerun the script to continue.</fail>
	</target>
	
	<target name="ipp.setup" depends="-ipp.load, -ipp.redownload" />
	
	<target name="ivy.config" depends="ipp.setup" unless="ivy.config">
		<ivy:configure file="buildScripts/ivysettings.xml" />
		<property name="ivy.config" value="true" />
	</target>
	
	<target name="deps.jdk6-runtime" unless="jdk6-rt.available">
		<echo>To ensure stable builds and avoid accessing API that was not available in JDK6, most of lombok is set up to build against OpenJDK6's runtime, which will now be downloaded...</echo>
		<mkdir dir="lib" />
		<get src="https://projectlombok.org/ivyrepo/langtools/rt-openjdk6.jar" dest="${jdk6-rt.loc}" verbose="true" usetimestamp="true" />
	</target>
	
	<target name="deps.jdk8-runtime" unless="jdk8-rt.available">
		<echo>To test java8, we need a java8 runtime, which will now be downloaded...</echo>
		<mkdir dir="lib" />
		<get src="https://projectlombok.org/ivyrepo/langtools/rt-openjdk8.jar" dest="${jdk8-rt.loc}" verbose="true" usetimestamp="true" />
	</target>
	
	<target name="deps.rtstubs18" unless="rtstubs18.available">
		<echo>To test in eclipse, we need a java runtime, which will now be downloaded...</echo>
		<mkdir dir="lib" />
		<get src="https://github.com/eclipse-jdt/eclipse.jdt.ui/raw/master/org.eclipse.jdt.ui.tests/testresources/rtstubs18.jar" dest="${rtstubs18.loc}" verbose="true" usetimestamp="true" />
	</target>
	
	<target name="deps.jdk-runtime" depends="deps.jdk6-runtime, deps.jdk8-runtime" />
	
	<target name="deps.custom" depends="ivy.config" description="Download the dependencies that comprise a configuration (from ivy.xml)">
		<fail unless="deps.conf">Supply ant with -Ddeps.conf=confname to pick the configuration you want to fetch</fail>
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="${deps.conf}" />
		<ivy:retrieve symlink="true" />
	</target>
	
	<target name="deps.eclipse.oxygen" depends="deps.rtstubs18, compile.support">
		<fetchdep.eclipse.osgi name="oxygen" version="4.7/R-4.7-201706120950" />
	</target>
	
	<target name="deps.eclipse.2022-03" depends="deps.rtstubs18, compile.support">
		<fetchdep.eclipse.osgi name="2022-03" version="4.23/R-4.23-202203080310" />
	</target>
	
	<macrodef name="fetchdep.ecj">
		<attribute name="version" />
		<sequential>
			<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="ecj@{version}" />
			<ivy:retrieve symlink="true" />
			<ivy:cachepath pathid="cp.ecj@{version}" conf="ecj@{version}" />
			<property name="cp.ecj@{version}" refid="cp.ecj@{version}" />
		</sequential>
	</macrodef>
	
	<macrodef name="fetchdep.eclipse">
		<attribute name="version" />
		<sequential>
			<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="eclipse-@{version}" />
			<ivy:retrieve symlink="true" />
			<ivy:cachepath pathid="cp.eclipse-@{version}" conf="eclipse-@{version}" />
			<property name="cp.eclipse-@{version}" refid="cp.eclipse-@{version}" />
		</sequential>
	</macrodef>
	
	<macrodef name="fetchdep.eclipse.osgi">
		<attribute name="target" default="testenv" />
		<attribute name="name" />
		<attribute name="version" />
		<sequential>
			<java classname="lombok.eclipse.dependencies.DownloadEclipseDependencies" failonerror="true">
				<classpath>
					<path refid="cp.buildtools" />
					<pathelement location="build/support" />
				</classpath>
				<arg value="@{target}" />
				<arg value="eclipse-@{name}" />
				<arg value="https://download.eclipse.org/eclipse/updates/@{version}/plugins/" />
				<arg value="com.ibm.icu" />
				<arg value="com.sun.jna" />
				<arg value="com.sun.jna.platform" />
				<arg value="javax.inject" />
				<arg value="javax.annotation" />
				<arg value="org.apache.batik.constants" />
				<arg value="org.apache.batik.css" />
				<arg value="org.apache.batik.i18n" />
				<arg value="org.apache.batik.util" />
				<arg value="org.apache.commons.io" />
				<arg value="org.apache.commons.logging" />
				<arg value="org.apache.commons.jxpath" />
				<arg value="org.apache.felix.scr" />
				<arg value="org.apache.xmlgraphics" />
				<arg value="org.bouncycastle.bcpg" />
				<arg value="org.bouncycastle.bcprov" />
				<arg value="org.eclipse.compare" />
				<arg value="org.eclipse.compare.core" />
				<arg value="org.eclipse.core.commands" />
				<arg value="org.eclipse.core.contenttype" />
				<arg value="org.eclipse.core.databinding" />
				<arg value="org.eclipse.core.databinding.observable" />
				<arg value="org.eclipse.core.databinding.property" />
				<arg value="org.eclipse.core.expressions" />
				<arg value="org.eclipse.core.filebuffers" />
				<arg value="org.eclipse.core.filesystem" />
				<arg value="org.eclipse.core.jobs" />
				<arg value="org.eclipse.core.resources" />
				<arg value="org.eclipse.core.runtime" />
				<arg value="org.eclipse.core.variables" />
				<arg value="org.eclipse.debug.core" />
				<arg value="org.eclipse.debug.ui" />
				<arg value="org.eclipse.e4.core.commands" />
				<arg value="org.eclipse.e4.core.contexts" />
				<arg value="org.eclipse.e4.core.di" />
				<arg value="org.eclipse.e4.core.di.annotations" />
				<arg value="org.eclipse.e4.core.di.extensions" />
				<arg value="org.eclipse.e4.core.di.extensions.supplier" />
				<arg value="org.eclipse.e4.core.services" />
				<arg value="org.eclipse.e4.emf.xpath" />
				<arg value="org.eclipse.e4.ui.bindings" />
				<arg value="org.eclipse.e4.ui.css.core" />
				<arg value="org.eclipse.e4.ui.css.swt" />
				<arg value="org.eclipse.e4.ui.css.swt.theme" />
				<arg value="org.eclipse.e4.ui.di" />
				<arg value="org.eclipse.e4.ui.dialogs" />
				<arg value="org.eclipse.e4.ui.ide" />
				<arg value="org.eclipse.e4.ui.model.workbench" />
				<arg value="org.eclipse.e4.ui.services" />
				<arg value="org.eclipse.e4.ui.widgets" />
				<arg value="org.eclipse.e4.ui.workbench" />
				<arg value="org.eclipse.e4.ui.workbench.addons.swt" />
				<arg value="org.eclipse.e4.ui.workbench.renderers.swt" />
				<arg value="org.eclipse.e4.ui.workbench.swt" />
				<arg value="org.eclipse.e4.ui.workbench3" />
				<arg value="org.eclipse.emf.common" />
				<arg value="org.eclipse.emf.ecore" />
				<arg value="org.eclipse.emf.ecore.change" />
				<arg value="org.eclipse.emf.ecore.xmi" />
				<arg value="org.eclipse.equinox.app" />
				<arg value="org.eclipse.equinox.bidi" />
				<arg value="org.eclipse.equinox.common" />
				<arg value="org.eclipse.equinox.p2.artifact.repository" />
				<arg value="org.eclipse.equinox.p2.core" />
				<arg value="org.eclipse.equinox.p2.engine" />
				<arg value="org.eclipse.equinox.p2.jarprocessor" />
				<arg value="org.eclipse.equinox.p2.metadata" />
				<arg value="org.eclipse.equinox.p2.metadata.repository" />
				<arg value="org.eclipse.equinox.p2.repository" />
				<arg value="org.eclipse.equinox.preferences" />
				<arg value="org.eclipse.equinox.registry" />
				<arg value="org.eclipse.equinox.security" />
				<arg value="org.eclipse.help" />
				<arg value="org.eclipse.jdt.core" />
				<arg value="org.eclipse.jdt.core.manipulation" />
				<arg value="org.eclipse.jdt.debug" />
				<arg value="org.eclipse.jdt.launching" />
				<arg value="org.eclipse.jdt.ui" />
				<arg value="org.eclipse.jface" />
				<arg value="org.eclipse.jface.databinding" />
				<arg value="org.eclipse.jface.text" />
				<arg value="org.eclipse.ltk.core.refactoring" />
				<arg value="org.eclipse.ltk.ui.refactoring" />
				<arg value="org.eclipse.osgi" />
				<arg value="org.eclipse.osgi.services" />
				<arg value="org.eclipse.osgi.util" />
				<arg value="org.eclipse.search" />
				<arg value="org.eclipse.swt" />
				<arg value="org.eclipse.swt.gtk.linux.x86_64" />
				<arg value="org.eclipse.team.core" />
				<arg value="org.eclipse.team.ui" />
				<arg value="org.eclipse.text" />
				<arg value="org.eclipse.ui" />
				<arg value="org.eclipse.ui.console" />
				<arg value="org.eclipse.ui.editors" />
				<arg value="org.eclipse.ui.forms" />
				<arg value="org.eclipse.ui.ide" />
				<arg value="org.eclipse.ui.navigator" />
				<arg value="org.eclipse.ui.navigator.resources" />
				<arg value="org.eclipse.ui.views" />
				<arg value="org.eclipse.ui.views.properties.tabbed" />
				<arg value="org.eclipse.ui.workbench" />
				<arg value="org.eclipse.ui.workbench.texteditor" />
				<arg value="org.eclipse.urischeme" />
				<arg value="org.tukaani.xz" />
				<arg value="org.w3c.css.sac" />
				<arg value="org.w3c.dom.events" />
				<arg value="org.w3c.dom.smil" />
				<arg value="org.w3c.dom.svg" />
			</java>
		</sequential>
	</macrodef>
	
	<target name="deps" depends="ivy.config, deps.jdk-runtime" description="Downloads all dependencies needed for common tasks">
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="javac6,javac8,ecj8,build,eclipse-oxygen,mapstruct,sources,stripe,buildtools,test" />
		<ivy:retrieve symlink="true" />
		<ivy:cachepath pathid="cp.javac6" conf="javac6" />
		<ivy:cachepath pathid="cp.javac8" conf="javac8" />
		<ivy:cachepath pathid="cp.ecj8" conf="ecj8" />
		<ivy:cachepath pathid="cp.build" conf="build" />
		<ivy:cachepath pathid="cp.eclipse-oxygen" conf="eclipse-oxygen" />
		<ivy:cachepath pathid="cp.mapstruct" conf="mapstruct" />
		<ivy:cachepath pathid="cp.stripe" conf="stripe" />
		<ivy:cachepath pathid="cp.buildtools" conf="buildtools" />
		<ivy:cachepath pathid="cp.test" conf="test" />
	</target>
	
	<fail>ant needs to be at least v1.10.0 or higher to build lombok. Your version is: ${ant.version}
		<condition>
			<not><antversion atleast="1.10.0" /></not>
		</condition>
	</fail>
	<fail>lombok must be compiled on jdk11 or later. Your version is: ${ant.java.version}
		<condition>
			<not><matches string="${ant.java.version}" pattern="${pattern.jdk11plus}" /></not>
		</condition>
	</fail>
</project>