forked from rzwitserloot/lombok.ast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
376 lines (336 loc) · 16.2 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
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
365
366
367
368
369
370
371
372
373
374
375
376
<!--
Copyright (C) 2010-2012 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.ast" default="dist" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus">
<property name="build.compiler" value="javac1.6" />
<property name="ivy.retrieve.pattern" value="lib/[conf]/[artifact].[ext]" />
<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
<available file="doc/jls/j3TOC.html" property="jls-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="ensure-ipp" depends="download-ipp">
<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
</target>
<path id="build.path">
<fileset dir="lib/build">
<include name="*.jar" />
</fileset>
</path>
<path id="runtime.path">
<fileset dir="lib/runtime">
<include name="*.jar" />
</fileset>
</path>
<path id="test.path">
<fileset dir="lib/test">
<include name="*.jar" />
</fileset>
</path>
<target name="-defSSH" depends="ensureBuildDeps">
<taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="build.path" />
<taskdef name="sshexec" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="build.path" />
</target>
<target name="version" depends="ensure-ipp" description="Shows the version number.">
<mkdir dir="build/lombok.ast" />
<ivy:compile destdir="build/lombok.ast" srcdir="src/main" includes="lombok/ast/Version.java" />
<java
classname="lombok.ast.Version"
classpath="build/lombok.ast"
failonerror="true"
output="build/version.txt" />
<ivy:loadversion property="lombok.ast.version" file="build/version.txt" />
<echo level="info">Lombok ast version: ${lombok.ast.version}</echo>
</target>
<target name="clean" description="Deletes build artefacts (but does not delete downloaded dependencies)">
<delete dir="build" quiet="true" />
<delete dir="report" quiet="true" />
<delete file="cobertura.ser" quiet="true" />
</target>
<target name="distclean" depends="clean" description="Deletes everything that this build script has ever generated.">
<delete dir="lib" quiet="true" />
<delete file=".project" quiet="true" />
<delete file=".classpath" quiet="true" />
<delete dir=".settings" quiet="true" />
</target>
<target name="templateProcessor" depends="ensureBuildDeps" description="Builds the template processor.">
<ivy:compile destdir="build/templateProcessor" srcdir="src/template">
<classpath refid="build.path" />
</ivy:compile>
<mkdir dir="build/templateProcessor/META-INF" />
<mkdir dir="build/templateProcessor/META-INF/services" />
<echo file="build/templateProcessor/META-INF/services/javax.annotation.processing.Processor">lombok.ast.template.TemplateProcessor</echo>
<jar destfile="build/templateProcessor.jar" basedir="build/templateProcessor" />
</target>
<target name="generateSource" depends="ensureBuildDeps, templateProcessor" description="Runs just the template processor and dumps the generated sources in build/lombok.ast_generatedSource">
<mkdir dir="build/lombok.ast_generatedSource" />
<ivy:compile destdir="build/lombok.ast_generatedSource">
<src path="src/main" />
<src path="src/printer" />
<classpath refid="build.path" />
<classpath location="build/templateProcessor.jar" />
<compilerarg value="-proc:only" />
<compilerarg value="-s" />
<compilerarg path="build/lombok.ast_generatedSource" />
</ivy:compile>
<echo>NOTE: If you see a wash of errors above this line, ignore them. Compilation succeeded; this is a javac bug.</echo>
</target>
<target name="-compileNeeded">
<uptodate property="build.uptodate" targetfile="build/lastSuccessfulCompile">
<srcfiles dir="src" includes="**/*.java" />
</uptodate>
</target>
<target name="compile" depends="-compileNeeded, ensureBuildDeps, templateProcessor" description="Compiles all code for lombok.ast" unless="build.uptodate">
<!--
Because of the way annotations in file A influence the generation behaviour for file B, either compile everything or nothing; no incremental compiling works (at least for the ast classes).
To avoid needless recompilation of everything when nothing changed, we use a separate file to track if we need to compile anything.
-->
<tstamp>
<format property="compile.started" pattern="yyyyMMddHHmmssSSS" />
</tstamp>
<delete dir="build/lombok.ast" quiet="true" />
<delete dir="build/lombok.ast_generatedSource" quiet="true" />
<mkdir dir="build/lombok.ast_generatedSource" />
<ivy:compile destdir="build/lombok.ast">
<src path="src/main" />
<src path="src/printer" />
<src path="src/javacTransformer" />
<src path="src/ecjTransformer" />
<classpath location="build/templateProcessor.jar" />
<classpath refid="build.path" />
<compilerarg value="-s" />
<compilerarg path="build/lombok.ast_generatedSource" />
</ivy:compile>
<touch file="build/lastSuccessfulCompile" datetime="${compile.started}" pattern="yyyyMMddHHmmssSSS" />
</target>
<target name="-test.quiet">
<property name="tests.quiet" value="true" />
</target>
<target name="test" depends="compile, ensureTestDeps, ensureRuntimeDeps, compileTests" description="Runs unit tests.">
<junit fork="on">
<formatter type="plain" usefile="false" unless="tests.quiet" />
<jvmarg value="-Xbootclasspath/p:lib/test/javac.jar" />
<classpath refid="test.path" />
<classpath refid="runtime.path" />
<classpath path="build/instrumented/lombok.ast" />
<classpath path="build/lombok.ast" />
<classpath path="build/tests" />
<batchtest>
<fileset dir="test/src">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="compileTests" depends="compile, ensureTestDeps" description="compiles test code">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="test" />
<mkdir dir="build/tests" />
<ivy:compile destdir="build/tests" srcdir="test/src">
<classpath refid="test.path" />
<classpath location="build/lombok.ast" />
</ivy:compile>
</target>
<target name="build-cobertura-instrumentation" depends="compile, ensureTestDeps">
<taskdef name="cobertura-instrument" classname="net.sourceforge.cobertura.ant.InstrumentTask" classpathref="test.path" />
<mkdir dir="instrumented/lombok.ast" />
<cobertura-instrument todir="build/instrumented/lombok.ast">
<fileset dir="build/lombok.ast">
<include name="**/ast/printer/*.class"/>
</fileset>
</cobertura-instrument>
</target>
<target name="build-current-cobertura-report" depends="ensureTestDeps">
<taskdef name="cobertura-report" classname="net.sourceforge.cobertura.ant.ReportTask" classpathref="test.path" />
<mkdir dir="build/cobertura" />
<cobertura-report format="html" destdir="build/cobertura">
<fileset dir="src/printer">
<include name="**/*.java" />
</fileset>
</cobertura-report>
</target>
<target name="show-cobertura-report" depends="clean, generateSource, compile, build-cobertura-instrumentation, test, build-current-cobertura-report"
description="Runs tests and shows a test report.">
<ivy:show-html file="build/cobertura/index.html" />
</target>
<target name="config-ivy" depends="ensure-ipp">
<ivy:configure file="buildScripts/ivysettings.xml" />
</target>
<target name="show-dep-report" depends="ensureRuntimeDeps" description="Displays a dependencies report">
<ivy:show-dep-report />
</target>
<target name="deps" depends="ensureBuildDeps, ensureRuntimeDeps, ensureTestDeps" />
<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" />
<ivy:retrieve />
</target>
<target name="fetchJLS" unless="jls-available">
<mkdir dir="doc/jls" />
<get src="http://projectlombok.org/ivyrepo/langtools/langspec-3.0.zip" dest="doc/jls/langspec-3.0.zip" verbose="on" />
<unzip src="doc/jls/langspec-3.0.zip" dest="doc/jls" />
<delete file="doc/jls/langspec-3.0.zip" />
</target>
<target name="contrib" depends="config-ivy, fetchJLS" description="Downloads and builds useful but optional extras, such as sources to used libraries.">
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="contrib" />
<ivy:retrieve />
</target>
<target name="unpackLibs" depends="ensureRuntimeDeps">
<unjar dest="build/lombok.ast">
<path refid="runtime.path" />
</unjar>
</target>
<target name="dist" depends="compile, version, unpackLibs" description="Creates distributable.">
<mkdir dir="dist" />
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/build/jarjar.jar" />
<jarjar destfile="dist/lombok.ast-${lombok.ast.version}.jar">
<fileset dir="build/lombok.ast" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
<rule pattern="com.google.common.**" result="lombok.ast.libs.com.google.common.@1" />
<rule pattern="org.parboiled.**" result="lombok.ast.libs.org.parboiled.@1" />
<rule pattern="com.zwitserloot.cmdreader.**" result="lombok.ast.libs.com.zwitserloot.cmdreader.@1" />
<manifest>
<attribute name="Main-Class" value="lombok.ast.app.Main" />
<attribute name="Lombok-Ast-Version" value="${lombok.ast.version}" />
<attribute name="Class-Path" value="ecj.jar javac.jar" />
</manifest>
</jarjar>
<copy file="dist/lombok.ast-${lombok.ast.version}.jar" tofile="dist/lombok.ast.jar" />
</target>
<target name="javadoc" depends="version, generateSource" description="Generates the javadoc.">
<delete dir="build/api" quiet="true" />
<delete dir="doc/api" quiet="true" />
<mkdir dir="build/api" />
<javadoc defaultexcludes="yes" destdir="build/api" windowtitle="lombok.ast">
<fileset dir="src/main" />
<fileset dir="src/javacTransformer" />
<fileset dir="src/ecjTransformer" />
<fileset dir="src/printer" />
<fileset dir="build/lombok.ast_generatedSource" />
<classpath location="build/templateProcessor.jar" />
<classpath refid="build.path" />
<link href="http://download.oracle.com/javase/6/docs/api/" />
<header><![CDATA[<a href='http://projectlombok.org/' target='_blank'>Lombok.ast</a> - ]]>v${lombok.ast.version}</header>
<bottom><![CDATA[<i>Copyright © 2010-2011 The Project Lombok Authors, licensed under the <a href='http://www.opensource.org/licenses/mit-license.php'>MIT licence</a>.]]></bottom>
</javadoc>
<!-- bugfix for boneheaded javadoc bug where ?is-external=true is inserted before an anchor ref, breaking the anchor ref.
is-external=true doesn't actually do anything, so, we'll just get rid of it. -->
<replaceregexp match="\?is-external=true#" replace="#" flags="gi">
<fileset dir="build/api" includes="**/*.html" />
</replaceregexp>
<mkdir dir="doc/api" />
<copy todir="doc/api">
<fileset dir="build/api" includes="**/*.html" />
<filterchain>
<linecontainsregexp negate="true">
<regexp pattern="(Generated by javadoc)|(.META NAME=.date.)" />
</linecontainsregexp>
</filterchain>
</copy>
<copy todir="doc/api">
<fileset dir="build/api" excludes="**/*.html" />
</copy>
</target>
<target name="maven" depends="version, dist, javadoc" description="Build a maven artifact bundle for lombok.ast.">
<jar destfile="dist/lombok.ast-${lombok.ast.version}-javadoc.jar">
<fileset dir="doc/api" />
</jar>
<jar destfile="dist/lombok.ast-${lombok.ast.version}-sources.jar">
<fileset dir="src/ecjTransformer" />
<fileset dir="src/javacTransformer" />
<fileset dir="src/main" />
<fileset dir="src/printer" />
<fileset dir="src/template" />
</jar>
<mkdir dir="build/mavenPublish" />
<copy tofile="build/mavenPublish/pom.xml" overwrite="true" file="doc/maven-pom.xml">
<filterchain>
<replacetokens>
<token key="VERSION" value="${lombok.ast.version}" />
</replacetokens>
</filterchain>
</copy>
<tar destfile="build/mavenPublish/lombok.ast-mavenPublish.tar.bz2" compression="bzip2">
<tarfileset dir="dist">
<include name="lombok.ast-${lombok.ast.version}.jar" />
<include name="lombok.ast-${lombok.ast.version}-sources.jar" />
<include name="lombok.ast-${lombok.ast.version}-javadoc.jar" />
</tarfileset>
<tarfileset dir="build/mavenPublish" includes="pom.xml" />
</tar>
</target>
<target name="maven-publish" depends="maven, test, -defSSH" description="Build a maven artifact bundle then upload it to projectlombok.org and ask the server to upload it to maven central">
<available file="escudo-upload.key" property="escudo.key.available" />
<fail unless="escudo.key.available">You don't have the escudo-upload.key; you'll need it to get write access to the server.</fail>
<scp
localFile="build/mavenPublish/lombok.ast-mavenPublish.tar.bz2"
todir="lombokup@projectlombok.org:/staging"
keyfile="escudo-upload.key" passphrase=""
sftp="false" verbose="true" trust="true" />
<sshexec
host="projectlombok.org"
username="lombokup"
keyfile="escudo-upload.key" passphrase=""
trust="true" command="./publishToMavenCentral-lombok.ast" />
<echo>The artifact has been published to staging. Now go to http://oss.sonatype.org/ and log in as Reinier, then doublecheck if all is well and 'release' it.</echo>
<sshexec
host="projectlombok.org"
username="lombokup"
keyfile="escudo-upload.key" passphrase=""
trust="true" command="./showMavenCentralPassword" />
</target>
<target name="publish-all" depends="publish, maven-publish" description="Publishes both to projectlombok.org and maven central."/>
<target name="publish" depends="dist, test, -defSSH" description="Creates distributable and uploads to projectlombok.org">
<available file="escudo-upload.key" property="escudo.key.available" />
<fail unless="escudo.key.available">You don't have the escudo-upload.key; you'll need it to get write access to the server.</fail>
<scp
localFile="dist/lombok.ast-${lombok.ast.version}.jar"
todir="lombokup@projectlombok.org:/web/downloads"
keyfile="escudo-upload.key" passphrase=""
sftp="false" verbose="true" trust="true" />
<sshexec
host="projectlombok.org"
username="lombokup"
keyfile="escudo-upload.key" passphrase=""
trust="true" command="./deployLombokAst '${lombok.ast.version}'" />
</target>
<target name="eclipse" depends="deps, contrib, templateProcessor" description="Creates eclipse project files and downloads all dependencies. Open this directory as project in eclipse after running this target.">
<ivy:eclipsegen>
<srcdir dir="src/main" />
<srcdir dir="src/printer" />
<srcdir dir="src/template" />
<srcdir dir="src/javacTransformer" />
<srcdir dir="src/ecjTransformer" />
<srcdir dir="test/src" />
<apt location="build/templateProcessor.jar" />
<conf name="build" sources="contrib" />
<conf name="test" sources="contrib" />
<settings>
<url url="http://projectlombok.org/downloads/lombok.eclipse.settings" />
</settings>
</ivy:eclipsegen>
</target>
</project>