aboutsummaryrefslogtreecommitdiff
path: root/build.xml
blob: 588dd8afe2c40674039d35c9e4a3c372bba3fa9e (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
<project name="lombok" default="dist">
	<property name="build.compiler" value="javac1.6" />
	<path id="lombok.deps.path">
		<fileset dir="deps/lombok">
			<include name="**/*.jar" />
		</fileset>
	</path>
	<path id="lombok.libs.path">
		<fileset dir="lib/lombok">
			<include name="**/*.jar" />
		</fileset>
	</path>

	<path id="eclipse.agent.deps.path">
		<fileset dir="deps/eclipse.agent">
			<include name="**/*.jar" />
		</fileset>
	</path>
	<path id="eclipse.agent.libs.path">
		<fileset dir="lib/eclipse.agent">
			<include name="**/*.jar" />
		</fileset>
	</path>
	
	<target name="clean">
		<delete dir="build" quiet="true" />
		<delete dir="dist" quiet="true" />
	</target>
	
	<target name="compile">
		<mkdir dir="build/lombok" />
		<!-- This version trickery is so that an eclipse running in a JVM 1.5 will run properly (It'll never touch the javac files and hence never trigger a Bad Class Version Number error
		     but for javac we definitely cannot support javac 1.5, partly because they completely rewrote large swaths of javac, and partly because our injection mechanism (annotations)
		     doesn't work very well on javac 1.5, hence, when using javac, we do demand you're on 1.6. -->
		<javac srcdir="src" debug="on" destdir="build/lombok" target="1.5" excludes="lombok/javac/**">
			<classpath refid="lombok.deps.path" />
			<classpath refid="lombok.libs.path" />
		</javac>
		<javac srcdir="src" debug="on" destdir="build/lombok" target="1.6" includes="lombok/javac/**">
			<classpath refid="lombok.deps.path" />
			<classpath refid="lombok.libs.path" />
		</javac>
		<copy todir="build/lombok">
			<fileset dir="src">
				<exclude name="**/*.java" />
				<exclude name="**/*.class" />
				<exclude name="**/*.svg" />
			</fileset>
		</copy>

		<mkdir dir="build/lombok/META-INF" />
		<mkdir dir="build/lombok/META-INF/services" />
		<echo file="build/lombok/META-INF/services/javax.annotation.processing.Processor">lombok.javac.apt.Processor</echo>
		
		<mkdir dir="build/eclipse.agent" />
		<javac srcdir="src_eclipseagent" debug="on" destdir="build/eclipse.agent" target="1.5">
			<classpath refid="eclipse.agent.deps.path" />
			<classpath refid="eclipse.agent.libs.path" />
		</javac>
	</target>
	
	<target name="unpackLibs">
		<unjar dest="build/lombok">
			<path refid="lombok.libs.path" />
		</unjar>
		<unjar dest="build/eclipse.agent">
			<path refid="eclipse.agent.libs.path" />
		</unjar>
	</target>
	
	<target name="getVersion" depends="compile">
		<java
			classname="lombok.core.Version"
			classpath="build/lombok"
			failonerror="true"
			output="build/version.txt" />
		<loadresource property="lombok.version">
			<file file="build/version.txt" />
			<filterchain>
				<striplinebreaks />
			</filterchain>
		</loadresource>
		<delete file="build/version.txt" quiet="true" />
		<echo level="info">Lombok version: ${lombok.version}</echo>
	</target>
	
	<target name="dist" depends="clean, compile, getVersion, unpackLibs">
		<mkdir dir="dist" />
		<jar basedir="build/eclipse.agent" destfile="dist/lombok.eclipse.agent-${lombok.version}.jar">
			<manifest>
				<attribute name="Premain-Class" value="lombok.eclipse.agent.EclipsePatcher" />
				<attribute name="Can-Redefine-Classes" value="true" />
			</manifest>
		</jar>
		<copy file="dist/lombok.eclipse.agent-${lombok.version}.jar" tofile="dist/lombok.eclipse.agent.jar" />
		<jar destfile="dist/lombok-${lombok.version}.jar">
			<fileset dir="build/lombok" />
			<fileset dir="dist" includes="lombok.eclipse.agent.jar" />
				
			<manifest>
				<attribute name="Main-Class" value="lombok.installer.InstallerWindow" />
			</manifest>
		</jar>
		<copy file="dist/lombok-${lombok.version}.jar" tofile="dist/lombok.jar" />
	</target>
</project>