forked from peichhorn/lombok-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
329 lines (294 loc) · 13.1 KB
/
build.xml
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
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="lombok-pg" default="dist" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>
This buildfile is part of lombok-ds. It is the main entry point that contains
the common tasks and can be called on to run the main aspects of all the sub-scripts.
</description>
<property name="build.compiler" value="javac1.6" />
<!-- resolve -->
<property name="ivy.retrieve.pattern" value="lib/[conf]/[artifact].[ext]" />
<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
<target name="download-ipp" unless="ivyplusplus.available">
<mkdir dir="lib" />
<get src="http://projectlombok.org/downloads/ivyplusplus.jar" dest="lib/ivyplusplus.jar" usetimestamp="true" />
</target>
<target name="download-maven-ant-tasks" unless="maven.available">
<mkdir dir="lib" />
<get src="http://apache.lehtivihrea.org//maven/binaries/maven-ant-tasks-2.1.3.jar" dest="lib/maven-ant-tasks.jar" usetimestamp="true" />
</target>
<target name="ensure-ipp" depends="download-ipp">
<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
</target>
<target name="ensure-maven-ant-tasks" depends="download-maven-ant-tasks">
<taskdef classpath="lib/maven-ant-tasks.jar" resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" />
</target>
<target name="config-ivy" depends="ensure-ipp">
<ivy:configure file="buildScripts/ivysettings.xml" />
</target>
<target name="deps" depends="ensureBuildDeps, ensureRuntimeDeps, ensureTestDeps, ensureContribDeps" description="Downloads all dependencies." />
<target name="ensureBuildDeps" depends="config-ivy">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build" />
<ivy:retrieve />
</target>
<target name="ensureRuntimeDeps" depends="config-ivy">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="runtime" />
<ivy:retrieve />
</target>
<target name="ensureTestDeps" depends="config-ivy">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="test, javac6, javac7, eclipseBuild" />
<ivy:retrieve />
</target>
<target name="ensureContribDeps" depends="config-ivy" description="Downloads various non-crucial documentation, sources, etc that are useful when developing lombok.ast.">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="contrib" />
<ivy:retrieve />
</target>
<!-- IDE integration -->
<target name="eclipse" depends="deps" description="Creates eclipse project files and downloads all dependencies. Open this directory as project in eclipse after running this target.">
<ivy:eclipsegen source="1.6">
<srcdir dir="src/core" />
<srcdir dir="src/eclipse" />
<srcdir dir="src/javac" />
<srcdir dir="test/eclipse" />
<srcdir dir="test/javac" />
<conf name="build" sources="contrib" />
<conf name="test" sources="contrib" />
<settings>
<url url="http://cloud.github.com/downloads/peichhorn/lombok-ds/lombok.eclipse.settings" />
</settings>
<apt location="lib/build/spi.jar" />
</ivy:eclipsegen>
<condition property="startOnFirstThread" value="-XstartOnFirstThread" else="">
<os family="mac" />
</condition>
<copy file="buildScripts/eclipse-debug-target.template" tofile="eclipse lombok-ds (JavaSE-1.6).launch" preservelastmodified="true" overwrite="true">
<filterset>
<filter token="START_ON_FIRST_THREAD" value="${startOnFirstThread}" />
</filterset>
</copy>
<copy file="buildScripts/java6-test-target.template" tofile="test lombok-ds (JavaSE-1.6).launch" preservelastmodified="true" overwrite="true" />
</target>
<!-- clean -->
<target name="clean" description="Removes all generated files.">
<delete dir="build" quiet="true" />
</target>
<target name="distclean" 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="ivyCache" quiet="true" />
</target>
<!-- compile -->
<path id="build.path">
<fileset dir="lib/build">
<include name="*.jar" />
</fileset>
</path>
<target name="unpackLibs" depends="ensureBuildDeps">
<ivy:cachedunjar dest="build/lombok-ds" marker="build/unpackDeps.marker">
<fileset file="lib/build/lombok.jar" />
</ivy:cachedunjar>
</target>
<target name="compile" depends="ensureBuildDeps, unpackLibs" description="Compiles the code.">
<delete file="build/lombok-ds/META-INF/services/javax.annotation.processing.Processor" quiet="true" />
<ivy:compile destdir="build/lombok-ds" source="1.6" target="1.6" includeantruntime="false">
<src path="src/core" />
<src path="src/eclipse" />
<src path="src/javac" />
<classpath location="build/lombok-ds" />
<classpath refid="build.path" />
</ivy:compile>
<mkdir dir="build/lombok-ds/META-INF" />
<mkdir dir="build/lombok-ds/META-INF/services" />
<echo file="build/lombok-ds/META-INF/services/javax.annotation.processing.Processor">lombok.core.AnnotationProcessor</echo>
</target>
<!-- version -->
<target name="version" depends="ensure-ipp" description="Shows the version number." unless="lombok.version">
<mkdir dir="build/lombok-ds" />
<javac includeDestClasses="false" srcdir="src/core" debug="on" destdir="build/lombok-ds" source="1.5" target="1.5" includes="lombok/core/Version.java" includeantruntime="false" />
<java classname="lombok.core.Version" classpath="build/lombok-ds" failonerror="true" output="build/version.txt" />
<ivy:loadversion property="lombok.version" file="build/version.txt" />
<echo level="info">lombok-ds is based on lombok-${lombok.version}</echo>
<condition property="lombok.version.is.snapshot">
<matches pattern=".*-SNAPSHOT" string="${lombok.version}" />
</condition>
</target>
<target name="init.version.snapshot" depends="version" unless="lombok.version.is.snapshot">
<property name="lombok.version.snapshot" value="${lombok.version}-SNAPSHOT" />
</target>
<target name="version.snapshot" depends="version, init.version.snapshot">
<property name="lombok.version.snapshot" value="${lombok.version}" />
</target>
<!-- test -->
<path id="test.path">
<fileset dir="lib/test">
<include name="*.jar" />
</fileset>
</path>
<path id="eclipseBuild.path">
<fileset dir="lib/eclipseBuild">
<include name="*.jar" />
</fileset>
</path>
<target name="test-compile" depends="ensureTestDeps, compile" unless="skipTests">
<mkdir dir="build/tests" />
<ivy:compile destdir="build/tests" source="1.5" target="1.5" includeantruntime="false">
<classpath refid="test.path" />
<classpath refid="build.path" />
<classpath path="build/lombok-ds" />
<src path="test/eclipse" />
<src path="test/javac" />
</ivy:compile>
<copy todir="build/tests">
<fileset dir="test/transform/resource" />
</copy>
</target>
<target name="test" depends="test-compile, dist" unless="tests.skip" description="Runs the tests.">
<junit haltonfailure="yes" fork="true">
<jvmarg value="-javaagent:dist/lombok.jar" />
<formatter type="plain" usefile="false" unless="tests.quiet" />
<classpath refid="test.path" />
<classpath refid="eclipseBuild.path" />
<classpath path="lib/javac6/javac6.jar" />
<classpath path="build/tests" />
<batchtest>
<fileset dir="test/eclipse">
<include name="**/*Test*.java" />
</fileset>
<fileset dir="test/javac">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
<echo level="info">All tests successful.</echo>
</target>
<!-- dist -->
<target name="dist" description="Builds the lombok-ds artifacts" depends="compile, version">
<mkdir dir="dist" />
<jar destfile="dist/lombok-ds-${lombok.version}.jar">
<fileset dir="build/lombok-ds" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
<manifest>
<attribute name="Premain-Class" value="lombok.core.LombokPGAgent" />
<attribute name="Agent-Class" value="lombok.core.LombokPGAgent" />
<attribute name="Can-Redefine-Classes" value="true" />
<attribute name="Main-Class" value="lombok.core.Main" />
<attribute name="Lombok-Version" value="${lombok.version}" />
</manifest>
</jar>
<!-- So the ecj-tests can run properly -->
<copy file="dist/lombok-ds-${lombok.version}.jar" tofile="dist/lombok.jar" />
<property name="lombok.dist.built" value="true" />
</target>
<!-- dist additional files -->
<target name="dist-additional" depends="dist">
<jar destfile="dist/lombok-ds-${lombok.version}-runtime.jar">
<fileset dir="build/lombok-ds">
<include name="*lombok/*.class" />
<include name="*lombok/extern/**/*.class" />
</fileset>
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
<manifest>
<attribute name="Lombok-Version" value="${lombok.version}" />
</manifest>
</jar>
<jar destfile="dist/lombok-ds-${lombok.version}-sources.jar">
<fileset dir="src/core" />
<fileset dir="src/eclipse" />
<fileset dir="src/javac" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
</jar>
<ant antfile="buildScripts/javadoc.ant.xml" target="javadoc" inheritAll="false">
<property name="lombok.version" value="${lombok.version}" />
</ant>
<jar destfile="dist/lombok-ds-${lombok.version}-javadoc.jar">
<fileset dir="build/javadoc" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
</jar>
</target>
<!-- deploy -->
<target name="maven-deploy" depends="ensure-maven-ant-tasks, dist, dist-additional, test, version.snapshot" description="Deploy snapshot version to Maven snapshot repository">
<!-- create pom -->
<copy tofile="dist/pom.xml" overwrite="true" file="buildScripts/maven-pom.xml">
<filterchain>
<replacetokens>
<token key="VERSION" value="${lombok.version.snapshot}" />
</replacetokens>
</filterchain>
</copy>
<!-- main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/content/repositories/snapshots/" />
<arg value="-DrepositoryId=sonatype-nexus-snapshots" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-ds-${lombok.version}.jar" />
<arg value="-DuniqueVersion=false" />
</artifact:mvn>
<!-- runtime artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/content/repositories/snapshots/" />
<arg value="-DrepositoryId=sonatype-nexus-snapshots" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-ds-${lombok.version}-runtime.jar" />
<arg value="-DuniqueVersion=false" />
<arg value="-Dclassifier=runtime" />
</artifact:mvn>
</target>
<!-- stage -->
<target name="maven-stage" depends="ensure-maven-ant-tasks, dist, dist-additional, test" description="Deploy release version to Maven staging repository">
<!-- create pom -->
<copy tofile="dist/pom.xml" overwrite="true" file="buildScripts/maven-pom.xml">
<filterchain>
<replacetokens>
<token key="VERSION" value="${lombok.version}" />
</replacetokens>
</filterchain>
</copy>
<!-- main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<arg value="-DrepositoryId=sonatype-nexus-staging" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-ds-${lombok.version}.jar" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- runtime artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<arg value="-DrepositoryId=sonatype-nexus-staging" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-ds-${lombok.version}-runtime.jar" />
<arg value="-Dclassifier=runtime" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<arg value="-DrepositoryId=sonatype-nexus-staging" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-ds-${lombok.version}-sources.jar" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<arg value="-DrepositoryId=sonatype-nexus-staging" />
<arg value="-DpomFile=dist/pom.xml" />
<arg value="-Dfile=dist/lombok-pg-${lombok.version}-javadoc.jar" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>