aboutsummaryrefslogtreecommitdiff
path: root/buildScripts/deps/lombok-patcher.ant.xml
blob: c0dfbf770551fed5dbab4bccfd502d37a211a4c0 (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
<!--
  Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
  
  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-deps-lombok-patcher" basedir="../.." default="install">
	<description>
This buildfile is part of projectlombok.org. It responsible for finding, downloading, and updating the lombok.patcher dependency.
	</description>
	<import file="../git.ant.xml" />
	
	<property name="lombok.patcher.giturl" value="git://github.com/rzwitserloot/lombok.patcher.git" />
	<property name="lombok.patcher.dir" location="../lombok.patcher" />
	<property name="lombok.patcher.fileurl" value="http://projectlombok.org/downloads/lombok-patcher.jar" />
	<property name="lombok.patcher.fileloc" location="lib/lombok/lombok-patcher.jar" />
	
	<target name="install-silent" depends="-check-lombok.patcher, -update-git-lombok.patcher, -update-file-lombok.patcher">
		<condition property="lombok.patcher.git.grab">
			<not><isset property="lombok.patcher.available.git" /></not>
		</condition>
		<antcall target="-grab-git-lombok.patcher" />
		<antcall target="-update-git-lombok.patcher" />
	</target>
	
	<target name="install" depends="-check-lombok.patcher, -missing1-lombok.patcher, -missing2-lombok.patcher, -update-git-lombok.patcher" />
	
	<target name="update" depends="-check-lombok.patcher, -warn-lombok.patcher, -update-git-lombok.patcher, -check-replace-lombok.patcher, -replace-lombok.patcher">
		<condition property="lombok.patcher.file.update">
			<and>
				<isset property="lombok.patcher.available.file" />
				<not><isset property="lombok.patcher.available.git" /></not>
			</and>
		</condition>
		<antcall target="-update-file-lombok.patcher" />
	</target>
	
	<target name="build" depends="-check-lombok.patcher, -warn-lombok.patcher, -check-replace-lombok.patcher, -replace-lombok.patcher" />
	
	<target name="-warn-lombok.patcher" unless="lombok.patcher.available">
		<fail>You don't have any version of lombok-patcher.jar installed. Run 'ant installDeps' to fix this.</fail>
	</target>
	
	<target name="-check-replace-lombok.patcher" if="lombok.patcher.checkreplace.git">
		<ant dir="${lombok.patcher.dir}" target="dist" inheritAll="false" />
		
		<condition property="lombok.patcher.replace">
			<or>
				<not><available file="${lombok.patcher.fileloc}" /></not>
				<not><uptodate
						srcfile="${lombok.patcher.dir}/dist/lombok-patcher.jar"
						targetfile="${lombok.patcher.fileloc}" /></not>
			</or>
		</condition>
	</target>
	
	<target name="-replace-lombok.patcher" if="lombok.patcher.replace">
		<copy file="${lombok.patcher.dir}/dist/lombok-patcher.jar" tofile="${lombok.patcher.fileloc}" />
		<echo level="info">** UPDATED: ${lombok.patcher.fileloc}</echo>
	</target>
	
	<target name="-check-lombok.patcher">
		<available file="${lombok.patcher.dir}/.project" property="lombok.patcher.available.git" />
		<available file="${lombok.patcher.fileloc}" property="lombok.patcher.available.file" />
		<condition property="lombok.patcher.available">
			<or>
				<isset property="lombok.patcher.available.git" />
				<isset property="lombok.patcher.available.file" />
			</or>
		</condition>
		<condition property="lombok.patcher.skip.missing2">
			<isset property="lombok.patcher.available.git" />
		</condition>
		<condition property="lombok.patcher.checkreplace.git">
			<isset property="lombok.patcher.available.git" />
		</condition>
	</target>
	
	<target name="-missing1-lombok.patcher" unless="lombok.patcher.available">
		<property name="lombok.patcher.skip.missing2" value="true" />
		<input validArgs="s,S,skip,Skip,SKIP,g,G,get,Get,GET,d,D,download,Download,DOWNLOAD" addproperty="missing1.feedback">
You don't have the lombok.patcher dependency. I can grab the lombok.patcher project form version control. If you want me to do so, I will put the project in a sibling directory next to your 'lombok' project directory. Otherwise, I can grab a copy from the internet, though it won't be as up-to-date, and may thus be insufficient to run the very latest lombok.
		Pick one (first letter will do):
		Skip     - Skips this download. This dependency is not optional, so your lombok won't compile.
		Get      - Grabs the latest version of lombok.patcher from source control.
		Download - Downloads the latest version from the internet, and will not be as up to date as 'get'.
		</input>
		<condition property="lombok.patcher.git.grab">
			<matches string="${missing1.feedback}" casesensitive="false" pattern="^g(et)?$" />
		</condition>
		<condition property="lombok.patcher.file.grab">
			<matches string="${missing1.feedback}" casesensitive="false" pattern="^d(ownload)?$" />
		</condition>
		<antcall target="-grab-git-lombok.patcher" />
		<antcall target="-grab-file-lombok.patcher" />
	</target>
	
	<target name="-missing2-lombok.patcher" unless="lombok.patcher.skip.missing2">
		<input validArgs="s,S,skip,Skip,SKIP,g,G,get,Get,GET" defaultvalue="s" addproperty="missing2.feedback">
You only have the lombok.patcher dependency as a downloaded file, which won't be as cutting edge as grabbing it from version control. Do you want to grab lombok.patcher from source control? I will put the project in a sibling directory next to your 'lombok' directory.
		Pick one (first letter will do):
		Skip  - Skips this download, and continues to rely on the occasionally updated web version.
		Get   - Grabs the latest version of lombok.patcher from source control. Lombok will start using this instead.
		</input>
		<condition property="lombok.patcher.git.grab">
			<matches string="${missing2.feedback}" casesensitive="false" pattern="^g(et)?$" />
		</condition>
		<condition property="lombok.patcher.file.update">
			<matches string="${missing2.feedback}" casesensitive="false" pattern="^s(kip)?$" />
		</condition>
		<antcall target="-grab-git-lombok.patcher" />
		<antcall target="-update-file-lombok.patcher" />
	</target>
	
	<target name="-grab-git-lombok.patcher" if="lombok.patcher.git.grab">
		<echo level="info">Cloning ${lombok.patcher.giturl} into ${lombok.patcher.dir}</echo>
		<git-clone repository="${lombok.patcher.giturl}" dest="${lombok.patcher.dir}" />
		<echo level="info">
Done! lombok-patcher.jar will now be resolved from this cloned repository.
You may want to import this project into your eclipse workspace as well.
		</echo>
		<property name="lombok.patcher.checkreplace.git" value="true" />
	</target>
	
	<target name="-update-git-lombok.patcher" if="lombok.patcher.available.git">
		<echo level="info">Updating existing git repository of lombok.patcher...</echo>
		<git-pull gitdir="${lombok.patcher.dir}" />
	</target>
	
	<target name="-grab-file-lombok.patcher" if="lombok.patcher.file.grab">
		<echo level="info">Downloading lombok-patcher.jar from the internet...</echo>
		<antcall target="-download-file-lombok.patcher" />
	</target>
	
	<target name="-update-file-lombok.patcher" if="lombok.patcher.file.update">
		<echo level="info">Updating existing lombok-patcher.jar from the internet...</echo>
		<antcall target="-download-file-lombok.patcher" />
	</target>
	
	<target name="-download-file-lombok.patcher">
		<get src="${lombok.patcher.fileurl}" dest="${lombok.patcher.fileloc}" verbose="true" usetimestamp="true" />
	</target>
</project>