aboutsummaryrefslogtreecommitdiff
path: root/buildScripts/eclipse-p2.ant.xml
blob: 75f6c4ebd8009ddcf4db9d1d304bb6a2f42602c1 (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
<!--
  Copyright (C) 2020 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.eclipsep2" basedir=".." xmlns:ivy="antlib:com.zwitserloot.ivyplusplus">
	<description>
This buildfile is part of projectlombok.org. It is responsible for building the eclipse P2 update site.
	</description>
	
	<target name="eclipsep2.clean">
		<delete dir="build/p2" quiet="true" />
	</target>
	
	<target name="-eclipsep2.get-epoch">
		<mkdir dir="build/p2-support" />
		<echo file="build/p2-support/Epoch.java">public class Epoch {public static void main(String[] args) {System.out.print(System.currentTimeMillis());}}</echo>
		<javac srcdir="build/p2-support" release="8" includeAntRuntime="false" destdir="build/p2-support" />
		<java classname="Epoch" classpath="build/p2-support" fork="false" outputproperty="dt.epochMillis" />
	</target>
	
	<target name="eclipsep2.build" depends="version, -eclipsep2.get-epoch">
		<tstamp><format property="dt.year" pattern="yyyy" /></tstamp>
		<mkdir dir="build/p2" />
		<mkdir dir="build/p2/features" />
		<mkdir dir="build/p2/plugins" />
		
		<jar destfile="build/p2/plugins/org.projectlombok.agent_${lombok.version}.jar">
			<manifest>
				<attribute name="Manifest-Version" value="1.0" />
				<attribute name="Bundle-ManifestVersion" value="2" />
				<attribute name="Bundle-Name" value="Lombok Agent" />
				<attribute name="Bundle-SymbolicName" value="org.projectlombok.agent" />
				<attribute name="Bundle-Version" value="${lombok.version}" />
				<attribute name="Automatic-Module-Name" value="org.projectlombok.agent" />
			</manifest>
			<zipfileset dir="buildScripts/p2" includes="p2.inf" prefix="META-INF/" />
			<zipfileset dir="dist" includes="lombok-${lombok.version}.jar" fullpath="lombok.jar" />
		</jar>
		<loadfile property="store.pass" srcFile="buildScripts/lombok.jks.password" />
		<signjar
			jar="build/p2/plugins/org.projectlombok.agent_${lombok.version}.jar"
			alias="lombok"
			storepass="${store.pass}"
			keystore="buildScripts/lombok.jks"
		/>
		
		<length property="agent.zip.size" file="build/p2/plugins/org.projectlombok.agent_${lombok.version}.jar" />
		
		<copy todir="build/p2" overwrite="true">
			<fileset dir="buildScripts/p2" includes="feature.xml" />
			<filterset>
				<filter token="YEAR" value="${dt.year}" />
				<filter token="EPOCH_MILLIS" value="${dt.epochMillis}" />
				<filter token="VERSION" value="${lombok.version}" />
			</filterset>
		</copy>
		<zip destfile="build/p2/features/org.projectlombok.feature_${lombok.version}.jar" basedir="build/p2" includes="feature.xml" />
		<signjar
			jar="build/p2/features/org.projectlombok.feature_${lombok.version}.jar"
			alias="lombok"
			storepass="${store.pass}"
			keystore="buildScripts/lombok.jks"
		/>
		<delete file="build/p2/feature.xml" />
		<length property="feature.zip.size" file="build/p2/features/org.projectlombok.feature_${lombok.version}.jar" />
		
		<copy todir="build/p2" overwrite="true">
			<fileset dir="buildScripts/p2" includes="artifacts.xml,content.xml" />
			<filterset>
				<filter token="YEAR" value="${dt.year}" />
				<filter token="EPOCH_MILLIS" value="${dt.epochMillis}" />
				<filter token="VERSION" value="${lombok.version}" />
				<filter token="FEATURE_ZIP_SIZE" value="${feature.zip.size}" />
				<filter token="AGENT_ZIP_SIZE" value="${agent.zip.size}" />
			</filterset>
		</copy>
		<zip destfile="build/p2/artifacts.jar" basedir="build/p2" includes="artifacts.xml" />
		<signjar
			jar="build/p2/artifacts.jar"
			alias="lombok"
			storepass="${store.pass}"
			keystore="buildScripts/lombok.jks"
		/>
		<zip destfile="build/p2/content.jar" basedir="build/p2" includes="content.xml" />
		<signjar
			jar="build/p2/content.jar"
			alias="lombok"
			storepass="${store.pass}"
			keystore="buildScripts/lombok.jks"
		/>
		<delete file="build/p2/artifacts.xml" />
		<delete file="build/p2/content.xml" />
	</target>
	
	<target name="eclipsep2.pack" depends="eclipsep2.build">
		<tar destfile="dist/eclipse-p2.tar.bz2" compression="bzip2">
			<tarfileset dir="build/p2" />
		</tar>
	</target>
	
	<target name="eclipsep2.publish" depends="setup.ssh, eclipsep2.pack">
		<ivy:scpUpload
			from="dist/eclipse-p2.tar.bz2"
			to="/data/lombok/staging"
			server="projectlombok.org"
			username="${ssh.username}"
			keyfile="${ssh.keyfile}"
			knownHosts="ssh.knownHosts" />
		<ivy:sshExec
			cmd="/data/lombok/stagingCmd/deployP2"
			server="projectlombok.org"
			username="${ssh.username}"
			keyfile="${ssh.keyfile}"
			knownHosts="ssh.knownHosts" />
	</target>
</project>