aboutsummaryrefslogtreecommitdiff
path: root/buildScripts/maven.ant.xml
blob: f2495bcdd71d705b0770f2fabd778a5446b27ead (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
<!--
  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-maven" basedir=".." default="maven">
	<description>
This buildfile is part of projectlombok.org. It is responsible for creating and maintaining
the maven repository that contains lombok's deliverables for those using maven.
	</description>
	
	<path id="buildScripts.deps.path">
		<fileset dir="deps/buildScripts">
			<include name="**/*.jar" />
		</fileset>
	</path>
	
	<target name="version" unless="lombok.version">
		<ant antfile="build.xml" target="version" inheritAll="false" />
		<loadresource property="lombok.version">
			<file file="build/version.txt" />
			<filterchain>
				<striplinebreaks />
			</filterchain>
		</loadresource>
	</target>
	
	<target name="dist" unless="lombok.dist.built" depends="version">
		<ant antfile="buildScripts/compile.ant.xml" target="dist" inheritAll="false">
			<property name="lombok.version" value="${lombok.version}" />
		</ant>
	</target>
	
	<target name="maven" depends="version, dist" description="Build a maven repository.">
		<loadresource property="mvn.oldversions">
			<url url="http://projectlombok.org/mavenrepo/org/projectlombok/lombok/maven-metadata.xml" />
			<filterchain>
				<linecontains><contains value="/version>" /></linecontains>
				<headfilter lines="-1" skip="1" />
			</filterchain>
		</loadresource>
		<mkdir dir="build" />
		<echo file="build/version.tagged.tmp">&lt;version&gt;${lombok.version}&lt;/version&gt;</echo>
		<loadfile srcFile="build/version.tagged.tmp" property="lombok.version.tagged" />
		<delete file="build/version.tagged.tmp" />
		<fail message="You already created a maven target for this version.  You'll have to update the version to something new!">
			<condition>
				<contains string="${mvn.oldversions}" substring="${lombok.version.tagged}" />
			</condition>
		</fail>

		<delete dir="build/maven" quiet="true" />
		<property name="mvn.dir" value="build/maven/org/projectlombok/lombok" />
		<property name="mvn.bin" value="${mvn.dir}/${lombok.version}" />
		<property name="mvn.pom" value="${mvn.bin}/lombok-${lombok.version}.pom" />
		<mkdir dir="${mvn.bin}" />
		<tstamp>
			<format property="now.millis" pattern="yyyyMMddHHmmss" timezone="UTC" />
		</tstamp>
		<copy todir="${mvn.bin}" file="dist/lombok-${lombok.version}.jar" />
		<checksum property="mvn.bin.md5" file="${mvn.bin}/lombok-${lombok.version}.jar" algorithm="MD5" />
		<checksum property="mvn.bin.sha1" file="${mvn.bin}/lombok-${lombok.version}.jar" algorithm="SHA1" />
		<echo file="${mvn.bin}/lombok-${lombok.version}.jar.md5">${mvn.bin.md5}</echo>
		<echo file="${mvn.bin}/lombok-${lombok.version}.jar.sha1">${mvn.bin.sha1}</echo>
		<jar destfile="${mvn.bin}/lombok-${lombok.version}-sources.jar" excludes="**/.DS_Store">
			<fileset dir="src/core" />
			<fileset dir="src/installer" />
			<fileset dir="src/eclipseAgent" />
		</jar>
		<checksum property="mvn.src.md5" file="${mvn.bin}/lombok-${lombok.version}-sources.jar" algorithm="MD5" />
		<checksum property="mvn.src.sha1" file="${mvn.bin}/lombok-${lombok.version}-sources.jar" algorithm="SHA1" />
		<echo file="${mvn.bin}/lombok-${lombok.version}-sources.jar.md5">${mvn.src.md5}</echo>
		<echo file="${mvn.bin}/lombok-${lombok.version}-sources.jar.sha1">${mvn.src.sha1}</echo>
		<copy tofile="${mvn.pom}" file="doc/maven-pom.xml">
			<filterchain>
				<replacetokens>
					<token key="VERSION" value="${lombok.version}" />
				</replacetokens>
			</filterchain>
		</copy>
		<checksum property="mvn.pom.md5" file="${mvn.pom}" algorithm="MD5" />
		<checksum property="mvn.pom.sha1" file="${mvn.pom}" algorithm="SHA1" />
		<echo file="${mvn.pom}.md5">${mvn.pom.md5}</echo>
		<echo file="${mvn.pom}.sha1">${mvn.pom.sha1}</echo>
		<echo file="${mvn.dir}/maven-metadata.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<metadata>
	<groupId>org.projectlombok</groupId>
	<artifactId>lombok</artifactId>
	<version>${lombok.version}</version>
	<versioning>
		<versions>
			<version>${lombok.version}</version>
			${mvn.oldversions}
		</versions>
		<lastUpdated>${now.millis}</lastUpdated>
	</versioning>
</metadata>
]]></echo>
		<checksum property="mvn.manifest.md5" file="${mvn.dir}/maven-metadata.xml" algorithm="MD5" />
		<checksum property="mvn.manifest.sha1" file="${mvn.dir}/maven-metadata.xml" algorithm="SHA1" />
		<echo file="${mvn.dir}/maven-metadata.xml.md5">${mvn.manifest.md5}</echo>
		<echo file="${mvn.dir}/maven-metadata.xml.sha1">${mvn.manifest.sha1}</echo>
		<tar destfile="dist/maven.tar.bz2" compression="bzip2">
			<tarfileset dir="build/maven" />
		</tar>
	</target>
	
	<taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="buildScripts.deps.path" />
	<taskdef name="sshexec" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="buildScripts.deps.path" />
	<target name="maven-publish" depends="maven">
		<available file="libertad-upload.key" property="libertad.key.available" />
		<fail unless="libertad.key.available">You don't have the libertad-upload.key; you'll need it to get write access to the server.</fail>
		<scp
			localFile="dist/maven.tar.bz2"
			todir="lombokup@projectlombok.org:/staging"
			keyfile="libertad-upload.key" passphrase=""
			sftp="true" verbose="true" trust="true" />
		<sshexec
			host="projectlombok.org"
			username="lombokup"
			keyfile="libertad-upload.key" passphrase=""
			trust="true" command="./deployMavenRepo" />
	</target>
	
	<target name="FOO">
		<sshexec
			host="projectlombok.org"
			username="lombokup"
			keyfile="libertad-upload.key" passphrase=""
			trust="true" command="./deployMavenRepo" />
	</target>
</project>