-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
230 lines (205 loc) · 9.42 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
<!--
Copyright (C) 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="anyannotation" 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]" />
<property name="ivyplusplus.location" value="http://projectlombok.org/downloads/ivyplusplus.jar" />
<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
<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="filesToPatch">
<fileset dir="patchedJavac">
<include name="**/*.class" />
</fileset>
</path>
<target name="download-ipp" unless="ivyplusplus.available">
<mkdir dir="lib" />
<get src="${ivyplusplus.location}" dest="lib/ivyplusplus.jar" usetimestamp="true" />
</target>
<target name="load-ipp" depends="download-ipp">
<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
<ivy:ensureippversion version="1.7" property="ipp.versionOkay" />
</target>
<target name="checkver-ipp" depends="load-ipp" unless="ipp.versionOkay">
<get src="${ivyplusplus.location}" dest="lib/ivyplusplus.jar" />
<fail>ivyplusplus has been updated to a new version. Restart the script to continue.</fail>
</target>
<target name="ensure-ipp" depends="load-ipp, checkver-ipp" />
<target name="config-ivy" depends="ensure-ipp" unless="ivy.config">
<ivy:configure file="buildScripts/ivysettings.xml" />
<property name="ivy.config" value="true" />
</target>
<target name="deps" depends="ensureBuildDeps, ensureRuntimeDeps" description="Downloads all dependencies." />
<target name="ensureBuildDeps" depends="config-ivy">
<mkdir dir="lib/build" />
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build" />
<ivy:retrieve />
</target>
<target name="ensureRuntimeDeps" depends="config-ivy">
<mkdir dir="lib/runtime" />
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="runtime" />
<ivy:retrieve />
</target>
<target name="clean" description="Deletes build artifacts.">
<delete quiet="true" dir="dist" />
<delete quiet="true" dir="build" />
</target>
<target name="distclean" depends="clean" description="Deletes everything 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="anyannotation.iml" quiet="true" />
</target>
<target name="compile" depends="ensureBuildDeps, -unpackLibs" description="Compiles live agent code.">
<ivy:compile destdir="build/main" source="1.6" target="1.6" compiler="javac1.7">
<src path="src/main" />
<classpath refid="build.path" />
</ivy:compile>
</target>
<target name="patchedJavacCompile" depends="ensureBuildDeps" description="Compiles patches.">
<javac includeAntRuntime="false" compiler="javac1.7" srcdir="patchedJavac" destdir="patchedJavac" source="1.6" target="1.6" debug="true">
<include name="**/*.java" />
<classpath refid="build.path" />
</javac>
</target>
<target name="test" depends="patchedJavacCompile, dist" description="Runs test script. Requires posixy environment.">
<exec executable="/bin/bash" dir="test" osfamily="unix">
<arg line="./runTests.sh" />
</exec>
<exec executable="bash" dir="test" osfamily="windows">
<arg line="./runTests.sh" />
</exec>
</target>
<target name="-unpackLibs" depends="ensureRuntimeDeps">
<ivy:cachedunjar dest="build/main" marker="build/unpackDeps.marker">
<path refid="runtime.path" />
</ivy:cachedunjar>
</target>
<target name="dist" depends="compile" description="Creates the distributable.">
<mkdir dir="dist" />
<mkdir dir="build/replacements/replacements" />
<copy todir="build/replacements/replacements">
<fileset dir="patchedJavac">
<include name="**/*.class" />
</fileset>
<globmapper from="*.class" to="*.class.rpl" />
</copy>
<property name="filesToPatch.txt" refid="filesToPatch" />
<echo file="build/replacements/replacements/classesToPatch_anyannotation.txt">${filesToPatch.txt}</echo>
<jar destfile="dist/anyannotation.jar">
<fileset dir=".">
<include name="README*" />
</fileset>
<fileset dir="build/main" />
<fileset dir="build/replacements" />
<manifest>
<attribute name="Premain-Class" value="org.projectlombok.anyannotation.JavaPatcher" />
<attribute name="Can-Redefine-Classes" value="true" />
</manifest>
</jar>
<jar destfile="dist/anyannotation-sources.jar">
<fileset dir=".">
<include name="README*" />
<include name="doc/**" />
<include name="src/**" />
<include name="build.xml" />
<include name="buildScripts/**" />
</fileset>
</jar>
</target>
<target name="contrib" 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, javac6" />
<ivy:retrieve />
</target>
<target name="intellij" depends="deps, contrib" description="Creates intellij project files and downloads all dependencies. Open this directory as a project in IntelliJ after running this target.">
<ivy:intellijgen>
<conf name="build" sources="contrib" />
<module name="anyannotation" depends="build, test">
<srcdir dir="src/main" />
<srcdir dir="patchedJavac" />
</module>
<settings>
<url url="http://projectlombok.org/downloads/lombok.intellij.settings" />
</settings>
</ivy:intellijgen>
</target>
<target name="eclipse" depends="deps, contrib" 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="patchedJavac" />
<conf name="build" sources="contrib" />
<settings>
<url url="http://projectlombok.org/downloads/lombok.eclipse.settings" />
</settings>
</ivy:eclipsegen>
</target>
<target name="createJavacPatch" description="Creates a patch file for javac">
<mkdir dir="build/original/com/sun/tools/javac/comp/"/>
<mkdir dir="build/original/com/sun/tools/javac/model/"/>
<mkdir dir="build/patch/comp/"/>
<mkdir dir="build/patch/model/"/>
<get
src="http://hg.openjdk.java.net/jdk7/jdk7/langtools/raw-file/6762754eb7c0/src/share/classes/com/sun/tools/javac/comp/Annotate.java"
dest="build/original/com/sun/tools/javac/comp/"
skipexisting="true"
/>
<get
src="http://hg.openjdk.java.net/jdk7/jdk7/langtools/raw-file/6762754eb7c0/src/share/classes/com/sun/tools/javac/comp/Check.java"
dest="build/original/com/sun/tools/javac/comp/"
skipexisting="true"
/>
<get
src="http://hg.openjdk.java.net/jdk7/jdk7/langtools/raw-file/6762754eb7c0/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java"
dest="build/original/com/sun/tools/javac/model/"
skipexisting="true"
/>
<exec executable="diff" output="build/patch/comp/Annotate.patch">
<arg line="build/original/com/sun/tools/javac/comp/Annotate.java patchedJavac/com/sun/tools/javac/comp/Annotate.java" />
</exec>
<exec executable="diff" output="build/patch/comp/Check.patch">
<arg line="build/original/com/sun/tools/javac/comp/Check.java patchedJavac/com/sun/tools/javac/comp/Check.java" />
</exec>
<exec executable="diff" output="build/patch/model/AnnotationProxyMaker.patch">
<arg line="build/original/com/sun/tools/javac/model/AnnotationProxyMaker.java patchedJavac/com/sun/tools/javac/model/AnnotationProxyMaker.java" />
</exec>
</target>
<target name="createJrePatch" description="Creates a patch file for the JRE">
<mkdir dir="build/original/sun/reflect/annotation/"/>
<mkdir dir="build/patch/annotation/"/>
<get
src="http://hg.openjdk.java.net/jdk7/jdk7/jdk/raw-file/00cd9dc3c2b5/src/share/classes/sun/reflect/annotation/AnnotationParser.java"
dest="build/original/sun/reflect/annotation/"
skipexisting="true"
/>
<exec executable="diff" output="build/patch/annotation/AnnotationParser.patch">
<arg line="build/original/sun/reflect/annotation/AnnotationParser.java patchedJre/sun/reflect/annotation/AnnotationParser.java" />
</exec>
</target>
</project>